diff options
-rw-r--r-- | CMakeLists.txt | 3 | ||||
-rw-r--r-- | lily-test.h | 6 |
2 files changed, 9 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index f7acc8a..9e4dcb5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,6 +4,9 @@ project( VERSION 0.1.0 DESCRIPTION "A super-simple single-header C test framework") +string(LENGTH "${CMAKE_SOURCE_DIR}/" SOURCE_PATH_SIZE) +add_definitions("-DSOURCE_PATH_SIZE=${SOURCE_PATH_SIZE}") + include_directories(${CMAKE_SOURCE_DIR}) set (TEST_SRC ${CMAKE_SOURCE_DIR}/tests) add_executable(lily-metatest diff --git a/lily-test.h b/lily-test.h index a1e63e5..a94f292 100644 --- a/lily-test.h +++ b/lily-test.h @@ -1,6 +1,12 @@ #ifndef LILY_TEST_H #define LILY_TEST_H +/* define SOURCE_PATH_SIZE to strip away the + leading parts of the full compilation path */ +#ifndef SOURCE_PATH_SIZE #define LILY_FILENAME __FILE__ +#else +#define LILY_FILENAME (__FILE__ + SOURCE_PATH_SIZE) +#endif #endif |