Tests: Launch CMake.Install test through 'cmake --build'

Use "cmake --build" to drive the "install" target from the CMake build
tree itself.  This avoids using the heavier "ctest --build-and-test"
just to run the native build tool to drive installation.
This commit is contained in:
Brad King 2013-11-14 14:16:06 -05:00
parent 8ee6b47630
commit f2b1d653cf
1 changed files with 4 additions and 18 deletions

View File

@ -17,29 +17,15 @@ if(CMake_TEST_INSTALL)
if(CMAKE_CONFIGURATION_TYPES)
# There are multiple configurations. Make sure the tested
# configuration is the one that is installed.
set(CMake_TEST_INSTALL_CONFIG -C "\${CTEST_CONFIGURATION_TYPE}")
set(CMake_TEST_INSTALL_CONFIG --config $<CONFIGURATION>)
else()
set(CMake_TEST_INSTALL_CONFIG)
endif()
# The CTest of the CMake used to build this CMake.
if(CMAKE_CTEST_COMMAND)
set(CMake_TEST_INSTALL_CTest ${CMAKE_CTEST_COMMAND})
else()
set(CMake_TEST_INSTALL_CTest ${CMake_BIN_DIR}/ctest)
endif()
# Add a test to install CMake through the build system install target.
add_test(CMake.Install
${CMake_TEST_INSTALL_CTest}
${CMake_TEST_INSTALL_CONFIG}
--build-and-test ${CMake_SOURCE_DIR} ${CMake_BINARY_DIR}
--build-generator ${CMAKE_GENERATOR} # Not CMAKE_TEST_GENERATOR
--build-project CMake
--build-makeprogram ${CMAKE_MAKE_PROGRAM} # Not CMAKE_TEST_MAKEPROGRAM
--build-nocmake
--build-noclean
--build-target install)
add_test(NAME CMake.Install
COMMAND cmake --build . --target install ${CMake_TEST_INSTALL_CONFIG}
)
# Avoid running this test simultaneously with other tests:
set_tests_properties(CMake.Install PROPERTIES RUN_SERIAL ON)