| 672 | } |
| 673 | |
| 674 | bool cmExportFileGenerator::PopulateCxxModuleExportProperties( |
| 675 | cmGeneratorTarget const* gte, ImportPropertyMap& properties, |
| 676 | cmGeneratorExpression::PreprocessContext ctx, |
| 677 | std::string const& includesDestinationDirs, std::string& errorMessage) |
| 678 | { |
| 679 | if (!gte->HaveCxx20ModuleSources(&errorMessage)) { |
| 680 | return true; |
| 681 | } |
| 682 | |
| 683 | struct ModuleTargetPropertyTable |
| 684 | { |
| 685 | cm::static_string_view Name; |
| 686 | ExportWhen Cond; |
| 687 | }; |
| 688 | |
| 689 | ModuleTargetPropertyTable const exportedDirectModuleProperties[] = { |
| 690 | { "CXX_EXTENSIONS"_s, ExportWhen::Defined }, |
| 691 | // Always define this property as it is an intrinsic property of the target |
| 692 | // and should not be inherited from the in-scope `CMAKE_CXX_MODULE_STD` |
| 693 | // variable. |
| 694 | // |
| 695 | // TODO(cxxmodules): A future policy may make this "ON" based on the target |
| 696 | // policies if unset. Add a new `ExportWhen` condition to handle it when |
| 697 | // this happens. |
| 698 | { "CXX_MODULE_STD"_s, ExportWhen::Always }, |
| 699 | }; |
| 700 | for (auto const& prop : exportedDirectModuleProperties) { |
| 701 | auto const propNameStr = std::string(prop.Name); |
| 702 | cmValue propValue = gte->Target->GetComputedProperty( |
| 703 | propNameStr, *gte->Target->GetMakefile()); |
| 704 | if (!propValue) { |
| 705 | propValue = gte->Target->GetProperty(propNameStr); |
| 706 | } |
| 707 | if (propValue) { |
| 708 | properties[propNameStr] = |
| 709 | cmGeneratorExpression::Preprocess(*propValue, ctx); |
| 710 | } else if (prop.Cond == ExportWhen::Always) { |
| 711 | properties[propNameStr] = ""; |
| 712 | } |
| 713 | } |
| 714 | |
| 715 | struct ModulePropertyTable |
| 716 | { |
| 717 | cm::static_string_view Name; |
| 718 | PropertyType Type; |
| 719 | }; |
| 720 | |
| 721 | ModulePropertyTable const exportedModuleProperties[] = { |
| 722 | { "INCLUDE_DIRECTORIES"_s, PropertyType::IncludePaths }, |
| 723 | { "COMPILE_DEFINITIONS"_s, PropertyType::Strings }, |
| 724 | { "COMPILE_OPTIONS"_s, PropertyType::Strings }, |
| 725 | { "COMPILE_FEATURES"_s, PropertyType::Strings }, |
| 726 | }; |
| 727 | for (auto const& propEntry : exportedModuleProperties) { |
| 728 | auto const propNameStr = std::string(propEntry.Name); |
| 729 | cmValue prop = gte->Target->GetComputedProperty( |
| 730 | propNameStr, *gte->Target->GetMakefile()); |
| 731 | if (!prop) { |
no test coverage detected