diff cmake/function/IrccdDefineLibrary.cmake @ 663:65a54b126c08

CMake: do not use TESTS_BINARY_DIR in libirccd-test The variable is not defined on initial CMake because the add_subdirectory(tests) appears after libirccd-test creation. Use a dedicated CMAKE_BINARY_DIR/tmp directory to store temporary files needed for CLI tests.
author David Demelier <markand@malikania.fr>
date Thu, 29 Mar 2018 19:39:20 +0200
parents e9adad05580f
children a17de53db29b
line wrap: on
line diff
--- a/cmake/function/IrccdDefineLibrary.cmake	Thu Mar 29 09:13:51 2018 +0200
+++ b/cmake/function/IrccdDefineLibrary.cmake	Thu Mar 29 19:39:20 2018 +0200
@@ -54,7 +54,14 @@
 
     add_library(${LIB_TARGET} ${type} ${LIB_SOURCES})
     target_include_directories(${LIB_TARGET} PRIVATE ${LIB_LOCAL_INCLUDES} PUBLIC ${LIB_PUBLIC_INCLUDES})
-    target_compile_definitions(${LIB_TARGET} PUBLIC ${LIB_FLAGS})
+    target_compile_definitions(
+        ${LIB_TARGET}
+        PRIVATE
+            CMAKE_BINARY_DIR="${CMAKE_BINARY_DIR}"
+            CMAKE_SOURCE_DIR="${CMAKE_SOURCE_DIR}"
+        PUBLIC
+            ${LIB_FLAGS}
+    )
     target_link_libraries(${LIB_TARGET} ${LIB_LIBRARIES})
     set_target_properties(
         ${LIB_TARGET}