From 2149dbd379896fd1c80700fefecc2b812a267b41 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 18 Mar 2024 12:51:00 -0400 Subject: generate_apple_architecture_selection_file: Document $(ARCHS_STANDARD) support Also add a test case. Fixes: #25780 --- Modules/CMakePackageConfigHelpers.cmake | 4 ++++ Tests/RunCMake/CMakePackage/RunCMakeTest.cmake | 3 +++ Tests/RunCMake/CMakePackage/apple-export-ios-simulator-common.cmake | 2 +- .../RunCMake/CMakePackage/apple-import-ios-simulator-xcode-stdout.txt | 1 + Tests/RunCMake/CMakePackage/apple-import-ios-simulator-xcode.cmake | 1 + 5 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 Tests/RunCMake/CMakePackage/apple-import-ios-simulator-xcode-stdout.txt create mode 100644 Tests/RunCMake/CMakePackage/apple-import-ios-simulator-xcode.cmake diff --git a/Modules/CMakePackageConfigHelpers.cmake b/Modules/CMakePackageConfigHelpers.cmake index 59d604a..0c04608 100644 --- a/Modules/CMakePackageConfigHelpers.cmake +++ b/Modules/CMakePackageConfigHelpers.cmake @@ -304,6 +304,10 @@ Generating an Apple Platform Selection File ``UNIVERSAL_ARCHITECTURES ...`` Architectures provided by the ``UNIVERSAL_INCLUDE_FILE``. + The list may include ``$(ARCHS_STANDARD)`` to support consumption using + the :generator:`Xcode` generator, but the architectures should always + be listed individually too. + ``UNIVERSAL_INCLUDE_FILE `` A file to load when :variable:`CMAKE_OSX_ARCHITECTURES` contains a (non-strict) subset of the ``UNIVERSAL_ARCHITECTURES`` and diff --git a/Tests/RunCMake/CMakePackage/RunCMakeTest.cmake b/Tests/RunCMake/CMakePackage/RunCMakeTest.cmake index 7d9d42a..ccf0a86 100644 --- a/Tests/RunCMake/CMakePackage/RunCMakeTest.cmake +++ b/Tests/RunCMake/CMakePackage/RunCMakeTest.cmake @@ -102,6 +102,9 @@ if(APPLE AND CMAKE_C_COMPILER_ID STREQUAL "AppleClang") endif() apple_import(watchos watchOS "${watch_archs}" watchos) apple_import(ios-simulator iOS "${macos_archs}" iphonesimulator) + if(RunCMake_GENERATOR STREQUAL "Xcode") + apple_import(ios-simulator-xcode iOS "$(ARCHS_STANDARD)" iphonesimulator) + endif() if(select_archs) foreach(arch IN LISTS macos_archs) apple_import(ios-simulator-${arch} iOS "${arch}" iphonesimulator) diff --git a/Tests/RunCMake/CMakePackage/apple-export-ios-simulator-common.cmake b/Tests/RunCMake/CMakePackage/apple-export-ios-simulator-common.cmake index ab66407..c935c3a 100644 --- a/Tests/RunCMake/CMakePackage/apple-export-ios-simulator-common.cmake +++ b/Tests/RunCMake/CMakePackage/apple-export-ios-simulator-common.cmake @@ -9,7 +9,7 @@ if(IOS_SIMULATOR_SELECT_ARCHS) INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX} SINGLE_ARCHITECTURES ${IOS_SIMULATOR_SELECT_ARCHS} SINGLE_ARCHITECTURE_INCLUDE_FILES ${IOS_SIMULATOR_SELECT_FILES} - UNIVERSAL_ARCHITECTURES ${IOS_SIMULATOR_SELECT_ARCHS} + UNIVERSAL_ARCHITECTURES ${IOS_SIMULATOR_SELECT_ARCHS} $(ARCHS_STANDARD) UNIVERSAL_INCLUDE_FILE "lib/ios-simulator/cmake/mylib/mylib-targets.cmake" ) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/mylib-select-arch-install.cmake DESTINATION lib/ios-simulator/cmake/mylib RENAME mylib-select-arch.cmake) diff --git a/Tests/RunCMake/CMakePackage/apple-import-ios-simulator-xcode-stdout.txt b/Tests/RunCMake/CMakePackage/apple-import-ios-simulator-xcode-stdout.txt new file mode 100644 index 0000000..4ca925d --- /dev/null +++ b/Tests/RunCMake/CMakePackage/apple-import-ios-simulator-xcode-stdout.txt @@ -0,0 +1 @@ +loaded: '[^']*/Tests/RunCMake/CMakePackage/apple-install/lib/ios-simulator/cmake/mylib/mylib-targets.cmake' diff --git a/Tests/RunCMake/CMakePackage/apple-import-ios-simulator-xcode.cmake b/Tests/RunCMake/CMakePackage/apple-import-ios-simulator-xcode.cmake new file mode 100644 index 0000000..90624a0 --- /dev/null +++ b/Tests/RunCMake/CMakePackage/apple-import-ios-simulator-xcode.cmake @@ -0,0 +1 @@ +include(apple-import-ios-simulator.cmake) -- cgit v0.12