summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-09-14 19:02:47 (GMT)
committerBrad King <brad.king@kitware.com>2020-09-18 17:02:14 (GMT)
commit8d5f4c4db93959f77dc8fb185e4630df4ec26d98 (patch)
treed71f3fd9552500ecb52217bff53f4a7b37d6e18c /Tests
parent2db623f554d5522350214a7c5bacd5ec2dec1b34 (diff)
downloadCMake-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')
-rw-r--r--Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem-stderr.txt2
-rw-r--r--Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem12-result.txt1
-rw-r--r--Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem12-stderr.txt10
-rw-r--r--Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem12.cmake1
-rw-r--r--Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake15
-rw-r--r--Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem1-result.txt1
-rw-r--r--Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem1-stderr.txt4
-rw-r--r--Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem1-stdout.txt1
-rw-r--r--Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem1.cmake8
-rw-r--r--Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem12-result.txt1
-rw-r--r--Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem12-stderr.txt4
-rw-r--r--Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem12-stdout.txt1
-rw-r--r--Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystem12.cmake8
-rw-r--r--Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault12-result.txt1
-rw-r--r--Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault12-stderr.txt4
-rw-r--r--Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault12-stdout.txt1
-rw-r--r--Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault12.cmake8
-rw-r--r--Tests/RunCMake/XcodeProject/RunCMakeTest.cmake4
-rw-r--r--Tests/RunCMake/XcodeProject/XcodeDuplicateCustomCommand-result.txt1
-rw-r--r--Tests/RunCMake/XcodeProject/XcodeDuplicateCustomCommand-stderr.txt13
-rw-r--r--Tests/RunCMake/XcodeProject/XcodeDuplicateCustomCommand.cmake3
21 files changed, 89 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()
diff --git a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake
index 70eaaeb..68de61c 100644
--- a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake
+++ b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake
@@ -10,6 +10,10 @@ run_cmake(XcodeAttributeGenex)
run_cmake(XcodeAttributeGenexError)
run_cmake(XcodeGenerateTopLevelProjectOnly)
+if(XCODE_VERSION VERSION_GREATER_EQUAL 12)
+ run_cmake(XcodeDuplicateCustomCommand)
+endif()
+
function(XcodeGenerateTopLevelProjectOnlyWithObjectLibrary)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeGenerateTopLevelProjectOnlyWithObjectLibrary-build)
run_cmake(XcodeGenerateTopLevelProjectOnlyWithObjectLibrary)
diff --git a/Tests/RunCMake/XcodeProject/XcodeDuplicateCustomCommand-result.txt b/Tests/RunCMake/XcodeProject/XcodeDuplicateCustomCommand-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject/XcodeDuplicateCustomCommand-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/XcodeProject/XcodeDuplicateCustomCommand-stderr.txt b/Tests/RunCMake/XcodeProject/XcodeDuplicateCustomCommand-stderr.txt
new file mode 100644
index 0000000..02af783
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject/XcodeDuplicateCustomCommand-stderr.txt
@@ -0,0 +1,13 @@
+^CMake Error in CMakeLists.txt:
+ The custom command generating
+
+ [^
+]*/Tests/RunCMake/XcodeProject/XcodeDuplicateCustomCommand-build/out.txt
+
+ is attached to multiple targets:
+
+ drive[0-9]
+ drive[0-9]
+
+ but none of these is a common dependency of the other\(s\). This is not
+ allowed by the Xcode "new build system".
diff --git a/Tests/RunCMake/XcodeProject/XcodeDuplicateCustomCommand.cmake b/Tests/RunCMake/XcodeProject/XcodeDuplicateCustomCommand.cmake
new file mode 100644
index 0000000..3ef1312
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject/XcodeDuplicateCustomCommand.cmake
@@ -0,0 +1,3 @@
+add_custom_command(OUTPUT out.txt COMMAND false)
+add_custom_target(drive1 DEPENDS out.txt)
+add_custom_target(drive2 DEPENDS out.txt)