diff options
58 files changed, 724 insertions, 129 deletions
diff --git a/Help/command/export.rst b/Help/command/export.rst index 0440c50..f190df7 100644 --- a/Help/command/export.rst +++ b/Help/command/export.rst @@ -170,6 +170,9 @@ Configuring Exports [ENABLED (<bool-true>|<bool-false>|AUTO)] [EXTRA_ARGS <args>...] ] [...] + [TARGET <target> + [XCFRAMEWORK_LOCATION <location>] + ] [...] ) .. versionadded:: 3.29 @@ -202,3 +205,13 @@ Configure the parameters of an export. The arguments are as follows: ``EXTRA_ARGS <args>`` Specify additional arguments to pass to :command:`find_dependency` after the ``REQUIRED`` argument. + +``TARGET <target>`` + Specify a target to configure in this export. This argument accepts the + following additional arguments: + + ``XCFRAMEWORK_LOCATION`` + Specify the location of an ``.xcframework`` which contains the library from + this target. If specified, the generated code will check to see if the + ``.xcframework`` exists, and if it does, it will use the ``.xcframework`` + as its imported location instead of the installed library. diff --git a/Help/command/file.rst b/Help/command/file.rst index f9d1a79..957b8b5 100644 --- a/Help/command/file.rst +++ b/Help/command/file.rst @@ -32,14 +32,14 @@ Synopsis `Writing`_ file({`WRITE`_ | `APPEND`_} <filename> <content>...) - file({`TOUCH`_ | `TOUCH_NOCREATE`_} [<file>...]) + file({`TOUCH`_ | `TOUCH_NOCREATE`_} <file>...) file(`GENERATE`_ OUTPUT <output-file> [...]) file(`CONFIGURE`_ OUTPUT <output-file> CONTENT <content> [...]) `Filesystem`_ - file({`GLOB`_ | `GLOB_RECURSE`_} <out-var> [...] [<globbing-expr>...]) - file(`MAKE_DIRECTORY`_ [<dir>...]) - file({`REMOVE`_ | `REMOVE_RECURSE`_ } [<files>...]) + file({`GLOB`_ | `GLOB_RECURSE`_} <out-var> [...] <globbing-expr>...) + file(`MAKE_DIRECTORY`_ <directories>...) + file({`REMOVE`_ | `REMOVE_RECURSE`_ } <files>...) file(`RENAME`_ <oldname> <newname> [...]) file(`COPY_FILE`_ <oldname> <newname> [...]) file({`COPY`_ | `INSTALL`_} <file>... DESTINATION <dir> [...]) @@ -80,7 +80,7 @@ Reading (``a`` through ``f``) are in lowercase. .. signature:: - file(STRINGS <filename> <variable> [<options>...]) + file(STRINGS <filename> <variable> <options>...) Parse a list of ASCII strings from ``<filename>`` and store it in ``<variable>``. Binary data in the file are ignored. Carriage return @@ -165,17 +165,17 @@ Reading [RESOLVED_DEPENDENCIES_VAR <deps_var>] [UNRESOLVED_DEPENDENCIES_VAR <unresolved_deps_var>] [CONFLICTING_DEPENDENCIES_PREFIX <conflicting_deps_prefix>] - [EXECUTABLES [<executable_files>...]] - [LIBRARIES [<library_files>...]] - [MODULES [<module_files>...]] - [DIRECTORIES [<directories>...]] + [EXECUTABLES <executable_files>...] + [LIBRARIES <library_files>...] + [MODULES <module_files>...] + [DIRECTORIES <directories>...] [BUNDLE_EXECUTABLE <bundle_executable_file>] - [PRE_INCLUDE_REGEXES [<regexes>...]] - [PRE_EXCLUDE_REGEXES [<regexes>...]] - [POST_INCLUDE_REGEXES [<regexes>...]] - [POST_EXCLUDE_REGEXES [<regexes>...]] - [POST_INCLUDE_FILES [<files>...]] - [POST_EXCLUDE_FILES [<files>...]] + [PRE_INCLUDE_REGEXES <regexes>...] + [PRE_EXCLUDE_REGEXES <regexes>...] + [POST_INCLUDE_REGEXES <regexes>...] + [POST_EXCLUDE_REGEXES <regexes>...] + [POST_INCLUDE_FILES <files>...] + [POST_EXCLUDE_FILES <files>...] ) Please note that this sub-command is not intended to be used in project mode. @@ -210,7 +210,7 @@ Reading of paths that were found for that filename are stored in ``<conflicting_deps_prefix>_<filename>``. - ``EXECUTABLES <executable_files>`` + ``EXECUTABLES <executable_files>...`` List of executable files to read for dependencies. These are executables that are typically created with :command:`add_executable`, but they do not have to be created by CMake. On Apple platforms, the paths to these @@ -218,14 +218,14 @@ Reading resolving the libraries. Specifying any kind of library (``STATIC``, ``MODULE``, or ``SHARED``) here will result in undefined behavior. - ``LIBRARIES <library_files>`` + ``LIBRARIES <library_files>...`` List of library files to read for dependencies. These are libraries that are typically created with :command:`add_library(SHARED)`, but they do not have to be created by CMake. Specifying ``STATIC`` libraries, ``MODULE`` libraries, or executables here will result in undefined behavior. - ``MODULES <module_files>`` + ``MODULES <module_files>...`` List of loadable module files to read for dependencies. These are modules that are typically created with :command:`add_library(MODULE)`, but they do not have to be created by CMake. They are typically used by calling @@ -233,7 +233,7 @@ Reading Specifying ``STATIC`` libraries, ``SHARED`` libraries, or executables here will result in undefined behavior. - ``DIRECTORIES <directories>`` + ``DIRECTORIES <directories>...`` List of additional directories to search for dependencies. On Linux platforms, these directories are searched if the dependency is not found in any of the other usual paths. If it is found in such a directory, a @@ -256,30 +256,30 @@ Reading The following arguments specify filters for including or excluding libraries to be resolved. See below for a full description of how they work. - ``PRE_INCLUDE_REGEXES <regexes>`` + ``PRE_INCLUDE_REGEXES <regexes>...`` List of pre-include regexes through which to filter the names of not-yet-resolved dependencies. - ``PRE_EXCLUDE_REGEXES <regexes>`` + ``PRE_EXCLUDE_REGEXES <regexes>...`` List of pre-exclude regexes through which to filter the names of not-yet-resolved dependencies. - ``POST_INCLUDE_REGEXES <regexes>`` + ``POST_INCLUDE_REGEXES <regexes>...`` List of post-include regexes through which to filter the names of resolved dependencies. - ``POST_EXCLUDE_REGEXES <regexes>`` + ``POST_EXCLUDE_REGEXES <regexes>...`` List of post-exclude regexes through which to filter the names of resolved dependencies. - ``POST_INCLUDE_FILES <files>`` + ``POST_INCLUDE_FILES <files>...`` .. versionadded:: 3.21 List of post-include filenames through which to filter the names of resolved dependencies. Symlinks are resolved when attempting to match these filenames. - ``POST_EXCLUDE_FILES <files>`` + ``POST_EXCLUDE_FILES <files>...`` .. versionadded:: 3.21 List of post-exclude filenames through which to filter the names of @@ -486,8 +486,8 @@ Writing to update the file only when its content changes. .. signature:: - file(TOUCH [<files>...]) - file(TOUCH_NOCREATE [<files>...]) + file(TOUCH <files>...) + file(TOUCH_NOCREATE <files>...) .. versionadded:: 3.12 @@ -638,10 +638,10 @@ Filesystem .. signature:: file(GLOB <variable> [LIST_DIRECTORIES true|false] [RELATIVE <path>] [CONFIGURE_DEPENDS] - [<globbing-expressions>...]) + <globbing-expressions>...) file(GLOB_RECURSE <variable> [FOLLOW_SYMLINKS] [LIST_DIRECTORIES true|false] [RELATIVE <path>] [CONFIGURE_DEPENDS] - [<globbing-expressions>...]) + <globbing-expressions>...) Generate a list of files that match the ``<globbing-expressions>`` and store it into the ``<variable>``. Globbing expressions are similar to @@ -703,13 +703,13 @@ Filesystem ============== ====================================================== .. signature:: - file(MAKE_DIRECTORY [<directories>...]) + file(MAKE_DIRECTORY <directories>...) Create the given directories and their parents as needed. .. signature:: - file(REMOVE [<files>...]) - file(REMOVE_RECURSE [<files>...]) + file(REMOVE <files>...) + file(REMOVE_RECURSE <files>...) Remove the given files. The ``REMOVE_RECURSE`` mode will remove the given files and directories, including non-empty directories. No error is emitted @@ -1012,8 +1012,8 @@ Transfer ^^^^^^^^ .. signature:: - file(DOWNLOAD <url> [<file>] [<options>...]) - file(UPLOAD <file> <url> [<options>...]) + file(DOWNLOAD <url> [<file>] <options>...) + file(UPLOAD <file> <url> <options>...) The ``DOWNLOAD`` subcommand downloads the given ``<url>`` to a local ``<file>``. The ``UPLOAD`` mode uploads a local ``<file>`` to a given diff --git a/Help/release/3.27.rst b/Help/release/3.27.rst index 2ba0c7d..8a67ebc 100644 --- a/Help/release/3.27.rst +++ b/Help/release/3.27.rst @@ -285,8 +285,8 @@ Changes made since CMake 3.27.0 include the following. to select the Windows 8.1 SDK. In CMake 3.27.[0-1] the ``version=`` field was limited to selecting Windows 10 SDKs. -3.27.3, 3.27.4, 3.27.5, 3.27.6, 3.27.7 --------------------------------------- +3.27.3, 3.27.4, 3.27.5, 3.27.6, 3.27.7, 3.27.8 +---------------------------------------------- * These versions made no changes to documented features or interfaces. Some implementation updates were made to support ecosystem changes diff --git a/Help/release/dev/install-export-xcframework.rst b/Help/release/dev/install-export-xcframework.rst new file mode 100644 index 0000000..513a552 --- /dev/null +++ b/Help/release/dev/install-export-xcframework.rst @@ -0,0 +1,9 @@ +install-export-xcframework +-------------------------- + +* The :command:`export(SETUP)` command gained a new ``XCFRAMEWORK_LOCATION`` + argument, which can be used to specify the location of a ``.xcframework`` + that can be substituted for the installed library. +* The :module:`CMakePackageConfigHelpers` module gained a new + :command:`generate_apple_platform_selection_file` function, which can be + used to generate a file that includes another Apple-platform-specific file. diff --git a/Help/variable/CMAKE_DISABLE_FIND_PACKAGE_PackageName.rst b/Help/variable/CMAKE_DISABLE_FIND_PACKAGE_PackageName.rst index 58818f4..b375b77 100644 --- a/Help/variable/CMAKE_DISABLE_FIND_PACKAGE_PackageName.rst +++ b/Help/variable/CMAKE_DISABLE_FIND_PACKAGE_PackageName.rst @@ -15,4 +15,14 @@ variables which have been stored in the cache will still be there. In that case it is recommended to remove the cache variables for this package from the cache using the cache editor or :option:`cmake -U`. +Note that this variable can lead to inconsistent results within the project. +Consider the case where a dependency is requested via :command:`find_package` +from two different places within the project. If the first call does not +have the ``REQUIRED`` keyword, it will not find the dependency when +``CMAKE_DISABLE_FIND_PACKAGE_<PackageName>`` is set to true for that +dependency. The project will proceed under the assumption that the dependency +isn't available. If the second call elsewhere in the project *does* have the +``REQUIRED`` keyword, it can succeed. Two different parts of the same project +have then seen opposite results for the same dependency. + See also the :variable:`CMAKE_REQUIRE_FIND_PACKAGE_<PackageName>` variable. diff --git a/Help/variable/CMAKE_REQUIRE_FIND_PACKAGE_PackageName.rst b/Help/variable/CMAKE_REQUIRE_FIND_PACKAGE_PackageName.rst index 893f1ae..52bf30a 100644 --- a/Help/variable/CMAKE_REQUIRE_FIND_PACKAGE_PackageName.rst +++ b/Help/variable/CMAKE_REQUIRE_FIND_PACKAGE_PackageName.rst @@ -11,4 +11,35 @@ turned into ``REQUIRED`` by setting the variable This can be used to assert assumptions about build environment and to ensure the build will fail early if they do not hold. +Note that setting this variable to true breaks some commonly used patterns. +Multiple calls to :command:`find_package` are sometimes used to obtain a +different search order to the default. +For example, projects can force checking a known path for a particular +package first before searching any of the other default search paths: + +.. code:: cmake + + find_package(something PATHS /some/local/path NO_DEFAULT_PATH) + find_package(something) + +In the above, the first call looks for the ``something`` package in a specific +directory. If ``CMAKE_REQUIRE_FIND_PACKAGE_something`` is set to true, then +this first call must succeed, otherwise a fatal error occurs. The second call +never gets a chance to provide a fall-back to using the default search +locations. + +A similar pattern is used even by some of CMake's own Find modules to search +for a config package first: + +.. code:: cmake + + find_package(something CONFIG QUIET) + if(NOT something_FOUND) + # Fall back to searching using typical Find module logic... + endif() + +Again, if ``CMAKE_REQUIRE_FIND_PACKAGE_something`` is true, the first call +must succeed. It effectively means a config package must be found for the +dependency, and the Find module logic is never used. + See also the :variable:`CMAKE_DISABLE_FIND_PACKAGE_<PackageName>` variable. diff --git a/Modules/CMakePackageConfigHelpers.cmake b/Modules/CMakePackageConfigHelpers.cmake index 581e65c..dabb635 100644 --- a/Modules/CMakePackageConfigHelpers.cmake +++ b/Modules/CMakePackageConfigHelpers.cmake @@ -190,6 +190,68 @@ Please note that these files are internal to CMake and you should not call :command:`configure_file()` on them yourself, but they can be used as starting 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: + + 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>] + ) + +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. + +``INSTALL_DESTINATION <path>`` + Path that the file will be installed to. + +``MACOS_CONFIG_FILE <file>`` + File to include if the platform is macOS. + +``IOS_CONFIG_FILE <file>`` + File to include if the platform is iOS. + +``IOS_SIMULATOR_CONFIG_FILE <file>`` + File to include if the platform is iOS Simulator. + +``TVOS_CONFIG_FILE <file>`` + File to include if the platform is tvOS. + +``TVOS_SIMULATOR_CONFIG_FILE <file>`` + File to include if the platform is tvOS Simulator. + +``WATCHOS_CONFIG_FILE <file>`` + File to include if the platform is watchOS. + +``WATCHOS_SIMULATOR_CONFIG_FILE <file>`` + File to include if the platform is watchOS Simulator. + +``VISIONOS_CONFIG_FILE <file>`` + File to include if the platform is visionOS. + +``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 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -344,3 +406,45 @@ endmacro() configure_file("${_inputFile}" "${_outputFile}" @ONLY) endfunction() + +function(generate_apple_platform_selection_file _output_file) + set(_config_file_options + MACOS_CONFIG_FILE + IOS_CONFIG_FILE + IOS_SIMULATOR_CONFIG_FILE + TVOS_CONFIG_FILE + TVOS_SIMULATOR_CONFIG_FILE + WATCHOS_CONFIG_FILE + WATCHOS_SIMULATOR_CONFIG_FILE + VISIONOS_CONFIG_FILE + VISIONOS_SIMULATOR_CONFIG_FILE + ) + + set(_options) + set(_single + INSTALL_DESTINATION + ${_config_file_options} + ) + set(_multi) + cmake_parse_arguments(PARSE_ARGV 0 _gpsf "${_options}" "${_single}" "${_multi}") + + set(_have_relative 0) + foreach(_opt IN LISTS _config_file_options) + if(_gpsf_${_opt}) + set(_config_file "${_gpsf_${_opt}}") + if(NOT IS_ABSOLUTE "${_config_file}") + string(PREPEND _config_file [[${PACKAGE_PREFIX_DIR}/]]) + set(_have_relative 1) + endif() + set(_branch_${_opt} "include(\"${_config_file}\")") + else() + set(_branch_${_opt} "message(FATAL_ERROR \"Platform not supported\")") + endif() + endforeach() + + configure_package_config_file("${CMAKE_CURRENT_FUNCTION_LIST_DIR}/PlatformSelectionFile.cmake.in" "${_output_file}" + INSTALL_DESTINATION "${_gpsf_INSTALL_DESTINATION}" + NO_SET_AND_CHECK_MACRO + NO_CHECK_REQUIRED_COMPONENTS_MACRO + ) +endfunction() diff --git a/Modules/FetchContent.cmake b/Modules/FetchContent.cmake index aa7f20a..8663631 100644 --- a/Modules/FetchContent.cmake +++ b/Modules/FetchContent.cmake @@ -195,6 +195,12 @@ Commands still be called if :variable:`FETCHCONTENT_TRY_FIND_PACKAGE_MODE` is set to ``OPT_IN`` or is not set. + It would not normally be appropriate to specify ``REQUIRED`` as one of + the additional arguments after ``FIND_PACKAGE_ARGS``. Doing so would + mean the :command:`find_package` call must succeed, so none of the other + details specified in the ``FetchContent_Declare()`` call would get a + chance to be used as a fall-back. + Everything after the ``FIND_PACKAGE_ARGS`` keyword is appended to the :command:`find_package` call, so all other ``<contentOptions>`` must come before the ``FIND_PACKAGE_ARGS`` keyword. If the @@ -1198,10 +1204,10 @@ function(__FetchContent_declareDetails contentName) set(propertyName "_FetchContent_${contentNameLower}_find_package_args") define_property(GLOBAL PROPERTY ${propertyName}) if(NOT __sawQuietKeyword) - list(INSERT __findPackageArgs 0 QUIET) + string(PREPEND __findPackageArgs "QUIET ") endif() if(CMAKE_FIND_PACKAGE_TARGETS_GLOBAL AND NOT __sawGlobalKeyword) - list(APPEND __findPackageArgs GLOBAL) + string(APPEND __findPackageArgs " GLOBAL") endif() cmake_language(EVAL CODE "set_property(GLOBAL PROPERTY ${propertyName} ${__findPackageArgs})" diff --git a/Modules/PlatformSelectionFile.cmake.in b/Modules/PlatformSelectionFile.cmake.in new file mode 100644 index 0000000..3f80f4b --- /dev/null +++ b/Modules/PlatformSelectionFile.cmake.in @@ -0,0 +1,24 @@ +@PACKAGE_INIT@ + +string(TOLOWER "${CMAKE_OSX_SYSROOT}" _CMAKE_OSX_SYSROOT_LOWER) +if(_CMAKE_OSX_SYSROOT_LOWER MATCHES "(^|/)iphonesimulator") + @_branch_IOS_SIMULATOR_CONFIG_FILE@ +elseif(_CMAKE_OSX_SYSROOT_LOWER MATCHES "(^|/)iphoneos") + @_branch_IOS_CONFIG_FILE@ +elseif(_CMAKE_OSX_SYSROOT_LOWER MATCHES "(^|/)tvsimulator") + @_branch_TVOS_SIMULATOR_CONFIG_FILE@ +elseif(_CMAKE_OSX_SYSROOT_LOWER MATCHES "(^|/)tvos") + @_branch_TVOS_CONFIG_FILE@ +elseif(_CMAKE_OSX_SYSROOT_LOWER MATCHES "(^|/)watchsimulator") + @_branch_WATCHOS_SIMULATOR_CONFIG_FILE@ +elseif(_CMAKE_OSX_SYSROOT_LOWER MATCHES "(^|/)watchos") + @_branch_WATCHOS_CONFIG_FILE@ +elseif(_CMAKE_OSX_SYSROOT_LOWER MATCHES "(^|/)xrsimulator") + @_branch_VISIONOS_SIMULATOR_CONFIG_FILE@ +elseif(_CMAKE_OSX_SYSROOT_LOWER MATCHES "(^|/)xros") + @_branch_VISIONOS_CONFIG_FILE@ +elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin") + @_branch_MACOS_CONFIG_FILE@ +else() + message(FATAL_ERROR "Platform not supported") +endif() diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake index cece973..f264fb6 100644 --- a/Modules/UseSWIG.cmake +++ b/Modules/UseSWIG.cmake @@ -657,7 +657,7 @@ function(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile) if(NOT ("-dllimport" IN_LIST swig_source_file_flags OR "-dllimport" IN_LIST SWIG_MODULE_${name}_EXTRA_FLAGS)) # This makes sure that the name used in the generated DllImport # matches the library name created by CMake - list (APPEND SWIG_MODULE_${name}_EXTRA_FLAGS "-dllimport" "$<TARGET_FILE_PREFIX:${target_name}>$<TARGET_FILE_BASE_NAME:${target_name}>") + list (APPEND SWIG_MODULE_${name}_EXTRA_FLAGS "-dllimport" "$<TARGET_FILE_BASE_NAME:${target_name}>") endif() endif() if (SWIG_MODULE_${name}_LANGUAGE STREQUAL "PYTHON" AND NOT SWIG_MODULE_${name}_NOPROXY) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index a5b75e0..aa65ea7 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 28) -set(CMake_VERSION_PATCH 20231114) +set(CMake_VERSION_PATCH 20231117) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx index b13576a..a29dd76 100644 --- a/Source/cmCommonTargetGenerator.cxx +++ b/Source/cmCommonTargetGenerator.cxx @@ -171,9 +171,8 @@ std::vector<std::string> cmCommonTargetGenerator::GetLinkedTargetDirectories( cmGlobalCommonGenerator* const gg = this->GlobalCommonGenerator; if (cmComputeLinkInformation* cli = this->GeneratorTarget->GetLinkInformation(config)) { - std::vector<cmGeneratorTarget const*> targets; - for (auto const& item : cli->GetItems()) { - auto const* linkee = item.Target; + auto addLinkedTarget = [this, &lang, &config, &dirs, &emitted, + gg](cmGeneratorTarget const* linkee) { if (linkee && !linkee->IsImported() // Skip targets that build after this one in a static lib cycle. @@ -195,6 +194,12 @@ std::vector<std::string> cmCommonTargetGenerator::GetLinkedTargetDirectories( } dirs.push_back(std::move(di)); } + }; + for (auto const& item : cli->GetItems()) { + addLinkedTarget(item.Target); + } + for (cmGeneratorTarget const* target : cli->GetExternalObjectTargets()) { + addLinkedTarget(target); } } return dirs; diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx index 66314a5..ea9e51d 100644 --- a/Source/cmComputeLinkDepends.cxx +++ b/Source/cmComputeLinkDepends.cxx @@ -30,7 +30,6 @@ #include "cmMessageType.h" #include "cmPolicies.h" #include "cmRange.h" -#include "cmSourceFile.h" #include "cmStateTypes.h" #include "cmStringAlgorithms.h" #include "cmTarget.h" @@ -522,9 +521,6 @@ cmComputeLinkDepends::Compute() // Follow the link dependencies of the target to be linked. this->AddDirectLinkEntries(); - // Add dependencies on targets named by $<TARGET_OBJECTS:...> sources. - this->AddTargetObjectEntries(); - // Complete the breadth-first search of dependencies. while (!this->BFSQueue.empty()) { // Get the next entry. @@ -670,6 +666,8 @@ std::pair<size_t, bool> cmComputeLinkDepends::AddLinkEntry( void cmComputeLinkDepends::AddLinkObject(cmLinkItem const& item) { + assert(!item.Target); // The item is an object file, not its target. + // Allocate a spot for the item entry. auto lei = this->AllocateLinkEntry(item); @@ -683,7 +681,6 @@ void cmComputeLinkDepends::AddLinkObject(cmLinkItem const& item) LinkEntry& entry = this->EntryList[index]; entry.Item = BT<std::string>(item.AsStr(), item.Backtrace); entry.Kind = LinkEntry::Object; - entry.Target = item.Target; // Record explicitly linked object files separately. this->ObjectEntries.emplace_back(index); @@ -872,21 +869,6 @@ void cmComputeLinkDepends::AddDirectLinkEntries() } } -void cmComputeLinkDepends::AddTargetObjectEntries() -{ - std::vector<cmSourceFile const*> externalObjects; - this->Target->GetExternalObjects(externalObjects, this->Config); - for (auto const* externalObject : externalObjects) { - std::string const& objLib = externalObject->GetObjectLibrary(); - if (objLib.empty()) { - continue; - } - cmLinkItem const& objItem = - this->Target->ResolveLinkItem(BT<std::string>(objLib)); - this->AddLinkObject(objItem); - } -} - template <typename T> void cmComputeLinkDepends::AddLinkEntries(size_t depender_index, std::vector<T> const& libs) diff --git a/Source/cmComputeLinkDepends.h b/Source/cmComputeLinkDepends.h index 63c289c..22c4e2a 100644 --- a/Source/cmComputeLinkDepends.h +++ b/Source/cmComputeLinkDepends.h @@ -100,7 +100,6 @@ private: void AddLinkObject(cmLinkItem const& item); void AddVarLinkEntries(size_t depender_index, const char* value); void AddDirectLinkEntries(); - void AddTargetObjectEntries(); template <typename T> void AddLinkEntries(size_t depender_index, std::vector<T> const& libs); void AddLinkObjects(std::vector<cmLinkItem> const& objs); diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index bd7ebed..f54f550 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -15,6 +15,7 @@ #include "cmComputeLinkDepends.h" #include "cmGeneratorTarget.h" #include "cmGlobalGenerator.h" +#include "cmLinkItem.h" #include "cmList.h" #include "cmListFileCache.h" #include "cmLocalGenerator.h" @@ -23,6 +24,7 @@ #include "cmOrderDirectories.h" #include "cmPlaceholderExpander.h" #include "cmPolicies.h" +#include "cmSourceFile.h" #include "cmState.h" #include "cmStateTypes.h" #include "cmStringAlgorithms.h" @@ -536,6 +538,12 @@ cmComputeLinkInformation::GetSharedLibrariesLinked() const return this->SharedLibrariesLinked; } +const std::vector<const cmGeneratorTarget*>& +cmComputeLinkInformation::GetExternalObjectTargets() const +{ + return this->ExternalObjectTargets; +} + bool cmComputeLinkInformation::Compute() { // Skip targets that do not link or have link-like information consumers may @@ -683,6 +691,9 @@ bool cmComputeLinkInformation::Compute() this->Target->GetBacktrace()); } + // Record targets referenced by $<TARGET_OBJECTS:...> sources. + this->AddExternalObjectTargets(); + return true; } @@ -1057,6 +1068,26 @@ cmComputeLinkInformation::GetGroupFeature(std::string const& feature) .first->second; } +void cmComputeLinkInformation::AddExternalObjectTargets() +{ + std::vector<cmSourceFile const*> externalObjects; + this->Target->GetExternalObjects(externalObjects, this->Config); + std::set<std::string> emitted; + for (auto const* externalObject : externalObjects) { + std::string const& objLib = externalObject->GetObjectLibrary(); + if (objLib.empty()) { + continue; + } + if (emitted.insert(objLib).second) { + cmLinkItem const& objItem = + this->Target->ResolveLinkItem(BT<std::string>(objLib)); + if (objItem.Target) { + this->ExternalObjectTargets.emplace_back(objItem.Target); + } + } + } +} + void cmComputeLinkInformation::AddImplicitLinkInfo() { // The link closure lists all languages whose implicit info is needed. @@ -1162,7 +1193,7 @@ void cmComputeLinkInformation::AddItem(LinkEntry const& entry) this->AddItem(BT<std::string>(libName, item.Backtrace)); } } else if (tgt->GetType() == cmStateEnums::OBJECT_LIBRARY) { - this->Items.emplace_back(entry.Item, ItemIsPath::No, entry.Target); + this->Items.emplace_back(item, ItemIsPath::No, tgt); } else if (this->GlobalGenerator->IsXcode() && !tgt->GetImportedXcFrameworkPath(config).empty()) { this->Items.emplace_back( diff --git a/Source/cmComputeLinkInformation.h b/Source/cmComputeLinkInformation.h index a988307..1e8556d 100644 --- a/Source/cmComputeLinkInformation.h +++ b/Source/cmComputeLinkInformation.h @@ -97,6 +97,8 @@ public: std::string GetRPathString(bool for_install) const; std::string GetChrpathString() const; std::set<cmGeneratorTarget const*> const& GetSharedLibrariesLinked() const; + std::vector<cmGeneratorTarget const*> const& GetExternalObjectTargets() + const; std::vector<cmGeneratorTarget const*> const& GetRuntimeDLLs() const { return this->RuntimeDLLs; @@ -134,6 +136,7 @@ private: std::vector<std::string> XcFrameworkHeaderPaths; std::vector<std::string> RuntimeSearchPath; std::set<cmGeneratorTarget const*> SharedLibrariesLinked; + std::vector<cmGeneratorTarget const*> ExternalObjectTargets; std::vector<cmGeneratorTarget const*> RuntimeDLLs; // Context information. @@ -221,6 +224,8 @@ private: bool FinishLinkerSearchDirectories(); void PrintLinkPolicyDiagnosis(std::ostream&); + void AddExternalObjectTargets(); + // Implicit link libraries and directories for linker language. void LoadImplicitLinkInfo(); void AddImplicitLinkInfo(); diff --git a/Source/cmDyndepCollation.cxx b/Source/cmDyndepCollation.cxx index 75f88b2..e9f7be3 100644 --- a/Source/cmDyndepCollation.cxx +++ b/Source/cmDyndepCollation.cxx @@ -242,14 +242,16 @@ Json::Value CollationInformationExports(cmGeneratorTarget const* gt) auto const& all_build_exports = gt->Makefile->GetExportBuildFileGenerators(); for (auto const& exp : all_build_exports) { - std::vector<std::string> targets; + std::vector<cmExportBuildFileGenerator::TargetExport> targets; exp->GetTargets(targets); // Ignore exports sets which are not for this target. auto const& name = gt->GetName(); bool has_current_target = std::any_of(targets.begin(), targets.end(), - [name](std::string const& tname) { return tname == name; }); + [name](cmExportBuildFileGenerator::TargetExport const& te) { + return te.Name == name; + }); if (!has_current_target) { continue; } diff --git a/Source/cmExportBuildAndroidMKGenerator.cxx b/Source/cmExportBuildAndroidMKGenerator.cxx index c54e6ac..34bda1b 100644 --- a/Source/cmExportBuildAndroidMKGenerator.cxx +++ b/Source/cmExportBuildAndroidMKGenerator.cxx @@ -57,8 +57,8 @@ void cmExportBuildAndroidMKGenerator::GenerateImportTargetCode( } void cmExportBuildAndroidMKGenerator::GenerateImportPropertyCode( - std::ostream&, const std::string&, cmGeneratorTarget const*, - ImportPropertyMap const&) + std::ostream&, const std::string&, const std::string&, + cmGeneratorTarget const*, ImportPropertyMap const&, const std::string&) { } diff --git a/Source/cmExportBuildAndroidMKGenerator.h b/Source/cmExportBuildAndroidMKGenerator.h index 8918ce1..9562cee 100644 --- a/Source/cmExportBuildAndroidMKGenerator.h +++ b/Source/cmExportBuildAndroidMKGenerator.h @@ -51,9 +51,9 @@ protected: void GenerateExpectedTargetsCode( std::ostream& os, const std::string& expectedTargets) override; void GenerateImportPropertyCode( - std::ostream& os, const std::string& config, - cmGeneratorTarget const* target, - ImportPropertyMap const& properties) override; + std::ostream& os, const std::string& config, const std::string& suffix, + cmGeneratorTarget const* target, ImportPropertyMap const& properties, + const std::string& importedXcFrameworkLocation) override; void GenerateMissingTargetsCheckCode(std::ostream& os) override; void GenerateFindDependencyCalls(std::ostream&) override {} void GenerateInterfaceProperties( diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx index eae3a74..8ba8d97 100644 --- a/Source/cmExportBuildFileGenerator.cxx +++ b/Source/cmExportBuildFileGenerator.cxx @@ -10,7 +10,6 @@ #include <utility> #include <cm/string_view> -#include <cmext/algorithm> #include <cmext/string_view> #include "cmExportSet.h" @@ -54,15 +53,15 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os) { std::string expectedTargets; std::string sep; - std::vector<std::string> targets; + std::vector<TargetExport> targets; bool generatedInterfaceRequired = false; this->GetTargets(targets); - for (std::string const& tei : targets) { - cmGeneratorTarget* te = this->LG->FindGeneratorTargetToUse(tei); + for (auto const& tei : targets) { + cmGeneratorTarget* te = this->LG->FindGeneratorTargetToUse(tei.Name); expectedTargets += sep + this->Namespace + te->GetExportName(); sep = " "; if (this->ExportedTargets.insert(te).second) { - this->Exports.push_back(te); + this->Exports.emplace_back(te, tei.XcFrameworkLocation); } else { std::ostringstream e; e << "given target \"" << te->GetName() << "\" more than once."; @@ -82,7 +81,8 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os) } // Create all the imported targets. - for (cmGeneratorTarget* gte : this->Exports) { + for (auto const& exp : this->Exports) { + cmGeneratorTarget* gte = exp.Target; this->GenerateImportTargetCode(os, gte, this->GetExportTargetType(gte)); gte->Target->AppendBuildInterfaceIncludes(); @@ -176,7 +176,9 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os) void cmExportBuildFileGenerator::GenerateImportTargetsConfig( std::ostream& os, const std::string& config, std::string const& suffix) { - for (cmGeneratorTarget* target : this->Exports) { + for (auto const& exp : this->Exports) { + cmGeneratorTarget* target = exp.Target; + // Collect import properties for this target. ImportPropertyMap properties; @@ -200,7 +202,23 @@ void cmExportBuildFileGenerator::GenerateImportTargetsConfig( // properties); // Generate code in the export file. - this->GenerateImportPropertyCode(os, config, target, properties); + std::string importedXcFrameworkLocation = exp.XcFrameworkLocation; + if (!importedXcFrameworkLocation.empty()) { + importedXcFrameworkLocation = cmGeneratorExpression::Preprocess( + importedXcFrameworkLocation, + cmGeneratorExpression::PreprocessContext::BuildInterface); + importedXcFrameworkLocation = cmGeneratorExpression::Evaluate( + importedXcFrameworkLocation, exp.Target->GetLocalGenerator(), config, + exp.Target, nullptr, exp.Target); + if (!importedXcFrameworkLocation.empty() && + !cmSystemTools::FileIsFullPath(importedXcFrameworkLocation)) { + importedXcFrameworkLocation = + cmStrCat(this->LG->GetCurrentBinaryDirectory(), '/', + importedXcFrameworkLocation); + } + } + this->GenerateImportPropertyCode(os, config, suffix, target, properties, + importedXcFrameworkLocation); } } } @@ -308,7 +326,7 @@ void cmExportBuildFileGenerator::HandleMissingTarget( } void cmExportBuildFileGenerator::GetTargets( - std::vector<std::string>& targets) const + std::vector<TargetExport>& targets) const { if (this->ExportSet) { for (std::unique_ptr<cmTargetExport> const& te : @@ -316,7 +334,7 @@ void cmExportBuildFileGenerator::GetTargets( if (te->NamelinkOnly) { continue; } - targets.push_back(te->TargetName); + targets.emplace_back(te->TargetName, te->XcFrameworkLocation); } return; } @@ -334,9 +352,11 @@ cmExportBuildFileGenerator::FindBuildExportInfo(cmGlobalGenerator* gg, for (auto const& exp : exportSets) { const auto& exportSet = exp.second; - std::vector<std::string> targets; + std::vector<TargetExport> targets; exportSet->GetTargets(targets); - if (cm::contains(targets, name)) { + if (std::any_of( + targets.begin(), targets.end(), + [&name](const TargetExport& te) { return te.Name == name; })) { exportFiles.push_back(exp.first); ns = exportSet->GetNamespace(); } diff --git a/Source/cmExportBuildFileGenerator.h b/Source/cmExportBuildFileGenerator.h index c5bb0df..9f11d13 100644 --- a/Source/cmExportBuildFileGenerator.h +++ b/Source/cmExportBuildFileGenerator.h @@ -33,15 +33,27 @@ class cmTargetExport; class cmExportBuildFileGenerator : public cmExportFileGenerator { public: + struct TargetExport + { + TargetExport(std::string name, std::string xcFrameworkLocation) + : Name(std::move(name)) + , XcFrameworkLocation(std::move(xcFrameworkLocation)) + { + } + + std::string Name; + std::string XcFrameworkLocation; + }; + cmExportBuildFileGenerator(); /** Set the list of targets to export. */ - void SetTargets(std::vector<std::string> const& targets) + void SetTargets(std::vector<TargetExport> const& targets) { this->Targets = targets; } - void GetTargets(std::vector<std::string>& targets) const; - void AppendTargets(std::vector<std::string> const& targets) + void GetTargets(std::vector<TargetExport>& targets) const; + void AppendTargets(std::vector<TargetExport> const& targets) { cm::append(this->Targets, targets); } @@ -99,9 +111,22 @@ protected: std::pair<std::vector<std::string>, std::string> FindBuildExportInfo( cmGlobalGenerator* gg, const std::string& name); - std::vector<std::string> Targets; + struct TargetExportPrivate + { + TargetExportPrivate(cmGeneratorTarget* target, + std::string xcFrameworkLocation) + : Target(target) + , XcFrameworkLocation(std::move(xcFrameworkLocation)) + { + } + + cmGeneratorTarget* Target; + std::string XcFrameworkLocation; + }; + + std::vector<TargetExport> Targets; cmExportSet* ExportSet; - std::vector<cmGeneratorTarget*> Exports; + std::vector<TargetExportPrivate> Exports; cmLocalGenerator* LG; // The directory for C++ module information. std::string CxxModulesDirectory; diff --git a/Source/cmExportCommand.cxx b/Source/cmExportCommand.cxx index cf1f4ad..9c3bc61 100644 --- a/Source/cmExportCommand.cxx +++ b/Source/cmExportCommand.cxx @@ -72,6 +72,8 @@ bool cmExportCommand(std::vector<std::string> const& args, std::vector<std::vector<std::string>> PackageDependencyArgs; bool ExportPackageDependencies = false; + + std::vector<std::vector<std::string>> TargetArgs; }; auto parser = @@ -87,6 +89,7 @@ bool cmExportCommand(std::vector<std::string> const& args, } else if (args[0] == "SETUP") { parser.Bind("SETUP"_s, &Arguments::ExportSetName); parser.Bind("PACKAGE_DEPENDENCY"_s, &Arguments::PackageDependencyArgs); + parser.Bind("TARGET"_s, &Arguments::TargetArgs); } else { parser.Bind("TARGETS"_s, &Arguments::Targets); parser.Bind("ANDROID_MK"_s, &Arguments::AndroidMKFile); @@ -159,6 +162,31 @@ bool cmExportCommand(std::vector<std::string> const& args, packageDependencyArguments.ExtraArgs); } + struct TargetArguments + { + std::string XcFrameworkLocation; + }; + + auto targetParser = cmArgumentParser<TargetArguments>{}.Bind( + "XCFRAMEWORK_LOCATION"_s, &TargetArguments::XcFrameworkLocation); + + for (auto const& targetArgs : arguments.TargetArgs) { + if (targetArgs.empty()) { + continue; + } + + TargetArguments const targetArguments = + targetParser.Parse(cmMakeRange(targetArgs).advance(1), &unknownArgs); + + if (!unknownArgs.empty()) { + status.SetError("Unknown argument: \"" + unknownArgs.front() + "\"."); + return false; + } + + exportSet.SetXcFrameworkLocation(targetArgs.front(), + targetArguments.XcFrameworkLocation); + } + return true; } @@ -204,7 +232,7 @@ bool cmExportCommand(std::vector<std::string> const& args, fname = dir + "/" + fname; } - std::vector<std::string> targets; + std::vector<cmExportBuildFileGenerator::TargetExport> targets; cmGlobalGenerator* gg = mf.GetGlobalGenerator(); @@ -242,7 +270,7 @@ bool cmExportCommand(std::vector<std::string> const& args, status.SetError(e.str()); return false; } - targets.push_back(currentTarget); + targets.emplace_back(currentTarget, std::string{}); } if (arguments.Append) { if (cmExportBuildFileGenerator* ebfg = diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index 205bf08..e2c3edd 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -1154,8 +1154,9 @@ void cmExportFileGenerator::GenerateImportTargetCode( } void cmExportFileGenerator::GenerateImportPropertyCode( - std::ostream& os, const std::string& config, cmGeneratorTarget const* target, - ImportPropertyMap const& properties) + std::ostream& os, const std::string& config, const std::string& suffix, + cmGeneratorTarget const* target, ImportPropertyMap const& properties, + const std::string& importedXcFrameworkLocation) { // Construct the imported target name. std::string targetName = this->Namespace; @@ -1174,12 +1175,31 @@ void cmExportFileGenerator::GenerateImportPropertyCode( } os << ")\n"; os << "set_target_properties(" << targetName << " PROPERTIES\n"; + std::string importedLocationProp = cmStrCat("IMPORTED_LOCATION", suffix); for (auto const& property : properties) { - os << " " << property.first << " " - << cmExportFileGeneratorEscape(property.second) << "\n"; + if (importedXcFrameworkLocation.empty() || + property.first != importedLocationProp) { + os << " " << property.first << " " + << cmExportFileGeneratorEscape(property.second) << "\n"; + } } - os << " )\n" - << "\n"; + os << " )\n"; + if (!importedXcFrameworkLocation.empty()) { + auto importedLocationIt = properties.find(importedLocationProp); + if (importedLocationIt != properties.end()) { + os << "if(NOT CMAKE_VERSION VERSION_LESS \"3.28\" AND IS_DIRECTORY " + << cmExportFileGeneratorEscape(importedXcFrameworkLocation) + << ")\n" + " set_property(TARGET " + << targetName << " PROPERTY " << importedLocationProp << " " + << cmExportFileGeneratorEscape(importedXcFrameworkLocation) + << ")\nelse()\n set_property(TARGET " << targetName << " PROPERTY " + << importedLocationProp << " " + << cmExportFileGeneratorEscape(importedLocationIt->second) + << ")\nendif()\n"; + } + } + os << "\n"; } void cmExportFileGenerator::GenerateFindDependencyCalls(std::ostream& os) @@ -1310,10 +1330,16 @@ void cmExportFileGenerator::GenerateImportedFileCheckLoop(std::ostream& os) /* clang-format off */ os << "# Loop over all imported files and verify that they actually exist\n" "foreach(_cmake_target IN LISTS _cmake_import_check_targets)\n" - " foreach(_cmake_file IN LISTS \"_cmake_import_check_files_for_${_cmake_target}\")\n" - " if(NOT EXISTS \"${_cmake_file}\")\n" - " message(FATAL_ERROR \"The imported target \\\"${_cmake_target}\\\"" - " references the file\n" + " if(CMAKE_VERSION VERSION_LESS \"3.28\"\n" + " OR NOT DEFINED " + "_cmake_import_check_xcframework_for_${_cmake_target}\n" + " OR NOT IS_DIRECTORY " + "\"${_cmake_import_check_xcframework_for_${_cmake_target}}\")\n" + " foreach(_cmake_file IN LISTS " + "\"_cmake_import_check_files_for_${_cmake_target}\")\n" + " if(NOT EXISTS \"${_cmake_file}\")\n" + " message(FATAL_ERROR \"The imported target " + "\\\"${_cmake_target}\\\" references the file\n" " \\\"${_cmake_file}\\\"\n" "but this file does not exist. Possible reasons include:\n" "* The file was deleted, renamed, or moved to another location.\n" @@ -1322,8 +1348,9 @@ void cmExportFileGenerator::GenerateImportedFileCheckLoop(std::ostream& os) " \\\"${CMAKE_CURRENT_LIST_FILE}\\\"\n" "but not all the files it references.\n" "\")\n" - " endif()\n" - " endforeach()\n" + " endif()\n" + " endforeach()\n" + " endif()\n" " unset(_cmake_file)\n" " unset(\"_cmake_import_check_files_for_${_cmake_target}\")\n" "endforeach()\n" @@ -1336,15 +1363,18 @@ void cmExportFileGenerator::GenerateImportedFileCheckLoop(std::ostream& os) void cmExportFileGenerator::GenerateImportedFileChecksCode( std::ostream& os, cmGeneratorTarget* target, ImportPropertyMap const& properties, - const std::set<std::string>& importedLocations) + const std::set<std::string>& importedLocations, + const std::string& importedXcFrameworkLocation) { // Construct the imported target name. std::string targetName = cmStrCat(this->Namespace, target->GetExportName()); - os << "list(APPEND _cmake_import_check_targets " << targetName - << " )\n" - "list(APPEND _cmake_import_check_files_for_" - << targetName << " "; + os << "list(APPEND _cmake_import_check_targets " << targetName << " )\n"; + if (!importedXcFrameworkLocation.empty()) { + os << "set(_cmake_import_check_xcframework_for_" << targetName << ' ' + << cmExportFileGeneratorEscape(importedXcFrameworkLocation) << ")\n"; + } + os << "list(APPEND _cmake_import_check_files_for_" << targetName << " "; for (std::string const& li : importedLocations) { auto pi = properties.find(li); diff --git a/Source/cmExportFileGenerator.h b/Source/cmExportFileGenerator.h index ccc10d8..554dd4a 100644 --- a/Source/cmExportFileGenerator.h +++ b/Source/cmExportFileGenerator.h @@ -84,14 +84,15 @@ protected: virtual void GenerateImportTargetCode(std::ostream& os, cmGeneratorTarget const* target, cmStateEnums::TargetType targetType); - virtual void GenerateImportPropertyCode(std::ostream& os, - const std::string& config, - cmGeneratorTarget const* target, - ImportPropertyMap const& properties); + virtual void GenerateImportPropertyCode( + std::ostream& os, const std::string& config, const std::string& suffix, + cmGeneratorTarget const* target, ImportPropertyMap const& properties, + const std::string& importedXcFrameworkLocation); virtual void GenerateImportedFileChecksCode( std::ostream& os, cmGeneratorTarget* target, ImportPropertyMap const& properties, - const std::set<std::string>& importedLocations); + const std::set<std::string>& importedLocations, + const std::string& importedXcFrameworkLocation); virtual void GenerateImportedFileCheckLoop(std::ostream& os); virtual void GenerateMissingTargetsCheckCode(std::ostream& os); virtual void GenerateFindDependencyCalls(std::ostream& os); diff --git a/Source/cmExportInstallAndroidMKGenerator.cxx b/Source/cmExportInstallAndroidMKGenerator.cxx index 7dfdc0e..eaa85f3 100644 --- a/Source/cmExportInstallAndroidMKGenerator.cxx +++ b/Source/cmExportInstallAndroidMKGenerator.cxx @@ -80,8 +80,8 @@ void cmExportInstallAndroidMKGenerator::GenerateExpectedTargetsCode( } void cmExportInstallAndroidMKGenerator::GenerateImportPropertyCode( - std::ostream&, const std::string&, cmGeneratorTarget const*, - ImportPropertyMap const&) + std::ostream&, const std::string&, const std::string&, + cmGeneratorTarget const*, ImportPropertyMap const&, const std::string&) { } @@ -122,7 +122,7 @@ void cmExportInstallAndroidMKGenerator::GenerateImportedFileCheckLoop( void cmExportInstallAndroidMKGenerator::GenerateImportedFileChecksCode( std::ostream&, cmGeneratorTarget*, ImportPropertyMap const&, - const std::set<std::string>&) + const std::set<std::string>&, const std::string&) { } diff --git a/Source/cmExportInstallAndroidMKGenerator.h b/Source/cmExportInstallAndroidMKGenerator.h index 9454cdf..b1778ef 100644 --- a/Source/cmExportInstallAndroidMKGenerator.h +++ b/Source/cmExportInstallAndroidMKGenerator.h @@ -45,9 +45,9 @@ protected: void GenerateExpectedTargetsCode( std::ostream& os, const std::string& expectedTargets) override; void GenerateImportPropertyCode( - std::ostream& os, const std::string& config, - cmGeneratorTarget const* target, - ImportPropertyMap const& properties) override; + std::ostream& os, const std::string& config, const std::string& suffix, + cmGeneratorTarget const* target, ImportPropertyMap const& properties, + const std::string& importedXcFrameworkLocation) override; void GenerateMissingTargetsCheckCode(std::ostream& os) override; void GenerateFindDependencyCalls(std::ostream&) override {} void GenerateInterfaceProperties( @@ -60,6 +60,7 @@ protected: void GenerateImportedFileChecksCode( std::ostream& os, cmGeneratorTarget* target, ImportPropertyMap const& properties, - const std::set<std::string>& importedLocations) override; + const std::set<std::string>& importedLocations, + const std::string& importedXcFrameworkLocation) override; bool GenerateImportFileConfig(const std::string& config) override; }; diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx index b829edd..64e694c 100644 --- a/Source/cmExportInstallFileGenerator.cxx +++ b/Source/cmExportInstallFileGenerator.cxx @@ -375,9 +375,26 @@ void cmExportInstallFileGenerator::GenerateImportTargetsConfig( // properties); // Generate code in the export file. - this->GenerateImportPropertyCode(os, config, gtgt, properties); - this->GenerateImportedFileChecksCode(os, gtgt, properties, - importedLocations); + std::string importedXcFrameworkLocation = te->XcFrameworkLocation; + if (!importedXcFrameworkLocation.empty()) { + importedXcFrameworkLocation = cmGeneratorExpression::Preprocess( + importedXcFrameworkLocation, + cmGeneratorExpression::PreprocessContext::InstallInterface, true); + importedXcFrameworkLocation = cmGeneratorExpression::Evaluate( + importedXcFrameworkLocation, te->Target->GetLocalGenerator(), config, + te->Target, nullptr, te->Target); + if (!importedXcFrameworkLocation.empty() && + !cmSystemTools::FileIsFullPath(importedXcFrameworkLocation) && + !cmHasLiteralPrefix(importedXcFrameworkLocation, + "${_IMPORT_PREFIX}/")) { + importedXcFrameworkLocation = + cmStrCat("${_IMPORT_PREFIX}/", importedXcFrameworkLocation); + } + } + this->GenerateImportPropertyCode(os, config, suffix, gtgt, properties, + importedXcFrameworkLocation); + this->GenerateImportedFileChecksCode( + os, gtgt, properties, importedLocations, importedXcFrameworkLocation); } } } diff --git a/Source/cmExportSet.cxx b/Source/cmExportSet.cxx index aa32394..b32bb8d 100644 --- a/Source/cmExportSet.cxx +++ b/Source/cmExportSet.cxx @@ -72,6 +72,16 @@ void cmExportSet::AddInstallation(cmInstallExportGenerator const* installation) this->Installations.push_back(installation); } +void cmExportSet::SetXcFrameworkLocation(const std::string& name, + const std::string& location) +{ + for (auto& te : this->TargetExports) { + if (name == te->TargetName) { + te->XcFrameworkLocation = location; + } + } +} + cmExportSet& cmExportSetMap::operator[](const std::string& name) { auto it = this->find(name); diff --git a/Source/cmExportSet.h b/Source/cmExportSet.h index c5fc91f..f2fc4a7 100644 --- a/Source/cmExportSet.h +++ b/Source/cmExportSet.h @@ -33,6 +33,9 @@ public: void AddInstallation(cmInstallExportGenerator const* installation); + void SetXcFrameworkLocation(const std::string& name, + const std::string& location); + std::string const& GetName() const { return this->Name; } std::vector<std::unique_ptr<cmTargetExport>> const& GetTargetExports() const diff --git a/Source/cmTargetExport.h b/Source/cmTargetExport.h index 0dac5ca..caeb54d 100644 --- a/Source/cmTargetExport.h +++ b/Source/cmTargetExport.h @@ -38,4 +38,5 @@ public: ///@} bool NamelinkOnly = false; + std::string XcFrameworkLocation; }; diff --git a/Tests/ObjectLibrary/CMakeLists.txt b/Tests/ObjectLibrary/CMakeLists.txt index b57761b..2bc2327 100644 --- a/Tests/ObjectLibrary/CMakeLists.txt +++ b/Tests/ObjectLibrary/CMakeLists.txt @@ -77,3 +77,5 @@ add_subdirectory(ExportLanguages) add_subdirectory(LinkObjects) add_subdirectory(Transitive) + +add_subdirectory(TransitiveLinkDeps) diff --git a/Tests/ObjectLibrary/TransitiveLinkDeps/CMakeLists.txt b/Tests/ObjectLibrary/TransitiveLinkDeps/CMakeLists.txt new file mode 100644 index 0000000..3f561fa --- /dev/null +++ b/Tests/ObjectLibrary/TransitiveLinkDeps/CMakeLists.txt @@ -0,0 +1,15 @@ +add_library(implgather INTERFACE) + +add_library(dep STATIC dep.c) + +add_library(deps INTERFACE) +target_link_libraries(deps INTERFACE dep) + +add_library(impl_obj OBJECT impl_obj.c) +target_link_libraries(impl_obj PUBLIC deps) + +target_sources(implgather INTERFACE "$<TARGET_OBJECTS:impl_obj>") +target_link_libraries(implgather INTERFACE impl_obj) + +add_executable(useimpl main.c) +target_link_libraries(useimpl PRIVATE implgather) diff --git a/Tests/ObjectLibrary/TransitiveLinkDeps/dep.c b/Tests/ObjectLibrary/TransitiveLinkDeps/dep.c new file mode 100644 index 0000000..7cc62c3 --- /dev/null +++ b/Tests/ObjectLibrary/TransitiveLinkDeps/dep.c @@ -0,0 +1,4 @@ +int from_dep(void) +{ + return 0; +} diff --git a/Tests/ObjectLibrary/TransitiveLinkDeps/impl_obj.c b/Tests/ObjectLibrary/TransitiveLinkDeps/impl_obj.c new file mode 100644 index 0000000..f5760b7 --- /dev/null +++ b/Tests/ObjectLibrary/TransitiveLinkDeps/impl_obj.c @@ -0,0 +1,6 @@ +int from_dep(void); + +int impl_obj(void) +{ + return from_dep(); +} diff --git a/Tests/ObjectLibrary/TransitiveLinkDeps/main.c b/Tests/ObjectLibrary/TransitiveLinkDeps/main.c new file mode 100644 index 0000000..5661f57 --- /dev/null +++ b/Tests/ObjectLibrary/TransitiveLinkDeps/main.c @@ -0,0 +1,6 @@ +int impl_obj(void); + +int main(int argc, char* argv[]) +{ + return impl_obj(); +} diff --git a/Tests/RunCMake/XcFramework/RunCMakeTest.cmake b/Tests/RunCMake/XcFramework/RunCMakeTest.cmake index 9a13892..1fef283 100644 --- a/Tests/RunCMake/XcFramework/RunCMakeTest.cmake +++ b/Tests/RunCMake/XcFramework/RunCMakeTest.cmake @@ -119,3 +119,128 @@ unset(RunCMake_TEST_BINARY_DIR) run_cmake(find-library) run_cmake_command(find-library-script ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/find-library.cmake) + +file(REMOVE_RECURSE ${RunCMake_BINARY_DIR}/export-install) +set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/export-macos-build) +run_cmake_with_options(export-macos -DCMAKE_SYSTEM_NAME=Darwin -DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/export-install) +set(RunCMake_TEST_NO_CLEAN 1) +set(_config_arg) +if(RunCMake_GENERATOR_IS_MULTI_CONFIG) + set(_config_arg --config Release) +endif() +run_cmake_command(export-macos-build ${CMAKE_COMMAND} --build . ${_config_arg}) +run_cmake_command(export-macos-install ${CMAKE_COMMAND} --install . ${_config_arg}) +unset(RunCMake_TEST_NO_CLEAN) +unset(RunCMake_TEST_BINARY_DIR) + +set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/import-macos-install-specific-no-xcframework-build) +run_cmake_with_options(import-macos-install-specific-no-xcframework -DCMAKE_SYSTEM_NAME=Darwin -Dmylib_DIR=${RunCMake_BINARY_DIR}/export-install/lib/macos/cmake/mylib) +set(RunCMake_TEST_NO_CLEAN 1) +set(_config_arg) +set(_config_dir) +if(RunCMake_GENERATOR_IS_MULTI_CONFIG) + set(_config_arg --config Release) + set(_config_dir /Release) +endif() +run_cmake_command(import-macos-install-specific-no-xcframework-build ${CMAKE_COMMAND} --build . ${_config_arg}) +unset(RunCMake_TEST_NO_CLEAN) +unset(RunCMake_TEST_BINARY_DIR) + +set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/export-macos-build) +set(RunCMake_TEST_NO_CLEAN 1) +if(CMake_TEST_XCODE_VERSION VERSION_GREATER_EQUAL 15) + # 'xcodebuild -create-xcframework' fails on symlinked paths. + file(REAL_PATH "${RunCMake_SOURCE_DIR}" src_dir) + file(REAL_PATH "${RunCMake_BINARY_DIR}" bld_dir) +else() + set(src_dir "${RunCMake_SOURCE_DIR}") + set(bld_dir "${RunCMake_BINARY_DIR}") +endif() +run_cmake_command(export-install-xcframework xcodebuild -create-xcframework + -output ${bld_dir}/export-install/lib/mylib.xcframework + -library ${bld_dir}/export-install/lib/macos/libmylib.a + -headers ${src_dir}/mylib/include + ) +run_cmake_command(export-build-xcframework xcodebuild -create-xcframework + -output ${bld_dir}/export-macos-build/lib/mylib.xcframework + -library ${bld_dir}/export-macos-build/lib/macos${_config_dir}/libmylib.a + -headers ${src_dir}/mylib/include + ) +run_cmake_command(export-install-xcframework-genex xcodebuild -create-xcframework + -output ${bld_dir}/export-install/lib2/mylib-genex.xcframework + -library ${bld_dir}/export-install/lib/macos/libmylib-genex.a + -headers ${src_dir}/mylib/include + ) +run_cmake_command(export-build-xcframework-genex xcodebuild -create-xcframework + -output ${bld_dir}/export-macos-build/lib/mylib-genex.xcframework + -library ${bld_dir}/export-macos-build/lib/macos${_config_dir}/libmylib-genex.a + -headers ${src_dir}/mylib/include + ) +unset(RunCMake_TEST_NO_CLEAN) +unset(RunCMake_TEST_BINARY_DIR) + +set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/import-macos-install-specific-build) +run_cmake_with_options(import-macos-install-specific -DCMAKE_SYSTEM_NAME=Darwin -Dmylib_DIR=${RunCMake_BINARY_DIR}/export-install/lib/macos/cmake/mylib) +set(RunCMake_TEST_NO_CLEAN 1) +set(_config_arg) +if(RunCMake_GENERATOR_IS_MULTI_CONFIG) + set(_config_arg --config Release) +endif() +run_cmake_command(import-macos-install-specific-build ${CMAKE_COMMAND} --build . ${_config_arg}) +unset(RunCMake_TEST_NO_CLEAN) +unset(RunCMake_TEST_BINARY_DIR) + +set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/import-macos-build-specific-build) +run_cmake_with_options(import-macos-build-specific -DCMAKE_SYSTEM_NAME=Darwin -Dmylib_DIR=${RunCMake_BINARY_DIR}/export-macos-build/lib/macos/cmake/mylib) +set(RunCMake_TEST_NO_CLEAN 1) +set(_config_arg) +if(RunCMake_GENERATOR_IS_MULTI_CONFIG) + set(_config_arg --config Release) +endif() +run_cmake_command(import-macos-build-specific-build ${CMAKE_COMMAND} --build . ${_config_arg}) +unset(RunCMake_TEST_NO_CLEAN) +unset(RunCMake_TEST_BINARY_DIR) + +set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/import-macos-install-specific-genex-build) +run_cmake_with_options(import-macos-install-specific-genex -DCMAKE_SYSTEM_NAME=Darwin -Dmylib_DIR=${RunCMake_BINARY_DIR}/export-install/lib/macos/cmake/mylib) +set(RunCMake_TEST_NO_CLEAN 1) +set(_config_arg) +if(RunCMake_GENERATOR_IS_MULTI_CONFIG) + set(_config_arg --config Release) +endif() +run_cmake_command(import-macos-install-specific-genex-build ${CMAKE_COMMAND} --build . ${_config_arg}) +unset(RunCMake_TEST_NO_CLEAN) +unset(RunCMake_TEST_BINARY_DIR) + +set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/import-macos-build-specific-genex-build) +run_cmake_with_options(import-macos-build-specific-genex -DCMAKE_SYSTEM_NAME=Darwin -Dmylib_DIR=${RunCMake_BINARY_DIR}/export-macos-build/lib/macos/cmake/mylib) +set(RunCMake_TEST_NO_CLEAN 1) +set(_config_arg) +if(RunCMake_GENERATOR_IS_MULTI_CONFIG) + set(_config_arg --config Release) +endif() +run_cmake_command(import-macos-build-specific-genex-build ${CMAKE_COMMAND} --build . ${_config_arg}) +unset(RunCMake_TEST_NO_CLEAN) +unset(RunCMake_TEST_BINARY_DIR) + +set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/import-macos-install-general-build) +run_cmake_with_options(import-macos-install-general -DCMAKE_SYSTEM_NAME=Darwin -Dmylib_DIR=${RunCMake_BINARY_DIR}/export-install/lib/cmake/mylib) +set(RunCMake_TEST_NO_CLEAN 1) +set(_config_arg) +if(RunCMake_GENERATOR_IS_MULTI_CONFIG) + set(_config_arg --config Release) +endif() +run_cmake_command(import-macos-install-general-build ${CMAKE_COMMAND} --build . ${_config_arg}) +unset(RunCMake_TEST_NO_CLEAN) +unset(RunCMake_TEST_BINARY_DIR) + +set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/import-macos-build-general-build) +run_cmake_with_options(import-macos-build-general -DCMAKE_SYSTEM_NAME=Darwin -Dmylib_DIR=${RunCMake_BINARY_DIR}/export-macos-build/lib/cmake/mylib) +set(RunCMake_TEST_NO_CLEAN 1) +set(_config_arg) +if(RunCMake_GENERATOR_IS_MULTI_CONFIG) + set(_config_arg --config Release) +endif() +run_cmake_command(import-macos-build-general-build ${CMAKE_COMMAND} --build . ${_config_arg}) +unset(RunCMake_TEST_NO_CLEAN) +unset(RunCMake_TEST_BINARY_DIR) diff --git a/Tests/RunCMake/XcFramework/export-macos.cmake b/Tests/RunCMake/XcFramework/export-macos.cmake new file mode 100644 index 0000000..2fac14f --- /dev/null +++ b/Tests/RunCMake/XcFramework/export-macos.cmake @@ -0,0 +1,44 @@ +enable_language(C) + +include(CMakePackageConfigHelpers) + +if(CMAKE_SYSTEM_NAME STREQUAL "iOS") + set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "NO") +endif() + +if(CMAKE_SYSTEM_NAME STREQUAL "tvOS" OR CMAKE_SYSTEM_NAME STREQUAL "watchOS" OR CMAKE_SYSTEM_NAME STREQUAL "visionOS") + set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "YES") +endif() + +add_library(mylib STATIC mylib/mylib.c) +target_include_directories(mylib INTERFACE $<INSTALL_INTERFACE:include>) +set_property(TARGET mylib PROPERTY ARCHIVE_OUTPUT_DIRECTORY lib/macos) + +add_library(mylib-genex STATIC mylib/mylib.c) +target_include_directories(mylib-genex INTERFACE $<INSTALL_INTERFACE:include>) +set_property(TARGET mylib-genex PROPERTY ARCHIVE_OUTPUT_DIRECTORY lib/macos) + +install(TARGETS mylib mylib-genex DESTINATION lib/macos EXPORT mylib) +install(FILES mylib/include/mylib/mylib.h DESTINATION include/mylib) +export(SETUP mylib + TARGET mylib XCFRAMEWORK_LOCATION lib/mylib.xcframework + TARGET mylib-genex XCFRAMEWORK_LOCATION "$<BUILD_INTERFACE:lib/$<TARGET_PROPERTY:NAME>.xcframework>$<INSTALL_INTERFACE:lib2/$<TARGET_PROPERTY:NAME>.xcframework>" + ) +install(EXPORT mylib DESTINATION lib/macos/cmake/mylib FILE mylib-targets.cmake) +export(EXPORT mylib FILE lib/macos/cmake/mylib/mylib-targets.cmake) + +configure_package_config_file(mylib-config.cmake.in mylib-config-sub.cmake INSTALL_DESTINATION lib/macos/cmake/mylib) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/mylib-config-sub.cmake DESTINATION lib/macos/cmake/mylib RENAME mylib-config.cmake) + +configure_package_config_file(mylib-config.cmake.in lib/macos/cmake/mylib/mylib-config.cmake INSTALL_DESTINATION lib/macos/cmake/mylib) + +generate_apple_platform_selection_file(mylib-config-top.cmake + INSTALL_DESTINATION lib/cmake/mylib + MACOS_CONFIG_FILE lib/macos/cmake/mylib/mylib-config.cmake + ) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/mylib-config-top.cmake DESTINATION lib/cmake/mylib RENAME mylib-config.cmake) + +generate_apple_platform_selection_file(lib/cmake/mylib/mylib-config.cmake + INSTALL_DESTINATION lib/cmake/mylib + MACOS_CONFIG_FILE lib/macos/cmake/mylib/mylib-config.cmake + ) diff --git a/Tests/RunCMake/XcFramework/import-common.cmake b/Tests/RunCMake/XcFramework/import-common.cmake new file mode 100644 index 0000000..4def6a4 --- /dev/null +++ b/Tests/RunCMake/XcFramework/import-common.cmake @@ -0,0 +1,5 @@ +enable_language(C) + +find_package(mylib REQUIRED) + +add_custom_target(print_loc ALL COMMAND ${CMAKE_COMMAND} -E echo "mylib location: $<TARGET_FILE:mylib>") diff --git a/Tests/RunCMake/XcFramework/import-genex-common.cmake b/Tests/RunCMake/XcFramework/import-genex-common.cmake new file mode 100644 index 0000000..e46902b --- /dev/null +++ b/Tests/RunCMake/XcFramework/import-genex-common.cmake @@ -0,0 +1,5 @@ +enable_language(C) + +find_package(mylib REQUIRED) + +add_custom_target(print_loc ALL COMMAND ${CMAKE_COMMAND} -E echo "mylib-genex location: $<TARGET_FILE:mylib-genex>") diff --git a/Tests/RunCMake/XcFramework/import-macos-build-general-build-stdout.txt b/Tests/RunCMake/XcFramework/import-macos-build-general-build-stdout.txt new file mode 100644 index 0000000..3ac467d --- /dev/null +++ b/Tests/RunCMake/XcFramework/import-macos-build-general-build-stdout.txt @@ -0,0 +1,2 @@ +mylib location: [^ +]*/Tests/RunCMake/XcFramework/export-macos-build/lib/mylib\.xcframework/macos-(arm64|x86_64|arm64_x86_64)/libmylib\.a diff --git a/Tests/RunCMake/XcFramework/import-macos-build-general.cmake b/Tests/RunCMake/XcFramework/import-macos-build-general.cmake new file mode 100644 index 0000000..08ef6db --- /dev/null +++ b/Tests/RunCMake/XcFramework/import-macos-build-general.cmake @@ -0,0 +1 @@ +include(import-common.cmake) diff --git a/Tests/RunCMake/XcFramework/import-macos-build-specific-build-stdout.txt b/Tests/RunCMake/XcFramework/import-macos-build-specific-build-stdout.txt new file mode 100644 index 0000000..3ac467d --- /dev/null +++ b/Tests/RunCMake/XcFramework/import-macos-build-specific-build-stdout.txt @@ -0,0 +1,2 @@ +mylib location: [^ +]*/Tests/RunCMake/XcFramework/export-macos-build/lib/mylib\.xcframework/macos-(arm64|x86_64|arm64_x86_64)/libmylib\.a diff --git a/Tests/RunCMake/XcFramework/import-macos-build-specific-genex-build-stdout.txt b/Tests/RunCMake/XcFramework/import-macos-build-specific-genex-build-stdout.txt new file mode 100644 index 0000000..d3a20e8 --- /dev/null +++ b/Tests/RunCMake/XcFramework/import-macos-build-specific-genex-build-stdout.txt @@ -0,0 +1,2 @@ +mylib-genex location: [^ +]*/Tests/RunCMake/XcFramework/export-macos-build/lib/mylib-genex\.xcframework/macos-(arm64|x86_64|arm64_x86_64)/libmylib-genex\.a diff --git a/Tests/RunCMake/XcFramework/import-macos-build-specific-genex.cmake b/Tests/RunCMake/XcFramework/import-macos-build-specific-genex.cmake new file mode 100644 index 0000000..a061bd3 --- /dev/null +++ b/Tests/RunCMake/XcFramework/import-macos-build-specific-genex.cmake @@ -0,0 +1 @@ +include(import-genex-common.cmake) diff --git a/Tests/RunCMake/XcFramework/import-macos-build-specific.cmake b/Tests/RunCMake/XcFramework/import-macos-build-specific.cmake new file mode 100644 index 0000000..08ef6db --- /dev/null +++ b/Tests/RunCMake/XcFramework/import-macos-build-specific.cmake @@ -0,0 +1 @@ +include(import-common.cmake) diff --git a/Tests/RunCMake/XcFramework/import-macos-install-general-build-stdout.txt b/Tests/RunCMake/XcFramework/import-macos-install-general-build-stdout.txt new file mode 100644 index 0000000..1421246 --- /dev/null +++ b/Tests/RunCMake/XcFramework/import-macos-install-general-build-stdout.txt @@ -0,0 +1,2 @@ +mylib location: [^ +]*/Tests/RunCMake/XcFramework/export-install/lib/mylib\.xcframework/macos-(arm64|x86_64|arm64_x86_64)/libmylib\.a diff --git a/Tests/RunCMake/XcFramework/import-macos-install-general.cmake b/Tests/RunCMake/XcFramework/import-macos-install-general.cmake new file mode 100644 index 0000000..08ef6db --- /dev/null +++ b/Tests/RunCMake/XcFramework/import-macos-install-general.cmake @@ -0,0 +1 @@ +include(import-common.cmake) diff --git a/Tests/RunCMake/XcFramework/import-macos-install-specific-build-stdout.txt b/Tests/RunCMake/XcFramework/import-macos-install-specific-build-stdout.txt new file mode 100644 index 0000000..1421246 --- /dev/null +++ b/Tests/RunCMake/XcFramework/import-macos-install-specific-build-stdout.txt @@ -0,0 +1,2 @@ +mylib location: [^ +]*/Tests/RunCMake/XcFramework/export-install/lib/mylib\.xcframework/macos-(arm64|x86_64|arm64_x86_64)/libmylib\.a diff --git a/Tests/RunCMake/XcFramework/import-macos-install-specific-genex-build-stdout.txt b/Tests/RunCMake/XcFramework/import-macos-install-specific-genex-build-stdout.txt new file mode 100644 index 0000000..5c88758 --- /dev/null +++ b/Tests/RunCMake/XcFramework/import-macos-install-specific-genex-build-stdout.txt @@ -0,0 +1,2 @@ +mylib-genex location: [^ +]*/Tests/RunCMake/XcFramework/export-install/lib2/mylib-genex\.xcframework/macos-(arm64|x86_64|arm64_x86_64)/libmylib-genex\.a diff --git a/Tests/RunCMake/XcFramework/import-macos-install-specific-genex.cmake b/Tests/RunCMake/XcFramework/import-macos-install-specific-genex.cmake new file mode 100644 index 0000000..a061bd3 --- /dev/null +++ b/Tests/RunCMake/XcFramework/import-macos-install-specific-genex.cmake @@ -0,0 +1 @@ +include(import-genex-common.cmake) diff --git a/Tests/RunCMake/XcFramework/import-macos-install-specific-no-xcframework-build-stdout.txt b/Tests/RunCMake/XcFramework/import-macos-install-specific-no-xcframework-build-stdout.txt new file mode 100644 index 0000000..1c92972 --- /dev/null +++ b/Tests/RunCMake/XcFramework/import-macos-install-specific-no-xcframework-build-stdout.txt @@ -0,0 +1,2 @@ +mylib location: [^ +]*/Tests/RunCMake/XcFramework/export-install/lib/macos/libmylib\.a diff --git a/Tests/RunCMake/XcFramework/import-macos-install-specific-no-xcframework.cmake b/Tests/RunCMake/XcFramework/import-macos-install-specific-no-xcframework.cmake new file mode 100644 index 0000000..08ef6db --- /dev/null +++ b/Tests/RunCMake/XcFramework/import-macos-install-specific-no-xcframework.cmake @@ -0,0 +1 @@ +include(import-common.cmake) diff --git a/Tests/RunCMake/XcFramework/import-macos-install-specific.cmake b/Tests/RunCMake/XcFramework/import-macos-install-specific.cmake new file mode 100644 index 0000000..08ef6db --- /dev/null +++ b/Tests/RunCMake/XcFramework/import-macos-install-specific.cmake @@ -0,0 +1 @@ +include(import-common.cmake) diff --git a/Tests/RunCMake/XcFramework/mylib-config.cmake.in b/Tests/RunCMake/XcFramework/mylib-config.cmake.in new file mode 100644 index 0000000..878d6e8 --- /dev/null +++ b/Tests/RunCMake/XcFramework/mylib-config.cmake.in @@ -0,0 +1,3 @@ +@PACKAGE_INIT@ + +include("${CMAKE_CURRENT_LIST_DIR}/mylib-targets.cmake") diff --git a/Utilities/KWIML/include/kwiml/abi.h b/Utilities/KWIML/include/kwiml/abi.h index 0437854..cefe9ce 100644 --- a/Utilities/KWIML/include/kwiml/abi.h +++ b/Utilities/KWIML/include/kwiml/abi.h @@ -494,7 +494,7 @@ suppression macro KWIML_ABI_NO_VERIFY was defined. #if defined(_MSC_VER) # pragma warning (push) -# pragma warning (disable:4309) /* static_cast trunction of constant value */ +# pragma warning (disable:4309) /* static_cast truncation of constant value */ # pragma warning (disable:4310) /* cast truncates constant value */ #endif diff --git a/Utilities/KWIML/include/kwiml/int.h b/Utilities/KWIML/include/kwiml/int.h index 49da373..d50c518 100644 --- a/Utilities/KWIML/include/kwiml/int.h +++ b/Utilities/KWIML/include/kwiml/int.h @@ -1016,7 +1016,7 @@ An includer may test the following macros after inclusion: #if defined(_MSC_VER) # pragma warning (push) -# pragma warning (disable:4309) /* static_cast trunction of constant value */ +# pragma warning (disable:4309) /* static_cast truncation of constant value */ # pragma warning (disable:4310) /* cast truncates constant value */ #endif diff --git a/Utilities/KWIML/test/test_int_format.h b/Utilities/KWIML/test/test_int_format.h index e139bdb..56b022e 100644 --- a/Utilities/KWIML/test/test_int_format.h +++ b/Utilities/KWIML/test/test_int_format.h @@ -8,7 +8,7 @@ #if defined(_MSC_VER) # pragma warning (push) -# pragma warning (disable:4309) /* static_cast trunction of constant value */ +# pragma warning (disable:4309) /* static_cast truncation of constant value */ # pragma warning (disable:4310) /* cast truncates constant value */ #endif diff --git a/Utilities/Sphinx/static/cmake.css b/Utilities/Sphinx/static/cmake.css index 6303cb1..9e7dfa3 100644 --- a/Utilities/Sphinx/static/cmake.css +++ b/Utilities/Sphinx/static/cmake.css @@ -45,12 +45,14 @@ div.sphinxsidebarwrapper { white-space: nowrap; } -/* Add hanging indent to version-{added,changed} content. */ -div .versionadded > *, -div .versionchanged > * { +/* Add hanging indent to deprecated and version-{added,changed} content. */ +div.deprecated > *, +div.versionadded > *, +div.versionchanged > * { padding-left: 2em; } +div.deprecated > :first-child, div.versionadded > :first-child, div.versionchanged > :first-child { text-indent: -2em; |