6#! SIMPLE_TEST_WITH_DATA(<testname> <baseline_relative_location> [argument1 ...])
9#! This macro add a test using the complete add_test signature specifying target using
10#! $<TARGET_FILE:...> generator expression. Optionnal test argument(s) can be passed
11#! after specifying the <testname>.
13#! <baseline_relative_location> parameter should corresponds to a subfolder located in <CTKData_DIR>/Baseline
15#! Variables named KIT and CTKData_DIR are expected to be defined in the current scope.
17#! KIT variable usually matches the value of PROJECT_NAME.
19#! The macro also associates a label to the test based on the current value of KIT.
21#! The following parameter will be passed to the test:
23#! <li>-D <CTKData_DIR>/Data</li>
24#! <li>-V <CTKData_DIR>/Baseline/<baseline_relative_location></li>
25#! <li>-T <PROJECT_BINARY_DIR>/Testing/Temporary</li>
28#! \sa http://www.cmake.org/cmake/help/cmake-2-8-docs.html#command:add_test
29#! \sa http://www.cmake.org/cmake/help/cmake-2-8-docs.html#variable:PROJECT_NAME
31#! \ingroup CMakeUtilities
32macro(SIMPLE_TEST_WITH_DATA testname baseline_relative_location)
33 if("${KIT}" STREQUAL "")
34 message(FATAL_ERROR "error: KIT variable is not set !")
37 if(NOT TARGET ${KIT}CppTests)
38 message(FATAL_ERROR "error: ${KIT}CppTests target does NOT exist !")
41 if(NOT EXISTS "${CTKData_DIR}/Data")
42 message(FATAL_ERROR "error: <CTKData_DIR>/Data corresponds to an non-existing directory. [<CTKData_DIR>/Data: ${CTKData_DIR}/Data]")
45 if(NOT EXISTS "${CTKData_DIR}/Baseline/${baseline_relative_location}")
46 message(FATAL_ERROR "error: <CTKData_DIR>/Baseline/<baseline_relative_location> corresponds to an non-existing file or directory. [<CTKData_DIR>/Baseline/<baseline_relative_location>: ${CTKData_DIR}/Baseline/${baseline_relative_location}]")
49 add_test(NAME ${testname} COMMAND $<TARGET_FILE:${KIT}CppTests> ${testname}
50 -D "${CTKData_DIR}/Data"
51 -V "${CTKData_DIR}/Baseline/${baseline_relative_location}"
52 -T "${PROJECT_BINARY_DIR}/Testing/Temporary"
55 set_property(TEST ${testname} PROPERTY LABELS ${KIT})