diff options
author | Brad King <brad.king@kitware.com> | 2019-02-05 12:30:19 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2019-02-05 12:33:04 (GMT) |
commit | c03072f2f7a08c6ddf0cec58dfc8ea2b83f4c1a9 (patch) | |
tree | afb2c6960e306ed36217f0cc6a1f7cad15d9ed3d /Modules | |
parent | 25e616862dac08aae7c4a3ad01839acfe7342ec7 (diff) | |
parent | e8ee8cab97bdb084d4555ee3e76eb33303e3bc85 (diff) | |
download | CMake-c03072f2f7a08c6ddf0cec58dfc8ea2b83f4c1a9.zip CMake-c03072f2f7a08c6ddf0cec58dfc8ea2b83f4c1a9.tar.gz CMake-c03072f2f7a08c6ddf0cec58dfc8ea2b83f4c1a9.tar.bz2 |
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@kitware.com>
Merge-request: !2392
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/CMakeDetermineCCompiler.cmake | 2 | ||||
-rw-r--r-- | Modules/CMakeDetermineCXXCompiler.cmake | 2 | ||||
-rw-r--r-- | Modules/CMakeDetermineCompilerId.cmake | 17 | ||||
-rw-r--r-- | Modules/CMakeTestCCompiler.cmake | 8 | ||||
-rw-r--r-- | Modules/CMakeTestCXXCompiler.cmake | 8 | ||||
-rw-r--r-- | Modules/CompilerId/Xcode-3.pbxproj.in | 3 | ||||
-rw-r--r-- | Modules/Platform/Darwin-Initialize.cmake | 8 | ||||
-rw-r--r-- | Modules/Platform/Darwin.cmake | 8 | ||||
-rw-r--r-- | Modules/Platform/iOS-Determine-CXX.cmake | 1 | ||||
-rw-r--r-- | Modules/Platform/iOS-Initialize.cmake | 7 | ||||
-rw-r--r-- | Modules/Platform/iOS.cmake | 1 | ||||
-rw-r--r-- | Modules/Platform/tvOS-Determine-CXX.cmake | 1 | ||||
-rw-r--r-- | Modules/Platform/tvOS-Initialize.cmake | 7 | ||||
-rw-r--r-- | Modules/Platform/tvOS.cmake | 1 | ||||
-rw-r--r-- | Modules/Platform/watchOS-Determine-CXX.cmake | 1 | ||||
-rw-r--r-- | Modules/Platform/watchOS-Initialize.cmake | 7 | ||||
-rw-r--r-- | Modules/Platform/watchOS.cmake | 1 |
17 files changed, 66 insertions, 17 deletions
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 cdbaea6..2f84c8e 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -354,22 +354,12 @@ 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 "") 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 "") - endif() configure_file(${CMAKE_ROOT}/Modules/CompilerId/Xcode-3.pbxproj.in ${id_dir}/CompilerId${lang}.xcodeproj/project.pbxproj @ONLY) unset(_ENV_MACOSX_DEPLOYMENT_TARGET) @@ -493,6 +483,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/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@id_lang@; }; name = Debug; 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) |