fix __FILE__ base name extraction, #628 (#648)

pull/664/head
Slyshyk Oleksiy 2017-10-25 22:48:43 +03:00 zatwierdzone przez Jerry Jacobs
rodzic a2a707e4f7
commit 95b6e03ed0
2 zmienionych plików z 2 dodań i 9 usunięć

Wyświetl plik

@ -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

Wyświetl plik

@ -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) */