summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Rolf Eike Beer <eike@sf-mail.de>2019-03-25 21:34:19 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-03-27 14:07:32 -0700
commit8526fea973a03724a9121002512fae516c6000ed (patch)
treedb9730ed4244956a15a7fc3774eed08a91265011
parentac0650865c08c153ef4f8a53dd95874b5ac2cde6 (diff)
downloadsubsurface-8526fea973a03724a9121002512fae516c6000ed.tar.gz
CMake: use function instead of macro
Signed-off-by: Rolf Eike Beer <eike@sf-mail.de>
-rw-r--r--tests/CMakeLists.txt9
1 files changed, 5 insertions, 4 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index c90453954..447a85033 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -39,9 +39,10 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
endif()
endif()
-# Helper macro TEST used to created rules to build, link, install and run tests
-macro(TEST NAME FILE)
- add_executable(${NAME} ${FILE} )
+# Helper function TEST used to created rules to build, link, install and run tests
+function(TEST NAME FILE)
+ get_filename_component(HDR "${FILE}" NAME_WE)
+ add_executable(${NAME} ${FILE} ${HDR}.h)
target_link_libraries(
${NAME}
subsurface_corelib
@@ -70,7 +71,7 @@ macro(TEST NAME FILE)
else()
add_test(NAME ${NAME} COMMAND $<TARGET_FILE:${NAME}>)
endif()
-endmacro()
+endfunction()
enable_testing()
add_definitions(-g)