Skip to content

Commit

Permalink
fix __FILE__ base name extraction, #628 (#648)
Browse files Browse the repository at this point in the history
  • Loading branch information
slyshykO authored and xor-gate committed Oct 25, 2017
1 parent a2a707e commit 95b6e03
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
5 changes: 0 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,6 @@ if (${CMAKE_BUILD_TYPE} MATCHES "Debug")
include(CTest)
endif()

# fixup __FILE__ absolute paths in logging module
# see: https://cmake.org/pipermail/cmake-developers/2015-January/024202.html
string(LENGTH "${CMAKE_SOURCE_DIR}/" CMAKE_SOURCE_DIR_LENGTH)
add_definitions(-DCMAKE_SOURCE_DIR_LENGTH=${CMAKE_SOURCE_DIR_LENGTH})

set(STLINK_HEADERS
include/stlink.h
include/stlink/usb.h
Expand Down
6 changes: 2 additions & 4 deletions include/stlink/logging.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@ enum ugly_loglevel {
int ugly_init(int maximum_threshold);
int ugly_log(int level, const char *tag, const char *format, ...);

#ifndef CMAKE_SOURCE_DIR_LENGTH
#define CMAKE_SOURCE_DIR_LENGTH 0
#endif
#define UGLY_LOG_FILE (__FILE__+CMAKE_SOURCE_DIR_LENGTH)
#define UGLY_LOG_FILE (strstr(__FILE__, "/") != NULL ? \
strrchr(__FILE__, '/') + 1 : strrchr(__FILE__, '\\') + 1)

/** @todo we need to write this in a more generic way, for now this should compile
on visual studio (See http://stackoverflow.com/a/8673872/1836746) */
Expand Down

0 comments on commit 95b6e03

Please sign in to comment.