comparison cmake/function/MalikaniaDefineTest.cmake @ 106:f8c6d2244795

Server: rework model and dao
author David Demelier <markand@malikania.fr>
date Mon, 04 Sep 2017 19:41:18 +0200
parents 0addfab87b17
children 119bcc5a727e
comparison
equal deleted inserted replaced
105:0a4a246d765b 106:f8c6d2244795
23 # malikania_create_test( 23 # malikania_create_test(
24 # NAME Test name (must be lowercase) 24 # NAME Test name (must be lowercase)
25 # SOURCES Test sources files 25 # SOURCES Test sources files
26 # LIBRARIES (Optional) Libraries to link to 26 # LIBRARIES (Optional) Libraries to link to
27 # RESOURCES (Optional) Resources files to copy verbatim 27 # RESOURCES (Optional) Resources files to copy verbatim
28 # FLAGS (Optional) Add list of compile definitions
28 # ) 29 # )
29 # 30 #
30 # This will generate a target named test-<name> where name is the parameter NAME. The test is created 31 # This will generate a target named test-<name> where name is the parameter NAME. The test is created
31 # under CMAKE_BINARY_DIR/test/<NAME> and resources are copied there with the same hierarchy. 32 # under CMAKE_BINARY_DIR/test/<NAME> and resources are copied there with the same hierarchy.
32 # 33 #
35 36
36 include(${CMAKE_CURRENT_LIST_DIR}/MalikaniaVeraCheck.cmake) 37 include(${CMAKE_CURRENT_LIST_DIR}/MalikaniaVeraCheck.cmake)
37 38
38 function(malikania_create_test) 39 function(malikania_create_test)
39 set(singleArgs NAME) 40 set(singleArgs NAME)
40 set(multiArgs LIBRARIES SOURCES RESOURCES) 41 set(multiArgs FLAGS LIBRARIES SOURCES RESOURCES)
41 42
42 cmake_parse_arguments(TEST "" "${singleArgs}" "${multiArgs}" ${ARGN}) 43 cmake_parse_arguments(TEST "" "${singleArgs}" "${multiArgs}" ${ARGN})
43 44
44 if (NOT TEST_NAME) 45 if (NOT TEST_NAME)
45 message(FATAL_ERROR "Missing NAME parameter") 46 message(FATAL_ERROR "Missing NAME parameter")
77 PRIVATE 78 PRIVATE
78 BOOST_TEST_DYN_LINK 79 BOOST_TEST_DYN_LINK
79 CMAKE_CURRENT_BINARY_DIR=\"${CMAKE_CURRENT_BINARY_DIR}\" 80 CMAKE_CURRENT_BINARY_DIR=\"${CMAKE_CURRENT_BINARY_DIR}\"
80 CMAKE_CURRENT_SOURCE_DIR=\"${CMAKE_CURRNET_SOURCE_DIR}\" 81 CMAKE_CURRENT_SOURCE_DIR=\"${CMAKE_CURRNET_SOURCE_DIR}\"
81 SOURCE_DIRECTORY=\"${CMAKE_BINARY_DIR}/test/${TEST_NAME}\" 82 SOURCE_DIRECTORY=\"${CMAKE_BINARY_DIR}/test/${TEST_NAME}\"
83 ${TEST_FLAGS}
82 ) 84 )
83 set_target_properties( 85 set_target_properties(
84 test-${TEST_NAME} 86 test-${TEST_NAME}
85 PROPERTIES 87 PROPERTIES
86 RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/test/${TEST_NAME} 88 RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/test/${TEST_NAME}