File: RunCMakeTest.cmake

package info (click to toggle)
cmake 4.2.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 152,336 kB
  • sloc: ansic: 403,896; cpp: 303,920; sh: 4,105; python: 3,583; 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: 111; javascript: 83; pascal: 63; tcl: 55; php: 25; ruby: 22
file content (39 lines) | stat: -rw-r--r-- 1,332 bytes parent folder | download | duplicates (3)
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
include(RunCMake)

# CMP0156 control how libraries are specified for the link step
# a sensible configuration is how circular dependency is handled

if(NOT RunCMake_GENERATOR_IS_MULTI_CONFIG)
  set(OPTIONS -DCMAKE_BUILD_TYPE=Release)
endif()

macro(run_cmake_and_build test)
  set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${test}-build)
  set(RunCMake_TEST_OUTPUT_MERGE TRUE)
  run_cmake_with_options(${test} ${OPTIONS})
  set(RunCMake_TEST_NO_CLEAN TRUE)
  run_cmake_command(${test}-build ${CMAKE_COMMAND} --build . --config Release)
  unset(RunCMake_TEST_NO_CLEAN)
  unset(RunCMake_TEST_BINARY_DIR)
  unset(RunCMake_TEST_OUTPUT_MERGE)
endmacro()

run_cmake(CMP0156-WARN)
run_cmake_and_build(CMP0156-OLD)
run_cmake_and_build(CMP0156-NEW)

if (CMAKE_C_COMPILER_ID STREQUAL "AppleClang"
    AND CMAKE_C_COMPILER_VERSION GREATER_EQUAL "15.0")
  # special case for Apple: with CMP0156=OLD, linker will warning on duplicate libraries
  run_cmake_and_build(CMP0156-OLD-AppleClang)
  run_cmake_and_build(CMP0156-NEW-AppleClang)
endif()


run_cmake_and_build(CMP0156-NEW-Imported)

if (CMAKE_C_COMPILER_ID STREQUAL "AppleClang"
    AND CMAKE_C_COMPILER_VERSION GREATER_EQUAL "15.0")
  # special case for Apple: FIXME(#26284): linker will warning on duplicate libraries
  run_cmake_and_build(CMP0156-NEW-AppleClang-Imported)
endif()