2009-12-10 18:34:36 +03:00
|
|
|
# Define option CMake_TEST_INSTALL, and enable by default for dashboards.
|
|
|
|
set(_default 0)
|
|
|
|
if(DEFINED ENV{DASHBOARD_TEST_FROM_CTEST})
|
|
|
|
set(_default 1)
|
|
|
|
endif()
|
|
|
|
option(CMake_TEST_INSTALL "Test CMake Installation" ${_default})
|
|
|
|
mark_as_advanced(CMake_TEST_INSTALL)
|
|
|
|
|
|
|
|
if(CMake_TEST_INSTALL)
|
|
|
|
# Do not build during the test.
|
|
|
|
set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY 1)
|
|
|
|
|
|
|
|
# Install to a test directory.
|
|
|
|
set(CMake_TEST_INSTALL_PREFIX ${CMake_BINARY_DIR}/Tests/CMakeInstall)
|
|
|
|
set(CMAKE_INSTALL_PREFIX "${CMake_TEST_INSTALL_PREFIX}")
|
|
|
|
|
|
|
|
if(CMAKE_CONFIGURATION_TYPES)
|
|
|
|
# There are multiple configurations. Make sure the tested
|
|
|
|
# configuration is the one that is installed.
|
2013-11-14 23:16:06 +04:00
|
|
|
set(CMake_TEST_INSTALL_CONFIG --config $<CONFIGURATION>)
|
2009-12-10 18:34:36 +03:00
|
|
|
else()
|
|
|
|
set(CMake_TEST_INSTALL_CONFIG)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# Add a test to install CMake through the build system install target.
|
2013-11-14 23:16:06 +04:00
|
|
|
add_test(NAME CMake.Install
|
|
|
|
COMMAND cmake --build . --target install ${CMake_TEST_INSTALL_CONFIG}
|
|
|
|
)
|
2009-12-10 18:34:36 +03:00
|
|
|
|
2010-12-31 17:17:37 +03:00
|
|
|
# Avoid running this test simultaneously with other tests:
|
|
|
|
set_tests_properties(CMake.Install PROPERTIES RUN_SERIAL ON)
|
|
|
|
|
2009-12-10 18:34:36 +03:00
|
|
|
# TODO: Make all other tests depend on this one, and then drive them
|
|
|
|
# with the installed CTest.
|
|
|
|
else()
|
|
|
|
set(CMake_TEST_INSTALL_PREFIX)
|
|
|
|
endif()
|