diff options
author | Brad King <brad.king@kitware.com> | 2020-09-14 19:02:47 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2020-09-18 17:02:14 (GMT) |
commit | 8d5f4c4db93959f77dc8fb185e4630df4ec26d98 (patch) | |
tree | d71f3fd9552500ecb52217bff53f4a7b37d6e18c /Tests/RunCMake/GeneratorToolset | |
parent | 2db623f554d5522350214a7c5bacd5ec2dec1b34 (diff) | |
download | CMake-8d5f4c4db93959f77dc8fb185e4630df4ec26d98.zip CMake-8d5f4c4db93959f77dc8fb185e4630df4ec26d98.tar.gz CMake-8d5f4c4db93959f77dc8fb185e4630df4ec26d98.tar.bz2 |
Xcode: Switch to the "new build system" for Xcode 12 and above
Provide an option to switch back to the original build system via
`-T buildsystem=1`.
Fixes: #18088
Diffstat (limited to 'Tests/RunCMake/GeneratorToolset')
17 files changed, 68 insertions, 3 deletions
diff --git a/Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem-stderr.txt b/Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem-stderr.txt index 9ef6b20..5e88e3b 100644 --- a/Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem-stderr.txt +++ b/Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem-stderr.txt @@ -7,4 +7,4 @@ CMake Error at CMakeLists.txt:[0-9]+ \(project\): buildsystem=bad - value is unkonwn. It must be '1'\.$ + value is unkonwn. It must be '1' or '12'\.$ diff --git a/Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem12-result.txt b/Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem12-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem12-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem12-stderr.txt b/Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem12-stderr.txt new file mode 100644 index 0000000..cdfae3e --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem12-stderr.txt @@ -0,0 +1,10 @@ +CMake Error at CMakeLists.txt:[0-9]+ \(project\): + Generator + + Xcode + + toolset specification field + + buildsystem=12 + + is not allowed with Xcode [0-9.]+\.$ diff --git a/Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem12.cmake b/Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem12.cmake new file mode 100644 index 0000000..2fc38e5 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem12.cmake @@ -0,0 +1 @@ +message(FATAL_ERROR "This should not be reached!") diff --git a/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake index af59019..5f12d79 100644 --- a/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake +++ b/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake @@ -56,8 +56,19 @@ elseif("${RunCMake_GENERATOR}" STREQUAL "Xcode") run_cmake(BadToolsetHostArchXcode) set(RunCMake_GENERATOR_TOOLSET "buildsystem=bad") run_cmake(BadToolsetXcodeBuildSystem) - set(RunCMake_GENERATOR_TOOLSET "Test Toolset") - run_cmake(TestToolsetXcodeBuildSystemDefault1) + if(XCODE_VERSION VERSION_GREATER_EQUAL 12) + set(RunCMake_GENERATOR_TOOLSET "Test Toolset") + run_cmake(TestToolsetXcodeBuildSystemDefault12) + set(RunCMake_GENERATOR_TOOLSET "Test Toolset,buildsystem=1") + run_cmake(TestToolsetXcodeBuildSystem1) + set(RunCMake_GENERATOR_TOOLSET "Test Toolset,buildsystem=12") + run_cmake(TestToolsetXcodeBuildSystem12) + else() + set(RunCMake_GENERATOR_TOOLSET "Test Toolset") + run_cmake(TestToolsetXcodeBuildSystemDefault1) + set(RunCMake_GENERATOR_TOOLSET "buildsystem=12") + run_cmake(BadToolsetXcodeBuildSystem12) + endif() else() set(RunCMake_GENERATOR_TOOLSET "Bad Toolset") run_cmake(BadToolset) diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem1-result.txt b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem1-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem1-stderr.txt b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem1-stderr.txt new file mode 100644 index 0000000..817467b --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem1-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at TestToolsetXcodeBuildSystem1.cmake:[0-9]+ \(message\): + CMAKE_GENERATOR_TOOLSET is "Test Toolset,buildsystem=1" as expected. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem1-stdout.txt b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem1-stdout.txt new file mode 100644 index 0000000..cba95ce --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem1-stdout.txt @@ -0,0 +1 @@ +CMAKE_XCODE_BUILD_SYSTEM='1' diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem1.cmake b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem1.cmake new file mode 100644 index 0000000..550a6a1 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem1.cmake @@ -0,0 +1,8 @@ +message(STATUS "CMAKE_XCODE_BUILD_SYSTEM='${CMAKE_XCODE_BUILD_SYSTEM}'") +if(CMAKE_GENERATOR_TOOLSET STREQUAL "Test Toolset,buildsystem=1") + message(FATAL_ERROR "CMAKE_GENERATOR_TOOLSET is \"Test Toolset,buildsystem=1\" as expected.") +else() + message(FATAL_ERROR + "CMAKE_GENERATOR_TOOLSET is \"${CMAKE_GENERATOR_TOOLSET}\" " + "but should be \"Test Toolset,buildsystem=1\"!") +endif() diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem12-result.txt b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem12-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem12-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem12-stderr.txt b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem12-stderr.txt new file mode 100644 index 0000000..9352faf --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem12-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at TestToolsetXcodeBuildSystem12.cmake:[0-9]+ \(message\): + CMAKE_GENERATOR_TOOLSET is "Test Toolset,buildsystem=12" as expected. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem12-stdout.txt b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem12-stdout.txt new file mode 100644 index 0000000..df49a31 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem12-stdout.txt @@ -0,0 +1 @@ +CMAKE_XCODE_BUILD_SYSTEM='12' diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem12.cmake b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem12.cmake new file mode 100644 index 0000000..7e30e43 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem12.cmake @@ -0,0 +1,8 @@ +message(STATUS "CMAKE_XCODE_BUILD_SYSTEM='${CMAKE_XCODE_BUILD_SYSTEM}'") +if(CMAKE_GENERATOR_TOOLSET STREQUAL "Test Toolset,buildsystem=12") + message(FATAL_ERROR "CMAKE_GENERATOR_TOOLSET is \"Test Toolset,buildsystem=12\" as expected.") +else() + message(FATAL_ERROR + "CMAKE_GENERATOR_TOOLSET is \"${CMAKE_GENERATOR_TOOLSET}\" " + "but should be \"Test Toolset,buildsystem=12\"!") +endif() diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault12-result.txt b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault12-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault12-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault12-stderr.txt b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault12-stderr.txt new file mode 100644 index 0000000..1d43537 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault12-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at TestToolsetXcodeBuildSystemDefault12.cmake:[0-9]+ \(message\): + CMAKE_GENERATOR_TOOLSET is "Test Toolset" as expected. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault12-stdout.txt b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault12-stdout.txt new file mode 100644 index 0000000..df49a31 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault12-stdout.txt @@ -0,0 +1 @@ +CMAKE_XCODE_BUILD_SYSTEM='12' diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault12.cmake b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault12.cmake new file mode 100644 index 0000000..645bb19 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault12.cmake @@ -0,0 +1,8 @@ +message(STATUS "CMAKE_XCODE_BUILD_SYSTEM='${CMAKE_XCODE_BUILD_SYSTEM}'") +if(CMAKE_GENERATOR_TOOLSET STREQUAL "Test Toolset") + message(FATAL_ERROR "CMAKE_GENERATOR_TOOLSET is \"Test Toolset\" as expected.") +else() + message(FATAL_ERROR + "CMAKE_GENERATOR_TOOLSET is \"${CMAKE_GENERATOR_TOOLSET}\" " + "but should be \"Test Toolset\"!") +endif() |