bladeRF/host/cmake/modules/ShortFileMacro.cmake
Jon Szymaniak 7c0969a44d host: Enable short source file name and line # in log output by default
When making log_* calls, add these two lines to the corresponding
CMake file prior to add_library() or add_executable():

    set(SRC_TO_SHORTEN ${MY_SRC_LIST})
    include(ShortFileMacro)

Many thanks to LazyDodo for providing the CMake approach for doing this,
and to rwr for suggesting this change.
2014-10-02 12:29:14 -04:00

11 lines
427 B
CMake

# Define a SHORT_FILE_ macro on a per-file basis to yield
# something akin to __FILE__, but with only the file name
#
# Parameters:
#
# SRC_TO_SHORTEN - List of source files to create short names for
foreach(FILE ${SRC_TO_SHORTEN})
get_filename_component(FILE_NAME ${FILE} NAME)
set_source_files_properties(${FILE} PROPERTIES
COMPILE_FLAGS -DSHORT_FILE_=\"${FILE_NAME}\")
endforeach()