Tests: Simplify CTest.BuildCommand.ProjectInSubdir configuration

Collect all ctest_configure options in a list to configure it into the
test script.  Drop the unused -DCMAKE_MAKE_PROGRAM argument to ctest.
This commit is contained in:
Brad King 2013-11-14 13:32:39 -05:00
parent 72bf2552f2
commit e965cb12e2
2 changed files with 8 additions and 7 deletions

View File

@ -1829,17 +1829,18 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
# )
# A test for ctest_build() with targets in subdirectories
set(ctest_configure_options)
if(CMAKE_TEST_GENERATOR_TOOLSET)
set(CMAKE_TEST_GENERATOR_TOOLSET_SELECTION "-T;${CMAKE_TEST_GENERATOR_TOOLSET};")
else()
set(CMAKE_TEST_GENERATOR_TOOLSET_SELECTION)
list(APPEND ctest_configure_options -T ${CMAKE_TEST_GENERATOR_TOOLSET})
endif()
if(CMAKE_TEST_MAKEPROGRAM)
list(APPEND ctest_configure_options -DCMAKE_MAKE_PROGRAM:FILEPATH=${CMAKE_TEST_MAKEPROGRAM})
endif()
configure_file("${CMake_SOURCE_DIR}/Tests/CTestBuildCommandProjectInSubdir/CTestBuildCommandProjectInSubdir.cmake.in"
"${CMake_BINARY_DIR}/Tests/CTestBuildCommandProjectInSubdir/CTestBuildCommandProjectInSubdir.cmake" @ONLY)
unset(CMAKE_TEST_GENERATOR_TOOLSET_SELECTION)
unset(ctest_configure_options)
add_test(CTest.BuildCommand.ProjectInSubdir
${CMAKE_CTEST_COMMAND} -S "${CMake_BINARY_DIR}/Tests/CTestBuildCommandProjectInSubdir/CTestBuildCommandProjectInSubdir.cmake"
-DCMAKE_MAKE_PROGRAM:FILEPATH=${CMAKE_TEST_MAKEPROGRAM})
${CMAKE_CTEST_COMMAND} -S "${CMake_BINARY_DIR}/Tests/CTestBuildCommandProjectInSubdir/CTestBuildCommandProjectInSubdir.cmake")
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CTestBuildCommandProjectInSubdir/Nested")
set(CTEST_TEST_UPDATE 1)

View File

@ -8,5 +8,5 @@ set(CTEST_BUILD_CONFIGURATION "@CTestTest_CONFIG@")
ctest_empty_binary_directory(${CTEST_BINARY_DIRECTORY})
ctest_start(Experimental)
ctest_configure(OPTIONS "@CMAKE_TEST_GENERATOR_TOOLSET_SELECTION@-DCMAKE_MAKE_PROGRAM:FILEPATH=@CMAKE_TEST_MAKEPROGRAM@")
ctest_configure(OPTIONS "@ctest_configure_options@")
ctest_build(TARGET test)