[Cmake-commits] CMake branch, master, updated. v3.13.4-1285-gc6d679f

Kitware Robot kwrobot at kitware.com
Tue Feb 5 07:43:08 EST 2019


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, master has been updated
       via  c6d679f0d904b19b3be411b399b5904a5da7ea78 (commit)
       via  c03072f2f7a08c6ddf0cec58dfc8ea2b83f4c1a9 (commit)
       via  d3d2c3cd497e09281a8f237b5a4cd35d8cd298f0 (commit)
       via  e8ee8cab97bdb084d4555ee3e76eb33303e3bc85 (commit)
       via  11da882a1293b39ddd054342b1e6f2f3bd1bc934 (commit)
       via  36cf44a7a3a8931c97790db6df61439d4dd86ea3 (commit)
      from  25e616862dac08aae7c4a3ad01839acfe7342ec7 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c6d679f0d904b19b3be411b399b5904a5da7ea78
commit c6d679f0d904b19b3be411b399b5904a5da7ea78
Merge: c03072f d3d2c3c
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Tue Feb 5 12:30:55 2019 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Tue Feb 5 07:36:36 2019 -0500

    Merge topic 'vs-fortran-target-check'
    
    d3d2c3cd49 VS: Fix Fortran target type selection when linking C++ targets
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Merge-request: !2913


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c03072f2f7a08c6ddf0cec58dfc8ea2b83f4c1a9
commit c03072f2f7a08c6ddf0cec58dfc8ea2b83f4c1a9
Merge: 25e6168 e8ee8ca
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Tue Feb 5 12:30:19 2019 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Tue Feb 5 07:33:04 2019 -0500

    Merge topic '17870-iphone-friendly-cmake'
    
    e8ee8cab97 Xcode: Completely disable code signing for compiler id detection
    11da882a12 Apple: Introduce separate system name for iOS, tvOS, and watchOS
    36cf44a7a3 Tests: Isolate RunCMake.XcodeProject per-device cases from host arch
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Merge-request: !2392


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d3d2c3cd497e09281a8f237b5a4cd35d8cd298f0
commit d3d2c3cd497e09281a8f237b5a4cd35d8cd298f0
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Mon Feb 4 09:41:57 2019 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Mon Feb 4 14:13:46 2019 -0500

    VS: Fix Fortran target type selection when linking C++ targets
    
    Since commit 2c9f35789d (VS: Decide project type by linker lang as
    fallback, 2017-03-30, v3.9.0-rc1~340^2) we consider the linker language
    when detecting whether to generate a `.vfproj` or `.vcxproj` file.
    However, this could cause C-only projects to become `.vfproj` files if
    they link to Fortran projects.  Instead we should consider only the
    `LINKER_LANGUAGE` property on the target itself.  This approach is
    already used for CSharp.  It allows project code to specify the project
    file type for a target with no sources but does not allow linked targets
    to affect it.
    
    Fixes: #18687

diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx
index 77be592..1922906 100644
--- a/Source/cmGlobalVisualStudioGenerator.cxx
+++ b/Source/cmGlobalVisualStudioGenerator.cxx
@@ -813,7 +813,6 @@ bool cmGlobalVisualStudioGenerator::TargetIsFortranOnly(
   cmGeneratorTarget const* gt)
 {
   // check to see if this is a fortran build
-  std::set<std::string> languages;
   {
     // Issue diagnostic if the source files depend on the config.
     std::vector<cmSourceFile*> sources;
@@ -821,27 +820,21 @@ bool cmGlobalVisualStudioGenerator::TargetIsFortranOnly(
       return false;
     }
   }
+
   // If there's only one source language, Fortran has to be used
   // in order for the sources to compile.
-  // Note: Via linker propagation, LINKER_LANGUAGE could become CXX in
-  // this situation and mismatch from the actual language of the linker.
+  std::set<std::string> languages;
   gt->GetLanguages(languages, "");
-  if (languages.size() == 1) {
-    if (*languages.begin() == "Fortran") {
-      return true;
-    }
-  }
-
-  // In the case of mixed object files or sources mixed with objects,
-  // decide the language based on the value of LINKER_LANGUAGE.
-  // This will not make it possible to mix source files of different
-  // languages, but object libraries will be linked together in the
-  // same fashion as other generators do.
-  if (gt->GetLinkerLanguage("") == "Fortran") {
-    return true;
-  }
-
-  return false;
+  // Consider an explicit linker language property, but *not* the
+  // computed linker language that may depend on linked targets.
+  // This allows the project to control the language choice in
+  // a target with none of its own sources, e.g. when also using
+  // object libraries.
+  const char* linkLang = gt->GetProperty("LINKER_LANGUAGE");
+  if (linkLang && *linkLang) {
+    languages.insert(linkLang);
+  }
+  return languages.size() == 1 && *languages.begin() == "Fortran";
 }
 
 bool cmGlobalVisualStudioGenerator::TargetCompare::operator()(
diff --git a/Tests/Fortran/CMakeLists.txt b/Tests/Fortran/CMakeLists.txt
index 52623d0..7023615 100644
--- a/Tests/Fortran/CMakeLists.txt
+++ b/Tests/Fortran/CMakeLists.txt
@@ -99,6 +99,11 @@ function(test_fortran_c_interface_module)
   target_link_libraries(myc myfort)
   set_property(TARGET myc PROPERTY COMPILE_DEFINITIONS ${MYC_DEFS})
 
+  add_library(myfort_obj OBJECT mysub.f)
+  add_library(myc_use_obj myc.c $<TARGET_OBJECTS:myfort_obj>)
+  add_executable(mainc_use_obj mainc.c)
+  target_link_libraries(mainc_use_obj myc_use_obj)
+
   add_library(mycxx mycxx.cxx)
   target_link_libraries(mycxx myc)
 

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e8ee8cab97bdb084d4555ee3e76eb33303e3bc85
commit e8ee8cab97bdb084d4555ee3e76eb33303e3bc85
Author:     Gregor Jasny <gjasny at googlemail.com>
AuthorDate: Wed Jan 30 12:49:23 2019 +0100
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Mon Feb 4 09:03:35 2019 -0500

    Xcode: Completely disable code signing for compiler id detection
    
    Issue: #17870

diff --git a/Help/manual/cmake-toolchains.7.rst b/Help/manual/cmake-toolchains.7.rst
index 565368b..d214e4a 100644
--- a/Help/manual/cmake-toolchains.7.rst
+++ b/Help/manual/cmake-toolchains.7.rst
@@ -564,6 +564,8 @@ code signing.  If the :generator:`Xcode` generator is being used and
 code signing is required or desired, the developmemt team ID can be
 specified via the ``CMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM`` CMake variable.
 This team ID will then be included in the generated Xcode project.
+By default, CMake avoids the need for code signing during the internal
+configuration phase (i.e compiler ID and feature detection).
 
 .. _`Switching Between Device and Simulator`:
 
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake
index a63d317..5eb7ac9 100644
--- a/Modules/CMakeDetermineCompilerId.cmake
+++ b/Modules/CMakeDetermineCompilerId.cmake
@@ -358,18 +358,6 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS}
     else()
       set(id_sdkroot "")
     endif()
-    if(CMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM)
-      set(id_development_team
-        "DEVELOPMENT_TEAM = \"${CMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM}\";")
-    else()
-      set(id_development_team "")
-    endif()
-    if(DEFINED CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY)
-      set(id_code_sign_identity
-        "CODE_SIGN_IDENTITY = \"${CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY}\";")
-    else()
-      set(id_code_sign_identity "CODE_SIGN_IDENTITY = \"\";")
-    endif()
     configure_file(${CMAKE_ROOT}/Modules/CompilerId/Xcode-3.pbxproj.in
       ${id_dir}/CompilerId${lang}.xcodeproj/project.pbxproj @ONLY)
     unset(_ENV_MACOSX_DEPLOYMENT_TARGET)
diff --git a/Modules/CompilerId/Xcode-3.pbxproj.in b/Modules/CompilerId/Xcode-3.pbxproj.in
index 4686b64..813c074 100644
--- a/Modules/CompilerId/Xcode-3.pbxproj.in
+++ b/Modules/CompilerId/Xcode-3.pbxproj.in
@@ -72,8 +72,7 @@
 		1DEB928608733DD80010E9CD = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
-				@id_development_team@
-				@id_code_sign_identity@
+				CODE_SIGN_IDENTITY = "";
 				PRODUCT_NAME = CompilerId at id_lang@;
 			};
 			name = Debug;

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=11da882a1293b39ddd054342b1e6f2f3bd1bc934
commit 11da882a1293b39ddd054342b1e6f2f3bd1bc934
Author:     Gregor Jasny <gjasny at googlemail.com>
AuthorDate: Mon Jan 15 22:21:10 2018 +0100
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Mon Feb 4 09:03:35 2019 -0500

    Apple: Introduce separate system name for iOS, tvOS, and watchOS
    
    - Remove code signing requirements for non-macOS
    - Do not set deployment target for non-macOS
    - Build static library for compiler feature detection for non-macOS
    - Use framework to run CompilerId tests for watchOS
    - Port tests to new SDK handling
    - Add new Apple cross-compiling section to toolchain documentation
    
    Closes: #17870

diff --git a/Help/manual/cmake-toolchains.7.rst b/Help/manual/cmake-toolchains.7.rst
index 8554e87..565368b 100644
--- a/Help/manual/cmake-toolchains.7.rst
+++ b/Help/manual/cmake-toolchains.7.rst
@@ -522,3 +522,72 @@ See also target properties:
 * :prop_tgt:`ANDROID_SECURE_PROPS_PATH`
 * :prop_tgt:`ANDROID_SKIP_ANT_STEP`
 * :prop_tgt:`ANDROID_STL_TYPE`
+
+.. _`Cross Compiling for iOS, tvOS, or watchOS`:
+
+Cross Compiling for iOS, tvOS, or watchOS
+-----------------------------------------
+
+For cross-compiling to iOS, tvOS, or watchOS, the :generator:`Xcode`
+generator is recommended.  The :generator:`Unix Makefiles` or
+:generator:`Ninja` generators can also be used, but they require the
+project to handle more areas like target CPU selection and code signing.
+
+Any of the three systems can be targetted by setting the
+:variable:`CMAKE_SYSTEM_NAME` variable to a value from the table below.
+By default, the latest Device SDK is chosen.  As for all Apple platforms,
+a different SDK (e.g. a simulator) can be selected by setting the
+:variable:`CMAKE_OSX_SYSROOT` variable, although this should rarely be
+necessary (see :ref:`Switching Between Device and Simulator` below).
+A list of available SDKs can be obtained by running ``xcodebuild -showsdks``.
+
+=======  ================= ==================== ================
+OS       CMAKE_SYSTEM_NAME Device SDK (default) Simulator SDK
+=======  ================= ==================== ================
+iOS      iOS               iphoneos             iphonesimulator
+tvOS     tvOS              appletvos            appletvsimulator
+watchOS  watchOS           watchos              watchsimulator
+=======  ================= ==================== ================
+
+For example, to create a CMake configuration for iOS, the following
+command is sufficient:
+
+.. code-block:: console
+
+  cmake .. -GXcode -DCMAKE_SYSTEM_NAME=iOS
+
+Code Signing
+^^^^^^^^^^^^
+
+Some build artifacts for the embedded Apple platforms require mandatory
+code signing.  If the :generator:`Xcode` generator is being used and
+code signing is required or desired, the developmemt team ID can be
+specified via the ``CMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM`` CMake variable.
+This team ID will then be included in the generated Xcode project.
+
+.. _`Switching Between Device and Simulator`:
+
+Switching Between Device and Simulator
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+When configuring for any of the embedded platforms, one can target either
+real devices or the simulator.  Both have their own separate SDK, but CMake
+only supports specifying a single SDK for the configuration phase.  This
+means the developer must select one or the other at configuration time.
+When using the :generator:`Xcode` generator, this is less of a limitation
+because Xcode still allows you to build for either a device or a simulator,
+even though configuration was only performed for one of the two.  From
+within the Xcode IDE, builds are performed for the selected "destination"
+platform.  When building from the command line, the desired sdk can be
+specified directly by passing a ``-sdk`` option to the underlying build
+tool (``xcodebuild``).  For example:
+
+.. code-block:: console
+
+  $ cmake --build ... -- -sdk iphonesimulator
+
+Please note that checks made during configuration were performed against
+the configure-time SDK and might not hold true for other SDKs.  Commands
+like :command:`find_package`, :command:`find_library`, etc. store and use
+details only for the configured SDK/platform, so they can be problematic
+if wanting to switch between device and simulator builds.
diff --git a/Help/release/dev/iphone-friendly-cmake.rst b/Help/release/dev/iphone-friendly-cmake.rst
new file mode 100644
index 0000000..f32f0d1
--- /dev/null
+++ b/Help/release/dev/iphone-friendly-cmake.rst
@@ -0,0 +1,5 @@
+iphone-friendly-cmake
+---------------------
+
+* CMake now supports :ref:`Cross Compiling for iOS, tvOS, or watchOS`
+  using simple toolchain files.
diff --git a/Modules/CMakeDetermineCCompiler.cmake b/Modules/CMakeDetermineCCompiler.cmake
index 4f355f3..d7f6f97 100644
--- a/Modules/CMakeDetermineCCompiler.cmake
+++ b/Modules/CMakeDetermineCCompiler.cmake
@@ -106,7 +106,7 @@ if(NOT CMAKE_C_COMPILER_ID_RUN)
   #      ...
   #      /path/to/cc ...CompilerIdC/...
   # to extract the compiler front-end for the language.
-  set(CMAKE_C_COMPILER_ID_TOOL_MATCH_REGEX "\nLd[^\n]*(\n[ \t]+[^\n]*)*\n[ \t]+([^ \t\r\n]+)[^\r\n]*-o[^\r\n]*CompilerIdC/(\\./)?(CompilerIdC.xctest/)?CompilerIdC[ \t\n\\\"]")
+  set(CMAKE_C_COMPILER_ID_TOOL_MATCH_REGEX "\nLd[^\n]*(\n[ \t]+[^\n]*)*\n[ \t]+([^ \t\r\n]+)[^\r\n]*-o[^\r\n]*CompilerIdC/(\\./)?(CompilerIdC.(framework|xctest)/)?CompilerIdC[ \t\n\\\"]")
   set(CMAKE_C_COMPILER_ID_TOOL_MATCH_INDEX 2)
 
   include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerId.cmake)
diff --git a/Modules/CMakeDetermineCXXCompiler.cmake b/Modules/CMakeDetermineCXXCompiler.cmake
index 96b4209..bd878b2 100644
--- a/Modules/CMakeDetermineCXXCompiler.cmake
+++ b/Modules/CMakeDetermineCXXCompiler.cmake
@@ -101,7 +101,7 @@ if(NOT CMAKE_CXX_COMPILER_ID_RUN)
   #      ...
   #      /path/to/cc ...CompilerIdCXX/...
   # to extract the compiler front-end for the language.
-  set(CMAKE_CXX_COMPILER_ID_TOOL_MATCH_REGEX "\nLd[^\n]*(\n[ \t]+[^\n]*)*\n[ \t]+([^ \t\r\n]+)[^\r\n]*-o[^\r\n]*CompilerIdCXX/(\\./)?(CompilerIdCXX.xctest/)?CompilerIdCXX[ \t\n\\\"]")
+  set(CMAKE_CXX_COMPILER_ID_TOOL_MATCH_REGEX "\nLd[^\n]*(\n[ \t]+[^\n]*)*\n[ \t]+([^ \t\r\n]+)[^\r\n]*-o[^\r\n]*CompilerIdCXX/(\\./)?(CompilerIdCXX.(framework|xctest)/)?CompilerIdCXX[ \t\n\\\"]")
   set(CMAKE_CXX_COMPILER_ID_TOOL_MATCH_INDEX 2)
 
   include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerId.cmake)
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake
index 2a0dbd3..a63d317 100644
--- a/Modules/CMakeDetermineCompilerId.cmake
+++ b/Modules/CMakeDetermineCompilerId.cmake
@@ -352,6 +352,8 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS}
       if(CMAKE_OSX_SYSROOT MATCHES "(^|/)[Ii][Pp][Hh][Oo][Nn][Ee]" OR
         CMAKE_OSX_SYSROOT MATCHES "(^|/)[Aa][Pp][Pp][Ll][Ee][Tt][Vv]")
         set(id_product_type "com.apple.product-type.bundle.unit-test")
+      elseif(CMAKE_OSX_SYSROOT MATCHES "(^|/)[Ww][Aa][Tt][Cc][Hh]")
+        set(id_product_type "com.apple.product-type.framework")
       endif()
     else()
       set(id_sdkroot "")
@@ -366,7 +368,7 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS}
       set(id_code_sign_identity
         "CODE_SIGN_IDENTITY = \"${CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY}\";")
     else()
-      set(id_code_sign_identity "")
+      set(id_code_sign_identity "CODE_SIGN_IDENTITY = \"\";")
     endif()
     configure_file(${CMAKE_ROOT}/Modules/CompilerId/Xcode-3.pbxproj.in
       ${id_dir}/CompilerId${lang}.xcodeproj/project.pbxproj @ONLY)
@@ -491,6 +493,9 @@ ${CMAKE_${lang}_COMPILER_ID_OUTPUT}
 
       # com.apple.package-type.bundle.unit-test
       ${_glob_id_dir}/*.xctest/*
+
+      # com.apple.product-type.framework
+      ${_glob_id_dir}/*.framework/*
       )
     list(REMOVE_ITEM files "${src}")
     set(COMPILER_${lang}_PRODUCED_FILES "")
diff --git a/Modules/CMakeTestCCompiler.cmake b/Modules/CMakeTestCCompiler.cmake
index f74a1c6..7bf6fde 100644
--- a/Modules/CMakeTestCCompiler.cmake
+++ b/Modules/CMakeTestCCompiler.cmake
@@ -11,6 +11,12 @@ endif()
 
 include(CMakeTestCompilerCommon)
 
+# work around enforced code signing and / or missing exectuable target type
+set(__CMAKE_SAVED_TRY_COMPILE_TARGET_TYPE ${CMAKE_TRY_COMPILE_TARGET_TYPE})
+if(_CMAKE_FEATURE_DETECTION_TARGET_TYPE)
+  set(CMAKE_TRY_COMPILE_TARGET_TYPE ${_CMAKE_FEATURE_DETECTION_TARGET_TYPE})
+endif()
+
 # Remove any cached result from an older CMake version.
 # We now store this in CMakeCCompiler.cmake.
 unset(CMAKE_C_COMPILER_WORKS CACHE)
@@ -86,4 +92,6 @@ else()
   endif()
 endif()
 
+set(CMAKE_TRY_COMPILE_TARGET_TYPE ${__CMAKE_SAVED_TRY_COMPILE_TARGET_TYPE})
+unset(__CMAKE_SAVED_TRY_COMPILE_TARGET_TYPE)
 unset(__CMAKE_C_COMPILER_OUTPUT)
diff --git a/Modules/CMakeTestCXXCompiler.cmake b/Modules/CMakeTestCXXCompiler.cmake
index fe6bd25..7e595b7 100644
--- a/Modules/CMakeTestCXXCompiler.cmake
+++ b/Modules/CMakeTestCXXCompiler.cmake
@@ -11,6 +11,12 @@ endif()
 
 include(CMakeTestCompilerCommon)
 
+# work around enforced code signing and / or missing exectuable target type
+set(__CMAKE_SAVED_TRY_COMPILE_TARGET_TYPE ${CMAKE_TRY_COMPILE_TARGET_TYPE})
+if(_CMAKE_FEATURE_DETECTION_TARGET_TYPE)
+  set(CMAKE_TRY_COMPILE_TARGET_TYPE ${_CMAKE_FEATURE_DETECTION_TARGET_TYPE})
+endif()
+
 # Remove any cached result from an older CMake version.
 # We now store this in CMakeCXXCompiler.cmake.
 unset(CMAKE_CXX_COMPILER_WORKS CACHE)
@@ -79,4 +85,6 @@ else()
   endif()
 endif()
 
+set(CMAKE_TRY_COMPILE_TARGET_TYPE ${__CMAKE_SAVED_TRY_COMPILE_TARGET_TYPE})
+unset(__CMAKE_SAVED_TRY_COMPILE_TARGET_TYPE)
 unset(__CMAKE_CXX_COMPILER_OUTPUT)
diff --git a/Modules/Platform/Darwin-Initialize.cmake b/Modules/Platform/Darwin-Initialize.cmake
index 3db77aa..2d797f6 100644
--- a/Modules/Platform/Darwin-Initialize.cmake
+++ b/Modules/Platform/Darwin-Initialize.cmake
@@ -34,7 +34,7 @@ string(REGEX REPLACE "^([0-9]+\\.[0-9]+).*$" "\\1"
 # CMAKE_OSX_DEPLOYMENT_TARGET
 
 # Set cache variable - end user may change this during ccmake or cmake-gui configure.
-if(_CURRENT_OSX_VERSION VERSION_GREATER 10.3)
+if(CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND _CURRENT_OSX_VERSION VERSION_GREATER 10.3)
   set(CMAKE_OSX_DEPLOYMENT_TARGET "$ENV{MACOSX_DEPLOYMENT_TARGET}" CACHE STRING
     "Minimum OS X version to target for deployment (at runtime); newer APIs weak linked. Set to empty string for default value.")
 endif()
@@ -49,6 +49,12 @@ elseif(NOT "x$ENV{SDKROOT}" STREQUAL "x" AND
         (NOT "x$ENV{SDKROOT}" MATCHES "/" OR IS_DIRECTORY "$ENV{SDKROOT}"))
   # Use the value of SDKROOT from the environment.
   set(_CMAKE_OSX_SYSROOT_DEFAULT "$ENV{SDKROOT}")
+elseif(CMAKE_SYSTEM_NAME STREQUAL iOS)
+  set(_CMAKE_OSX_SYSROOT_DEFAULT "iphoneos")
+elseif(CMAKE_SYSTEM_NAME STREQUAL tvOS)
+  set(_CMAKE_OSX_SYSROOT_DEFAULT "appletvos")
+elseif(CMAKE_SYSTEM_NAME STREQUAL watchOS)
+  set(_CMAKE_OSX_SYSROOT_DEFAULT "watchos")
 elseif("${CMAKE_GENERATOR}" MATCHES Xcode
        OR CMAKE_OSX_DEPLOYMENT_TARGET
        OR CMAKE_OSX_ARCHITECTURES MATCHES "[^;]"
diff --git a/Modules/Platform/Darwin.cmake b/Modules/Platform/Darwin.cmake
index 727baa6..a73ffba 100644
--- a/Modules/Platform/Darwin.cmake
+++ b/Modules/Platform/Darwin.cmake
@@ -1,5 +1,13 @@
 set(APPLE 1)
 
+if(CMAKE_SYSTEM_NAME STREQUAL "iOS" OR CMAKE_SYSTEM_NAME STREQUAL "tvOS" OR CMAKE_SYSTEM_NAME STREQUAL "watchOS")
+  set(CMAKE_MACOSX_BUNDLE ON)
+
+  set(CMAKE_FIND_ROOT_PATH "${_CMAKE_OSX_SYSROOT_PATH}")
+  set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
+  set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
+endif()
+
 # Darwin versions:
 #   6.x == Mac OSX 10.2 (Jaguar)
 #   7.x == Mac OSX 10.3 (Panther)
diff --git a/Modules/Platform/iOS-Determine-CXX.cmake b/Modules/Platform/iOS-Determine-CXX.cmake
new file mode 100644
index 0000000..ac80fa6
--- /dev/null
+++ b/Modules/Platform/iOS-Determine-CXX.cmake
@@ -0,0 +1 @@
+include(Platform/Darwin-Determine-CXX)
diff --git a/Modules/Platform/iOS-Initialize.cmake b/Modules/Platform/iOS-Initialize.cmake
new file mode 100644
index 0000000..41399a3
--- /dev/null
+++ b/Modules/Platform/iOS-Initialize.cmake
@@ -0,0 +1,7 @@
+include(Platform/Darwin-Initialize)
+
+if(NOT _CMAKE_OSX_SYSROOT_PATH MATCHES "/iPhone(OS|Simulator)")
+  message(FATAL_ERROR "${CMAKE_OSX_SYSROOT} is not an iOS SDK")
+endif()
+
+set(_CMAKE_FEATURE_DETECTION_TARGET_TYPE STATIC_LIBRARY)
diff --git a/Modules/Platform/iOS.cmake b/Modules/Platform/iOS.cmake
new file mode 100644
index 0000000..850ddc2
--- /dev/null
+++ b/Modules/Platform/iOS.cmake
@@ -0,0 +1 @@
+include(Platform/Darwin)
diff --git a/Modules/Platform/tvOS-Determine-CXX.cmake b/Modules/Platform/tvOS-Determine-CXX.cmake
new file mode 100644
index 0000000..ac80fa6
--- /dev/null
+++ b/Modules/Platform/tvOS-Determine-CXX.cmake
@@ -0,0 +1 @@
+include(Platform/Darwin-Determine-CXX)
diff --git a/Modules/Platform/tvOS-Initialize.cmake b/Modules/Platform/tvOS-Initialize.cmake
new file mode 100644
index 0000000..6834c80
--- /dev/null
+++ b/Modules/Platform/tvOS-Initialize.cmake
@@ -0,0 +1,7 @@
+include(Platform/Darwin-Initialize)
+
+if(NOT _CMAKE_OSX_SYSROOT_PATH MATCHES "/AppleTV(OS|Simulator)")
+  message(FATAL_ERROR "${CMAKE_OSX_SYSROOT} is not an tvOS SDK")
+endif()
+
+set(_CMAKE_FEATURE_DETECTION_TARGET_TYPE STATIC_LIBRARY)
diff --git a/Modules/Platform/tvOS.cmake b/Modules/Platform/tvOS.cmake
new file mode 100644
index 0000000..850ddc2
--- /dev/null
+++ b/Modules/Platform/tvOS.cmake
@@ -0,0 +1 @@
+include(Platform/Darwin)
diff --git a/Modules/Platform/watchOS-Determine-CXX.cmake b/Modules/Platform/watchOS-Determine-CXX.cmake
new file mode 100644
index 0000000..ac80fa6
--- /dev/null
+++ b/Modules/Platform/watchOS-Determine-CXX.cmake
@@ -0,0 +1 @@
+include(Platform/Darwin-Determine-CXX)
diff --git a/Modules/Platform/watchOS-Initialize.cmake b/Modules/Platform/watchOS-Initialize.cmake
new file mode 100644
index 0000000..2f396d3
--- /dev/null
+++ b/Modules/Platform/watchOS-Initialize.cmake
@@ -0,0 +1,7 @@
+include(Platform/Darwin-Initialize)
+
+if(NOT _CMAKE_OSX_SYSROOT_PATH MATCHES "/Watch(OS|Simulator)")
+  message(FATAL_ERROR "${CMAKE_OSX_SYSROOT} is not an watchOS SDK")
+endif()
+
+set(_CMAKE_FEATURE_DETECTION_TARGET_TYPE STATIC_LIBRARY)
diff --git a/Modules/Platform/watchOS.cmake b/Modules/Platform/watchOS.cmake
new file mode 100644
index 0000000..850ddc2
--- /dev/null
+++ b/Modules/Platform/watchOS.cmake
@@ -0,0 +1 @@
+include(Platform/Darwin)
diff --git a/Tests/RunCMake/XcodeProject/DeploymentTarget.cmake b/Tests/RunCMake/XcodeProject/DeploymentTarget.cmake
index 6281352..288735e 100644
--- a/Tests/RunCMake/XcodeProject/DeploymentTarget.cmake
+++ b/Tests/RunCMake/XcodeProject/DeploymentTarget.cmake
@@ -3,28 +3,21 @@ 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")
+if(CMAKE_SYSTEM_NAME STREQUAL "iOS")
   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")
+elseif(CMAKE_SYSTEM_NAME STREQUAL "watchOS")
   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})
+elseif(CMAKE_SYSTEM_NAME STREQUAL "tvOS")
   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()
 
diff --git a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake
index 6ea0c0c..4918f7c 100644
--- a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake
+++ b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake
@@ -1,9 +1,5 @@
 include(RunCMake)
 
-if(XCODE_VERSION VERSION_GREATER_EQUAL 9)
-  set(IOS_DEPLOYMENT_TARGET "-DCMAKE_XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET=10")
-endif()
-
 run_cmake(ExplicitCMakeLists)
 
 run_cmake(XcodeFileType)
@@ -65,8 +61,8 @@ if(NOT XCODE_VERSION VERSION_LESS 5)
   set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeInstallIOS-build)
   set(RunCMake_TEST_NO_CLEAN 1)
   set(RunCMake_TEST_OPTIONS
-    "-DCMAKE_INSTALL_PREFIX:PATH=${RunCMake_BINARY_DIR}/ios_install"
-    "${IOS_DEPLOYMENT_TARGET}")
+    "-DCMAKE_SYSTEM_NAME=iOS"
+    "-DCMAKE_INSTALL_PREFIX:PATH=${RunCMake_BINARY_DIR}/ios_install")
 
   file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
   file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
@@ -81,7 +77,7 @@ if(NOT XCODE_VERSION VERSION_LESS 5)
   set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeBundlesOSX-build)
   set(RunCMake_TEST_NO_CLEAN 1)
   set(RunCMake_TEST_OPTIONS
-    "-DTEST_IOS=OFF"
+    "-DCMAKE_SYSTEM_NAME=Darwin"
     "-DCMAKE_INSTALL_PREFIX:PATH=${RunCMake_TEST_BINARY_DIR}/_install")
 
   file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
@@ -98,9 +94,8 @@ if(NOT XCODE_VERSION VERSION_LESS 5)
   set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeBundlesIOS-build)
   set(RunCMake_TEST_NO_CLEAN 1)
   set(RunCMake_TEST_OPTIONS
-    "-DTEST_IOS=ON"
-    "-DCMAKE_INSTALL_PREFIX:PATH=${RunCMake_TEST_BINARY_DIR}/_install"
-    "${IOS_DEPLOYMENT_TARGET}")
+    "-DCMAKE_SYSTEM_NAME=iOS"
+    "-DCMAKE_INSTALL_PREFIX:PATH=${RunCMake_TEST_BINARY_DIR}/_install")
 
   file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
   file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
@@ -118,7 +113,7 @@ if(NOT XCODE_VERSION VERSION_LESS 7)
   set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeBundlesWatchOS-build)
   set(RunCMake_TEST_NO_CLEAN 1)
   set(RunCMake_TEST_OPTIONS
-    "-DTEST_WATCHOS=ON"
+    "-DCMAKE_SYSTEM_NAME=watchOS"
     "-DCMAKE_INSTALL_PREFIX:PATH=${RunCMake_TEST_BINARY_DIR}/_install")
 
   file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
@@ -137,7 +132,7 @@ if(NOT XCODE_VERSION VERSION_LESS 7.1)
   set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeBundlesTvOS-build)
   set(RunCMake_TEST_NO_CLEAN 1)
   set(RunCMake_TEST_OPTIONS
-    "-DTEST_TVOS=ON"
+    "-DCMAKE_SYSTEM_NAME=tvOS"
     "-DCMAKE_INSTALL_PREFIX:PATH=${RunCMake_TEST_BINARY_DIR}/_install")
 
   file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
@@ -163,9 +158,9 @@ if(NOT XCODE_VERSION VERSION_LESS 6)
   set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeIOSInstallCombined-build)
   set(RunCMake_TEST_NO_CLEAN 1)
   set(RunCMake_TEST_OPTIONS
-    "-DCMAKE_INSTALL_PREFIX:PATH=${RunCMake_TEST_BINARY_DIR}/_install"
+    "-DCMAKE_SYSTEM_NAME=iOS"
     "-DCMAKE_IOS_INSTALL_COMBINED=YES"
-    "${IOS_DEPLOYMENT_TARGET}")
+    "-DCMAKE_INSTALL_PREFIX:PATH=${RunCMake_TEST_BINARY_DIR}/_install")
 
   file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
   file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
@@ -182,9 +177,9 @@ if(NOT XCODE_VERSION VERSION_LESS 6)
   set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeIOSInstallCombinedPrune-build)
   set(RunCMake_TEST_NO_CLEAN 1)
   set(RunCMake_TEST_OPTIONS
-    "-DCMAKE_INSTALL_PREFIX:PATH=${RunCMake_TEST_BINARY_DIR}/_install"
+    "-DCMAKE_SYSTEM_NAME=iOS"
     "-DCMAKE_IOS_INSTALL_COMBINED=YES"
-    "${IOS_DEPLOYMENT_TARGET}")
+    "-DCMAKE_INSTALL_PREFIX:PATH=${RunCMake_TEST_BINARY_DIR}/_install")
 
   file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
   file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
@@ -201,9 +196,9 @@ if(NOT XCODE_VERSION VERSION_LESS 6)
   set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeIOSInstallCombinedSingleArch-build)
   set(RunCMake_TEST_NO_CLEAN 1)
   set(RunCMake_TEST_OPTIONS
-    "-DCMAKE_INSTALL_PREFIX:PATH=${RunCMake_TEST_BINARY_DIR}/_install"
+    "-DCMAKE_SYSTEM_NAME=iOS"
     "-DCMAKE_IOS_INSTALL_COMBINED=YES"
-    "${IOS_DEPLOYMENT_TARGET}")
+    "-DCMAKE_INSTALL_PREFIX:PATH=${RunCMake_TEST_BINARY_DIR}/_install")
 
   file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
   file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
@@ -240,10 +235,10 @@ if(NOT XCODE_VERSION VERSION_LESS 5)
 endif()
 
 if(XCODE_VERSION VERSION_GREATER_EQUAL 8)
-  function(deploymeny_target_test SDK)
+  function(deployment_target_test SystemName SDK)
     set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/DeploymentTarget-${SDK}-build)
     set(RunCMake_TEST_NO_CLEAN 1)
-    set(RunCMake_TEST_OPTIONS "-DSDK=${SDK}")
+    set(RunCMake_TEST_OPTIONS "-DCMAKE_SYSTEM_NAME=${SystemName}" "-DCMAKE_OSX_SYSROOT=${SDK}")
 
     file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
     file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
@@ -252,9 +247,13 @@ if(XCODE_VERSION VERSION_GREATER_EQUAL 8)
     run_cmake_command(DeploymentTarget-${SDK} ${CMAKE_COMMAND} --build .)
   endfunction()
 
-  foreach(SDK macosx iphoneos iphonesimulator appletvos appletvsimulator watchos watchsimulator)
-    deploymeny_target_test(${SDK})
-  endforeach()
+  deployment_target_test(Darwin macosx)
+  deployment_target_test(iOS iphoneos)
+  deployment_target_test(iOS iphonesimulator)
+  deployment_target_test(tvOS appletvos)
+  deployment_target_test(tvOS appletvsimulator)
+  deployment_target_test(watchOS watchos)
+  deployment_target_test(watchOS watchsimulator)
 endif()
 
 # Please add macOS-only tests above before the device-specific tests.
diff --git a/Tests/RunCMake/XcodeProject/XcodeBundles.cmake b/Tests/RunCMake/XcodeProject/XcodeBundles.cmake
index 5d19ee8..ef772ea 100644
--- a/Tests/RunCMake/XcodeProject/XcodeBundles.cmake
+++ b/Tests/RunCMake/XcodeProject/XcodeBundles.cmake
@@ -3,27 +3,12 @@
 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")
+if(CMAKE_SYSTEM_NAME STREQUAL "iOS")
   set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO")
   set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "NO")
-endif(TEST_IOS)
-
-if(TEST_WATCHOS)
-  set(CMAKE_OSX_SYSROOT watchos)
-  set(CMAKE_OSX_ARCHITECTURES "armv7k")
-  set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO")
-  set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "")
-  set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "YES")
 endif()
 
-if(TEST_TVOS)
-  set(CMAKE_OSX_SYSROOT appletvos)
-  set(CMAKE_OSX_ARCHITECTURES "arm64")
+if(CMAKE_SYSTEM_NAME STREQUAL "tvOS" OR CMAKE_SYSTEM_NAME STREQUAL "watchOS")
   set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO")
   set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "")
   set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "YES")
@@ -41,7 +26,7 @@ add_dependencies(AppBundleTest AppBundle)
 
 # with custom extension
 
-if (NOT TEST_IOS AND NOT TEST_WATCHOS AND NOT TEST_TVOS)
+if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
   add_executable(AppBundleExt MACOSX_BUNDLE main.m)
   set_target_properties(AppBundleExt PROPERTIES BUNDLE_EXTENSION "foo")
   install(TARGETS AppBundleExt BUNDLE DESTINATION FooExtension)
@@ -55,7 +40,7 @@ endif()
 
 # Shared Framework (not supported for iOS on Xcode < 6)
 
-if(NOT TEST_IOS OR NOT XCODE_VERSION VERSION_LESS 6)
+if(NOT CMAKE_SYSTEM_NAME STREQUAL "iOS" OR NOT XCODE_VERSION VERSION_LESS 6)
   add_library(SharedFramework SHARED main.c)
   set_target_properties(SharedFramework PROPERTIES FRAMEWORK TRUE)
 
diff --git a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined.cmake b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined.cmake
index d7f3920..7f31d94 100644
--- a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined.cmake
+++ b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined.cmake
@@ -2,10 +2,10 @@ 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)
+if(XCODE_VERSION VERSION_GREATER_EQUAL 9)
+  set(CMAKE_OSX_DEPLOYMENT_TARGET 10)
+endif()
 
-set(CMAKE_OSX_SYSROOT iphoneos)
 set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO")
 set(CMAKE_XCODE_ATTRIBUTE_DEBUG_INFORMATION_FORMAT "dwarf")
 set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "NO")
diff --git a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedPrune.cmake b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedPrune.cmake
index 28ab883..ec11dbb 100644
--- a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedPrune.cmake
+++ b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedPrune.cmake
@@ -2,10 +2,10 @@ 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)
+if(XCODE_VERSION VERSION_GREATER_EQUAL 9)
+  set(CMAKE_OSX_DEPLOYMENT_TARGET 10)
+endif()
 
-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 5e7961a..58e96b4 100644
--- a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch.cmake
+++ b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch.cmake
@@ -2,10 +2,10 @@ 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)
+if(XCODE_VERSION VERSION_GREATER_EQUAL 9)
+  set(CMAKE_OSX_DEPLOYMENT_TARGET 10)
+endif()
 
-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/XcodeInstallIOS.cmake b/Tests/RunCMake/XcodeProject/XcodeInstallIOS.cmake
index a797410..ab31387 100644
--- a/Tests/RunCMake/XcodeProject/XcodeInstallIOS.cmake
+++ b/Tests/RunCMake/XcodeProject/XcodeInstallIOS.cmake
@@ -2,11 +2,8 @@ cmake_minimum_required(VERSION 2.8.5)
 
 project(XcodeInstallIOS)
 
-set(CMAKE_OSX_SYSROOT iphoneos)
 set(XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO")
 set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "NO")
 
-set(CMAKE_OSX_ARCHITECTURES "armv7;i386")
-
 add_library(foo STATIC foo.cpp)
 install(TARGETS foo ARCHIVE DESTINATION lib)

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=36cf44a7a3a8931c97790db6df61439d4dd86ea3
commit 36cf44a7a3a8931c97790db6df61439d4dd86ea3
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Mon Feb 4 08:58:56 2019 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Mon Feb 4 09:02:47 2019 -0500

    Tests: Isolate RunCMake.XcodeProject per-device cases from host arch
    
    Run all host cases before per-device cases.  Do not expose the host
    `CMAKE_OSX_ARCHITECTURES` environment value to the per-device tests.

diff --git a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake
index fb04005..6ea0c0c 100644
--- a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake
+++ b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake
@@ -25,6 +25,40 @@ run_cmake(PerConfigPerSourceOptions)
 run_cmake(PerConfigPerSourceDefinitions)
 run_cmake(PerConfigPerSourceIncludeDirs)
 
+function(XcodeSchemaGeneration)
+  set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeSchemaGeneration-build)
+  set(RunCMake_TEST_NO_CLEAN 1)
+  set(RunCMake_TEST_OPTIONS "-DCMAKE_XCODE_GENERATE_SCHEME=ON")
+
+  file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
+  file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
+
+  run_cmake(XcodeSchemaGeneration)
+  run_cmake_command(XcodeSchemaGeneration-build xcodebuild -scheme foo build)
+endfunction()
+
+if(NOT XCODE_VERSION VERSION_LESS 7)
+  XcodeSchemaGeneration()
+  run_cmake(XcodeSchemaProperty)
+endif()
+
+function(XcodeDependOnZeroCheck)
+  set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeDependOnZeroCheck-build)
+  set(RunCMake_TEST_NO_CLEAN 1)
+
+  file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
+  file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
+
+  run_cmake(XcodeDependOnZeroCheck)
+  run_cmake_command(XcodeDependOnZeroCheck-build ${CMAKE_COMMAND} --build . --target parentdirlib)
+  run_cmake_command(XcodeDependOnZeroCheck-build ${CMAKE_COMMAND} --build . --target subdirlib)
+endfunction()
+
+XcodeDependOnZeroCheck()
+
+# Isolate device tests from host architecture selection.
+unset(ENV{CMAKE_OSX_ARCHITECTURES})
+
 # Use a single build tree for a few tests without cleaning.
 
 if(NOT XCODE_VERSION VERSION_LESS 5)
@@ -205,23 +239,6 @@ if(NOT XCODE_VERSION VERSION_LESS 5)
   unset(RunCMake_TEST_OPTIONS)
 endif()
 
-function(XcodeSchemaGeneration)
-  set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeSchemaGeneration-build)
-  set(RunCMake_TEST_NO_CLEAN 1)
-  set(RunCMake_TEST_OPTIONS "-DCMAKE_XCODE_GENERATE_SCHEME=ON")
-
-  file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
-  file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
-
-  run_cmake(XcodeSchemaGeneration)
-  run_cmake_command(XcodeSchemaGeneration-build xcodebuild -scheme foo build)
-endfunction()
-
-if(NOT XCODE_VERSION VERSION_LESS 7)
-  XcodeSchemaGeneration()
-  run_cmake(XcodeSchemaProperty)
-endif()
-
 if(XCODE_VERSION VERSION_GREATER_EQUAL 8)
   function(deploymeny_target_test SDK)
     set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/DeploymentTarget-${SDK}-build)
@@ -240,16 +257,4 @@ if(XCODE_VERSION VERSION_GREATER_EQUAL 8)
   endforeach()
 endif()
 
-function(XcodeDependOnZeroCheck)
-  set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeDependOnZeroCheck-build)
-  set(RunCMake_TEST_NO_CLEAN 1)
-
-  file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
-  file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
-
-  run_cmake(XcodeDependOnZeroCheck)
-  run_cmake_command(XcodeDependOnZeroCheck-build ${CMAKE_COMMAND} --build . --target parentdirlib)
-  run_cmake_command(XcodeDependOnZeroCheck-build ${CMAKE_COMMAND} --build . --target subdirlib)
-endfunction()
-
-XcodeDependOnZeroCheck()
+# Please add macOS-only tests above before the device-specific tests.

-----------------------------------------------------------------------

Summary of changes:
 Help/manual/cmake-toolchains.7.rst                 |  71 +++++++++++++
 Help/release/dev/iphone-friendly-cmake.rst         |   5 +
 Modules/CMakeDetermineCCompiler.cmake              |   2 +-
 Modules/CMakeDetermineCXXCompiler.cmake            |   2 +-
 Modules/CMakeDetermineCompilerId.cmake             |  17 +---
 Modules/CMakeTestCCompiler.cmake                   |   8 ++
 Modules/CMakeTestCXXCompiler.cmake                 |   8 ++
 Modules/CompilerId/Xcode-3.pbxproj.in              |   3 +-
 Modules/Platform/Darwin-Initialize.cmake           |   8 +-
 Modules/Platform/Darwin.cmake                      |   8 ++
 Modules/Platform/iOS-Determine-CXX.cmake           |   1 +
 Modules/Platform/iOS-Initialize.cmake              |   7 ++
 Modules/Platform/iOS.cmake                         |   1 +
 Modules/Platform/tvOS-Determine-CXX.cmake          |   1 +
 Modules/Platform/tvOS-Initialize.cmake             |   7 ++
 Modules/Platform/tvOS.cmake                        |   1 +
 Modules/Platform/watchOS-Determine-CXX.cmake       |   1 +
 Modules/Platform/watchOS-Initialize.cmake          |   7 ++
 Modules/Platform/watchOS.cmake                     |   1 +
 Source/cmGlobalVisualStudioGenerator.cxx           |  31 +++---
 Tests/Fortran/CMakeLists.txt                       |   5 +
 Tests/RunCMake/XcodeProject/DeploymentTarget.cmake |  13 +--
 Tests/RunCMake/XcodeProject/RunCMakeTest.cmake     | 110 +++++++++++----------
 Tests/RunCMake/XcodeProject/XcodeBundles.cmake     |  23 +----
 .../XcodeProject/XcodeIOSInstallCombined.cmake     |   6 +-
 .../XcodeIOSInstallCombinedPrune.cmake             |   6 +-
 .../XcodeIOSInstallCombinedSingleArch.cmake        |   6 +-
 Tests/RunCMake/XcodeProject/XcodeInstallIOS.cmake  |   3 -
 28 files changed, 232 insertions(+), 130 deletions(-)
 create mode 100644 Help/release/dev/iphone-friendly-cmake.rst
 create mode 100644 Modules/Platform/iOS-Determine-CXX.cmake
 create mode 100644 Modules/Platform/iOS-Initialize.cmake
 create mode 100644 Modules/Platform/iOS.cmake
 create mode 100644 Modules/Platform/tvOS-Determine-CXX.cmake
 create mode 100644 Modules/Platform/tvOS-Initialize.cmake
 create mode 100644 Modules/Platform/tvOS.cmake
 create mode 100644 Modules/Platform/watchOS-Determine-CXX.cmake
 create mode 100644 Modules/Platform/watchOS-Initialize.cmake
 create mode 100644 Modules/Platform/watchOS.cmake


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list