summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-09-14 15:52:31 (GMT)
committerBrad King <brad.king@kitware.com>2020-09-18 16:49:17 (GMT)
commit2db623f554d5522350214a7c5bacd5ec2dec1b34 (patch)
tree27da28d96274f726e195d216199fd949005a0930 /Tests/RunCMake
parent3ab18c870dc00499f33a40a193e95cc4e1df54ba (diff)
downloadCMake-2db623f554d5522350214a7c5bacd5ec2dec1b34.zip
CMake-2db623f554d5522350214a7c5bacd5ec2dec1b34.tar.gz
CMake-2db623f554d5522350214a7c5bacd5ec2dec1b34.tar.bz2
Xcode: Add option to specify build system variant
Extend the `-T <toolset>` option to support a `buildsystem=` field with the Xcode generator. Add a `CMAKE_XCODE_BUILD_SYSTEM` variable to inform project code about the selected build system variant.
Diffstat (limited to 'Tests/RunCMake')
-rw-r--r--Tests/RunCMake/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/GeneratorToolset/BadToolsetHostArchXcode-stderr.txt6
-rw-r--r--Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem-result.txt1
-rw-r--r--Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem-stderr.txt10
-rw-r--r--Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem.cmake1
-rw-r--r--Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake4
-rw-r--r--Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault1-result.txt1
-rw-r--r--Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault1-stderr.txt4
-rw-r--r--Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault1-stdout.txt1
-rw-r--r--Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault1.cmake8
10 files changed, 34 insertions, 5 deletions
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index e586961..39455b7 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -238,6 +238,9 @@ add_RunCMake_test(GenEx-GENEX_EVAL)
add_RunCMake_test(GeneratorExpression)
add_RunCMake_test(GeneratorInstance)
add_RunCMake_test(GeneratorPlatform)
+if(XCODE_VERSION)
+ set(GeneratorToolset_ARGS -DXCODE_VERSION=${XCODE_VERSION})
+endif()
add_RunCMake_test(GeneratorToolset)
add_RunCMake_test(GetPrerequisites)
add_RunCMake_test(GNUInstallDirs -DSYSTEM_NAME=${CMAKE_SYSTEM_NAME})
diff --git a/Tests/RunCMake/GeneratorToolset/BadToolsetHostArchXcode-stderr.txt b/Tests/RunCMake/GeneratorToolset/BadToolsetHostArchXcode-stderr.txt
index 5737e95..a86bd02 100644
--- a/Tests/RunCMake/GeneratorToolset/BadToolsetHostArchXcode-stderr.txt
+++ b/Tests/RunCMake/GeneratorToolset/BadToolsetHostArchXcode-stderr.txt
@@ -3,8 +3,4 @@ CMake Error at CMakeLists.txt:[0-9]+ \(project\):
.*
- does not recognize the toolset
-
- Test Toolset,host=x6[45]
-
- that was specified\.$
+ given toolset specification that contains invalid field 'host'\.$
diff --git a/Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem-result.txt b/Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem-stderr.txt b/Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem-stderr.txt
new file mode 100644
index 0000000..9ef6b20
--- /dev/null
+++ b/Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem-stderr.txt
@@ -0,0 +1,10 @@
+CMake Error at CMakeLists.txt:[0-9]+ \(project\):
+ Generator
+
+ Xcode
+
+ toolset specification field
+
+ buildsystem=bad
+
+ value is unkonwn. It must be '1'\.$
diff --git a/Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem.cmake b/Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem.cmake
new file mode 100644
index 0000000..2fc38e5
--- /dev/null
+++ b/Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem.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 bb22841..af59019 100644
--- a/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake
+++ b/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake
@@ -54,6 +54,10 @@ elseif("${RunCMake_GENERATOR}" STREQUAL "Xcode")
run_cmake(TestToolset)
set(RunCMake_GENERATOR_TOOLSET "Test Toolset,host=x64")
run_cmake(BadToolsetHostArchXcode)
+ set(RunCMake_GENERATOR_TOOLSET "buildsystem=bad")
+ run_cmake(BadToolsetXcodeBuildSystem)
+ set(RunCMake_GENERATOR_TOOLSET "Test Toolset")
+ run_cmake(TestToolsetXcodeBuildSystemDefault1)
else()
set(RunCMake_GENERATOR_TOOLSET "Bad Toolset")
run_cmake(BadToolset)
diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault1-result.txt b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault1-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault1-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault1-stderr.txt b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault1-stderr.txt
new file mode 100644
index 0000000..0adbd0c
--- /dev/null
+++ b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault1-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Error at TestToolsetXcodeBuildSystemDefault1.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/TestToolsetXcodeBuildSystemDefault1-stdout.txt b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault1-stdout.txt
new file mode 100644
index 0000000..cba95ce
--- /dev/null
+++ b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault1-stdout.txt
@@ -0,0 +1 @@
+CMAKE_XCODE_BUILD_SYSTEM='1'
diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault1.cmake b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault1.cmake
new file mode 100644
index 0000000..645bb19
--- /dev/null
+++ b/Tests/RunCMake/GeneratorToolset/TestToolsetXcodeBuildSystemDefault1.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()