Generated apple platform and architecture selection files must not raise fatal errors
CMake 3.29 is adding new generate_apple_platform_selection_file()
and generate_apple_architecture_selection_file()
commands to the CMakePackageConfigHelpers
module. Both of these commands are aimed at creating files that would be used as part of a <package>-config.cmake
file. Both commands generate files that can raise fatal errors, but that shouldn't be done from any <package>-config.cmake
file if the error relates to something that package expects to be available or set, but isn't. What should happen is that the package sets ${CMAKE_FIND_PACKAGE_NAME}_FOUND
to false, ${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE
to an appropriate error message, and then it returns to the caller. The find_package()
implementation should be able to move on to trying other locations and looking for other package config files.
The ApplePlatformSelection.cmake.in
template will raise a fatal error if it encounters a CMAKE_SYSTEM_NAME
it doesn't recognise. If Apple release a new platform in the future, and a project tries to build for it, the mere presence of a package generated with CMake 3.29 would cause that project's configure to fail, even if there was a newer package available somewhere which did understand the new platform.
The AppleArchitectureSelection.cmake.in
template will raise a fatal error if CMAKE_OSX_ARCHITECTURES
is not set, or if it is not one of the architectures listed in the SINGLE_ARCHITECTURES
argument given to generate_apple_architecture_selection_file()
. This has the same problem as for the platform above. If Apple comes out with a new architecture, the mere presence of a package generated with CMake 3.29 would again prevent a project that targets the new architecture from configuring.