diff options
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/CMakePackageConfigHelpers.cmake | 94 | ||||
-rw-r--r-- | Modules/GoogleTestAddTests.cmake | 1 | ||||
-rw-r--r-- | Modules/Internal/ApplePlatformSelection.cmake.in (renamed from Modules/Internal/PlatformSelectionFile.cmake.in) | 0 | ||||
-rw-r--r-- | Modules/UsePkgConfig.cmake | 9 |
4 files changed, 55 insertions, 49 deletions
diff --git a/Modules/CMakePackageConfigHelpers.cmake b/Modules/CMakePackageConfigHelpers.cmake index ab38820..407acff 100644 --- a/Modules/CMakePackageConfigHelpers.cmake +++ b/Modules/CMakePackageConfigHelpers.cmake @@ -193,64 +193,66 @@ point to create more sophisticated custom ``ConfigVersion.cmake`` files. Generating an Apple Platform Selection File ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -.. versionadded:: 3.29 - .. command:: generate_apple_platform_selection_file - Create an Apple platform selection file: + .. versionadded:: 3.29 - generate_apple_platform_selection_file(<filename> - INSTALL_DESTINATION <path> - [MACOS_CONFIG_FILE <file>] - [IOS_CONFIG_FILE <file>] - [IOS_SIMULATOR_CONFIG_FILE <file>] - [TVOS_CONFIG_FILE <file>] - [TVOS_SIMULATOR_CONFIG_FILE <file>] - [WATCHOS_CONFIG_FILE <file>] - [WATCHOS_SIMULATOR_CONFIG_FILE <file>] - [VISIONOS_CONFIG_FILE <file>] - [VISIONOS_SIMULATOR_CONFIG_FILE <file>] - ) + Create an Apple platform selection file: + + .. code-block:: cmake -Writes a file for use as ``<PackageName>Config.cmake`` which can include an -Apple-platform-specific ``<PackageName>Config.cmake`` from a different -directory. This can be used in conjunction with the ``XCFRAMEWORK_LOCATION`` -argument of :command:`export(SETUP)` to export packages in a way that a project -built for any Apple platform can use them. + generate_apple_platform_selection_file(<filename> + INSTALL_DESTINATION <path> + [MACOS_CONFIG_FILE <file>] + [IOS_CONFIG_FILE <file>] + [IOS_SIMULATOR_CONFIG_FILE <file>] + [TVOS_CONFIG_FILE <file>] + [TVOS_SIMULATOR_CONFIG_FILE <file>] + [WATCHOS_CONFIG_FILE <file>] + [WATCHOS_SIMULATOR_CONFIG_FILE <file>] + [VISIONOS_CONFIG_FILE <file>] + [VISIONOS_SIMULATOR_CONFIG_FILE <file>] + ) -``INSTALL_DESTINATION <path>`` - Path that the file will be installed to. + Writes a file for use as ``<PackageName>Config.cmake`` which can include an + Apple-platform-specific ``<PackageName>Config.cmake`` from a different + directory. This can be used in conjunction with the ``XCFRAMEWORK_LOCATION`` + argument of :command:`export(SETUP)` to export packages in a way that a project + built for any Apple platform can use them. -``MACOS_CONFIG_FILE <file>`` - File to include if the platform is macOS. + ``INSTALL_DESTINATION <path>`` + Path that the file will be installed to. -``IOS_CONFIG_FILE <file>`` - File to include if the platform is iOS. + ``MACOS_CONFIG_FILE <file>`` + File to include if the platform is macOS. -``IOS_SIMULATOR_CONFIG_FILE <file>`` - File to include if the platform is iOS Simulator. + ``IOS_CONFIG_FILE <file>`` + File to include if the platform is iOS. -``TVOS_CONFIG_FILE <file>`` - File to include if the platform is tvOS. + ``IOS_SIMULATOR_CONFIG_FILE <file>`` + File to include if the platform is iOS Simulator. -``TVOS_SIMULATOR_CONFIG_FILE <file>`` - File to include if the platform is tvOS Simulator. + ``TVOS_CONFIG_FILE <file>`` + File to include if the platform is tvOS. -``WATCHOS_CONFIG_FILE <file>`` - File to include if the platform is watchOS. + ``TVOS_SIMULATOR_CONFIG_FILE <file>`` + File to include if the platform is tvOS Simulator. -``WATCHOS_SIMULATOR_CONFIG_FILE <file>`` - File to include if the platform is watchOS Simulator. + ``WATCHOS_CONFIG_FILE <file>`` + File to include if the platform is watchOS. -``VISIONOS_CONFIG_FILE <file>`` - File to include if the platform is visionOS. + ``WATCHOS_SIMULATOR_CONFIG_FILE <file>`` + File to include if the platform is watchOS Simulator. -``VISIONOS_SIMULATOR_CONFIG_FILE <file>`` - File to include if the platform is visionOS Simulator. + ``VISIONOS_CONFIG_FILE <file>`` + File to include if the platform is visionOS. -If any of the optional config files are not specified, and the consuming -project is built for their corresponding platform, an error will be thrown -when including the generated file. + ``VISIONOS_SIMULATOR_CONFIG_FILE <file>`` + File to include if the platform is visionOS Simulator. + + If any of the optional config files are not specified, and the consuming + project is built for their corresponding platform, an error will be thrown + when including the generated file. Example Generating Package Files ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -428,6 +430,10 @@ function(generate_apple_platform_selection_file _output_file) set(_multi) cmake_parse_arguments(PARSE_ARGV 0 _gpsf "${_options}" "${_single}" "${_multi}") + if(NOT _gpsf_INSTALL_DESTINATION) + message(FATAL_ERROR "No INSTALL_DESTINATION given to generate_apple_platform_selection_file()") + endif() + set(_have_relative 0) foreach(_opt IN LISTS _config_file_options) if(_gpsf_${_opt}) @@ -442,7 +448,7 @@ function(generate_apple_platform_selection_file _output_file) endif() endforeach() - configure_package_config_file("${CMAKE_CURRENT_FUNCTION_LIST_DIR}/Internal/PlatformSelectionFile.cmake.in" "${_output_file}" + configure_package_config_file("${CMAKE_CURRENT_FUNCTION_LIST_DIR}/Internal/ApplePlatformSelection.cmake.in" "${_output_file}" INSTALL_DESTINATION "${_gpsf_INSTALL_DESTINATION}" NO_SET_AND_CHECK_MACRO NO_CHECK_REQUIRED_COMPONENTS_MACRO diff --git a/Modules/GoogleTestAddTests.cmake b/Modules/GoogleTestAddTests.cmake index de0f7d6..eea267d 100644 --- a/Modules/GoogleTestAddTests.cmake +++ b/Modules/GoogleTestAddTests.cmake @@ -112,6 +112,7 @@ function(gtest_discover_tests_impl) message(FATAL_ERROR "Error running test executable.\n" " Path: '${path}'\n" + " Working directory: '${_TEST_WORKING_DIR}'\n" " Result: ${result}\n" " Output:\n" " ${output}\n" diff --git a/Modules/Internal/PlatformSelectionFile.cmake.in b/Modules/Internal/ApplePlatformSelection.cmake.in index 493d650..493d650 100644 --- a/Modules/Internal/PlatformSelectionFile.cmake.in +++ b/Modules/Internal/ApplePlatformSelection.cmake.in diff --git a/Modules/UsePkgConfig.cmake b/Modules/UsePkgConfig.cmake index b020259..fdf632a 100644 --- a/Modules/UsePkgConfig.cmake +++ b/Modules/UsePkgConfig.cmake @@ -41,20 +41,19 @@ macro(PKGCONFIG _package _include_DIR _link_DIR _link_FLAGS _cflags) if(NOT _return_VALUE) execute_process(COMMAND ${PKGCONFIG_EXECUTABLE} ${_package} --variable=includedir - OUTPUT_VARIABLE ${_include_DIR} ) + OUTPUT_VARIABLE ${_include_DIR} OUTPUT_STRIP_TRAILING_WHITESPACE ) string(REGEX REPLACE "[\r\n]" " " ${_include_DIR} "${${_include_DIR}}") - execute_process(COMMAND ${PKGCONFIG_EXECUTABLE} ${_package} --variable=libdir - OUTPUT_VARIABLE ${_link_DIR} ) + OUTPUT_VARIABLE ${_link_DIR} OUTPUT_STRIP_TRAILING_WHITESPACE ) string(REGEX REPLACE "[\r\n]" " " ${_link_DIR} "${${_link_DIR}}") execute_process(COMMAND ${PKGCONFIG_EXECUTABLE} ${_package} --libs - OUTPUT_VARIABLE ${_link_FLAGS} ) + OUTPUT_VARIABLE ${_link_FLAGS} OUTPUT_STRIP_TRAILING_WHITESPACE ) string(REGEX REPLACE "[\r\n]" " " ${_link_FLAGS} "${${_link_FLAGS}}") execute_process(COMMAND ${PKGCONFIG_EXECUTABLE} ${_package} --cflags - OUTPUT_VARIABLE ${_cflags} ) + OUTPUT_VARIABLE ${_cflags} OUTPUT_STRIP_TRAILING_WHITESPACE ) string(REGEX REPLACE "[\r\n]" " " ${_cflags} "${${_cflags}}") else() |