diff options
author | Ben Boeckel <ben.boeckel@kitware.com> | 2023-09-26 12:51:12 (GMT) |
---|---|---|
committer | Ben Boeckel <ben.boeckel@kitware.com> | 2023-09-26 18:32:46 (GMT) |
commit | b3d1bbbbcc841b452f132b9927bef1424625d923 (patch) | |
tree | 535ed3f33b620b081b8203633ab8ac997ce20abe | |
parent | 349ff8b080d7075d3773a5c9dbf4f0545bb92163 (diff) | |
download | CMake-b3d1bbbbcc841b452f132b9927bef1424625d923.zip CMake-b3d1bbbbcc841b452f132b9927bef1424625d923.tar.gz CMake-b3d1bbbbcc841b452f132b9927bef1424625d923.tar.bz2 |
cmExportFileGenerator: relocate include directories for C++ modules
Include directories are paths that need munged on install to support the
installation prefix.
Fixes: #25275
-rw-r--r-- | Source/cmExportFileGenerator.cxx | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index 5a12297..dae061b 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -1256,6 +1256,18 @@ void cmExportFileGenerator::GenerateImportedFileChecksCode( os << ")\n\n"; } +enum class PropertyType +{ + Strings, + Paths, +}; + +struct ModulePropertyTable +{ + cm::static_string_view Name; + PropertyType Type; +}; + bool cmExportFileGenerator::PopulateCxxModuleExportProperties( cmGeneratorTarget const* gte, ImportPropertyMap& properties, cmGeneratorExpression::PreprocessContext ctx, std::string& errorMessage) @@ -1279,14 +1291,14 @@ bool cmExportFileGenerator::PopulateCxxModuleExportProperties( } } - const cm::static_string_view exportedModuleProperties[] = { - "INCLUDE_DIRECTORIES"_s, - "COMPILE_DEFINITIONS"_s, - "COMPILE_OPTIONS"_s, - "COMPILE_FEATURES"_s, + const ModulePropertyTable exportedModuleProperties[] = { + { "INCLUDE_DIRECTORIES"_s, PropertyType::Paths }, + { "COMPILE_DEFINITIONS"_s, PropertyType::Strings }, + { "COMPILE_OPTIONS"_s, PropertyType::Strings }, + { "COMPILE_FEATURES"_s, PropertyType::Strings }, }; - for (auto const& propName : exportedModuleProperties) { - auto const propNameStr = std::string(propName); + for (auto const& propEntry : exportedModuleProperties) { + auto const propNameStr = std::string(propEntry.Name); cmValue prop = gte->Target->GetComputedProperty( propNameStr, *gte->Target->GetMakefile()); if (!prop) { @@ -1294,9 +1306,14 @@ bool cmExportFileGenerator::PopulateCxxModuleExportProperties( } if (prop) { auto const exportedPropName = - cmStrCat("IMPORTED_CXX_MODULES_", propName); + cmStrCat("IMPORTED_CXX_MODULES_", propEntry.Name); properties[exportedPropName] = cmGeneratorExpression::Preprocess(*prop, ctx); + if (ctx == cmGeneratorExpression::InstallInterface && + propEntry.Type == PropertyType::Paths) { + this->ReplaceInstallPrefix(properties[exportedPropName]); + prefixItems(properties[exportedPropName]); + } } } |