forked from Slicer/Slicer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSlicerMacroConfigureGenericCxxModuleTests.cmake
49 lines (39 loc) · 1.77 KB
/
SlicerMacroConfigureGenericCxxModuleTests.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#
# SlicerMacroConfigureGenericCxxModuleTests
#
macro(SlicerMacroConfigureGenericCxxModuleTests MODULENAMES TEST_SRCS_OUTPUT_VAR TEST_NAMES_OUTPUT_VAR TEST_NAMES_CXX_OUTPUT_VAR)
# Sanity checks
if("${MODULENAMES}" STREQUAL "")
message(FATAL_ERROR "error: Variable MODULENAMES is empty !")
endif()
if("${TEST_SRCS_OUTPUT_VAR}" STREQUAL "")
message(FATAL_ERROR "error: Variable TEST_SRCS_OUTPUT_VAR is empty !")
endif()
if("${TEST_NAMES_OUTPUT_VAR}" STREQUAL "")
message(FATAL_ERROR "error: Variable TEST_NAMES_OUTPUT_VAR is empty !")
endif()
if("${TEST_NAMES_CXX_OUTPUT_VAR}" STREQUAL "")
message(FATAL_ERROR "error: Variable TEST_NAMES_CXX_OUTPUT_VAR is empty !")
endif()
if("${Slicer_CXX_MODULE_TEST_TEMPLATES_DIR}" STREQUAL "")
message(FATAL_ERROR "error: Variable Slicer_CXX_MODULE_TEST_TEMPLATES_DIR is empty !")
endif()
set(MODULEPATH_WITHOUT_INTDIR ${CMAKE_BINARY_DIR}/${Slicer_QTLOADABLEMODULES_BIN_DIR})
foreach(MODULENAME ${MODULENAMES})
set(MODULETESTS ModuleGenericTest ModuleWidgetGenericTest)
foreach(MODULETEST ${MODULETESTS})
# Note: the variable MODULENAME is used to configure the different tests.
set(configured_test_src ${CMAKE_CURRENT_BINARY_DIR}/qSlicer${MODULENAME}${MODULETEST}.cxx)
configure_file(
${Slicer_CXX_MODULE_TEST_TEMPLATES_DIR}/qSlicer${MODULETEST}.cxx.in
${configured_test_src}
@ONLY
)
list(APPEND ${TEST_SRCS_OUTPUT_VAR} ${configured_test_src})
get_filename_component(test_name ${configured_test_src} NAME_WE)
list(APPEND ${TEST_NAMES_OUTPUT_VAR} ${test_name})
get_filename_component(test_filename ${configured_test_src} NAME)
list(APPEND ${TEST_NAMES_CXX_OUTPUT_VAR} ${test_filename})
endforeach()
endforeach()
endmacro()