Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix __FILE__ base name extraction, #628 #648

Merged
merged 1 commit into from
Oct 25, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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