From 2e24123186b09cceef805dd88daaac8536770176 Mon Sep 17 00:00:00 2001 From: Marc Chevrier Date: Fri, 3 Mar 2023 17:14:59 +0100 Subject: Apple: text-based stubs: manage imported configurations mapping --- Help/manual/cmake-buildsystem.7.rst | 2 ++ Help/prop_tgt/IMPORTED_CONFIGURATIONS.rst | 4 +++- Source/cmTarget.cxx | 4 +++- Tests/GeneratorExpression/CMakeLists.txt | 16 ++++++++++++++++ Tests/GeneratorExpression/check-part3.cmake | 1 + 5 files changed, 25 insertions(+), 2 deletions(-) diff --git a/Help/manual/cmake-buildsystem.7.rst b/Help/manual/cmake-buildsystem.7.rst index 9fdb26c..b88b864 100644 --- a/Help/manual/cmake-buildsystem.7.rst +++ b/Help/manual/cmake-buildsystem.7.rst @@ -37,6 +37,8 @@ is defined as an executable formed by compiling and linking ``zipapp.cpp``. When linking the ``zipapp`` executable, the ``archive`` static library is linked in. +.. _`Binary Executables`: + Binary Executables ------------------ diff --git a/Help/prop_tgt/IMPORTED_CONFIGURATIONS.rst b/Help/prop_tgt/IMPORTED_CONFIGURATIONS.rst index 8605548..a4746d3 100644 --- a/Help/prop_tgt/IMPORTED_CONFIGURATIONS.rst +++ b/Help/prop_tgt/IMPORTED_CONFIGURATIONS.rst @@ -8,7 +8,9 @@ target. For each configuration named, the imported target's artifacts must be specified in other target properties: * :prop_tgt:`IMPORTED_LOCATION_`, or -* :prop_tgt:`IMPORTED_IMPLIB_` (on DLL platforms), or +* :prop_tgt:`IMPORTED_IMPLIB_` (on DLL platforms, on AIX for + :ref:`Executables ` or on Apple for + :ref:`Shared Libraries `), or * :prop_tgt:`IMPORTED_OBJECTS_` (for :ref:`Object Libraries`), or * :prop_tgt:`IMPORTED_LIBNAME_` (for :ref:`Interface Libraries`). diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 0bb91b6..ec87271 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -3012,7 +3012,9 @@ bool cmTarget::GetMappedConfig(std::string const& desired_config, cmValue& loc, bool allowImp = (this->IsDLLPlatform() && (this->GetType() == cmStateEnums::SHARED_LIBRARY || this->IsExecutableWithExports())) || - (this->IsAIX() && this->IsExecutableWithExports()); + (this->IsAIX() && this->IsExecutableWithExports()) || + (this->GetMakefile()->PlatformSupportsAppleTextStubs() && + this->IsSharedLibraryWithExports()); // If a mapping was found, check its configurations. for (auto mci = mappedConfigs.begin(); diff --git a/Tests/GeneratorExpression/CMakeLists.txt b/Tests/GeneratorExpression/CMakeLists.txt index 3fb53d1..ef115e6 100644 --- a/Tests/GeneratorExpression/CMakeLists.txt +++ b/Tests/GeneratorExpression/CMakeLists.txt @@ -200,6 +200,21 @@ set_property(TARGET importedFallback PROPERTY IMPORTED_LOCATION fallback_loc) set_property(TARGET importedFallback PROPERTY MAP_IMPORTED_CONFIG_DEBUG "" DEBUG) set_property(TARGET importedFallback PROPERTY MAP_IMPORTED_CONFIG_RELEASE "") +add_library(importedFallback2 SHARED IMPORTED) +set_property(TARGET importedFallback2 PROPERTY ENABLE_EXPORTS TRUE) +set_property(TARGET importedFallback2 PROPERTY IMPORTED_LOCATION_NOCONFIG noconfig_loc) +set_property(TARGET importedFallback2 PROPERTY IMPORTED_IMPLIB_NOCONFIG noconfig_imp) +set_property(TARGET importedFallback2 PROPERTY IMPORTED_LOCATION_DEBUG debug_loc) +set_property(TARGET importedFallback2 PROPERTY IMPORTED_IMPLIB_DEBUG debug_imp) +set_property(TARGET importedFallback2 PROPERTY IMPORTED_LOCATION_RELEASE release_loc) +set_property(TARGET importedFallback2 PROPERTY IMPORTED_IMPLIB_RELEASE release_imp) +set_property(TARGET importedFallback2 PROPERTY IMPORTED_LOCATION fallback_loc) +set_property(TARGET importedFallback2 PROPERTY IMPORTED_IMPLIB fallback_imp) +set_property(TARGET importedFallback2 PROPERTY IMPORTED_IMPLIB_SPECIAL special_imp) +set_property(TARGET importedFallback2 PROPERTY MAP_IMPORTED_CONFIG_NOCONFIG SPECIAL "") +set_property(TARGET importedFallback2 PROPERTY MAP_IMPORTED_CONFIG_DEBUG SPECIAL "") +set_property(TARGET importedFallback2 PROPERTY MAP_IMPORTED_CONFIG_RELEASE SPECIAL "") + add_library(importedFallback_genex STATIC IMPORTED) set_property(TARGET importedFallback_genex PROPERTY IMPORTED_CONFIGURATIONS RELEASE) set_property(TARGET importedFallback_genex PROPERTY IMPORTED_LOCATION_RELEASE release_loc) @@ -217,6 +232,7 @@ add_custom_target(check-part3 ALL -Dconfig=$ -Dtest_imported_includes=$ -Dtest_imported_fallback=$,fallback_loc> + -Dtest_imported_fallback2=$,$,$>>,$,special_imp>,$,fallback_loc>> -Dtest_imported_fallback_genex=$,FOOBAR=1> -Dtest_alias_file_exe=$,$> -Dtest_alias_file_lib=$,$> diff --git a/Tests/GeneratorExpression/check-part3.cmake b/Tests/GeneratorExpression/check-part3.cmake index e1b1f93..7bb0d85 100644 --- a/Tests/GeneratorExpression/check-part3.cmake +++ b/Tests/GeneratorExpression/check-part3.cmake @@ -19,6 +19,7 @@ else() endif() check(test_imported_fallback "1") +check(test_imported_fallback2 "1") check(test_imported_fallback_genex "1") check(test_alias_file_exe "1") -- cgit v0.12