summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2018-01-08 14:58:06 (GMT)
committerKitware Robot <kwrobot@kitware.com>2018-01-08 14:58:11 (GMT)
commita3bba2a5ad30287a22f2a700de6a60f0869b8dac (patch)
treea53f8f47d28b7259a18020ecaedaec152c07d094 /Tests
parent2c089d80de3945e4f08f13557d59e04cbc942a60 (diff)
parent4017bf40de512e977d59c12f4e3f6c91f5dd953d (diff)
downloadCMake-a3bba2a5ad30287a22f2a700de6a60f0869b8dac.zip
CMake-a3bba2a5ad30287a22f2a700de6a60f0869b8dac.tar.gz
CMake-a3bba2a5ad30287a22f2a700de6a60f0869b8dac.tar.bz2
Merge topic '17431-iphone-deployment-target'
4017bf40 Darwin: Emit deployment target that matches the SDK 8f4663ff Xcode: rename embedded SDK query function Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !1447
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/XcodeProject/DeploymentTarget.c26
-rw-r--r--Tests/RunCMake/XcodeProject/DeploymentTarget.cmake32
-rw-r--r--Tests/RunCMake/XcodeProject/RunCMakeTest.cmake18
-rw-r--r--Tests/RunCMake/XcodeProject/XcodeBundles.cmake3
-rw-r--r--Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined.cmake3
-rw-r--r--Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedPrune.cmake3
-rw-r--r--Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch.cmake3
7 files changed, 88 insertions, 0 deletions
diff --git a/Tests/RunCMake/XcodeProject/DeploymentTarget.c b/Tests/RunCMake/XcodeProject/DeploymentTarget.c
new file mode 100644
index 0000000..51af046
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject/DeploymentTarget.c
@@ -0,0 +1,26 @@
+#include <Availability.h>
+#include <TargetConditionals.h>
+
+#if TARGET_OS_OSX
+#if __MAC_OS_X_VERSION_MIN_REQUIRED != __MAC_10_11
+#error macOS deployment version mismatch
+#endif
+#elif TARGET_OS_IOS
+#if __IPHONE_OS_VERSION_MIN_REQUIRED != __IPHONE_9_1
+#error iOS deployment version mismatch
+#endif
+#elif TARGET_OS_WATCH
+#if __WATCH_OS_VERSION_MIN_REQUIRED != __WATCHOS_2_0
+#error watchOS deployment version mismatch
+#endif
+#elif TARGET_OS_TV
+#if __TV_OS_VERSION_MIN_REQUIRED != __TVOS_9_0
+#error tvOS deployment version mismatch
+#endif
+#else
+#error unknown OS
+#endif
+
+void foo()
+{
+}
diff --git a/Tests/RunCMake/XcodeProject/DeploymentTarget.cmake b/Tests/RunCMake/XcodeProject/DeploymentTarget.cmake
new file mode 100644
index 0000000..6281352
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject/DeploymentTarget.cmake
@@ -0,0 +1,32 @@
+cmake_minimum_required(VERSION 3.10)
+project(DeploymentTarget C)
+
+# using Xcode 7.1 SDK versions for deployment targets
+
+if(SDK MATCHES iphone)
+ set(CMAKE_OSX_SYSROOT ${SDK})
+ set(CMAKE_OSX_ARCHITECTURES "armv7;x86_64")
+ set(CMAKE_OSX_DEPLOYMENT_TARGET "9.1")
+ set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO")
+ set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "NO")
+elseif(SDK MATCHES watch)
+ set(CMAKE_OSX_SYSROOT ${SDK})
+ set(CMAKE_OSX_ARCHITECTURES "armv7k;i386")
+ set(CMAKE_OSX_DEPLOYMENT_TARGET "2.0")
+ set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO")
+ set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "")
+ set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "YES")
+elseif(SDK MATCHES appletv)
+ set(CMAKE_OSX_SYSROOT ${SDK})
+ set(CMAKE_OSX_DEPLOYMENT_TARGET "9.0")
+ set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64")
+ set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO")
+ set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "")
+ set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "YES")
+else()
+ set(CMAKE_OSX_SYSROOT ${SDK})
+ set(CMAKE_OSX_DEPLOYMENT_TARGET "10.11")
+endif()
+
+add_library(myFramework STATIC DeploymentTarget.c)
+set_target_properties(myFramework PROPERTIES FRAMEWORK TRUE)
diff --git a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake
index 7eb624c..1313cb5 100644
--- a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake
+++ b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake
@@ -216,3 +216,21 @@ endfunction()
if(NOT XCODE_VERSION VERSION_LESS 7)
XcodeSchemaGeneration()
endif()
+
+if(XCODE_VERSION VERSION_GREATER_EQUAL 8)
+ function(deploymeny_target_test SDK)
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/DeploymentTarget-${SDK}-build)
+ set(RunCMake_TEST_NO_CLEAN 1)
+ set(RunCMake_TEST_OPTIONS "-DSDK=${SDK}")
+
+ file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
+ file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
+
+ run_cmake(DeploymentTarget)
+ run_cmake_command(DeploymentTarget-${SDK} ${CMAKE_COMMAND} --build .)
+ endfunction()
+
+ foreach(SDK macosx iphoneos iphonesimulator appletvos appletvsimulator watchos watchsimulator)
+ deploymeny_target_test(${SDK})
+ endforeach()
+endif()
diff --git a/Tests/RunCMake/XcodeProject/XcodeBundles.cmake b/Tests/RunCMake/XcodeProject/XcodeBundles.cmake
index 0b854d8..5d19ee8 100644
--- a/Tests/RunCMake/XcodeProject/XcodeBundles.cmake
+++ b/Tests/RunCMake/XcodeProject/XcodeBundles.cmake
@@ -3,6 +3,9 @@
cmake_minimum_required(VERSION 3.3)
enable_language(C)
+# due to lack of toolchain file it might point to running macOS version
+unset(CMAKE_OSX_DEPLOYMENT_TARGET CACHE)
+
if(TEST_IOS)
set(CMAKE_OSX_SYSROOT iphoneos)
set(CMAKE_OSX_ARCHITECTURES "armv7")
diff --git a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined.cmake b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined.cmake
index fc830b1..d7f3920 100644
--- a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined.cmake
+++ b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined.cmake
@@ -2,6 +2,9 @@ cmake_minimum_required(VERSION 3.3)
project(IOSInstallCombined CXX)
+# due to lack of toolchain file it might point to running macOS version
+unset(CMAKE_OSX_DEPLOYMENT_TARGET CACHE)
+
set(CMAKE_OSX_SYSROOT iphoneos)
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO")
set(CMAKE_XCODE_ATTRIBUTE_DEBUG_INFORMATION_FORMAT "dwarf")
diff --git a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedPrune.cmake b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedPrune.cmake
index b47d3a5..28ab883 100644
--- a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedPrune.cmake
+++ b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedPrune.cmake
@@ -2,6 +2,9 @@ cmake_minimum_required(VERSION 3.3)
project(XcodeIOSInstallCombinedPrune CXX)
+# due to lack of toolchain file it might point to running macOS version
+unset(CMAKE_OSX_DEPLOYMENT_TARGET CACHE)
+
set(CMAKE_OSX_SYSROOT iphoneos)
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO")
set(CMAKE_XCODE_ATTRIBUTE_DEBUG_INFORMATION_FORMAT "dwarf")
diff --git a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch.cmake b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch.cmake
index 4b5e7ce..5e7961a 100644
--- a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch.cmake
+++ b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch.cmake
@@ -2,6 +2,9 @@ cmake_minimum_required(VERSION 3.3)
project(XcodeIOSInstallCombinedSingleArch CXX)
+# due to lack of toolchain file it might point to running macOS version
+unset(CMAKE_OSX_DEPLOYMENT_TARGET CACHE)
+
set(CMAKE_OSX_SYSROOT iphoneos)
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO")
set(CMAKE_XCODE_ATTRIBUTE_DEBUG_INFORMATION_FORMAT "dwarf")