summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-08-17 18:52:03 (GMT)
committerKitware Robot <kwrobot@kitware.com>2020-08-17 18:52:08 (GMT)
commit3313bf06eb3e8ca3ca655f85e216368e61ee620d (patch)
tree236b41ebffce424796d63ebceb15596dc6754292
parent35d8543f2524d088ccbe7eb4a600f2c65d7f53d7 (diff)
parent5852b8867f77c17ae4c905c4f41db850f8d53d47 (diff)
downloadCMake-3313bf06eb3e8ca3ca655f85e216368e61ee620d.zip
CMake-3313bf06eb3e8ca3ca655f85e216368e61ee620d.tar.gz
CMake-3313bf06eb3e8ca3ca655f85e216368e61ee620d.tar.bz2
Merge topic 'ios-combined-prune-archs'
5852b8867f CMakeIOSInstallCombined: Enforce disjoint architecture sets 79098d23eb Tests: Avoid warnings about unused arguments Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !5111
-rw-r--r--Help/prop_tgt/IOS_INSTALL_COMBINED.rst6
-rw-r--r--Modules/CMakeIOSInstallCombined.cmake14
-rw-r--r--Tests/RunCMake/XcodeProject/main.cpp2
-rw-r--r--Tests/RunCMake/XcodeProject/main.m2
4 files changed, 21 insertions, 3 deletions
diff --git a/Help/prop_tgt/IOS_INSTALL_COMBINED.rst b/Help/prop_tgt/IOS_INSTALL_COMBINED.rst
index 23a86e6..92d60dc 100644
--- a/Help/prop_tgt/IOS_INSTALL_COMBINED.rst
+++ b/Help/prop_tgt/IOS_INSTALL_COMBINED.rst
@@ -10,4 +10,10 @@ either be built with the device SDK or the simulator SDK depending on the SDK
set. But if this property is set to true then the target will at install time
also be built for the corresponding SDK and combined into one library.
+.. note::
+
+ If a selected architecture is available for both: device SDK and simulator
+ SDK it will be built for the SDK selected by :variable:`CMAKE_OSX_SYSROOT`
+ and removed from the corresponding SDK.
+
This feature requires at least Xcode version 6.
diff --git a/Modules/CMakeIOSInstallCombined.cmake b/Modules/CMakeIOSInstallCombined.cmake
index 418bafd..44bb622 100644
--- a/Modules/CMakeIOSInstallCombined.cmake
+++ b/Modules/CMakeIOSInstallCombined.cmake
@@ -80,6 +80,17 @@ function(_ios_install_combined_get_valid_archs sdk resultvar)
cmake_policy(POP)
endfunction()
+# Make both arch lists a disjoint set by preferring the current SDK
+# (starting with Xcode 12 arm64 is available as device and simulator arch on iOS)
+function(_ios_install_combined_prune_common_archs corr_sdk corr_archs_var this_archs_var)
+ list(REMOVE_ITEM ${corr_archs_var} ${${this_archs_var}})
+
+ string(REPLACE ";" " " printable "${${corr_archs_var}}")
+ _ios_install_combined_message("Architectures (${corr_sdk}) after pruning: ${printable}")
+
+ set("${corr_archs_var}" "${${corr_archs_var}}" PARENT_SCOPE)
+endfunction()
+
# Final target can contain more architectures that specified by SDK. This
# function will run 'lipo -info' and parse output. Result will be returned
# as a CMake list.
@@ -266,8 +277,9 @@ function(ios_install_combined target destination)
_ios_install_combined_detect_sdks(this_sdk corr_sdk)
# Get architectures of the target
- _ios_install_combined_get_valid_archs("${corr_sdk}" corr_valid_archs)
_ios_install_combined_get_valid_archs("${this_sdk}" this_valid_archs)
+ _ios_install_combined_get_valid_archs("${corr_sdk}" corr_valid_archs)
+ _ios_install_combined_prune_common_archs("${corr_sdk}" corr_valid_archs this_valid_archs)
# Return if there are no valid architectures for the SDK.
# (note that library already installed)
diff --git a/Tests/RunCMake/XcodeProject/main.cpp b/Tests/RunCMake/XcodeProject/main.cpp
index c94753f..f8b643a 100644
--- a/Tests/RunCMake/XcodeProject/main.cpp
+++ b/Tests/RunCMake/XcodeProject/main.cpp
@@ -1,4 +1,4 @@
-int main(int argc, const char* argv[])
+int main()
{
return 0;
}
diff --git a/Tests/RunCMake/XcodeProject/main.m b/Tests/RunCMake/XcodeProject/main.m
index 6dc190a..3e70e50 100644
--- a/Tests/RunCMake/XcodeProject/main.m
+++ b/Tests/RunCMake/XcodeProject/main.m
@@ -1,3 +1,3 @@
-int main(int argc, const char * argv[]) {
+int main(void) {
return 1;
}