Merge topic 'fix-synth-preproc-cxx-options'

6fb8e308df c++modules: Account for preprocessor flags in compile options

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12310
This commit is contained in:
Brad King
2026-07-24 08:16:37 -04:00
committed by Kitware Robot
13 changed files with 284 additions and 743 deletions
+206 -39
View File
@@ -4,15 +4,16 @@
#include <algorithm>
#include <set>
#include <utility>
#include <vector>
#include <cm/string_view>
#include <cmext/string_view>
#include "cmCryptoHash.h"
#include "cmGeneratorTarget.h"
#include "cmListFileCache.h"
#include "cmMakefile.h"
#include "cmRange.h"
#include "cmStringAlgorithms.h"
#include "cmTarget.h"
#include "cmValue.h"
@@ -70,34 +71,6 @@ bool IsGNUWarning(cm::string_view flag)
return long_names.find(flag) != long_names.end();
}
bool UnknownFilter(cm::string_view)
{
return false;
}
using FlagFilter = bool (*)(cm::string_view flag);
FlagFilter GetFlagFilter(cmGeneratorTarget const* gt)
{
static FlagFilter filter = nullptr;
if (filter) {
return filter;
}
cmValue frontendVariant =
gt->Makefile->GetDefinition("CMAKE_CXX_COMPILER_FRONTEND_VARIANT");
if (frontendVariant == "GNU") {
filter = IsGNUWarning;
} else if (frontendVariant == "MSVC") {
filter = IsMSVCWarning;
} else {
filter = UnknownFilter;
}
return filter;
}
void AppendUsage(std::string& usageHashInput, std::string const& entry)
{
usageHashInput += entry;
@@ -121,28 +94,216 @@ void AppendUsageEntries(std::string& usageHashInput, Range const& entries)
usageHashInput.push_back('\0');
}
enum class CompileOptionUsage
{
Hash,
Ignore,
SavePreprocessor,
};
struct CompileOptionClassification
{
CompileOptionClassification(
CompileOptionUsage usage = CompileOptionUsage::Hash,
bool saveFollowingArgument = false)
: Usage(usage)
, SaveFollowingArgument(saveFollowingArgument)
{
}
CompileOptionUsage Usage = CompileOptionUsage::Hash;
bool SaveFollowingArgument = false;
};
CompileOptionClassification SaveIfStartsWith(cm::string_view flag,
cm::string_view prefix)
{
if (flag.rfind(prefix, 0) == 0) {
return { CompileOptionUsage::SavePreprocessor,
flag.size() == prefix.size() };
}
return {};
}
CompileOptionClassification ClassifyGNUCompileOption(cm::string_view flag)
{
if (IsGNUWarning(flag)) {
return { CompileOptionUsage::Ignore, false };
}
if (flag.size() < 2 || flag.front() != '-') {
return {};
}
flag.remove_prefix(1);
switch (flag.front()) {
case 'D':
case 'I':
case 'U':
return { CompileOptionUsage::SavePreprocessor, flag.size() == 1 };
case 'i': {
CompileOptionClassification classification =
SaveIfStartsWith(flag, "isystem"_s);
if (classification.Usage != CompileOptionUsage::Hash) {
return classification;
}
}
{
CompileOptionClassification classification =
SaveIfStartsWith(flag, "iquote"_s);
if (classification.Usage != CompileOptionUsage::Hash) {
return classification;
}
}
{
CompileOptionClassification classification =
SaveIfStartsWith(flag, "idirafter"_s);
if (classification.Usage != CompileOptionUsage::Hash) {
return classification;
}
}
{
CompileOptionClassification classification =
SaveIfStartsWith(flag, "include"_s);
if (classification.Usage != CompileOptionUsage::Hash) {
return classification;
}
}
{
CompileOptionClassification classification =
SaveIfStartsWith(flag, "imacros"_s);
if (classification.Usage != CompileOptionUsage::Hash) {
return classification;
}
}
break;
case '-':
flag.remove_prefix(1);
return SaveIfStartsWith(flag, "embed-dir"_s);
default:
break;
}
return {};
}
CompileOptionClassification ClassifyMSVCCompileOption(cm::string_view flag)
{
if (IsMSVCWarning(flag)) {
return { CompileOptionUsage::Ignore, false };
}
if (flag.size() < 2 || (flag.front() != '/' && flag.front() != '-')) {
return {};
}
flag.remove_prefix(1);
switch (flag.front()) {
case 'D':
case 'I':
case 'U':
return { CompileOptionUsage::SavePreprocessor, flag.size() == 1 };
default:
break;
}
return {};
}
CompileOptionClassification ClassifyUnknownCompileOption(cm::string_view flag)
{
static_cast<void>(flag);
return {};
}
using CompileOptionClassifier =
CompileOptionClassification (*)(cm::string_view flag);
CompileOptionClassifier GetCompileOptionClassifier(cmGeneratorTarget const* gt)
{
static CompileOptionClassifier classifier = nullptr;
if (classifier) {
return classifier;
}
cmValue frontendVariant =
gt->Makefile->GetDefinition("CMAKE_CXX_COMPILER_FRONTEND_VARIANT");
if (frontendVariant == "GNU") {
classifier = ClassifyGNUCompileOption;
} else if (frontendVariant == "MSVC") {
classifier = ClassifyMSVCCompileOption;
} else {
classifier = ClassifyUnknownCompileOption;
}
return classifier;
}
struct SplitCompileOptionsResult
{
std::vector<BT<std::string>> HashEntries;
std::vector<BT<std::string>> PreprocessorEntries;
};
template <typename Range>
SplitCompileOptionsResult SplitCompileOptions(Range const& entries,
CompileOptionClassifier classify)
{
SplitCompileOptionsResult result;
for (auto it = entries.begin(); it != entries.end(); ++it) {
BT<std::string> const& option = *it;
auto const classification = classify(option.Value);
switch (classification.Usage) {
case CompileOptionUsage::Ignore:
continue;
case CompileOptionUsage::SavePreprocessor:
result.PreprocessorEntries.push_back(option);
if (classification.SaveFollowingArgument) {
auto next = it;
++next;
if (next != entries.end()) {
result.PreprocessorEntries.push_back(*next);
it = next;
}
}
continue;
case CompileOptionUsage::Hash:
break;
}
result.HashEntries.push_back(option);
}
return result;
}
}
cmCxxModuleUsageEffects::cmCxxModuleUsageEffects(cmGeneratorTarget const* gt,
std::string const& config)
{
auto const* tgt = gt->Target;
auto const filter = GetFlagFilter(gt);
auto const classify = GetCompileOptionClassifier(gt);
std::string usageHashInput;
if (tgt->IsImported()) {
AppendUsageEntries(usageHashInput,
tgt->GetImportedCxxModulesCompileFeaturesEntries());
AppendUsageEntries(
usageHashInput,
tgt->GetImportedCxxModulesCompileOptionsEntries().filter(
[&](const BT<std::string>& flag) { return !filter(flag.Value); }));
auto compileOptions = SplitCompileOptions(
tgt->GetImportedCxxModulesCompileOptionsEntries(), classify);
this->PreprocessorCompileOptions =
std::move(compileOptions.PreprocessorEntries);
AppendUsageEntries(usageHashInput, compileOptions.HashEntries);
} else {
AppendUsageEntries(usageHashInput,
cmMakeRange(gt->GetCompileOptions(config, "CXX"))
.filter([&](const BT<std::string>& flag) {
return !filter(flag.Value);
}));
auto compileOptions =
SplitCompileOptions(gt->GetCompileOptions(config, "CXX"), classify);
this->PreprocessorCompileOptions =
std::move(compileOptions.PreprocessorEntries);
AppendUsageEntries(usageHashInput, compileOptions.HashEntries);
cmValue langStd = gt->GetLanguageStandard("CXX", config);
if (!langStd) {
@@ -167,3 +328,9 @@ std::string const& cmCxxModuleUsageEffects::GetHash() const
{
return this->Hash;
}
std::vector<BT<std::string>> const&
cmCxxModuleUsageEffects::GetPreprocessorCompileOptions() const
{
return this->PreprocessorCompileOptions;
}
+5
View File
@@ -5,6 +5,9 @@
#include "cmConfigure.h" // IWYU pragma: keep
#include <string>
#include <vector>
#include "cmListFileCache.h"
class cmGeneratorTarget;
@@ -14,7 +17,9 @@ public:
cmCxxModuleUsageEffects(cmGeneratorTarget const* gt,
std::string const& config);
std::string const& GetHash() const;
std::vector<BT<std::string>> const& GetPreprocessorCompileOptions() const;
private:
std::string Hash;
std::vector<BT<std::string>> PreprocessorCompileOptions;
};
+7
View File
@@ -5565,6 +5565,13 @@ cmGeneratorTarget const* cmGeneratorTarget::GetCxxSyntheticTarget(
// compile features and options.
tgt->CopyUsageEffects(&bmiConsumer, config);
auto const& preprocessorCompileOptions =
this->GetCxxModuleUsageEffects(config).GetPreprocessorCompileOptions();
for (auto it = preprocessorCompileOptions.rbegin();
it != preprocessorCompileOptions.rend(); ++it) {
tgt->InsertCompileOption(*it, true);
}
// Copy properties which don't effect consumer compatibility
tgt->CopyCxxModulesEntries(model);
@@ -185,7 +185,7 @@
}
],
"visible-sets": [
"CXXModules__export_build_database@synth_1@<CONFIG>"
"CXXModules__export_build_database@synth_0@<CONFIG>"
]
},
{
@@ -251,7 +251,7 @@
}
],
"visible-sets": [
"CXXModules__export_build_database@synth_1@<CONFIG_OTHER>"
"CXXModules__export_build_database@synth_0@<CONFIG_OTHER>"
]
},
{
@@ -275,8 +275,10 @@
"-Dfrom_cmake_cxx_flags",
"-Dfrom_cmake_cxx_<CONFIG_LOWER>_flags",
"<CXX20_OPTION>",
"-Dtarget_interface_option",
"-Dfrom_compile_options",
"-Dtarget_private_option",
"-Dtarget_public_option",
"-Dtarget_interface_option",
"-Ddep_interface_option",
"PATH:-Ddepflag=\"CMakeFiles/CXXModules__export_build_database@synth_0.dir<CONFIG_DIR>/.d\"",
"REGEX:<BMI_ONLY_FLAG>",
@@ -299,8 +301,10 @@
"-Dfrom_cmake_cxx_flags",
"-Dfrom_cmake_cxx_<CONFIG_LOWER>_flags",
"<CXX20_OPTION>",
"-Dtarget_interface_option",
"-Dfrom_compile_options",
"-Dtarget_private_option",
"-Dtarget_public_option",
"-Dtarget_interface_option",
"-Ddep_interface_option"
],
"local-arguments": [
@@ -318,8 +322,10 @@
"-Dfrom_cmake_cxx_flags",
"-Dfrom_cmake_cxx_<CONFIG_LOWER>_flags",
"<CXX20_OPTION>",
"-Dtarget_interface_option",
"-Dfrom_compile_options",
"-Dtarget_private_option",
"-Dtarget_public_option",
"-Dtarget_interface_option",
"-Ddep_interface_option"
],
"private": false,
@@ -354,8 +360,10 @@
"-Dfrom_cmake_cxx_flags",
"-Dfrom_cmake_cxx_<CONFIG_OTHER_LOWER>_flags",
"<CXX20_OPTION>",
"-Dtarget_interface_option",
"-Dfrom_compile_options",
"-Dtarget_private_option",
"-Dtarget_public_option",
"-Dtarget_interface_option",
"-Ddep_interface_option",
"PATH:-Ddepflag=\"CMakeFiles/CXXModules__export_build_database@synth_0.dir<CONFIG_OTHER_DIR>/.d\"",
"REGEX:<BMI_ONLY_FLAG>",
@@ -363,172 +371,6 @@
"REGEX:-[cv]",
"PATH:<SOURCE_DIR>/exp-builddb/importable.cxx"
],
"baseline-arguments": [
"-D_MBCS",
"-Ddep_interface_define",
"-Dfrom_compile_definitions",
"-Dtarget_interface_define",
"-Dtarget_private_define",
"-Dtarget_public_define",
"PATH:-I<SOURCE_DIR>/exp-builddb/from_include_directories",
"PATH:-I<SOURCE_DIR>/exp-builddb/target_private_include",
"PATH:-I<SOURCE_DIR>/exp-builddb/target_public_include",
"PATH:-I<SOURCE_DIR>/exp-builddb/dep_interface_include",
"PATH:-I<SOURCE_DIR>/exp-builddb/target_interface_include",
"-Dfrom_cmake_cxx_flags",
"-Dfrom_cmake_cxx_<CONFIG_OTHER_LOWER>_flags",
"<CXX20_OPTION>",
"-Dtarget_interface_option",
"-Dtarget_public_option",
"-Ddep_interface_option"
],
"local-arguments": [
"-D_MBCS",
"-Ddep_interface_define",
"-Dfrom_compile_definitions",
"-Dtarget_interface_define",
"-Dtarget_private_define",
"-Dtarget_public_define",
"PATH:-I<SOURCE_DIR>/exp-builddb/from_include_directories",
"PATH:-I<SOURCE_DIR>/exp-builddb/target_private_include",
"PATH:-I<SOURCE_DIR>/exp-builddb/target_public_include",
"PATH:-I<SOURCE_DIR>/exp-builddb/dep_interface_include",
"PATH:-I<SOURCE_DIR>/exp-builddb/target_interface_include",
"-Dfrom_cmake_cxx_flags",
"-Dfrom_cmake_cxx_<CONFIG_OTHER_LOWER>_flags",
"<CXX20_OPTION>",
"-Dtarget_interface_option",
"-Dtarget_public_option",
"-Ddep_interface_option"
],
"private": false,
"provides": {
"importable": "<IGNORE>"
},
"requires": [],
"source": "PATH:<SOURCE_DIR>/exp-builddb/importable.cxx",
"work-directory": "<BINARY_DIR>"
}
],
"visible-sets": []
},
{
"family-name": "REGEX:CXXModules::export_build_database@<HEX>",
"name": "CXXModules__export_build_database@synth_1@<CONFIG>",
"translation-units": [
{
"arguments": [
"<IGNORE>",
"-D_MBCS",
"-Ddep_interface_define",
"-Dfrom_compile_definitions",
"-Dtarget_interface_define",
"-Dtarget_private_define",
"-Dtarget_public_define",
"PATH:-I<SOURCE_DIR>/exp-builddb/from_include_directories",
"PATH:-I<SOURCE_DIR>/exp-builddb/target_private_include",
"PATH:-I<SOURCE_DIR>/exp-builddb/target_public_include",
"PATH:-I<SOURCE_DIR>/exp-builddb/dep_interface_include",
"PATH:-I<SOURCE_DIR>/exp-builddb/target_interface_include",
"-Dfrom_cmake_cxx_flags",
"-Dfrom_cmake_cxx_<CONFIG_LOWER>_flags",
"<CXX20_OPTION>",
"-Dfrom_compile_options",
"-Dtarget_private_option",
"-Dtarget_public_option",
"-Dtarget_interface_option",
"-Ddep_interface_option",
"PATH:-Ddepflag=\"CMakeFiles/CXXModules__export_build_database@synth_1.dir<CONFIG_DIR>/.d\"",
"REGEX:<BMI_ONLY_FLAG>",
"PATH:<OUTPUT_FLAG>CMakeFiles/CXXModules__export_build_database@synth_1.dir<CONFIG_DIR>/",
"REGEX:-[cv]",
"PATH:<SOURCE_DIR>/exp-builddb/importable.cxx"
],
"baseline-arguments": [
"-D_MBCS",
"-Ddep_interface_define",
"-Dfrom_compile_definitions",
"-Dtarget_interface_define",
"-Dtarget_private_define",
"-Dtarget_public_define",
"PATH:-I<SOURCE_DIR>/exp-builddb/from_include_directories",
"PATH:-I<SOURCE_DIR>/exp-builddb/target_private_include",
"PATH:-I<SOURCE_DIR>/exp-builddb/target_public_include",
"PATH:-I<SOURCE_DIR>/exp-builddb/dep_interface_include",
"PATH:-I<SOURCE_DIR>/exp-builddb/target_interface_include",
"-Dfrom_cmake_cxx_flags",
"-Dfrom_cmake_cxx_<CONFIG_LOWER>_flags",
"<CXX20_OPTION>",
"-Dfrom_compile_options",
"-Dtarget_private_option",
"-Dtarget_public_option",
"-Dtarget_interface_option",
"-Ddep_interface_option"
],
"local-arguments": [
"-D_MBCS",
"-Ddep_interface_define",
"-Dfrom_compile_definitions",
"-Dtarget_interface_define",
"-Dtarget_private_define",
"-Dtarget_public_define",
"PATH:-I<SOURCE_DIR>/exp-builddb/from_include_directories",
"PATH:-I<SOURCE_DIR>/exp-builddb/target_private_include",
"PATH:-I<SOURCE_DIR>/exp-builddb/target_public_include",
"PATH:-I<SOURCE_DIR>/exp-builddb/dep_interface_include",
"PATH:-I<SOURCE_DIR>/exp-builddb/target_interface_include",
"-Dfrom_cmake_cxx_flags",
"-Dfrom_cmake_cxx_<CONFIG_LOWER>_flags",
"<CXX20_OPTION>",
"-Dfrom_compile_options",
"-Dtarget_private_option",
"-Dtarget_public_option",
"-Dtarget_interface_option",
"-Ddep_interface_option"
],
"private": false,
"provides": {
"importable": "<IGNORE>"
},
"requires": [],
"source": "PATH:<SOURCE_DIR>/exp-builddb/importable.cxx",
"work-directory": "<BINARY_DIR>"
}
],
"visible-sets": []
},
{
"family-name": "REGEX:CXXModules::export_build_database@<HEX>",
"name": "CXXModules__export_build_database@synth_1@<CONFIG_OTHER>",
"translation-units": [
{
"arguments": [
"<IGNORE>",
"-D_MBCS",
"-Ddep_interface_define",
"-Dfrom_compile_definitions",
"-Dtarget_interface_define",
"-Dtarget_private_define",
"-Dtarget_public_define",
"PATH:-I<SOURCE_DIR>/exp-builddb/from_include_directories",
"PATH:-I<SOURCE_DIR>/exp-builddb/target_private_include",
"PATH:-I<SOURCE_DIR>/exp-builddb/target_public_include",
"PATH:-I<SOURCE_DIR>/exp-builddb/dep_interface_include",
"PATH:-I<SOURCE_DIR>/exp-builddb/target_interface_include",
"-Dfrom_cmake_cxx_flags",
"-Dfrom_cmake_cxx_<CONFIG_OTHER_LOWER>_flags",
"<CXX20_OPTION>",
"-Dfrom_compile_options",
"-Dtarget_private_option",
"-Dtarget_public_option",
"-Dtarget_interface_option",
"-Ddep_interface_option",
"PATH:-Ddepflag=\"CMakeFiles/CXXModules__export_build_database@synth_1.dir<CONFIG_OTHER_DIR>/.d\"",
"REGEX:<BMI_ONLY_FLAG>",
"PATH:<OUTPUT_FLAG>CMakeFiles/CXXModules__export_build_database@synth_1.dir<CONFIG_OTHER_DIR>/",
"REGEX:-[cv]",
"PATH:<SOURCE_DIR>/exp-builddb/importable.cxx"
],
"baseline-arguments": [
"-D_MBCS",
"-Ddep_interface_define",
@@ -125,91 +125,12 @@
}
],
"visible-sets": [
"CXXModules__export_build_database@synth_1@<CONFIG>"
"CXXModules__export_build_database@synth_0@<CONFIG>"
]
},
{
"family-name": "REGEX:CXXModules::export_build_database@<HEX>",
"name": "CXXModules__export_build_database@synth_0@<CONFIG>",
"translation-units": [
{
"arguments": [
"<IGNORE>",
"-D_MBCS",
"-Ddep_interface_define",
"-Dfrom_compile_definitions",
"-Dtarget_interface_define",
"-Dtarget_private_define",
"-Dtarget_public_define",
"PATH:-I<SOURCE_DIR>/exp-builddb/from_include_directories",
"PATH:-I<SOURCE_DIR>/exp-builddb/target_private_include",
"PATH:-I<SOURCE_DIR>/exp-builddb/target_public_include",
"PATH:-I<SOURCE_DIR>/exp-builddb/dep_interface_include",
"PATH:-I<SOURCE_DIR>/exp-builddb/target_interface_include",
"-Dfrom_cmake_cxx_flags",
"-Dfrom_cmake_cxx_<CONFIG_LOWER>_flags",
"<CXX20_OPTION>",
"-Dtarget_interface_option",
"-Dtarget_public_option",
"-Ddep_interface_option",
"PATH:-Ddepflag=\"CMakeFiles/CXXModules__export_build_database@synth_0.dir<CONFIG_DIR>/.d\"",
"REGEX:<BMI_ONLY_FLAG>",
"PATH:<OUTPUT_FLAG>CMakeFiles/CXXModules__export_build_database@synth_0.dir<CONFIG_DIR>/",
"REGEX:-[cv]",
"PATH:<SOURCE_DIR>/exp-builddb/importable.cxx"
],
"baseline-arguments": [
"-D_MBCS",
"-Ddep_interface_define",
"-Dfrom_compile_definitions",
"-Dtarget_interface_define",
"-Dtarget_private_define",
"-Dtarget_public_define",
"PATH:-I<SOURCE_DIR>/exp-builddb/from_include_directories",
"PATH:-I<SOURCE_DIR>/exp-builddb/target_private_include",
"PATH:-I<SOURCE_DIR>/exp-builddb/target_public_include",
"PATH:-I<SOURCE_DIR>/exp-builddb/dep_interface_include",
"PATH:-I<SOURCE_DIR>/exp-builddb/target_interface_include",
"-Dfrom_cmake_cxx_flags",
"-Dfrom_cmake_cxx_<CONFIG_LOWER>_flags",
"<CXX20_OPTION>",
"-Dtarget_interface_option",
"-Dtarget_public_option",
"-Ddep_interface_option"
],
"local-arguments": [
"-D_MBCS",
"-Ddep_interface_define",
"-Dfrom_compile_definitions",
"-Dtarget_interface_define",
"-Dtarget_private_define",
"-Dtarget_public_define",
"PATH:-I<SOURCE_DIR>/exp-builddb/from_include_directories",
"PATH:-I<SOURCE_DIR>/exp-builddb/target_private_include",
"PATH:-I<SOURCE_DIR>/exp-builddb/target_public_include",
"PATH:-I<SOURCE_DIR>/exp-builddb/dep_interface_include",
"PATH:-I<SOURCE_DIR>/exp-builddb/target_interface_include",
"-Dfrom_cmake_cxx_flags",
"-Dfrom_cmake_cxx_<CONFIG_LOWER>_flags",
"<CXX20_OPTION>",
"-Dtarget_interface_option",
"-Dtarget_public_option",
"-Ddep_interface_option"
],
"private": false,
"provides": {
"importable": "<IGNORE>"
},
"requires": [],
"source": "PATH:<SOURCE_DIR>/exp-builddb/importable.cxx",
"work-directory": "<BINARY_DIR>"
}
],
"visible-sets": []
},
{
"family-name": "REGEX:CXXModules::export_build_database@<HEX>",
"name": "CXXModules__export_build_database@synth_1@<CONFIG>",
"translation-units": [
{
"arguments": [
@@ -233,9 +154,9 @@
"-Dtarget_public_option",
"-Dtarget_interface_option",
"-Ddep_interface_option",
"PATH:-Ddepflag=\"CMakeFiles/CXXModules__export_build_database@synth_1.dir<CONFIG_DIR>/.d\"",
"PATH:-Ddepflag=\"CMakeFiles/CXXModules__export_build_database@synth_0.dir<CONFIG_DIR>/.d\"",
"REGEX:<BMI_ONLY_FLAG>",
"PATH:<OUTPUT_FLAG>CMakeFiles/CXXModules__export_build_database@synth_1.dir<CONFIG_DIR>/",
"PATH:<OUTPUT_FLAG>CMakeFiles/CXXModules__export_build_database@synth_0.dir<CONFIG_DIR>/",
"REGEX:-[cv]",
"PATH:<SOURCE_DIR>/exp-builddb/importable.cxx"
],
@@ -125,91 +125,12 @@
}
],
"visible-sets": [
"CXXModules__export_build_database@synth_1@<CONFIG>"
"CXXModules__export_build_database@synth_0@<CONFIG>"
]
},
{
"family-name": "REGEX:CXXModules::export_build_database@<HEX>",
"name": "CXXModules__export_build_database@synth_0@<CONFIG>",
"translation-units": [
{
"arguments": [
"<IGNORE>",
"-D_MBCS",
"-Ddep_interface_define",
"-Dfrom_compile_definitions",
"-Dtarget_interface_define",
"-Dtarget_private_define",
"-Dtarget_public_define",
"PATH:-I<SOURCE_DIR>/exp-builddb/from_include_directories",
"PATH:-I<SOURCE_DIR>/exp-builddb/target_private_include",
"PATH:-I<SOURCE_DIR>/exp-builddb/target_public_include",
"PATH:-I<SOURCE_DIR>/exp-builddb/dep_interface_include",
"PATH:-I<SOURCE_DIR>/exp-builddb/target_interface_include",
"-Dfrom_cmake_cxx_flags",
"-Dfrom_cmake_cxx_<CONFIG_LOWER>_flags",
"<CXX20_OPTION>",
"-Dtarget_interface_option",
"-Dtarget_public_option",
"-Ddep_interface_option",
"PATH:-Ddepflag=\"CMakeFiles/CXXModules__export_build_database@synth_0.dir<CONFIG_DIR>/.d\"",
"REGEX:<BMI_ONLY_FLAG>",
"PATH:<OUTPUT_FLAG>CMakeFiles/CXXModules__export_build_database@synth_0.dir<CONFIG_DIR>/",
"REGEX:-[cv]",
"PATH:<SOURCE_DIR>/exp-builddb/importable.cxx"
],
"baseline-arguments": [
"-D_MBCS",
"-Ddep_interface_define",
"-Dfrom_compile_definitions",
"-Dtarget_interface_define",
"-Dtarget_private_define",
"-Dtarget_public_define",
"PATH:-I<SOURCE_DIR>/exp-builddb/from_include_directories",
"PATH:-I<SOURCE_DIR>/exp-builddb/target_private_include",
"PATH:-I<SOURCE_DIR>/exp-builddb/target_public_include",
"PATH:-I<SOURCE_DIR>/exp-builddb/dep_interface_include",
"PATH:-I<SOURCE_DIR>/exp-builddb/target_interface_include",
"-Dfrom_cmake_cxx_flags",
"-Dfrom_cmake_cxx_<CONFIG_LOWER>_flags",
"<CXX20_OPTION>",
"-Dtarget_interface_option",
"-Dtarget_public_option",
"-Ddep_interface_option"
],
"local-arguments": [
"-D_MBCS",
"-Ddep_interface_define",
"-Dfrom_compile_definitions",
"-Dtarget_interface_define",
"-Dtarget_private_define",
"-Dtarget_public_define",
"PATH:-I<SOURCE_DIR>/exp-builddb/from_include_directories",
"PATH:-I<SOURCE_DIR>/exp-builddb/target_private_include",
"PATH:-I<SOURCE_DIR>/exp-builddb/target_public_include",
"PATH:-I<SOURCE_DIR>/exp-builddb/dep_interface_include",
"PATH:-I<SOURCE_DIR>/exp-builddb/target_interface_include",
"-Dfrom_cmake_cxx_flags",
"-Dfrom_cmake_cxx_<CONFIG_LOWER>_flags",
"<CXX20_OPTION>",
"-Dtarget_interface_option",
"-Dtarget_public_option",
"-Ddep_interface_option"
],
"private": false,
"provides": {
"importable": "<IGNORE>"
},
"requires": [],
"source": "PATH:<SOURCE_DIR>/exp-builddb/importable.cxx",
"work-directory": "<BINARY_DIR>"
}
],
"visible-sets": []
},
{
"family-name": "REGEX:CXXModules::export_build_database@<HEX>",
"name": "CXXModules__export_build_database@synth_1@<CONFIG>",
"translation-units": [
{
"arguments": [
@@ -233,9 +154,9 @@
"-Dtarget_public_option",
"-Dtarget_interface_option",
"-Ddep_interface_option",
"PATH:-Ddepflag=\"CMakeFiles/CXXModules__export_build_database@synth_1.dir<CONFIG_DIR>/.d\"",
"PATH:-Ddepflag=\"CMakeFiles/CXXModules__export_build_database@synth_0.dir<CONFIG_DIR>/.d\"",
"REGEX:<BMI_ONLY_FLAG>",
"PATH:<OUTPUT_FLAG>CMakeFiles/CXXModules__export_build_database@synth_1.dir<CONFIG_DIR>/",
"PATH:<OUTPUT_FLAG>CMakeFiles/CXXModules__export_build_database@synth_0.dir<CONFIG_DIR>/",
"REGEX:-[cv]",
"PATH:<SOURCE_DIR>/exp-builddb/importable.cxx"
],
@@ -125,91 +125,12 @@
}
],
"visible-sets": [
"CXXModules__export_build_database@synth_1@<CONFIG>"
"CXXModules__export_build_database@synth_0@<CONFIG>"
]
},
{
"family-name": "REGEX:CXXModules::export_build_database@<HEX>",
"name": "CXXModules__export_build_database@synth_0@<CONFIG>",
"translation-units": [
{
"arguments": [
"<IGNORE>",
"-D_MBCS",
"-Ddep_interface_define",
"-Dfrom_compile_definitions",
"-Dtarget_interface_define",
"-Dtarget_private_define",
"-Dtarget_public_define",
"PATH:-I<SOURCE_DIR>/exp-builddb/from_include_directories",
"PATH:-I<SOURCE_DIR>/exp-builddb/target_private_include",
"PATH:-I<SOURCE_DIR>/exp-builddb/target_public_include",
"PATH:-I<SOURCE_DIR>/exp-builddb/dep_interface_include",
"PATH:-I<SOURCE_DIR>/exp-builddb/target_interface_include",
"-Dfrom_cmake_cxx_flags",
"-Dfrom_cmake_cxx_<CONFIG_LOWER>_flags",
"<CXX20_OPTION>",
"-Dtarget_interface_option",
"-Dtarget_public_option",
"-Ddep_interface_option",
"PATH:-Ddepflag=\"CMakeFiles/CXXModules__export_build_database@synth_0.dir<CONFIG_DIR>/.d\"",
"REGEX:<BMI_ONLY_FLAG>",
"PATH:<OUTPUT_FLAG>CMakeFiles/CXXModules__export_build_database@synth_0.dir<CONFIG_DIR>/",
"REGEX:-[cv]",
"PATH:<SOURCE_DIR>/exp-builddb/importable.cxx"
],
"baseline-arguments": [
"-D_MBCS",
"-Ddep_interface_define",
"-Dfrom_compile_definitions",
"-Dtarget_interface_define",
"-Dtarget_private_define",
"-Dtarget_public_define",
"PATH:-I<SOURCE_DIR>/exp-builddb/from_include_directories",
"PATH:-I<SOURCE_DIR>/exp-builddb/target_private_include",
"PATH:-I<SOURCE_DIR>/exp-builddb/target_public_include",
"PATH:-I<SOURCE_DIR>/exp-builddb/dep_interface_include",
"PATH:-I<SOURCE_DIR>/exp-builddb/target_interface_include",
"-Dfrom_cmake_cxx_flags",
"-Dfrom_cmake_cxx_<CONFIG_LOWER>_flags",
"<CXX20_OPTION>",
"-Dtarget_interface_option",
"-Dtarget_public_option",
"-Ddep_interface_option"
],
"local-arguments": [
"-D_MBCS",
"-Ddep_interface_define",
"-Dfrom_compile_definitions",
"-Dtarget_interface_define",
"-Dtarget_private_define",
"-Dtarget_public_define",
"PATH:-I<SOURCE_DIR>/exp-builddb/from_include_directories",
"PATH:-I<SOURCE_DIR>/exp-builddb/target_private_include",
"PATH:-I<SOURCE_DIR>/exp-builddb/target_public_include",
"PATH:-I<SOURCE_DIR>/exp-builddb/dep_interface_include",
"PATH:-I<SOURCE_DIR>/exp-builddb/target_interface_include",
"-Dfrom_cmake_cxx_flags",
"-Dfrom_cmake_cxx_<CONFIG_LOWER>_flags",
"<CXX20_OPTION>",
"-Dtarget_interface_option",
"-Dtarget_public_option",
"-Ddep_interface_option"
],
"private": false,
"provides": {
"importable": "<IGNORE>"
},
"requires": [],
"source": "PATH:<SOURCE_DIR>/exp-builddb/importable.cxx",
"work-directory": "<BINARY_DIR>"
}
],
"visible-sets": []
},
{
"family-name": "REGEX:CXXModules::export_build_database@<HEX>",
"name": "CXXModules__export_build_database@synth_1@<CONFIG>",
"translation-units": [
{
"arguments": [
@@ -233,9 +154,9 @@
"-Dtarget_public_option",
"-Dtarget_interface_option",
"-Ddep_interface_option",
"PATH:-Ddepflag=\"CMakeFiles/CXXModules__export_build_database@synth_1.dir<CONFIG_DIR>/.d\"",
"PATH:-Ddepflag=\"CMakeFiles/CXXModules__export_build_database@synth_0.dir<CONFIG_DIR>/.d\"",
"REGEX:<BMI_ONLY_FLAG>",
"PATH:<OUTPUT_FLAG>CMakeFiles/CXXModules__export_build_database@synth_1.dir<CONFIG_DIR>/",
"PATH:<OUTPUT_FLAG>CMakeFiles/CXXModules__export_build_database@synth_0.dir<CONFIG_DIR>/",
"REGEX:-[cv]",
"PATH:<SOURCE_DIR>/exp-builddb/importable.cxx"
],
@@ -185,7 +185,7 @@
}
],
"visible-sets": [
"CXXModules__export_build_database@synth_1@<CONFIG>"
"CXXModules__export_build_database@synth_0@<CONFIG>"
]
},
{
@@ -251,7 +251,7 @@
}
],
"visible-sets": [
"CXXModules__export_build_database@synth_1@<CONFIG_OTHER>"
"CXXModules__export_build_database@synth_0@<CONFIG_OTHER>"
]
},
{
@@ -275,8 +275,10 @@
"-Dfrom_cmake_cxx_flags",
"-Dfrom_cmake_cxx_<CONFIG_LOWER>_flags",
"<CXX20_OPTION>",
"-Dtarget_interface_option",
"-Dfrom_compile_options",
"-Dtarget_private_option",
"-Dtarget_public_option",
"-Dtarget_interface_option",
"-Ddep_interface_option",
"PATH:-Ddepflag=\"CMakeFiles/CXXModules__export_build_database@synth_0.dir<CONFIG_DIR>/.d\"",
"REGEX:<BMI_ONLY_FLAG>",
@@ -299,8 +301,10 @@
"-Dfrom_cmake_cxx_flags",
"-Dfrom_cmake_cxx_<CONFIG_LOWER>_flags",
"<CXX20_OPTION>",
"-Dtarget_interface_option",
"-Dfrom_compile_options",
"-Dtarget_private_option",
"-Dtarget_public_option",
"-Dtarget_interface_option",
"-Ddep_interface_option"
],
"local-arguments": [
@@ -318,8 +322,10 @@
"-Dfrom_cmake_cxx_flags",
"-Dfrom_cmake_cxx_<CONFIG_LOWER>_flags",
"<CXX20_OPTION>",
"-Dtarget_interface_option",
"-Dfrom_compile_options",
"-Dtarget_private_option",
"-Dtarget_public_option",
"-Dtarget_interface_option",
"-Ddep_interface_option"
],
"private": false,
@@ -354,8 +360,10 @@
"-Dfrom_cmake_cxx_flags",
"-Dfrom_cmake_cxx_<CONFIG_OTHER_LOWER>_flags",
"<CXX20_OPTION>",
"-Dtarget_interface_option",
"-Dfrom_compile_options",
"-Dtarget_private_option",
"-Dtarget_public_option",
"-Dtarget_interface_option",
"-Ddep_interface_option",
"PATH:-Ddepflag=\"CMakeFiles/CXXModules__export_build_database@synth_0.dir<CONFIG_OTHER_DIR>/.d\"",
"REGEX:<BMI_ONLY_FLAG>",
@@ -363,172 +371,6 @@
"REGEX:-[cv]",
"PATH:<SOURCE_DIR>/exp-builddb/importable.cxx"
],
"baseline-arguments": [
"-D_MBCS",
"-Ddep_interface_define",
"-Dfrom_compile_definitions",
"-Dtarget_interface_define",
"-Dtarget_private_define",
"-Dtarget_public_define",
"PATH:-I<SOURCE_DIR>/exp-builddb/from_include_directories",
"PATH:-I<SOURCE_DIR>/exp-builddb/target_private_include",
"PATH:-I<SOURCE_DIR>/exp-builddb/target_public_include",
"PATH:-I<SOURCE_DIR>/exp-builddb/dep_interface_include",
"PATH:-I<SOURCE_DIR>/exp-builddb/target_interface_include",
"-Dfrom_cmake_cxx_flags",
"-Dfrom_cmake_cxx_<CONFIG_OTHER_LOWER>_flags",
"<CXX20_OPTION>",
"-Dtarget_interface_option",
"-Dtarget_public_option",
"-Ddep_interface_option"
],
"local-arguments": [
"-D_MBCS",
"-Ddep_interface_define",
"-Dfrom_compile_definitions",
"-Dtarget_interface_define",
"-Dtarget_private_define",
"-Dtarget_public_define",
"PATH:-I<SOURCE_DIR>/exp-builddb/from_include_directories",
"PATH:-I<SOURCE_DIR>/exp-builddb/target_private_include",
"PATH:-I<SOURCE_DIR>/exp-builddb/target_public_include",
"PATH:-I<SOURCE_DIR>/exp-builddb/dep_interface_include",
"PATH:-I<SOURCE_DIR>/exp-builddb/target_interface_include",
"-Dfrom_cmake_cxx_flags",
"-Dfrom_cmake_cxx_<CONFIG_OTHER_LOWER>_flags",
"<CXX20_OPTION>",
"-Dtarget_interface_option",
"-Dtarget_public_option",
"-Ddep_interface_option"
],
"private": false,
"provides": {
"importable": "<IGNORE>"
},
"requires": [],
"source": "PATH:<SOURCE_DIR>/exp-builddb/importable.cxx",
"work-directory": "<BINARY_DIR>"
}
],
"visible-sets": []
},
{
"family-name": "REGEX:CXXModules::export_build_database@<HEX>",
"name": "CXXModules__export_build_database@synth_1@<CONFIG>",
"translation-units": [
{
"arguments": [
"<IGNORE>",
"-D_MBCS",
"-Ddep_interface_define",
"-Dfrom_compile_definitions",
"-Dtarget_interface_define",
"-Dtarget_private_define",
"-Dtarget_public_define",
"PATH:-I<SOURCE_DIR>/exp-builddb/from_include_directories",
"PATH:-I<SOURCE_DIR>/exp-builddb/target_private_include",
"PATH:-I<SOURCE_DIR>/exp-builddb/target_public_include",
"PATH:-I<SOURCE_DIR>/exp-builddb/dep_interface_include",
"PATH:-I<SOURCE_DIR>/exp-builddb/target_interface_include",
"-Dfrom_cmake_cxx_flags",
"-Dfrom_cmake_cxx_<CONFIG_LOWER>_flags",
"<CXX20_OPTION>",
"-Dfrom_compile_options",
"-Dtarget_private_option",
"-Dtarget_public_option",
"-Dtarget_interface_option",
"-Ddep_interface_option",
"PATH:-Ddepflag=\"CMakeFiles/CXXModules__export_build_database@synth_1.dir<CONFIG_DIR>/.d\"",
"REGEX:<BMI_ONLY_FLAG>",
"PATH:<OUTPUT_FLAG>CMakeFiles/CXXModules__export_build_database@synth_1.dir<CONFIG_DIR>/",
"REGEX:-[cv]",
"PATH:<SOURCE_DIR>/exp-builddb/importable.cxx"
],
"baseline-arguments": [
"-D_MBCS",
"-Ddep_interface_define",
"-Dfrom_compile_definitions",
"-Dtarget_interface_define",
"-Dtarget_private_define",
"-Dtarget_public_define",
"PATH:-I<SOURCE_DIR>/exp-builddb/from_include_directories",
"PATH:-I<SOURCE_DIR>/exp-builddb/target_private_include",
"PATH:-I<SOURCE_DIR>/exp-builddb/target_public_include",
"PATH:-I<SOURCE_DIR>/exp-builddb/dep_interface_include",
"PATH:-I<SOURCE_DIR>/exp-builddb/target_interface_include",
"-Dfrom_cmake_cxx_flags",
"-Dfrom_cmake_cxx_<CONFIG_LOWER>_flags",
"<CXX20_OPTION>",
"-Dfrom_compile_options",
"-Dtarget_private_option",
"-Dtarget_public_option",
"-Dtarget_interface_option",
"-Ddep_interface_option"
],
"local-arguments": [
"-D_MBCS",
"-Ddep_interface_define",
"-Dfrom_compile_definitions",
"-Dtarget_interface_define",
"-Dtarget_private_define",
"-Dtarget_public_define",
"PATH:-I<SOURCE_DIR>/exp-builddb/from_include_directories",
"PATH:-I<SOURCE_DIR>/exp-builddb/target_private_include",
"PATH:-I<SOURCE_DIR>/exp-builddb/target_public_include",
"PATH:-I<SOURCE_DIR>/exp-builddb/dep_interface_include",
"PATH:-I<SOURCE_DIR>/exp-builddb/target_interface_include",
"-Dfrom_cmake_cxx_flags",
"-Dfrom_cmake_cxx_<CONFIG_LOWER>_flags",
"<CXX20_OPTION>",
"-Dfrom_compile_options",
"-Dtarget_private_option",
"-Dtarget_public_option",
"-Dtarget_interface_option",
"-Ddep_interface_option"
],
"private": false,
"provides": {
"importable": "<IGNORE>"
},
"requires": [],
"source": "PATH:<SOURCE_DIR>/exp-builddb/importable.cxx",
"work-directory": "<BINARY_DIR>"
}
],
"visible-sets": []
},
{
"family-name": "REGEX:CXXModules::export_build_database@<HEX>",
"name": "CXXModules__export_build_database@synth_1@<CONFIG_OTHER>",
"translation-units": [
{
"arguments": [
"<IGNORE>",
"-D_MBCS",
"-Ddep_interface_define",
"-Dfrom_compile_definitions",
"-Dtarget_interface_define",
"-Dtarget_private_define",
"-Dtarget_public_define",
"PATH:-I<SOURCE_DIR>/exp-builddb/from_include_directories",
"PATH:-I<SOURCE_DIR>/exp-builddb/target_private_include",
"PATH:-I<SOURCE_DIR>/exp-builddb/target_public_include",
"PATH:-I<SOURCE_DIR>/exp-builddb/dep_interface_include",
"PATH:-I<SOURCE_DIR>/exp-builddb/target_interface_include",
"-Dfrom_cmake_cxx_flags",
"-Dfrom_cmake_cxx_<CONFIG_OTHER_LOWER>_flags",
"<CXX20_OPTION>",
"-Dfrom_compile_options",
"-Dtarget_private_option",
"-Dtarget_public_option",
"-Dtarget_interface_option",
"-Ddep_interface_option",
"PATH:-Ddepflag=\"CMakeFiles/CXXModules__export_build_database@synth_1.dir<CONFIG_OTHER_DIR>/.d\"",
"REGEX:<BMI_ONLY_FLAG>",
"PATH:<OUTPUT_FLAG>CMakeFiles/CXXModules__export_build_database@synth_1.dir<CONFIG_OTHER_DIR>/",
"REGEX:-[cv]",
"PATH:<SOURCE_DIR>/exp-builddb/importable.cxx"
],
"baseline-arguments": [
"-D_MBCS",
"-Ddep_interface_define",
@@ -125,91 +125,12 @@
}
],
"visible-sets": [
"CXXModules__export_build_database@synth_1@<CONFIG>"
"CXXModules__export_build_database@synth_0@<CONFIG>"
]
},
{
"family-name": "REGEX:CXXModules::export_build_database@<HEX>",
"name": "CXXModules__export_build_database@synth_0@<CONFIG>",
"translation-units": [
{
"arguments": [
"<IGNORE>",
"-D_MBCS",
"-Ddep_interface_define",
"-Dfrom_compile_definitions",
"-Dtarget_interface_define",
"-Dtarget_private_define",
"-Dtarget_public_define",
"PATH:-I<SOURCE_DIR>/exp-builddb/from_include_directories",
"PATH:-I<SOURCE_DIR>/exp-builddb/target_private_include",
"PATH:-I<SOURCE_DIR>/exp-builddb/target_public_include",
"PATH:-I<SOURCE_DIR>/exp-builddb/dep_interface_include",
"PATH:-I<SOURCE_DIR>/exp-builddb/target_interface_include",
"-Dfrom_cmake_cxx_flags",
"-Dfrom_cmake_cxx_<CONFIG_LOWER>_flags",
"<CXX20_OPTION>",
"-Dtarget_interface_option",
"-Dtarget_public_option",
"-Ddep_interface_option",
"PATH:-Ddepflag=\"CMakeFiles/CXXModules__export_build_database@synth_0.dir<CONFIG_DIR>/.d\"",
"REGEX:<BMI_ONLY_FLAG>",
"PATH:<OUTPUT_FLAG>CMakeFiles/CXXModules__export_build_database@synth_0.dir<CONFIG_DIR>/",
"REGEX:-[cv]",
"PATH:<SOURCE_DIR>/exp-builddb/importable.cxx"
],
"baseline-arguments": [
"-D_MBCS",
"-Ddep_interface_define",
"-Dfrom_compile_definitions",
"-Dtarget_interface_define",
"-Dtarget_private_define",
"-Dtarget_public_define",
"PATH:-I<SOURCE_DIR>/exp-builddb/from_include_directories",
"PATH:-I<SOURCE_DIR>/exp-builddb/target_private_include",
"PATH:-I<SOURCE_DIR>/exp-builddb/target_public_include",
"PATH:-I<SOURCE_DIR>/exp-builddb/dep_interface_include",
"PATH:-I<SOURCE_DIR>/exp-builddb/target_interface_include",
"-Dfrom_cmake_cxx_flags",
"-Dfrom_cmake_cxx_<CONFIG_LOWER>_flags",
"<CXX20_OPTION>",
"-Dtarget_interface_option",
"-Dtarget_public_option",
"-Ddep_interface_option"
],
"local-arguments": [
"-D_MBCS",
"-Ddep_interface_define",
"-Dfrom_compile_definitions",
"-Dtarget_interface_define",
"-Dtarget_private_define",
"-Dtarget_public_define",
"PATH:-I<SOURCE_DIR>/exp-builddb/from_include_directories",
"PATH:-I<SOURCE_DIR>/exp-builddb/target_private_include",
"PATH:-I<SOURCE_DIR>/exp-builddb/target_public_include",
"PATH:-I<SOURCE_DIR>/exp-builddb/dep_interface_include",
"PATH:-I<SOURCE_DIR>/exp-builddb/target_interface_include",
"-Dfrom_cmake_cxx_flags",
"-Dfrom_cmake_cxx_<CONFIG_LOWER>_flags",
"<CXX20_OPTION>",
"-Dtarget_interface_option",
"-Dtarget_public_option",
"-Ddep_interface_option"
],
"private": false,
"provides": {
"importable": "<IGNORE>"
},
"requires": [],
"source": "PATH:<SOURCE_DIR>/exp-builddb/importable.cxx",
"work-directory": "<BINARY_DIR>"
}
],
"visible-sets": []
},
{
"family-name": "REGEX:CXXModules::export_build_database@<HEX>",
"name": "CXXModules__export_build_database@synth_1@<CONFIG>",
"translation-units": [
{
"arguments": [
@@ -233,9 +154,9 @@
"-Dtarget_public_option",
"-Dtarget_interface_option",
"-Ddep_interface_option",
"PATH:-Ddepflag=\"CMakeFiles/CXXModules__export_build_database@synth_1.dir<CONFIG_DIR>/.d\"",
"PATH:-Ddepflag=\"CMakeFiles/CXXModules__export_build_database@synth_0.dir<CONFIG_DIR>/.d\"",
"REGEX:<BMI_ONLY_FLAG>",
"PATH:<OUTPUT_FLAG>CMakeFiles/CXXModules__export_build_database@synth_1.dir<CONFIG_DIR>/",
"PATH:<OUTPUT_FLAG>CMakeFiles/CXXModules__export_build_database@synth_0.dir<CONFIG_DIR>/",
"REGEX:-[cv]",
"PATH:<SOURCE_DIR>/exp-builddb/importable.cxx"
],
@@ -65,7 +65,7 @@
}
],
"visible-sets": [
"CXXModules__export_build_database@synth_1@<CONFIG>"
"CXXModules__export_build_database@synth_0@<CONFIG>"
]
}
]
@@ -1,8 +1,8 @@
# Verify the build system reused the owning target BMI when compatible and
# generated a synthetic target BMI only for the incompatible importer.
set(expected_consumers consumer20 consumer23)
set(linked_dir_keys "")
set(linked_dir_names "")
# Verify the build system reused the owning target BMI when compatible,
# generated a shared synthetic target BMI for the incompatible importers,
# and ignored preprocessor-only compile options in the BMI compatibility hash.
set(expected_consumers consumer20 consumer23 consumer23flag)
set(shared_synth_target_name "")
if (DEFINED RunCMake_TEST_CONFIG)
set(config_dir "${RunCMake_TEST_CONFIG}")
@@ -36,9 +36,10 @@ foreach (consumer IN LISTS expected_consumers)
set(expected_linked_tgt_regex "^importable\.dir$")
set(expected_linked_tgt_desc "owning target dir for 'importable'")
set(expected_linked_tgt_has_bmi 0)
elseif (consumer STREQUAL "consumer23")
elseif (consumer STREQUAL "consumer23" OR
consumer STREQUAL "consumer23flag")
set(expected_linked_tgt_regex "^importable@synth_[A-Za-z0-9_]+\.dir$")
set(expected_linked_tgt_desc "synthetic target dir for 'importable'")
set(expected_linked_tgt_desc "shared synthetic target dir for 'importable'")
set(expected_linked_tgt_has_bmi 1)
else ()
list(APPEND RunCMake_TEST_FAILED
@@ -97,33 +98,15 @@ foreach (consumer IN LISTS expected_consumers)
endif ()
endif ()
if (linked_tgt_name MATCHES "^importable@synth_[A-Za-z0-9_]+\.dir$")
# Record the consumers of each synthetic dir to verify uniqueness.
string(REGEX REPLACE "[^A-Za-z0-9_]" "_" linked_dir_key "${linked_tgt_name}")
set(linked_dir_consumers_var "linked_dir_consumers_${linked_dir_key}")
if (NOT DEFINED ${linked_dir_consumers_var})
list(APPEND linked_dir_keys "${linked_dir_key}")
list(APPEND linked_dir_names "${linked_tgt_name}")
if (consumer STREQUAL "consumer23" OR consumer STREQUAL "consumer23flag")
if (shared_synth_target_name STREQUAL "")
set(shared_synth_target_name "${linked_tgt_name}")
elseif (NOT linked_tgt_name STREQUAL shared_synth_target_name)
list(APPEND RunCMake_TEST_FAILED
"Expected consumer23 and consumer23flag to share one synthetic target dir, but found '${shared_synth_target_name}' and '${linked_tgt_name}'")
endif ()
list(APPEND ${linked_dir_consumers_var} ${consumer})
endif ()
endforeach ()
# Verify each synthetic target is consumed exactly once.
foreach (linked_dir_key IN LISTS linked_dir_keys)
set(consumers "${linked_dir_consumers_${linked_dir_key}}")
list(LENGTH consumers linked_dir_consumer_count)
if (linked_dir_consumer_count GREATER 1)
list(FIND linked_dir_keys ${linked_dir_key} linked_dir_index)
list(GET linked_dir_names ${linked_dir_index} linked_tgt_name)
string(JOIN ", " linked_dir_consumers_joined ${consumers})
list(APPEND RunCMake_TEST_FAILED
"Expected per-compatibility synthetic BMI generation, but '${linked_tgt_name}' is linked to by multiple targets: ${linked_dir_consumers_joined}")
endif ()
endforeach ()
string(REPLACE ";" "\n " RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}")
@@ -8,6 +8,7 @@ target_sources(importable
PUBLIC FILE_SET CXX_MODULES FILES importable.cxx)
target_compile_features(importable PUBLIC cxx_std_20)
target_compile_options(importable PRIVATE "-DIMPORTABLE_PRIVATE_DEFINE=1")
add_executable(consumer20 consumer20.cxx)
target_compile_features(consumer20 PRIVATE cxx_std_20)
@@ -17,5 +18,11 @@ add_executable(consumer23 consumer23.cxx)
target_compile_features(consumer23 PRIVATE cxx_std_23)
target_link_libraries(consumer23 PRIVATE importable)
add_executable(consumer23flag consumer23.cxx)
target_compile_features(consumer23flag PRIVATE cxx_std_23)
target_compile_options(consumer23flag PRIVATE "-DCONSUMER23FLAG_ONLY=1")
target_link_libraries(consumer23flag PRIVATE importable)
add_test(NAME consumer20 COMMAND consumer20)
add_test(NAME consumer23 COMMAND consumer23)
add_test(NAME consumer23flag COMMAND consumer23flag)
@@ -1,5 +1,9 @@
export module importable;
#ifndef IMPORTABLE_PRIVATE_DEFINE
# error "missing private compile option required for BMI generation"
#endif
export int from_import()
{
return 0;