From 6d3e9d8220e0dfe8d4684a94369deb296491946d Mon Sep 17 00:00:00 2001 From: Vito Gamberini Date: Thu, 18 Jun 2026 08:14:18 -0400 Subject: [PATCH 1/2] c++modules: single import std target --- Help/dev/experimental.rst | 2 +- Modules/CMakeDetermineCompilerSupport.cmake | 2 +- Source/cmExperimental.cxx | 2 +- Source/cmGeneratorTarget.cxx | 63 ++++++------------- Source/cmGeneratorTarget.h | 2 +- Source/cmGlobalGenerator.cxx | 15 +++-- Source/cmGlobalGenerator.h | 2 +- Tests/RunCMake/CXXModules/CMP0155-NEW.cmake | 3 - Tests/RunCMake/CXXModules/CMP0155-OLD.cmake | 3 - Tests/RunCMake/CXXModules/ImplicitCXX20.cmake | 3 - Tests/RunCMake/CXXModules/Inspect.cmake | 16 ----- Tests/RunCMake/CXXModules/NoCXX20.cmake | 3 - .../CXXModules/NoScanningVariable.cmake | 3 - .../imp-dummy-std/CMakeLists.txt | 2 +- .../imp-std-exp-no-std-build/CMakeLists.txt | 2 +- .../test/CMakeLists.txt | 4 +- .../imp-std-exp-no-std-install/CMakeLists.txt | 2 +- .../test/CMakeLists.txt | 4 +- .../imp-std-no-std-prop/CMakeLists.txt | 2 +- .../imp-std-not-in-exp-build/CMakeLists.txt | 2 +- .../test/CMakeLists.txt | 4 +- .../imp-std-not-in-exp-install/CMakeLists.txt | 2 +- .../test/CMakeLists.txt | 4 +- .../imp-std-trans/CMakeLists.txt | 8 +-- .../CXXModulesCompile/imp-std/CMakeLists.txt | 2 +- .../Experimental/CxxImportStd-quiet.cmake | 2 +- .../Experimental/CxxImportStd-set.cmake | 2 +- 27 files changed, 50 insertions(+), 111 deletions(-) diff --git a/Help/dev/experimental.rst b/Help/dev/experimental.rst index 60955f1112..ee2bc83fda 100644 --- a/Help/dev/experimental.rst +++ b/Help/dev/experimental.rst @@ -66,7 +66,7 @@ In order to activate support for ``import std`` in C++23 and newer targets, set * variable ``CMAKE_EXPERIMENTAL_CXX_IMPORT_STD`` to -* value ``451f2fe2-a8a2-47c3-bc32-94786d8fc91b``. +* value ``f35a9ac6-8463-4d38-8eec-5d6008153e7d``. This UUID may change in future versions of CMake. Be sure to use the value documented here by the source tree of the version of CMake with which you are diff --git a/Modules/CMakeDetermineCompilerSupport.cmake b/Modules/CMakeDetermineCompilerSupport.cmake index d11a494825..ed80ba7e38 100644 --- a/Modules/CMakeDetermineCompilerSupport.cmake +++ b/Modules/CMakeDetermineCompilerSupport.cmake @@ -158,7 +158,7 @@ function(cmake_determine_compiler_support lang) foreach(_cmake_import_std_version IN ITEMS 23 26) if(CMAKE_CXX${_cmake_import_std_version}_COMPILE_FEATURES) # Modules JSON covers all versions, otherwise rely on toolchain targets - if(CMAKE_CXX_STDLIB_MODULES_JSON OR (TARGET "__CMAKE:CXX${_cmake_import_std_version}")) + if(CMAKE_CXX_STDLIB_MODULES_JSON) list(APPEND CMAKE_CXX_COMPILER_IMPORT_STD ${_cmake_import_std_version}) endif() endif() diff --git a/Source/cmExperimental.cxx b/Source/cmExperimental.cxx index 2d9232c5d3..cdfa405a3e 100644 --- a/Source/cmExperimental.cxx +++ b/Source/cmExperimental.cxx @@ -31,7 +31,7 @@ cmExperimental::FeatureData const LookupTable[] = { cmExperimental::TryCompileCondition::Always }, // CxxImportStd { "CxxImportStd", - "451f2fe2-a8a2-47c3-bc32-94786d8fc91b", + "f35a9ac6-8463-4d38-8eec-5d6008153e7d", "CMAKE_EXPERIMENTAL_CXX_IMPORT_STD", "CMake's support for `import std;` in C++23 and newer is experimental. It " "is meant only for experimentation and feedback to CMake developers.", diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 42430a73d1..efa090100a 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -5330,8 +5330,6 @@ bool cmGeneratorTarget::IsNullImpliedByLinkLibraries( namespace { bool CreateCxxStdlibTarget(cmMakefile* makefile, cmLocalGenerator* lg, std::string const& targetName, - std::string const& cxxTargetName, - std::string const& stdLevel, std::vector const& configs) { #ifndef CMAKE_BOOTSTRAP @@ -5377,20 +5375,17 @@ bool CreateCxxStdlibTarget(cmMakefile* makefile, cmLocalGenerator* lg, metadata = std::move(*parseResult.Meta); } - auto const localTargetName = cmStrCat("__cmake_cxx_std_", stdLevel); - cmStandardLevelResolver standardResolver(makefile); auto* stdlibTgt = makefile->AddLibrary( - localTargetName, cmStateEnums::STATIC_LIBRARY, {}, true); + "@cmake_cxx_std", cmStateEnums::STATIC_LIBRARY, {}, true); cmCxxModuleMetadata::PopulateTarget(*stdlibTgt, *metadata, configs); - standardResolver.AddRequiredTargetFeature(stdlibTgt, - cmStrCat("cxx_std_", stdLevel)); + cmStandardLevelResolver standardResolver(makefile); + standardResolver.AddRequiredTargetFeature(stdlibTgt, "cxx_std_20"); auto gt = cm::make_unique(stdlibTgt, lg); for (auto const& config : configs) { gt->ComputeCompileFeatures(config); } lg->AddGeneratorTarget(std::move(gt)); - makefile->AddAlias(cxxTargetName, localTargetName); #endif // CMAKE_BOOTSTRAP @@ -5398,11 +5393,8 @@ bool CreateCxxStdlibTarget(cmMakefile* makefile, cmLocalGenerator* lg, } } // namespace -bool cmGeneratorTarget::ApplyCXXStdTargets() +bool cmGeneratorTarget::ApplyCXXStdTarget() { - cmStandardLevelResolver standardResolver(this->Makefile); - cmStandardLevel const cxxStd23 = - *standardResolver.LanguageStandardLevel("CXX", "23"); std::vector const& configs = this->Makefile->GetGeneratorConfigs(cmMakefile::IncludeEmptyConfig); auto std_prop = this->GetProperty("CXX_MODULE_STD"); @@ -5466,35 +5458,18 @@ bool cmGeneratorTarget::ApplyCXXStdTargets() return true; } - for (auto const& config : configs) { - if (this->HaveCxxModuleSupport(config) != Cxx20SupportLevel::Supported) { - continue; - } - - cm::optional explicitLevel = - this->GetExplicitStandardLevel("CXX", config); - if (!explicitLevel || *explicitLevel < cxxStd23) { - continue; - } - - auto const stdLevel = - standardResolver.GetLevelString("CXX", *explicitLevel); - auto const cxxTargetName = cmStrCat("__CMAKE::CXX", stdLevel); - - // Create the __CMAKE::CXX## target if it doesn't already exist - if (!this->Makefile->FindTargetToUse(cxxTargetName) && - !CreateCxxStdlibTarget(this->Makefile, this->LocalGenerator, - this->GetName(), cxxTargetName, stdLevel, - configs)) { - return false; - } - - this->Target->AppendProperty( - "LINK_LIBRARIES", - cmStrCat("$:", cxxTargetName, ">>")); + // Create the single, unreferenceable import std target if it doesn't + // already exist. BMI compatibility handles per-consumer standard level + // differences by creating synthetic targets as needed. + if (!this->Makefile->FindTargetToUse("@cmake_cxx_std") && + !CreateCxxStdlibTarget(this->Makefile, this->LocalGenerator, + this->GetName(), configs)) { + return false; } + this->Target->AppendProperty("LINK_LIBRARIES", + "$"); + // Check the experimental feature here. A toolchain may have // skipped the check in the toolchain preparation logic. if (!cmExperimental::HasSupportEnabled( @@ -5577,8 +5552,10 @@ cmGeneratorTarget const* cmGeneratorTarget::GetCxxSyntheticTarget( } } - // Copy properties which effect consumer compatibility - tgt->CopyUsageEffects(bmiConsumer.Target); + // Copy properties which effect consumer compatibility. + // CopyUsageEffects now uses the consumer's full (own + transitive) + // compile features and options. + tgt->CopyUsageEffects(&bmiConsumer, config); // Copy properties which don't effect consumer compatibility tgt->CopyCxxModulesEntries(model); @@ -5599,9 +5576,9 @@ cmGeneratorTarget const* cmGeneratorTarget::GetCxxSyntheticTarget( for (auto const& innerConfig : allConfigs) { gtp->ComputeCompileFeatures(innerConfig); } - // See `cmGlobalGenerator::ApplyCXXStdTargets` in + // See `cmGlobalGenerator::ApplyCXXStdTarget` in // `cmGlobalGenerator::Compute` for non-synthetic target resolutions. - if (!gtp->ApplyCXXStdTargets()) { + if (!gtp->ApplyCXXStdTarget()) { return nullptr; } diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 6815fa068d..d7b47e32d1 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -1146,7 +1146,7 @@ public: std::string GetImportedXcFrameworkPath(std::string const& config) const; - bool ApplyCXXStdTargets(); + bool ApplyCXXStdTarget(); cmCxxModuleUsageEffects const& GetCxxModuleUsageEffects() const; cmGeneratorTarget const* GetTargetForCxxModules( std::string const& config, cmGeneratorTarget const& bmiConsumer) const; diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 12037063d9..cb2f82171c 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1676,13 +1676,12 @@ bool cmGlobalGenerator::Compute() } } - // We now have all targets set up and std levels constructed. Add - // `__CMAKE::CXX*` targets as link dependencies to all targets which need - // them. + // We now have all targets set up. Add the `@cmake_cxx_std` target as a link + // dependency to all targets which need it. // // Synthetic targets performed this inside of // `cmLocalGenerator::DiscoverSyntheticTargets` - if (!this->ApplyCXXStdTargets()) { + if (!this->ApplyCXXStdTarget()) { return false; } @@ -1997,12 +1996,12 @@ void cmGlobalGenerator::ComputeTargetOrder(cmGeneratorTarget const* gt, entry->second = index++; } -bool cmGlobalGenerator::ApplyCXXStdTargets() +bool cmGlobalGenerator::ApplyCXXStdTarget() { for (auto const& gen : this->LocalGenerators) { - // tgt->ApplyCXXStd can create targets itself, so we need iterators which - // won't be invalidated by that target creation + // tgt->ApplyCXXStdTarget can create a target itself, so we need iterators + // which won't be invalidated by that target creation auto const& genTgts = gen->GetGeneratorTargets(); std::vector existingTgts; existingTgts.reserve(genTgts.size()); @@ -2011,7 +2010,7 @@ bool cmGlobalGenerator::ApplyCXXStdTargets() } for (auto const& tgt : existingTgts) { - if (!tgt->ApplyCXXStdTargets()) { + if (!tgt->ApplyCXXStdTarget()) { return false; } } diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 4033df874a..7f941e3be1 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -800,7 +800,7 @@ protected: virtual bool CheckALLOW_DUPLICATE_CUSTOM_TARGETS() const; - bool ApplyCXXStdTargets(); + bool ApplyCXXStdTarget(); bool DiscoverSyntheticTargets(); bool AddHeaderSetVerification(); diff --git a/Tests/RunCMake/CXXModules/CMP0155-NEW.cmake b/Tests/RunCMake/CXXModules/CMP0155-NEW.cmake index c754930260..d68775ac23 100644 --- a/Tests/RunCMake/CXXModules/CMP0155-NEW.cmake +++ b/Tests/RunCMake/CXXModules/CMP0155-NEW.cmake @@ -1,6 +1,3 @@ -# Block making C++ `import std` targets. -add_library(__CMAKE::CXX23 IMPORTED INTERFACE) - enable_language(CXX) unset(CMAKE_CXX_SCANDEP_SOURCE) diff --git a/Tests/RunCMake/CXXModules/CMP0155-OLD.cmake b/Tests/RunCMake/CXXModules/CMP0155-OLD.cmake index a994266d9d..201598e7a0 100644 --- a/Tests/RunCMake/CXXModules/CMP0155-OLD.cmake +++ b/Tests/RunCMake/CXXModules/CMP0155-OLD.cmake @@ -1,6 +1,3 @@ -# Block making C++ `import std` targets. -add_library(__CMAKE::CXX23 IMPORTED INTERFACE) - enable_language(CXX) unset(CMAKE_CXX_SCANDEP_SOURCE) diff --git a/Tests/RunCMake/CXXModules/ImplicitCXX20.cmake b/Tests/RunCMake/CXXModules/ImplicitCXX20.cmake index 64d69f3a69..cac1777f52 100644 --- a/Tests/RunCMake/CXXModules/ImplicitCXX20.cmake +++ b/Tests/RunCMake/CXXModules/ImplicitCXX20.cmake @@ -1,9 +1,6 @@ # Enable scanning by default for targets that explicitly use C++ 20. cmake_policy(SET CMP0155 NEW) -# Block making C++ `import std` targets. -add_library(__CMAKE::CXX23 IMPORTED INTERFACE) - # Force CMAKE_CXX_STANDARD_DEFAULT to be C++ 20. set(ENV{CXXFLAGS} "$ENV{CXXFLAGS} ${CMAKE_CXX20_STANDARD_COMPILE_OPTION}") enable_language(CXX) diff --git a/Tests/RunCMake/CXXModules/Inspect.cmake b/Tests/RunCMake/CXXModules/Inspect.cmake index 702e349e23..2ebb892bbe 100644 --- a/Tests/RunCMake/CXXModules/Inspect.cmake +++ b/Tests/RunCMake/CXXModules/Inspect.cmake @@ -15,22 +15,6 @@ if (CMAKE_CXX_FLAGS MATCHES "-std=") set(forced_cxx_standard 1) endif () -macro (cxx_check_import_std version) - set(have_cxx${version}_import_std 0) - if ("${version}" IN_LIST CMAKE_CXX_COMPILER_IMPORT_STD) - set(have_cxx${version}_import_std 1) - endif () - - if (TARGET "__CMAKE:CXX${version}" AND NOT have_cxx${version}_import_std) - message(FATAL_ERROR - "The toolchain's C++${version} target exists, but the user variable does " - "not indicate it.") - endif () -endmacro () - -cxx_check_import_std(23) -cxx_check_import_std(26) - # Forward information about the C++ compile features. string(APPEND info "\ set(CMAKE_CXX_COMPILE_FEATURES \"${CMAKE_CXX_COMPILE_FEATURES}\") diff --git a/Tests/RunCMake/CXXModules/NoCXX20.cmake b/Tests/RunCMake/CXXModules/NoCXX20.cmake index 9710728be0..b7372e8260 100644 --- a/Tests/RunCMake/CXXModules/NoCXX20.cmake +++ b/Tests/RunCMake/CXXModules/NoCXX20.cmake @@ -1,6 +1,3 @@ -# Block making C++ `import std` targets. -add_library(__CMAKE::CXX23 IMPORTED INTERFACE) - enable_language(CXX) add_library(nocxx20) diff --git a/Tests/RunCMake/CXXModules/NoScanningVariable.cmake b/Tests/RunCMake/CXXModules/NoScanningVariable.cmake index 950f1f3e20..4bb6a703e5 100644 --- a/Tests/RunCMake/CXXModules/NoScanningVariable.cmake +++ b/Tests/RunCMake/CXXModules/NoScanningVariable.cmake @@ -1,9 +1,6 @@ # Enable scanning by default for targets that explicitly use C++ 20. cmake_policy(SET CMP0155 NEW) -# Block making C++ `import std` targets. -add_library(__CMAKE::CXX23 IMPORTED INTERFACE) - enable_language(CXX) # Hide any real scanning rule that may be available. diff --git a/Tests/RunCMake/CXXModulesCompile/imp-dummy-std/CMakeLists.txt b/Tests/RunCMake/CXXModulesCompile/imp-dummy-std/CMakeLists.txt index 051b6abcf4..8a0bdb522a 100644 --- a/Tests/RunCMake/CXXModulesCompile/imp-dummy-std/CMakeLists.txt +++ b/Tests/RunCMake/CXXModulesCompile/imp-dummy-std/CMakeLists.txt @@ -1,5 +1,5 @@ set(CMAKE_EXPERIMENTAL_CXX_IMPORT_STD - "451f2fe2-a8a2-47c3-bc32-94786d8fc91b") + "f35a9ac6-8463-4d38-8eec-5d6008153e7d") set(CMAKE_CXX_STDLIB_MODULES_JSON "${CMAKE_CURRENT_LIST_DIR}/../dummy-std/manifest/dummy-std.modules.json" ) diff --git a/Tests/RunCMake/CXXModulesCompile/imp-std-exp-no-std-build/CMakeLists.txt b/Tests/RunCMake/CXXModulesCompile/imp-std-exp-no-std-build/CMakeLists.txt index 7e1f998873..361fc4476d 100644 --- a/Tests/RunCMake/CXXModulesCompile/imp-std-exp-no-std-build/CMakeLists.txt +++ b/Tests/RunCMake/CXXModulesCompile/imp-std-exp-no-std-build/CMakeLists.txt @@ -1,5 +1,5 @@ set(CMAKE_EXPERIMENTAL_CXX_IMPORT_STD - "451f2fe2-a8a2-47c3-bc32-94786d8fc91b") + "f35a9ac6-8463-4d38-8eec-5d6008153e7d") cmake_minimum_required(VERSION 3.29) project(cxx_modules_import_std_export_no_std CXX) diff --git a/Tests/RunCMake/CXXModulesCompile/imp-std-exp-no-std-build/test/CMakeLists.txt b/Tests/RunCMake/CXXModulesCompile/imp-std-exp-no-std-build/test/CMakeLists.txt index e37f1744fa..7483b3f72a 100644 --- a/Tests/RunCMake/CXXModulesCompile/imp-std-exp-no-std-build/test/CMakeLists.txt +++ b/Tests/RunCMake/CXXModulesCompile/imp-std-exp-no-std-build/test/CMakeLists.txt @@ -39,7 +39,7 @@ list(FILTER usage_dependent_targets EXCLUDE REGEX "CXXModules::") # Strip quotes. string(REPLACE "\"" "" usage_dependent_targets "${usage_dependent_targets}") -if ("__CMAKE::CXX23" IN_LIST usage_dependent_targets) +if ("@cmake_cxx_std" IN_LIST usage_dependent_targets) message(SEND_ERROR - "The main export requires the '__CMAKE::CXX23' target") + "The main export requires the '@cmake_cxx_std' target") endif () diff --git a/Tests/RunCMake/CXXModulesCompile/imp-std-exp-no-std-install/CMakeLists.txt b/Tests/RunCMake/CXXModulesCompile/imp-std-exp-no-std-install/CMakeLists.txt index b63c814730..c249276be5 100644 --- a/Tests/RunCMake/CXXModulesCompile/imp-std-exp-no-std-install/CMakeLists.txt +++ b/Tests/RunCMake/CXXModulesCompile/imp-std-exp-no-std-install/CMakeLists.txt @@ -1,5 +1,5 @@ set(CMAKE_EXPERIMENTAL_CXX_IMPORT_STD - "451f2fe2-a8a2-47c3-bc32-94786d8fc91b") + "f35a9ac6-8463-4d38-8eec-5d6008153e7d") cmake_minimum_required(VERSION 3.29) project(cxx_modules_import_std_export_no_std CXX) diff --git a/Tests/RunCMake/CXXModulesCompile/imp-std-exp-no-std-install/test/CMakeLists.txt b/Tests/RunCMake/CXXModulesCompile/imp-std-exp-no-std-install/test/CMakeLists.txt index e37f1744fa..7483b3f72a 100644 --- a/Tests/RunCMake/CXXModulesCompile/imp-std-exp-no-std-install/test/CMakeLists.txt +++ b/Tests/RunCMake/CXXModulesCompile/imp-std-exp-no-std-install/test/CMakeLists.txt @@ -39,7 +39,7 @@ list(FILTER usage_dependent_targets EXCLUDE REGEX "CXXModules::") # Strip quotes. string(REPLACE "\"" "" usage_dependent_targets "${usage_dependent_targets}") -if ("__CMAKE::CXX23" IN_LIST usage_dependent_targets) +if ("@cmake_cxx_std" IN_LIST usage_dependent_targets) message(SEND_ERROR - "The main export requires the '__CMAKE::CXX23' target") + "The main export requires the '@cmake_cxx_std' target") endif () diff --git a/Tests/RunCMake/CXXModulesCompile/imp-std-no-std-prop/CMakeLists.txt b/Tests/RunCMake/CXXModulesCompile/imp-std-no-std-prop/CMakeLists.txt index 12dc294607..982c7d6db7 100644 --- a/Tests/RunCMake/CXXModulesCompile/imp-std-no-std-prop/CMakeLists.txt +++ b/Tests/RunCMake/CXXModulesCompile/imp-std-no-std-prop/CMakeLists.txt @@ -1,5 +1,5 @@ set(CMAKE_EXPERIMENTAL_CXX_IMPORT_STD - "451f2fe2-a8a2-47c3-bc32-94786d8fc91b") + "f35a9ac6-8463-4d38-8eec-5d6008153e7d") cmake_minimum_required(VERSION 3.29) project(cxx_modules_import_std_no_std_property CXX) diff --git a/Tests/RunCMake/CXXModulesCompile/imp-std-not-in-exp-build/CMakeLists.txt b/Tests/RunCMake/CXXModulesCompile/imp-std-not-in-exp-build/CMakeLists.txt index 2298cf61c5..4f77dcaed2 100644 --- a/Tests/RunCMake/CXXModulesCompile/imp-std-not-in-exp-build/CMakeLists.txt +++ b/Tests/RunCMake/CXXModulesCompile/imp-std-not-in-exp-build/CMakeLists.txt @@ -1,5 +1,5 @@ set(CMAKE_EXPERIMENTAL_CXX_IMPORT_STD - "451f2fe2-a8a2-47c3-bc32-94786d8fc91b") + "f35a9ac6-8463-4d38-8eec-5d6008153e7d") cmake_minimum_required(VERSION 3.29) project(cxx_modules_import_std_not_in_export CXX) diff --git a/Tests/RunCMake/CXXModulesCompile/imp-std-not-in-exp-build/test/CMakeLists.txt b/Tests/RunCMake/CXXModulesCompile/imp-std-not-in-exp-build/test/CMakeLists.txt index 4e994d23b5..a3cf78f164 100644 --- a/Tests/RunCMake/CXXModulesCompile/imp-std-not-in-exp-build/test/CMakeLists.txt +++ b/Tests/RunCMake/CXXModulesCompile/imp-std-not-in-exp-build/test/CMakeLists.txt @@ -39,7 +39,7 @@ list(FILTER usage_dependent_targets EXCLUDE REGEX "CXXModules::") # Strip quotes. string(REPLACE "\"" "" usage_dependent_targets "${usage_dependent_targets}") -if ("__CMAKE::CXX23" IN_LIST usage_dependent_targets) +if ("@cmake_cxx_std" IN_LIST usage_dependent_targets) message(SEND_ERROR - "The main export requires the '__CMAKE::CXX23' target") + "The main export requires the '@cmake_cxx_std' target") endif () diff --git a/Tests/RunCMake/CXXModulesCompile/imp-std-not-in-exp-install/CMakeLists.txt b/Tests/RunCMake/CXXModulesCompile/imp-std-not-in-exp-install/CMakeLists.txt index b0587c90ae..0e2e1818f7 100644 --- a/Tests/RunCMake/CXXModulesCompile/imp-std-not-in-exp-install/CMakeLists.txt +++ b/Tests/RunCMake/CXXModulesCompile/imp-std-not-in-exp-install/CMakeLists.txt @@ -1,5 +1,5 @@ set(CMAKE_EXPERIMENTAL_CXX_IMPORT_STD - "451f2fe2-a8a2-47c3-bc32-94786d8fc91b") + "f35a9ac6-8463-4d38-8eec-5d6008153e7d") cmake_minimum_required(VERSION 3.29) project(cxx_modules_import_std_not_in_export CXX) diff --git a/Tests/RunCMake/CXXModulesCompile/imp-std-not-in-exp-install/test/CMakeLists.txt b/Tests/RunCMake/CXXModulesCompile/imp-std-not-in-exp-install/test/CMakeLists.txt index 4e994d23b5..a3cf78f164 100644 --- a/Tests/RunCMake/CXXModulesCompile/imp-std-not-in-exp-install/test/CMakeLists.txt +++ b/Tests/RunCMake/CXXModulesCompile/imp-std-not-in-exp-install/test/CMakeLists.txt @@ -39,7 +39,7 @@ list(FILTER usage_dependent_targets EXCLUDE REGEX "CXXModules::") # Strip quotes. string(REPLACE "\"" "" usage_dependent_targets "${usage_dependent_targets}") -if ("__CMAKE::CXX23" IN_LIST usage_dependent_targets) +if ("@cmake_cxx_std" IN_LIST usage_dependent_targets) message(SEND_ERROR - "The main export requires the '__CMAKE::CXX23' target") + "The main export requires the '@cmake_cxx_std' target") endif () diff --git a/Tests/RunCMake/CXXModulesCompile/imp-std-trans/CMakeLists.txt b/Tests/RunCMake/CXXModulesCompile/imp-std-trans/CMakeLists.txt index aa37dccbdd..8c6dccb198 100644 --- a/Tests/RunCMake/CXXModulesCompile/imp-std-trans/CMakeLists.txt +++ b/Tests/RunCMake/CXXModulesCompile/imp-std-trans/CMakeLists.txt @@ -1,14 +1,8 @@ set(CMAKE_EXPERIMENTAL_CXX_IMPORT_STD - "451f2fe2-a8a2-47c3-bc32-94786d8fc91b") + "f35a9ac6-8463-4d38-8eec-5d6008153e7d") cmake_minimum_required(VERSION 3.29) -if (EXPORT_NO_STD) - # Block making C++ `import std` targets. - add_library(__CMAKE::CXX23 IMPORTED INTERFACE) - add_library(__CMAKE::CXX26 IMPORTED INTERFACE) -endif () - project(cxx_modules_import_std_transitive CXX) include("${CMAKE_SOURCE_DIR}/../cxx-modules-rules.cmake") diff --git a/Tests/RunCMake/CXXModulesCompile/imp-std/CMakeLists.txt b/Tests/RunCMake/CXXModulesCompile/imp-std/CMakeLists.txt index 5488596fe2..3a81e064c5 100644 --- a/Tests/RunCMake/CXXModulesCompile/imp-std/CMakeLists.txt +++ b/Tests/RunCMake/CXXModulesCompile/imp-std/CMakeLists.txt @@ -1,5 +1,5 @@ set(CMAKE_EXPERIMENTAL_CXX_IMPORT_STD - "451f2fe2-a8a2-47c3-bc32-94786d8fc91b") + "f35a9ac6-8463-4d38-8eec-5d6008153e7d") cmake_minimum_required(VERSION 3.29) project(cxx_modules_import_std CXX) diff --git a/Tests/RunCMake/cmake_language/Experimental/CxxImportStd-quiet.cmake b/Tests/RunCMake/cmake_language/Experimental/CxxImportStd-quiet.cmake index bf6147d323..35387f4dcb 100644 --- a/Tests/RunCMake/cmake_language/Experimental/CxxImportStd-quiet.cmake +++ b/Tests/RunCMake/cmake_language/Experimental/CxxImportStd-quiet.cmake @@ -13,7 +13,7 @@ if (NOT feature_present STREQUAL "FALSE") endif () set(CMAKE_EXPERIMENTAL_CXX_IMPORT_STD - "451f2fe2-a8a2-47c3-bc32-94786d8fc91b") + "f35a9ac6-8463-4d38-8eec-5d6008153e7d") cmake_language(GET_EXPERIMENTAL_FEATURE_ENABLED "CxxImportStd" diff --git a/Tests/RunCMake/cmake_language/Experimental/CxxImportStd-set.cmake b/Tests/RunCMake/cmake_language/Experimental/CxxImportStd-set.cmake index 66720a9538..f4740c2f69 100644 --- a/Tests/RunCMake/cmake_language/Experimental/CxxImportStd-set.cmake +++ b/Tests/RunCMake/cmake_language/Experimental/CxxImportStd-set.cmake @@ -1,5 +1,5 @@ set(CMAKE_EXPERIMENTAL_CXX_IMPORT_STD - "451f2fe2-a8a2-47c3-bc32-94786d8fc91b") + "f35a9ac6-8463-4d38-8eec-5d6008153e7d") cmake_language(GET_EXPERIMENTAL_FEATURE_ENABLED "CxxImportStd" From 42d2d63235fa2a8853fdb71919e2f85e8087ed42 Mon Sep 17 00:00:00 2001 From: Vito Gamberini Date: Thu, 18 Jun 2026 09:13:56 -0400 Subject: [PATCH 2/2] c++modules: Copy props from BMI consumers more correctly Fixes: #27891 --- Source/cmCxxModuleUsageEffects.cxx | 34 ++++++++++++-- Source/cmCxxModuleUsageEffects.h | 3 +- Source/cmGeneratorTarget.cxx | 22 +++++---- Source/cmGeneratorTarget.h | 5 +- Source/cmTarget.cxx | 47 ++++++++++++------- Source/cmTarget.h | 4 +- ...epchain-mods-json-file-rebuild-check.cmake | 23 +-------- .../expect/exp-builddb-imped-all-multi.json | 40 ++++++++-------- .../expect/exp-builddb-imped-all.json | 20 ++++---- .../expect/exp-builddb-imped-config.json | 20 ++++---- .../expect/exp-builddb-imped-cxx-config.json | 20 ++++---- .../expect/exp-builddb-imped-cxx-multi.json | 40 ++++++++-------- .../expect/exp-builddb-imped-cxx.json | 20 ++++---- 13 files changed, 163 insertions(+), 135 deletions(-) diff --git a/Source/cmCxxModuleUsageEffects.cxx b/Source/cmCxxModuleUsageEffects.cxx index 760e868ddc..9684309193 100644 --- a/Source/cmCxxModuleUsageEffects.cxx +++ b/Source/cmCxxModuleUsageEffects.cxx @@ -12,6 +12,8 @@ #include "cmGeneratorTarget.h" #include "cmListFileCache.h" #include "cmMakefile.h" +#include "cmRange.h" +#include "cmStringAlgorithms.h" #include "cmTarget.h" #include "cmValue.h" @@ -96,10 +98,17 @@ FlagFilter GetFlagFilter(cmGeneratorTarget const* gt) return filter; } +void AppendUsage(std::string& usageHashInput, std::string const& entry) +{ + usageHashInput += entry; + usageHashInput.push_back('\0'); +} + template void AppendUsageEntries(std::string& usageHashInput, Range const& entries) { std::vector entryValues; + entryValues.reserve(entries.size()); for (auto const& entry : entries) { entryValues.push_back(entry.Value); } @@ -114,7 +123,8 @@ void AppendUsageEntries(std::string& usageHashInput, Range const& entries) } } -cmCxxModuleUsageEffects::cmCxxModuleUsageEffects(cmGeneratorTarget const* gt) +cmCxxModuleUsageEffects::cmCxxModuleUsageEffects(cmGeneratorTarget const* gt, + std::string const& config) { auto const* tgt = gt->Target; auto const filter = GetFlagFilter(gt); @@ -128,11 +138,25 @@ cmCxxModuleUsageEffects::cmCxxModuleUsageEffects(cmGeneratorTarget const* gt) tgt->GetImportedCxxModulesCompileOptionsEntries().filter( [&](const BT& flag) { return !filter(flag.Value); })); } else { - AppendUsageEntries(usageHashInput, tgt->GetCompileFeaturesEntries()); - AppendUsageEntries( + AppendUsageEntries(usageHashInput, + cmMakeRange(gt->GetCompileOptions(config, "CXX")) + .filter([&](const BT& flag) { + return !filter(flag.Value); + })); + + cmValue langStd = gt->GetLanguageStandard("CXX", config); + if (!langStd) { + langStd = gt->Makefile->GetDefinition("CMAKE_CXX_STANDARD_DEFAULT"); + } + AppendUsage(usageHashInput, + cmStrCat("CXX_STANDARD:", langStd ? *langStd : "20")); + AppendUsage( usageHashInput, - tgt->GetCompileOptionsEntries().filter( - [&](const BT& flag) { return !filter(flag.Value); })); + cmStrCat("CXX_EXTENSIONS:", *gt->GetLanguageExtensions("CXX"))); + AppendUsage( + usageHashInput, + cmStrCat("CXX_STANDARD_REQUIRED:", + gt->GetLanguageStandardRequired("CXX") ? "TRUE" : "FALSE")); } cmCryptoHash hasher(cmCryptoHash::AlgoSHA3_512); diff --git a/Source/cmCxxModuleUsageEffects.h b/Source/cmCxxModuleUsageEffects.h index f959135b33..1fd190f22f 100644 --- a/Source/cmCxxModuleUsageEffects.h +++ b/Source/cmCxxModuleUsageEffects.h @@ -11,7 +11,8 @@ class cmGeneratorTarget; class cmCxxModuleUsageEffects { public: - cmCxxModuleUsageEffects(cmGeneratorTarget const* gt); + cmCxxModuleUsageEffects(cmGeneratorTarget const* gt, + std::string const& config); std::string const& GetHash() const; private: diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index efa090100a..39ac753d1e 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -5485,21 +5485,26 @@ bool cmGeneratorTarget::ApplyCXXStdTarget() return true; } -cmCxxModuleUsageEffects const& cmGeneratorTarget::GetCxxModuleUsageEffects() - const +cmCxxModuleUsageEffects const& cmGeneratorTarget::GetCxxModuleUsageEffects( + std::string const& config) const { - if (!this->CxxModuleUsageEffects) { - this->CxxModuleUsageEffects.emplace(this); + + auto iter = this->CxxModuleUsageEffects.find(config); + if (iter == this->CxxModuleUsageEffects.end()) { + auto result = this->CxxModuleUsageEffects.emplace( + std::pair{ + config, cmCxxModuleUsageEffects(this, config) }); + return result.first->second; } - return *this->CxxModuleUsageEffects; + return iter->second; } cmGeneratorTarget const* cmGeneratorTarget::GetTargetForCxxModules( std::string const& config, cmGeneratorTarget const& bmiConsumer) const { - auto const& consumingUsage = bmiConsumer.GetCxxModuleUsageEffects(); - auto const& owningUsage = this->GetCxxModuleUsageEffects(); + auto const& consumingUsage = bmiConsumer.GetCxxModuleUsageEffects(config); + auto const& owningUsage = this->GetCxxModuleUsageEffects(config); if (consumingUsage.GetHash() == owningUsage.GetHash()) { if (this->IsImported()) { return this->GetCxxSyntheticTarget(config, *this); @@ -5513,7 +5518,8 @@ cmGeneratorTarget const* cmGeneratorTarget::GetTargetForCxxModules( cmGeneratorTarget const* cmGeneratorTarget::GetCxxSyntheticTarget( std::string const& config, cmGeneratorTarget const& bmiConsumer) const { - auto const& usageHash = bmiConsumer.GetCxxModuleUsageEffects().GetHash(); + auto const& usageHash = + bmiConsumer.GetCxxModuleUsageEffects(config).GetHash(); auto cached = this->SynthCxxTargets.find(usageHash); if (cached != this->SynthCxxTargets.end()) { return cached->second; diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index d7b47e32d1..d0bcdcc164 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -1147,7 +1147,8 @@ public: std::string GetImportedXcFrameworkPath(std::string const& config) const; bool ApplyCXXStdTarget(); - cmCxxModuleUsageEffects const& GetCxxModuleUsageEffects() const; + cmCxxModuleUsageEffects const& GetCxxModuleUsageEffects( + std::string const& config) const; cmGeneratorTarget const* GetTargetForCxxModules( std::string const& config, cmGeneratorTarget const& bmiConsumer) const; bool DiscoverSyntheticTargets( @@ -1617,7 +1618,7 @@ private: std::map SourceFlags; }; mutable std::map SynthCxxTargets; - mutable cm::optional CxxModuleUsageEffects; + mutable std::map CxxModuleUsageEffects; mutable std::map Configs; std::unique_ptr FileSets; bool PchReused = false; diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 7f8a29d2ff..25fabc049e 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -25,6 +25,7 @@ #include "cmFileSetMetadata.h" #include "cmFindPackageStack.h" #include "cmGeneratorExpression.h" +#include "cmGeneratorTarget.h" #include "cmGlobalGenerator.h" #include "cmList.h" #include "cmListFileCache.h" @@ -595,6 +596,16 @@ TargetProperty const StaticTargetProperties[] = { #undef COMMON_LANGUAGE_PROPERTIES #undef IC #undef R + +cmValue copyProperty(cmTarget const* src, cmTarget* dst, + std::string const& prop) +{ + cmValue value = src->GetProperty(prop); + // Always set the property; it may have been explicitly unset. + dst->SetProperty(prop, value); + return value; +}; + } class cmTargetInternals @@ -1739,12 +1750,16 @@ cmBTStringRange cmTarget::GetLinkInterfaceDirectExcludeEntries() const return cmMakeRange(this->impl->InterfaceLinkLibrariesDirectExclude.Entries); } -void cmTarget::CopyUsageEffects(cmTarget const* tgt) +void cmTarget::CopyUsageEffects(cmGeneratorTarget const* gt, + std::string const& config) { // Normal targets cannot be the target of a copy. assert(!this->IsNormal()); // Imported targets cannot be the target of a copy. assert(!this->IsImported()); + + auto const* tgt = gt->Target; + // Only imported or normal targets can be the source of a copy. assert(tgt->IsImported() || tgt->IsNormal()); @@ -1758,10 +1773,17 @@ void cmTarget::CopyUsageEffects(cmTarget const* tgt) cmMakeRange(tgt->impl->ImportedCxxModulesCompileOptions.Entries)); } else { this->impl->CompileFeatures.CopyFromEntries( - cmMakeRange(tgt->impl->CompileFeatures.Entries)); + cmMakeRange(gt->GetCompileFeatures(config))); this->impl->CompileOptions.CopyFromEntries( - cmMakeRange(tgt->impl->CompileOptions.Entries)); + cmMakeRange(gt->GetCompileOptions(config, "CXX"))); } + + cmValue langStd = gt->GetLanguageStandard("CXX", config); + if (langStd) { + this->SetProperty("CXX_STANDARD", *langStd); + } + copyProperty(tgt, this, "CXX_EXTENSIONS"); + copyProperty(tgt, this, "CXX_STANDARD_REQUIRED"); } void cmTarget::CopyPolicyStatuses(cmTarget const* tgt) @@ -1857,9 +1879,6 @@ void cmTarget::CopyCxxModulesProperties(cmTarget const* tgt) // -- Language // ---- C++ "CXX_COMPILER_LAUNCHER", - "CXX_STANDARD", - "CXX_STANDARD_REQUIRED", - "CXX_EXTENSIONS", "CXX_VISIBILITY_PRESET", "CXX_MODULE_STD", @@ -1896,15 +1915,8 @@ void cmTarget::CopyCxxModulesProperties(cmTarget const* tgt) "SYSTEM", }; - auto copyProperty = [this, tgt](std::string const& prop) -> cmValue { - cmValue value = tgt->GetProperty(prop); - // Always set the property; it may have been explicitly unset. - this->SetProperty(prop, value); - return value; - }; - for (auto const& prop : propertiesToCopy) { - copyProperty(prop); + copyProperty(tgt, this, prop); } static cm::static_string_view const perConfigPropertiesToCopy[] = { @@ -1919,12 +1931,13 @@ void cmTarget::CopyCxxModulesProperties(cmTarget const* tgt) for (std::string const& configName : configNames) { std::string configUpper = cmSystemTools::UpperCase(configName); for (auto const& perConfigProp : perConfigPropertiesToCopy) { - copyProperty(cmStrCat(perConfigProp, configUpper)); + copyProperty(tgt, this, cmStrCat(perConfigProp, configUpper)); } } if (this->GetGlobalGenerator()->IsXcode()) { - cmValue xcodeGenerateScheme = copyProperty("XCODE_GENERATE_SCHEME"); + cmValue xcodeGenerateScheme = + copyProperty(tgt, this, "XCODE_GENERATE_SCHEME"); // TODO: Make sure these show up on the imported target in the first place // XCODE_ATTRIBUTE_??? @@ -1954,7 +1967,7 @@ void cmTarget::CopyCxxModulesProperties(cmTarget const* tgt) }; for (auto const& xcodeProperty : xcodeSchemePropertiesToCopy) { - copyProperty(xcodeProperty); + copyProperty(tgt, this, xcodeProperty); } #endif } diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 5f0e5b2e32..f32cf3163e 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -32,6 +32,7 @@ enum class Visibility; class cmCustomCommand; class cmFileSet; class cmFindPackageStack; +class cmGeneratorTarget; class cmGlobalGenerator; class cmInstallTargetGenerator; class cmMakefile; @@ -327,7 +328,8 @@ public: cmBTStringRange GetLinkInterfaceDirectEntries() const; cmBTStringRange GetLinkInterfaceDirectExcludeEntries() const; - void CopyUsageEffects(cmTarget const* tgt); + void CopyUsageEffects(cmGeneratorTarget const* gt, + std::string const& config); void CopyPolicyStatuses(cmTarget const* tgt); void CopyCxxModulesEntries(cmTarget const* tgt); void CopyCxxModulesProperties(cmTarget const* tgt); diff --git a/Tests/RunCMake/CXXModulesCompile/depchain-mods-json-file-rebuild-check.cmake b/Tests/RunCMake/CXXModulesCompile/depchain-mods-json-file-rebuild-check.cmake index 4568873174..cc228169ae 100644 --- a/Tests/RunCMake/CXXModulesCompile/depchain-mods-json-file-rebuild-check.cmake +++ b/Tests/RunCMake/CXXModulesCompile/depchain-mods-json-file-rebuild-check.cmake @@ -2,26 +2,7 @@ file(GLOB synth_dirs "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/depchain_with_modules_json_file@synth_*.dir") list(LENGTH synth_dirs synth_dirs_len) -if (NOT synth_dirs_len EQUAL 1) +if (NOT synth_dirs_len EQUAL 0) list(APPEND RunCMake_TEST_FAILED - "Expected exactly one synthetic target for consuming 'depchain_with_modules_json_file' but found ${synth_dirs_len}: ${synth_dirs}") -endif () - -list(GET synth_dirs 0 synth_dir) - -if (RunCMake_GENERATOR_IS_MULTI_CONFIG) - set(dep_modules_json_path "CMakeFiles/depchain_modules_json_file.dir/Debug/CXX.dd") - set(modules_json_path "${synth_dir}/Debug/CXXModules.json") -else () - set(dep_modules_json_path "CMakeFiles/depchain_modules_json_file.dir/CXX.dd") - set(modules_json_path "${synth_dir}/CXXModules.json") -endif () - - -if ("${modules_json_path}" IS_NEWER_THAN "${RunCMake_TEST_BINARY_DIR}/${dep_modules_json_path}") - cmake_path(RELATIVE_PATH modules_json_path - BASE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") - - list(APPEND RunCMake_TEST_FAILED - "Object '${dep_modules_json_path}' should have recompiled if '${modules_json_path}' changed.") + "Expected no synthetic targets for consuming 'depchain_with_modules_json_file' but found ${synth_dirs_len}: ${synth_dirs}") endif () diff --git a/Tests/RunCMake/CXXModulesCompile/expect/exp-builddb-imped-all-multi.json b/Tests/RunCMake/CXXModulesCompile/expect/exp-builddb-imped-all-multi.json index c742a2eb30..113680635e 100644 --- a/Tests/RunCMake/CXXModulesCompile/expect/exp-builddb-imped-all-multi.json +++ b/Tests/RunCMake/CXXModulesCompile/expect/exp-builddb-imped-all-multi.json @@ -275,9 +275,9 @@ "-Dfrom_cmake_cxx_flags", "-Dfrom_cmake_cxx__flags", "", - "-Ddep_interface_option", "-Dtarget_interface_option", "-Dtarget_public_option", + "-Ddep_interface_option", "PATH:-Ddepflag=\"CMakeFiles/CXXModules__export_build_database@synth_0.dir/.d\"", "REGEX:", "PATH:CMakeFiles/CXXModules__export_build_database@synth_0.dir/", @@ -299,9 +299,9 @@ "-Dfrom_cmake_cxx_flags", "-Dfrom_cmake_cxx__flags", "", - "-Ddep_interface_option", "-Dtarget_interface_option", - "-Dtarget_public_option" + "-Dtarget_public_option", + "-Ddep_interface_option" ], "local-arguments": [ "-D_MBCS", @@ -318,9 +318,9 @@ "-Dfrom_cmake_cxx_flags", "-Dfrom_cmake_cxx__flags", "", - "-Ddep_interface_option", "-Dtarget_interface_option", - "-Dtarget_public_option" + "-Dtarget_public_option", + "-Ddep_interface_option" ], "private": false, "provides": { @@ -354,9 +354,9 @@ "-Dfrom_cmake_cxx_flags", "-Dfrom_cmake_cxx__flags", "", - "-Ddep_interface_option", "-Dtarget_interface_option", "-Dtarget_public_option", + "-Ddep_interface_option", "PATH:-Ddepflag=\"CMakeFiles/CXXModules__export_build_database@synth_0.dir/.d\"", "REGEX:", "PATH:CMakeFiles/CXXModules__export_build_database@synth_0.dir/", @@ -378,9 +378,9 @@ "-Dfrom_cmake_cxx_flags", "-Dfrom_cmake_cxx__flags", "", - "-Ddep_interface_option", "-Dtarget_interface_option", - "-Dtarget_public_option" + "-Dtarget_public_option", + "-Ddep_interface_option" ], "local-arguments": [ "-D_MBCS", @@ -397,9 +397,9 @@ "-Dfrom_cmake_cxx_flags", "-Dfrom_cmake_cxx__flags", "", - "-Ddep_interface_option", "-Dtarget_interface_option", - "-Dtarget_public_option" + "-Dtarget_public_option", + "-Ddep_interface_option" ], "private": false, "provides": { @@ -436,8 +436,8 @@ "-Dfrom_compile_options", "-Dtarget_private_option", "-Dtarget_public_option", - "-Ddep_interface_option", "-Dtarget_interface_option", + "-Ddep_interface_option", "PATH:-Ddepflag=\"CMakeFiles/CXXModules__export_build_database@synth_1.dir/.d\"", "REGEX:", "PATH:CMakeFiles/CXXModules__export_build_database@synth_1.dir/", @@ -462,8 +462,8 @@ "-Dfrom_compile_options", "-Dtarget_private_option", "-Dtarget_public_option", - "-Ddep_interface_option", - "-Dtarget_interface_option" + "-Dtarget_interface_option", + "-Ddep_interface_option" ], "local-arguments": [ "-D_MBCS", @@ -483,8 +483,8 @@ "-Dfrom_compile_options", "-Dtarget_private_option", "-Dtarget_public_option", - "-Ddep_interface_option", - "-Dtarget_interface_option" + "-Dtarget_interface_option", + "-Ddep_interface_option" ], "private": false, "provides": { @@ -521,8 +521,8 @@ "-Dfrom_compile_options", "-Dtarget_private_option", "-Dtarget_public_option", - "-Ddep_interface_option", "-Dtarget_interface_option", + "-Ddep_interface_option", "PATH:-Ddepflag=\"CMakeFiles/CXXModules__export_build_database@synth_1.dir/.d\"", "REGEX:", "PATH:CMakeFiles/CXXModules__export_build_database@synth_1.dir/", @@ -547,8 +547,8 @@ "-Dfrom_compile_options", "-Dtarget_private_option", "-Dtarget_public_option", - "-Ddep_interface_option", - "-Dtarget_interface_option" + "-Dtarget_interface_option", + "-Ddep_interface_option" ], "local-arguments": [ "-D_MBCS", @@ -568,8 +568,8 @@ "-Dfrom_compile_options", "-Dtarget_private_option", "-Dtarget_public_option", - "-Ddep_interface_option", - "-Dtarget_interface_option" + "-Dtarget_interface_option", + "-Ddep_interface_option" ], "private": false, "provides": { diff --git a/Tests/RunCMake/CXXModulesCompile/expect/exp-builddb-imped-all.json b/Tests/RunCMake/CXXModulesCompile/expect/exp-builddb-imped-all.json index 0428807896..83cef7942a 100644 --- a/Tests/RunCMake/CXXModulesCompile/expect/exp-builddb-imped-all.json +++ b/Tests/RunCMake/CXXModulesCompile/expect/exp-builddb-imped-all.json @@ -149,9 +149,9 @@ "-Dfrom_cmake_cxx_flags", "-Dfrom_cmake_cxx__flags", "", - "-Ddep_interface_option", "-Dtarget_interface_option", "-Dtarget_public_option", + "-Ddep_interface_option", "PATH:-Ddepflag=\"CMakeFiles/CXXModules__export_build_database@synth_0.dir/.d\"", "REGEX:", "PATH:CMakeFiles/CXXModules__export_build_database@synth_0.dir/", @@ -173,9 +173,9 @@ "-Dfrom_cmake_cxx_flags", "-Dfrom_cmake_cxx__flags", "", - "-Ddep_interface_option", "-Dtarget_interface_option", - "-Dtarget_public_option" + "-Dtarget_public_option", + "-Ddep_interface_option" ], "local-arguments": [ "-D_MBCS", @@ -192,9 +192,9 @@ "-Dfrom_cmake_cxx_flags", "-Dfrom_cmake_cxx__flags", "", - "-Ddep_interface_option", "-Dtarget_interface_option", - "-Dtarget_public_option" + "-Dtarget_public_option", + "-Ddep_interface_option" ], "private": false, "provides": { @@ -231,8 +231,8 @@ "-Dfrom_compile_options", "-Dtarget_private_option", "-Dtarget_public_option", - "-Ddep_interface_option", "-Dtarget_interface_option", + "-Ddep_interface_option", "PATH:-Ddepflag=\"CMakeFiles/CXXModules__export_build_database@synth_1.dir/.d\"", "REGEX:", "PATH:CMakeFiles/CXXModules__export_build_database@synth_1.dir/", @@ -257,8 +257,8 @@ "-Dfrom_compile_options", "-Dtarget_private_option", "-Dtarget_public_option", - "-Ddep_interface_option", - "-Dtarget_interface_option" + "-Dtarget_interface_option", + "-Ddep_interface_option" ], "local-arguments": [ "-D_MBCS", @@ -278,8 +278,8 @@ "-Dfrom_compile_options", "-Dtarget_private_option", "-Dtarget_public_option", - "-Ddep_interface_option", - "-Dtarget_interface_option" + "-Dtarget_interface_option", + "-Ddep_interface_option" ], "private": false, "provides": { diff --git a/Tests/RunCMake/CXXModulesCompile/expect/exp-builddb-imped-config.json b/Tests/RunCMake/CXXModulesCompile/expect/exp-builddb-imped-config.json index 0428807896..83cef7942a 100644 --- a/Tests/RunCMake/CXXModulesCompile/expect/exp-builddb-imped-config.json +++ b/Tests/RunCMake/CXXModulesCompile/expect/exp-builddb-imped-config.json @@ -149,9 +149,9 @@ "-Dfrom_cmake_cxx_flags", "-Dfrom_cmake_cxx__flags", "", - "-Ddep_interface_option", "-Dtarget_interface_option", "-Dtarget_public_option", + "-Ddep_interface_option", "PATH:-Ddepflag=\"CMakeFiles/CXXModules__export_build_database@synth_0.dir/.d\"", "REGEX:", "PATH:CMakeFiles/CXXModules__export_build_database@synth_0.dir/", @@ -173,9 +173,9 @@ "-Dfrom_cmake_cxx_flags", "-Dfrom_cmake_cxx__flags", "", - "-Ddep_interface_option", "-Dtarget_interface_option", - "-Dtarget_public_option" + "-Dtarget_public_option", + "-Ddep_interface_option" ], "local-arguments": [ "-D_MBCS", @@ -192,9 +192,9 @@ "-Dfrom_cmake_cxx_flags", "-Dfrom_cmake_cxx__flags", "", - "-Ddep_interface_option", "-Dtarget_interface_option", - "-Dtarget_public_option" + "-Dtarget_public_option", + "-Ddep_interface_option" ], "private": false, "provides": { @@ -231,8 +231,8 @@ "-Dfrom_compile_options", "-Dtarget_private_option", "-Dtarget_public_option", - "-Ddep_interface_option", "-Dtarget_interface_option", + "-Ddep_interface_option", "PATH:-Ddepflag=\"CMakeFiles/CXXModules__export_build_database@synth_1.dir/.d\"", "REGEX:", "PATH:CMakeFiles/CXXModules__export_build_database@synth_1.dir/", @@ -257,8 +257,8 @@ "-Dfrom_compile_options", "-Dtarget_private_option", "-Dtarget_public_option", - "-Ddep_interface_option", - "-Dtarget_interface_option" + "-Dtarget_interface_option", + "-Ddep_interface_option" ], "local-arguments": [ "-D_MBCS", @@ -278,8 +278,8 @@ "-Dfrom_compile_options", "-Dtarget_private_option", "-Dtarget_public_option", - "-Ddep_interface_option", - "-Dtarget_interface_option" + "-Dtarget_interface_option", + "-Ddep_interface_option" ], "private": false, "provides": { diff --git a/Tests/RunCMake/CXXModulesCompile/expect/exp-builddb-imped-cxx-config.json b/Tests/RunCMake/CXXModulesCompile/expect/exp-builddb-imped-cxx-config.json index 0428807896..83cef7942a 100644 --- a/Tests/RunCMake/CXXModulesCompile/expect/exp-builddb-imped-cxx-config.json +++ b/Tests/RunCMake/CXXModulesCompile/expect/exp-builddb-imped-cxx-config.json @@ -149,9 +149,9 @@ "-Dfrom_cmake_cxx_flags", "-Dfrom_cmake_cxx__flags", "", - "-Ddep_interface_option", "-Dtarget_interface_option", "-Dtarget_public_option", + "-Ddep_interface_option", "PATH:-Ddepflag=\"CMakeFiles/CXXModules__export_build_database@synth_0.dir/.d\"", "REGEX:", "PATH:CMakeFiles/CXXModules__export_build_database@synth_0.dir/", @@ -173,9 +173,9 @@ "-Dfrom_cmake_cxx_flags", "-Dfrom_cmake_cxx__flags", "", - "-Ddep_interface_option", "-Dtarget_interface_option", - "-Dtarget_public_option" + "-Dtarget_public_option", + "-Ddep_interface_option" ], "local-arguments": [ "-D_MBCS", @@ -192,9 +192,9 @@ "-Dfrom_cmake_cxx_flags", "-Dfrom_cmake_cxx__flags", "", - "-Ddep_interface_option", "-Dtarget_interface_option", - "-Dtarget_public_option" + "-Dtarget_public_option", + "-Ddep_interface_option" ], "private": false, "provides": { @@ -231,8 +231,8 @@ "-Dfrom_compile_options", "-Dtarget_private_option", "-Dtarget_public_option", - "-Ddep_interface_option", "-Dtarget_interface_option", + "-Ddep_interface_option", "PATH:-Ddepflag=\"CMakeFiles/CXXModules__export_build_database@synth_1.dir/.d\"", "REGEX:", "PATH:CMakeFiles/CXXModules__export_build_database@synth_1.dir/", @@ -257,8 +257,8 @@ "-Dfrom_compile_options", "-Dtarget_private_option", "-Dtarget_public_option", - "-Ddep_interface_option", - "-Dtarget_interface_option" + "-Dtarget_interface_option", + "-Ddep_interface_option" ], "local-arguments": [ "-D_MBCS", @@ -278,8 +278,8 @@ "-Dfrom_compile_options", "-Dtarget_private_option", "-Dtarget_public_option", - "-Ddep_interface_option", - "-Dtarget_interface_option" + "-Dtarget_interface_option", + "-Ddep_interface_option" ], "private": false, "provides": { diff --git a/Tests/RunCMake/CXXModulesCompile/expect/exp-builddb-imped-cxx-multi.json b/Tests/RunCMake/CXXModulesCompile/expect/exp-builddb-imped-cxx-multi.json index c742a2eb30..113680635e 100644 --- a/Tests/RunCMake/CXXModulesCompile/expect/exp-builddb-imped-cxx-multi.json +++ b/Tests/RunCMake/CXXModulesCompile/expect/exp-builddb-imped-cxx-multi.json @@ -275,9 +275,9 @@ "-Dfrom_cmake_cxx_flags", "-Dfrom_cmake_cxx__flags", "", - "-Ddep_interface_option", "-Dtarget_interface_option", "-Dtarget_public_option", + "-Ddep_interface_option", "PATH:-Ddepflag=\"CMakeFiles/CXXModules__export_build_database@synth_0.dir/.d\"", "REGEX:", "PATH:CMakeFiles/CXXModules__export_build_database@synth_0.dir/", @@ -299,9 +299,9 @@ "-Dfrom_cmake_cxx_flags", "-Dfrom_cmake_cxx__flags", "", - "-Ddep_interface_option", "-Dtarget_interface_option", - "-Dtarget_public_option" + "-Dtarget_public_option", + "-Ddep_interface_option" ], "local-arguments": [ "-D_MBCS", @@ -318,9 +318,9 @@ "-Dfrom_cmake_cxx_flags", "-Dfrom_cmake_cxx__flags", "", - "-Ddep_interface_option", "-Dtarget_interface_option", - "-Dtarget_public_option" + "-Dtarget_public_option", + "-Ddep_interface_option" ], "private": false, "provides": { @@ -354,9 +354,9 @@ "-Dfrom_cmake_cxx_flags", "-Dfrom_cmake_cxx__flags", "", - "-Ddep_interface_option", "-Dtarget_interface_option", "-Dtarget_public_option", + "-Ddep_interface_option", "PATH:-Ddepflag=\"CMakeFiles/CXXModules__export_build_database@synth_0.dir/.d\"", "REGEX:", "PATH:CMakeFiles/CXXModules__export_build_database@synth_0.dir/", @@ -378,9 +378,9 @@ "-Dfrom_cmake_cxx_flags", "-Dfrom_cmake_cxx__flags", "", - "-Ddep_interface_option", "-Dtarget_interface_option", - "-Dtarget_public_option" + "-Dtarget_public_option", + "-Ddep_interface_option" ], "local-arguments": [ "-D_MBCS", @@ -397,9 +397,9 @@ "-Dfrom_cmake_cxx_flags", "-Dfrom_cmake_cxx__flags", "", - "-Ddep_interface_option", "-Dtarget_interface_option", - "-Dtarget_public_option" + "-Dtarget_public_option", + "-Ddep_interface_option" ], "private": false, "provides": { @@ -436,8 +436,8 @@ "-Dfrom_compile_options", "-Dtarget_private_option", "-Dtarget_public_option", - "-Ddep_interface_option", "-Dtarget_interface_option", + "-Ddep_interface_option", "PATH:-Ddepflag=\"CMakeFiles/CXXModules__export_build_database@synth_1.dir/.d\"", "REGEX:", "PATH:CMakeFiles/CXXModules__export_build_database@synth_1.dir/", @@ -462,8 +462,8 @@ "-Dfrom_compile_options", "-Dtarget_private_option", "-Dtarget_public_option", - "-Ddep_interface_option", - "-Dtarget_interface_option" + "-Dtarget_interface_option", + "-Ddep_interface_option" ], "local-arguments": [ "-D_MBCS", @@ -483,8 +483,8 @@ "-Dfrom_compile_options", "-Dtarget_private_option", "-Dtarget_public_option", - "-Ddep_interface_option", - "-Dtarget_interface_option" + "-Dtarget_interface_option", + "-Ddep_interface_option" ], "private": false, "provides": { @@ -521,8 +521,8 @@ "-Dfrom_compile_options", "-Dtarget_private_option", "-Dtarget_public_option", - "-Ddep_interface_option", "-Dtarget_interface_option", + "-Ddep_interface_option", "PATH:-Ddepflag=\"CMakeFiles/CXXModules__export_build_database@synth_1.dir/.d\"", "REGEX:", "PATH:CMakeFiles/CXXModules__export_build_database@synth_1.dir/", @@ -547,8 +547,8 @@ "-Dfrom_compile_options", "-Dtarget_private_option", "-Dtarget_public_option", - "-Ddep_interface_option", - "-Dtarget_interface_option" + "-Dtarget_interface_option", + "-Ddep_interface_option" ], "local-arguments": [ "-D_MBCS", @@ -568,8 +568,8 @@ "-Dfrom_compile_options", "-Dtarget_private_option", "-Dtarget_public_option", - "-Ddep_interface_option", - "-Dtarget_interface_option" + "-Dtarget_interface_option", + "-Ddep_interface_option" ], "private": false, "provides": { diff --git a/Tests/RunCMake/CXXModulesCompile/expect/exp-builddb-imped-cxx.json b/Tests/RunCMake/CXXModulesCompile/expect/exp-builddb-imped-cxx.json index 0428807896..83cef7942a 100644 --- a/Tests/RunCMake/CXXModulesCompile/expect/exp-builddb-imped-cxx.json +++ b/Tests/RunCMake/CXXModulesCompile/expect/exp-builddb-imped-cxx.json @@ -149,9 +149,9 @@ "-Dfrom_cmake_cxx_flags", "-Dfrom_cmake_cxx__flags", "", - "-Ddep_interface_option", "-Dtarget_interface_option", "-Dtarget_public_option", + "-Ddep_interface_option", "PATH:-Ddepflag=\"CMakeFiles/CXXModules__export_build_database@synth_0.dir/.d\"", "REGEX:", "PATH:CMakeFiles/CXXModules__export_build_database@synth_0.dir/", @@ -173,9 +173,9 @@ "-Dfrom_cmake_cxx_flags", "-Dfrom_cmake_cxx__flags", "", - "-Ddep_interface_option", "-Dtarget_interface_option", - "-Dtarget_public_option" + "-Dtarget_public_option", + "-Ddep_interface_option" ], "local-arguments": [ "-D_MBCS", @@ -192,9 +192,9 @@ "-Dfrom_cmake_cxx_flags", "-Dfrom_cmake_cxx__flags", "", - "-Ddep_interface_option", "-Dtarget_interface_option", - "-Dtarget_public_option" + "-Dtarget_public_option", + "-Ddep_interface_option" ], "private": false, "provides": { @@ -231,8 +231,8 @@ "-Dfrom_compile_options", "-Dtarget_private_option", "-Dtarget_public_option", - "-Ddep_interface_option", "-Dtarget_interface_option", + "-Ddep_interface_option", "PATH:-Ddepflag=\"CMakeFiles/CXXModules__export_build_database@synth_1.dir/.d\"", "REGEX:", "PATH:CMakeFiles/CXXModules__export_build_database@synth_1.dir/", @@ -257,8 +257,8 @@ "-Dfrom_compile_options", "-Dtarget_private_option", "-Dtarget_public_option", - "-Ddep_interface_option", - "-Dtarget_interface_option" + "-Dtarget_interface_option", + "-Ddep_interface_option" ], "local-arguments": [ "-D_MBCS", @@ -278,8 +278,8 @@ "-Dfrom_compile_options", "-Dtarget_private_option", "-Dtarget_public_option", - "-Ddep_interface_option", - "-Dtarget_interface_option" + "-Dtarget_interface_option", + "-Ddep_interface_option" ], "private": false, "provides": {