File: CMakeInstall.cmake

package info (click to toggle)
cmake 4.2.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 152,344 kB
  • sloc: ansic: 403,894; cpp: 303,807; sh: 4,097; python: 3,582; yacc: 3,106; lex: 1,279; f90: 538; asm: 471; lisp: 375; cs: 270; java: 266; fortran: 239; objc: 215; perl: 213; xml: 198; makefile: 108; javascript: 83; pascal: 63; tcl: 55; php: 25; ruby: 22
file content (48 lines) | stat: -rw-r--r-- 1,734 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# 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}")

  # 3.9 or later provides a definitive answer to whether we are multi-config
  # through a global property. Prior to 3.9, CMAKE_CONFIGURATION_TYPES being set
  # is assumed to mean multi-config, but developers might modify it so it is
  # technically not as reliable.
  if(NOT CMAKE_VERSION VERSION_LESS 3.9)
    get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
  elseif(CMAKE_CONFIGURATION_TYPES)
    set(_isMultiConfig True)
  else()
    set(_isMultiConfig False)
  endif()
  if(_isMultiConfig)
    # There are multiple configurations.  Make sure the tested
    # configuration is the one that is installed.
    set(CMake_TEST_INSTALL_CONFIG --config $<CONFIGURATION>)
  else()
    set(CMake_TEST_INSTALL_CONFIG)
  endif()

  # Add a test to install CMake through the build system install target.
  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)

  # TODO: Make all other tests depend on this one, and then drive them
  # with the installed CTest.
else()
  set(CMake_TEST_INSTALL_PREFIX)
endif()