mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-14 19:08:07 +08:00
cmExportFileGenerator: export link libraries as-is
This allows for transitive modules to work because `$<COMPILE_ONLY>`-wrapped dependencies do not end up in the `linked-target-dirs` collator property. Test suite exported property tests updated to account for the change.
This commit is contained in:
@@ -1360,11 +1360,7 @@ bool cmExportFileGenerator::PopulateCxxModuleExportProperties(
|
|||||||
auto value = cmGeneratorExpression::Preprocess(*prop, ctx);
|
auto value = cmGeneratorExpression::Preprocess(*prop, ctx);
|
||||||
this->ResolveTargetsInGeneratorExpressions(
|
this->ResolveTargetsInGeneratorExpressions(
|
||||||
value, gte, cmExportFileGenerator::ReplaceFreeTargets);
|
value, gte, cmExportFileGenerator::ReplaceFreeTargets);
|
||||||
std::vector<std::string> wrappedValues;
|
properties[exportedPropName] = value;
|
||||||
for (auto& item : cmList{ value }) {
|
|
||||||
wrappedValues.push_back(cmStrCat("$<COMPILE_ONLY:", item, '>'));
|
|
||||||
}
|
|
||||||
properties[exportedPropName] = cmJoin(wrappedValues, ";");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -10,7 +10,7 @@ endif ()
|
|||||||
|
|
||||||
get_property(transitive_targets TARGET CXXModules::export_transitive_targets
|
get_property(transitive_targets TARGET CXXModules::export_transitive_targets
|
||||||
PROPERTY IMPORTED_CXX_MODULES_LINK_LIBRARIES)
|
PROPERTY IMPORTED_CXX_MODULES_LINK_LIBRARIES)
|
||||||
if (NOT transitive_targets STREQUAL "$<COMPILE_ONLY:CXXModules::usage_reqs>")
|
if (NOT transitive_targets STREQUAL "CXXModules::usage_reqs")
|
||||||
message(FATAL_ERROR
|
message(FATAL_ERROR
|
||||||
"Incorrect transitive link library in C++ module interface CXXModules::export_transitive_targets:\n ${transitive_targets}")
|
"Incorrect transitive link library in C++ module interface CXXModules::export_transitive_targets:\n ${transitive_targets}")
|
||||||
endif ()
|
endif ()
|
||||||
|
@@ -10,7 +10,7 @@ endif ()
|
|||||||
|
|
||||||
get_property(transitive_targets TARGET CXXModules::export_transitive_targets
|
get_property(transitive_targets TARGET CXXModules::export_transitive_targets
|
||||||
PROPERTY IMPORTED_CXX_MODULES_LINK_LIBRARIES)
|
PROPERTY IMPORTED_CXX_MODULES_LINK_LIBRARIES)
|
||||||
if (NOT transitive_targets STREQUAL "$<COMPILE_ONLY:CXXModules::usage_reqs>")
|
if (NOT transitive_targets STREQUAL "CXXModules::usage_reqs")
|
||||||
message(FATAL_ERROR
|
message(FATAL_ERROR
|
||||||
"Incorrect transitive link library in C++ module interface CXXModules::export_transitive_targets:\n ${transitive_targets}")
|
"Incorrect transitive link library in C++ module interface CXXModules::export_transitive_targets:\n ${transitive_targets}")
|
||||||
endif ()
|
endif ()
|
||||||
|
@@ -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("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("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("${export_interfaces_flag}100;${export_interfaces_flag}200" "IMPORTED_CXX_MODULES_COMPILE_OPTIONS")
|
||||||
check_property("$<COMPILE_ONLY:CXXModules::export_used>;$<COMPILE_ONLY:CXXModules::export_build>" "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.
|
# Extract the export-dependent targets from the export file.
|
||||||
file(STRINGS "${export_usage_DIR}/export_usage-targets.cmake" usage_dependent_targets
|
file(STRINGS "${export_usage_DIR}/export_usage-targets.cmake" usage_dependent_targets
|
||||||
|
@@ -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("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("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("${export_interfaces_flag}100;${export_interfaces_flag}300" "IMPORTED_CXX_MODULES_COMPILE_OPTIONS")
|
||||||
check_property("$<COMPILE_ONLY:CXXModules::export_used>;$<COMPILE_ONLY:CXXModules::export_install>" "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.
|
# Extract the export-dependent targets from the export file.
|
||||||
file(STRINGS "${export_usage_DIR}/export_usage-targets.cmake" usage_dependent_targets
|
file(STRINGS "${export_usage_DIR}/export_usage-targets.cmake" usage_dependent_targets
|
||||||
|
Reference in New Issue
Block a user