Mercurial > irccd
comparison cmake/function/IrccdDefineTest.cmake @ 150:81dd79ec1e99
CMake: add optional FLAGS in irccd_define_test macro
author | David Demelier <markand@malikania.fr> |
---|---|
date | Fri, 20 May 2016 12:56:28 +0200 |
parents | ff26bd33a45d |
children | 70ed0753ce0d |
comparison
equal
deleted
inserted
replaced
149:19df514cb61c | 150:81dd79ec1e99 |
---|---|
23 # irccd_define_test( | 23 # irccd_define_test( |
24 # NAME the test name | 24 # NAME the test name |
25 # SOURCES the sources files | 25 # SOURCES the sources files |
26 # LIBRARIES (Optional) libraries to link | 26 # LIBRARIES (Optional) libraries to link |
27 # RESOURCES (Optional) some resources file to copy | 27 # RESOURCES (Optional) some resources file to copy |
28 # FLAGS (Optional) compilation flags | |
28 # ) | 29 # ) |
29 # | 30 # |
30 # Create a unit test named test-${NAME} | 31 # Create a unit test named test-${NAME} |
31 # | 32 # |
32 # Resources files are copied VERBATIM into the same directory. | 33 # Resources files are copied VERBATIM into the same directory. |
33 # | 34 # |
34 | 35 |
35 function(irccd_define_test) | 36 function(irccd_define_test) |
36 set(oneValueArgs NAME) | 37 set(oneValueArgs NAME) |
37 set(multiValueArgs SOURCES LIBRARIES RESOURCES) | 38 set(multiValueArgs SOURCES LIBRARIES RESOURCES FLAGS) |
38 | 39 |
39 cmake_parse_arguments(TEST "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) | 40 cmake_parse_arguments(TEST "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) |
40 | 41 |
41 if (NOT TEST_NAME) | 42 if (NOT TEST_NAME) |
42 message(FATAL_ERROR "Please set NAME") | 43 message(FATAL_ERROR "Please set NAME") |
72 ) | 73 ) |
73 | 74 |
74 target_compile_definitions( | 75 target_compile_definitions( |
75 test-${TEST_NAME} | 76 test-${TEST_NAME} |
76 PRIVATE | 77 PRIVATE |
78 ${TEST_FLAGS} | |
79 SOURCEDIR="${CMAKE_CURRENT_SOURCE_DIR}" | |
77 IRCCD_TESTS_DIRECTORY="${CMAKE_BINARY_DIR}/tests" | 80 IRCCD_TESTS_DIRECTORY="${CMAKE_BINARY_DIR}/tests" |
78 ) | 81 ) |
79 | 82 |
80 # Tests are all in the same directory | 83 # Tests are all in the same directory |
81 set_target_properties( | 84 set_target_properties( |