From 67466ddf65aafa02a19225b306bd712c2be3fb7f Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 20 Feb 2024 07:38:58 -0500 Subject: cmExportFileGenerator: export link libraries as-is This allows for transitive modules to work because `$`-wrapped dependencies do not end up in the `linked-target-dirs` collator property. Test suite exported property tests updated to account for the change. --- Source/cmExportFileGenerator.cxx | 6 +----- .../examples/export-transitive-targets-build/test/CMakeLists.txt | 2 +- .../examples/export-transitive-targets-install/test/CMakeLists.txt | 2 +- .../CXXModules/examples/export-usage-build/test/CMakeLists.txt | 2 +- .../CXXModules/examples/export-usage-install/test/CMakeLists.txt | 2 +- 5 files changed, 5 insertions(+), 9 deletions(-) diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index f2742df..64448f1 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -1360,11 +1360,7 @@ bool cmExportFileGenerator::PopulateCxxModuleExportProperties( auto value = cmGeneratorExpression::Preprocess(*prop, ctx); this->ResolveTargetsInGeneratorExpressions( value, gte, cmExportFileGenerator::ReplaceFreeTargets); - std::vector wrappedValues; - for (auto& item : cmList{ value }) { - wrappedValues.push_back(cmStrCat("$')); - } - properties[exportedPropName] = cmJoin(wrappedValues, ";"); + properties[exportedPropName] = value; } } diff --git a/Tests/RunCMake/CXXModules/examples/export-transitive-targets-build/test/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/export-transitive-targets-build/test/CMakeLists.txt index 8e70576..4c6eefd 100644 --- a/Tests/RunCMake/CXXModules/examples/export-transitive-targets-build/test/CMakeLists.txt +++ b/Tests/RunCMake/CXXModules/examples/export-transitive-targets-build/test/CMakeLists.txt @@ -10,7 +10,7 @@ endif () get_property(transitive_targets TARGET CXXModules::export_transitive_targets PROPERTY IMPORTED_CXX_MODULES_LINK_LIBRARIES) -if (NOT transitive_targets STREQUAL "$") +if (NOT transitive_targets STREQUAL "CXXModules::usage_reqs") message(FATAL_ERROR "Incorrect transitive link library in C++ module interface CXXModules::export_transitive_targets:\n ${transitive_targets}") endif () diff --git a/Tests/RunCMake/CXXModules/examples/export-transitive-targets-install/test/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/export-transitive-targets-install/test/CMakeLists.txt index 8e70576..4c6eefd 100644 --- a/Tests/RunCMake/CXXModules/examples/export-transitive-targets-install/test/CMakeLists.txt +++ b/Tests/RunCMake/CXXModules/examples/export-transitive-targets-install/test/CMakeLists.txt @@ -10,7 +10,7 @@ endif () get_property(transitive_targets TARGET CXXModules::export_transitive_targets PROPERTY IMPORTED_CXX_MODULES_LINK_LIBRARIES) -if (NOT transitive_targets STREQUAL "$") +if (NOT transitive_targets STREQUAL "CXXModules::usage_reqs") message(FATAL_ERROR "Incorrect transitive link library in C++ module interface CXXModules::export_transitive_targets:\n ${transitive_targets}") endif () diff --git a/Tests/RunCMake/CXXModules/examples/export-usage-build/test/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/export-usage-build/test/CMakeLists.txt index c84153d..a88c915 100644 --- a/Tests/RunCMake/CXXModules/examples/export-usage-build/test/CMakeLists.txt +++ b/Tests/RunCMake/CXXModules/examples/export-usage-build/test/CMakeLists.txt @@ -41,7 +41,7 @@ check_property("/usr/exported;/usr/buildiface" "IMPORTED_CXX_MODULES_INCLUDE_DIR check_property("exported;buildiface" "IMPORTED_CXX_MODULES_COMPILE_DEFINITIONS") check_property("cxx_std_20;cxx_std_11;cxx_std_14" "IMPORTED_CXX_MODULES_COMPILE_FEATURES") check_property("${export_interfaces_flag}100;${export_interfaces_flag}200" "IMPORTED_CXX_MODULES_COMPILE_OPTIONS") -check_property("$;$" "IMPORTED_CXX_MODULES_LINK_LIBRARIES") +check_property("CXXModules::export_used;CXXModules::export_build" "IMPORTED_CXX_MODULES_LINK_LIBRARIES") # Extract the export-dependent targets from the export file. file(STRINGS "${export_usage_DIR}/export_usage-targets.cmake" usage_dependent_targets diff --git a/Tests/RunCMake/CXXModules/examples/export-usage-install/test/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/export-usage-install/test/CMakeLists.txt index ceb428b..67ce30a 100644 --- a/Tests/RunCMake/CXXModules/examples/export-usage-install/test/CMakeLists.txt +++ b/Tests/RunCMake/CXXModules/examples/export-usage-install/test/CMakeLists.txt @@ -41,7 +41,7 @@ check_property("/usr/exported;/usr/installiface" "IMPORTED_CXX_MODULES_INCLUDE_D check_property("exported;installiface" "IMPORTED_CXX_MODULES_COMPILE_DEFINITIONS") check_property("cxx_std_20;cxx_std_11;cxx_std_17" "IMPORTED_CXX_MODULES_COMPILE_FEATURES") check_property("${export_interfaces_flag}100;${export_interfaces_flag}300" "IMPORTED_CXX_MODULES_COMPILE_OPTIONS") -check_property("$;$" "IMPORTED_CXX_MODULES_LINK_LIBRARIES") +check_property("CXXModules::export_used;CXXModules::export_install" "IMPORTED_CXX_MODULES_LINK_LIBRARIES") # Extract the export-dependent targets from the export file. file(STRINGS "${export_usage_DIR}/export_usage-targets.cmake" usage_dependent_targets -- cgit v0.12