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:
parent
8ee6b47630
commit
f2b1d653cf
|
@ -17,29 +17,15 @@ if(CMake_TEST_INSTALL)
|
||||||
if(CMAKE_CONFIGURATION_TYPES)
|
if(CMAKE_CONFIGURATION_TYPES)
|
||||||
# There are multiple configurations. Make sure the tested
|
# There are multiple configurations. Make sure the tested
|
||||||
# configuration is the one that is installed.
|
# configuration is the one that is installed.
|
||||||
set(CMake_TEST_INSTALL_CONFIG -C "\${CTEST_CONFIGURATION_TYPE}")
|
set(CMake_TEST_INSTALL_CONFIG --config $<CONFIGURATION>)
|
||||||
else()
|
else()
|
||||||
set(CMake_TEST_INSTALL_CONFIG)
|
set(CMake_TEST_INSTALL_CONFIG)
|
||||||
endif()
|
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 a test to install CMake through the build system install target.
|
||||||
add_test(CMake.Install
|
add_test(NAME CMake.Install
|
||||||
${CMake_TEST_INSTALL_CTest}
|
COMMAND cmake --build . --target install ${CMake_TEST_INSTALL_CONFIG}
|
||||||
${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)
|
|
||||||
|
|
||||||
# Avoid running this test simultaneously with other tests:
|
# Avoid running this test simultaneously with other tests:
|
||||||
set_tests_properties(CMake.Install PROPERTIES RUN_SERIAL ON)
|
set_tests_properties(CMake.Install PROPERTIES RUN_SERIAL ON)
|
||||||
|
|
Loading…
Reference in New Issue