diff options
author | Ben Boeckel <ben.boeckel@kitware.com> | 2024-03-02 05:09:26 (GMT) |
---|---|---|
committer | Ben Boeckel <ben.boeckel@kitware.com> | 2024-04-11 14:19:43 (GMT) |
commit | 3273b1897290731acbc3cdf9d5bc73f34a170772 (patch) | |
tree | af57867a93891bf925d9a48b44a118e7a0dadbcc /Source/cmExportFileGenerator.cxx | |
parent | 5bbd2c12dbef5aec8988b40d807037ae59fdb794 (diff) | |
download | CMake-3273b1897290731acbc3cdf9d5bc73f34a170772.zip CMake-3273b1897290731acbc3cdf9d5bc73f34a170772.tar.gz CMake-3273b1897290731acbc3cdf9d5bc73f34a170772.tar.bz2 |
cmExportFileGenerator: support always exporting properties
Diffstat (limited to 'Source/cmExportFileGenerator.cxx')
-rw-r--r-- | Source/cmExportFileGenerator.cxx | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index 7867a8e..2d48f34 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -1388,6 +1388,12 @@ void cmExportFileGenerator::GenerateImportedFileChecksCode( os << ")\n\n"; } +enum class ExportWhen +{ + Defined, + Always, +}; + enum class PropertyType { Strings, @@ -1409,6 +1415,12 @@ bool PropertyTypeIsForPaths(PropertyType pt) } } +struct ModuleTargetPropertyTable +{ + cm::static_string_view Name; + ExportWhen Cond; +}; + struct ModulePropertyTable { cm::static_string_view Name; @@ -1424,18 +1436,21 @@ bool cmExportFileGenerator::PopulateCxxModuleExportProperties( return true; } - const cm::static_string_view exportedDirectModuleProperties[] = { - "CXX_EXTENSIONS"_s, + const ModuleTargetPropertyTable exportedDirectModuleProperties[] = { + { "CXX_EXTENSIONS"_s, ExportWhen::Defined }, }; - for (auto const& propName : exportedDirectModuleProperties) { - auto const propNameStr = std::string(propName); - cmValue prop = gte->Target->GetComputedProperty( + for (auto const& prop : exportedDirectModuleProperties) { + auto const propNameStr = std::string(prop.Name); + cmValue propValue = gte->Target->GetComputedProperty( propNameStr, *gte->Target->GetMakefile()); - if (!prop) { - prop = gte->Target->GetProperty(propNameStr); + if (!propValue) { + propValue = gte->Target->GetProperty(propNameStr); } - if (prop) { - properties[propNameStr] = cmGeneratorExpression::Preprocess(*prop, ctx); + if (propValue) { + properties[propNameStr] = + cmGeneratorExpression::Preprocess(*propValue, ctx); + } else if (prop.Cond == ExportWhen::Always) { + properties[propNameStr] = ""; } } |