diff options
author | Craig Scott <craig.scott@crascit.com> | 2021-02-08 06:30:48 (GMT) |
---|---|---|
committer | Craig Scott <craig.scott@crascit.com> | 2021-02-08 07:02:46 (GMT) |
commit | 0110aa018d81a7b0f1f9371fcd038b71fefae554 (patch) | |
tree | b6232f4855654052c2eba15f663154ec19dc2b55 /Modules/CMakeIOSInstallCombined.cmake | |
parent | f0257a87a3c282e2ea0c0a06556d4fedeb4cfe95 (diff) | |
download | CMake-0110aa018d81a7b0f1f9371fcd038b71fefae554.zip CMake-0110aa018d81a7b0f1f9371fcd038b71fefae554.tar.gz CMake-0110aa018d81a7b0f1f9371fcd038b71fefae554.tar.bz2 |
IOS_INSTALL_COMBINED: Support Xcode 12 (command line only)
Xcode 12 doesn't allow nested builds within the same build directory.
That means we can no longer do an install by building the install target
when IOS_INSTALL_COMBINED is true. We can, however, still do an install
by running the cmake_install.cmake script or executing cmake --install,
since there is no outer build and therefore the associated SDK can be
built as a sub-build.
The non-build methods previously didn't work when
IOS_INSTALL_COMBINED was true because the generated install script
and the CMakeIOSInstallCombined script both made certain assumptions
that relied on being part of a build. Those assumptions are now
removed. A side-effect of this work is that cpack now also works from the
command line when IOS_INSTALL_COMBINED is true.
Relates: #21282
Fixes: #20023
Diffstat (limited to 'Modules/CMakeIOSInstallCombined.cmake')
-rw-r--r-- | Modules/CMakeIOSInstallCombined.cmake | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/Modules/CMakeIOSInstallCombined.cmake b/Modules/CMakeIOSInstallCombined.cmake index 44bb622..b022217 100644 --- a/Modules/CMakeIOSInstallCombined.cmake +++ b/Modules/CMakeIOSInstallCombined.cmake @@ -3,10 +3,11 @@ cmake_policy(PUSH) cmake_policy(SET CMP0057 NEW) # if IN_LIST +cmake_policy(SET CMP0054 NEW) # Function to print messages of this module function(_ios_install_combined_message) - message("[iOS combined] " ${ARGN}) + message(STATUS "[iOS combined] " ${ARGN}) endfunction() # Get build settings for the current target/config/SDK by running @@ -176,29 +177,33 @@ function(_ios_install_combined_keep_archs lib archs) endforeach() endfunction() -function(_ios_install_combined_detect_sdks this_sdk_var corr_sdk_var) - set(this_sdk "$ENV{PLATFORM_NAME}") - if("${this_sdk}" STREQUAL "") - message(FATAL_ERROR "Environment variable PLATFORM_NAME is empty") +function(_ios_install_combined_detect_associated_sdk corr_sdk_var) + if("${PLATFORM_NAME}" STREQUAL "") + message(FATAL_ERROR "PLATFORM_NAME should not be empty") endif() set(all_platforms "$ENV{SUPPORTED_PLATFORMS}") - if("${all_platforms}" STREQUAL "") - message(FATAL_ERROR "Environment variable SUPPORTED_PLATFORMS is empty") + if("${SUPPORTED_PLATFORMS}" STREQUAL "") + _ios_install_combined_get_build_setting( + ${PLATFORM_NAME} SUPPORTED_PLATFORMS all_platforms) + if("${all_platforms}" STREQUAL "") + message(FATAL_ERROR + "SUPPORTED_PLATFORMS not set as an environment variable nor " + "able to be determined from project") + endif() endif() separate_arguments(all_platforms) - if(NOT this_sdk IN_LIST all_platforms) - message(FATAL_ERROR "`${this_sdk}` not found in `${all_platforms}`") + if(NOT PLATFORM_NAME IN_LIST all_platforms) + message(FATAL_ERROR "`${PLATFORM_NAME}` not found in `${all_platforms}`") endif() - list(REMOVE_ITEM all_platforms "" "${this_sdk}") + list(REMOVE_ITEM all_platforms "" "${PLATFORM_NAME}") list(LENGTH all_platforms all_platforms_length) if(NOT all_platforms_length EQUAL 1) message(FATAL_ERROR "Expected one element: ${all_platforms}") endif() - set(${this_sdk_var} "${this_sdk}" PARENT_SCOPE) set(${corr_sdk_var} "${all_platforms}" PARENT_SCOPE) endfunction() @@ -274,10 +279,10 @@ function(ios_install_combined target destination) _ios_install_combined_message("Destination: ${destination}") # Get SDKs - _ios_install_combined_detect_sdks(this_sdk corr_sdk) + _ios_install_combined_detect_associated_sdk(corr_sdk) # Get architectures of the target - _ios_install_combined_get_valid_archs("${this_sdk}" this_valid_archs) + _ios_install_combined_get_valid_archs("${PLATFORM_NAME}" 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) |