summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBen Boeckel <ben.boeckel@kitware.com>2023-09-21 20:03:08 (GMT)
committerBen Boeckel <ben.boeckel@kitware.com>2023-10-02 14:17:31 (GMT)
commit0c07f390068fe5a9c3c99ebc64f6e6c72b6eff41 (patch)
tree89a4e61adfbb81b0194602a09f0052398d6100a0 /Source
parent68caec9137f47fda219995db7cfdf588886c84a1 (diff)
downloadCMake-0c07f390068fe5a9c3c99ebc64f6e6c72b6eff41.zip
CMake-0c07f390068fe5a9c3c99ebc64f6e6c72b6eff41.tar.gz
CMake-0c07f390068fe5a9c3c99ebc64f6e6c72b6eff41.tar.bz2
cmExperimental: remove the flag for C++ modules
All the major compilers now have scheduled releases with support for scanning, so remove the experimental gate. Fixes: #18355
Diffstat (limited to 'Source')
-rw-r--r--Source/cmCoreTryCompile.cxx17
-rw-r--r--Source/cmExperimental.cxx11
-rw-r--r--Source/cmExperimental.h1
-rw-r--r--Source/cmExportCommand.cxx15
-rw-r--r--Source/cmGeneratorTarget.cxx16
-rw-r--r--Source/cmGeneratorTarget.h4
-rw-r--r--Source/cmInstallCommand.cxx25
-rw-r--r--Source/cmTargetSourcesCommand.cxx31
8 files changed, 30 insertions, 90 deletions
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index ee40bd5..6ca0e14 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -235,25 +235,16 @@ ArgumentParser::Continue cmCoreTryCompile::Arguments::SetSourceType(
this->SourceTypeContext = SourceType::Normal;
matched = true;
} else if (sourceType == "CXX_MODULE"_s) {
- bool const supportCxxModuleSources = cmExperimental::HasSupportEnabled(
- *this->Makefile, cmExperimental::Feature::CxxModuleCMakeApi);
- if (supportCxxModuleSources) {
- this->SourceTypeContext = SourceType::CxxModule;
- matched = true;
- }
+ this->SourceTypeContext = SourceType::CxxModule;
+ matched = true;
}
if (!matched && this->SourceTypeError.empty()) {
- bool const supportCxxModuleSources = cmExperimental::HasSupportEnabled(
- *this->Makefile, cmExperimental::Feature::CxxModuleCMakeApi);
- auto const* message = "'SOURCE'";
- if (supportCxxModuleSources) {
- message = "one of 'SOURCE' or 'CXX_MODULE'";
- }
// Only remember one error at a time; all other errors related to argument
// parsing are "indicate one error and return" anyways.
this->SourceTypeError =
- cmStrCat("Invalid 'SOURCE_TYPE' '", sourceType, "'; must be ", message);
+ cmStrCat("Invalid 'SOURCE_TYPE' '", sourceType,
+ "'; must be one of 'SOURCE' or 'CXX_MODULE'");
}
return ArgumentParser::Continue::Yes;
}
diff --git a/Source/cmExperimental.cxx b/Source/cmExperimental.cxx
index 104ab81..d75879f 100644
--- a/Source/cmExperimental.cxx
+++ b/Source/cmExperimental.cxx
@@ -19,17 +19,6 @@ namespace {
* up-to-date.
*/
cmExperimental::FeatureData LookupTable[] = {
- // CxxModuleCMakeApi
- { "CxxModuleCMakeApi",
- "ac01f462-0f5f-432a-86aa-acef252918a6",
- "CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API",
- "CMake's C++ module support is experimental. It is meant only for "
- "experimentation and feedback to CMake developers.",
- { "CMAKE_EXPERIMENTAL_CXX_SCANDEP_SOURCE",
- "CMAKE_EXPERIMENTAL_CXX_MODULE_MAP_FORMAT",
- "CMAKE_EXPERIMENTAL_CXX_MODULE_MAP_FLAG" },
- cmExperimental::TryCompileCondition::SkipCompilerChecks,
- false },
// WindowsKernelModeDriver
{ "WindowsKernelModeDriver",
"5c2d848d-4efa-4529-a768-efd57171bf68",
diff --git a/Source/cmExperimental.h b/Source/cmExperimental.h
index c958ab6..e4c1448 100644
--- a/Source/cmExperimental.h
+++ b/Source/cmExperimental.h
@@ -15,7 +15,6 @@ class cmExperimental
public:
enum class Feature
{
- CxxModuleCMakeApi,
WindowsKernelModeDriver,
Sentinel,
diff --git a/Source/cmExportCommand.cxx b/Source/cmExportCommand.cxx
index 273296d..e78b869 100644
--- a/Source/cmExportCommand.cxx
+++ b/Source/cmExportCommand.cxx
@@ -16,7 +16,6 @@
#include "cmArgumentParserTypes.h"
#include "cmCryptoHash.h"
#include "cmExecutionStatus.h"
-#include "cmExperimental.h"
#include "cmExportBuildAndroidMKGenerator.h"
#include "cmExportBuildFileGenerator.h"
#include "cmExportSet.h"
@@ -69,15 +68,11 @@ bool cmExportCommand(std::vector<std::string> const& args,
bool ExportOld = false;
};
- auto parser = cmArgumentParser<Arguments>{}
- .Bind("NAMESPACE"_s, &Arguments::Namespace)
- .Bind("FILE"_s, &Arguments::Filename);
-
- bool const supportCxx20FileSetTypes = cmExperimental::HasSupportEnabled(
- status.GetMakefile(), cmExperimental::Feature::CxxModuleCMakeApi);
- if (supportCxx20FileSetTypes) {
- parser.Bind("CXX_MODULES_DIRECTORY"_s, &Arguments::CxxModulesDirectory);
- }
+ auto parser =
+ cmArgumentParser<Arguments>{}
+ .Bind("NAMESPACE"_s, &Arguments::Namespace)
+ .Bind("FILE"_s, &Arguments::Filename)
+ .Bind("CXX_MODULES_DIRECTORY"_s, &Arguments::CxxModulesDirectory);
if (args[0] == "EXPORT") {
parser.Bind("EXPORT"_s, &Arguments::ExportSetName);
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 04d7bb1..bbb47e4 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -31,7 +31,6 @@
#include "cmCustomCommandGenerator.h"
#include "cmCxxModuleUsageEffects.h"
#include "cmEvaluatedTargetProperty.h"
-#include "cmExperimental.h"
#include "cmFileSet.h"
#include "cmFileTimes.h"
#include "cmGeneratedFileStream.h"
@@ -9106,9 +9105,10 @@ cmGeneratorTarget::Cxx20SupportLevel cmGeneratorTarget::HaveCxxModuleSupport(
// Else, an empty CMAKE_CXX_STANDARD_DEFAULT means CMake does not detect and
// set a default standard level for this compiler, so assume all standards
// are available.
- if (!cmExperimental::HasSupportEnabled(
- *this->Makefile, cmExperimental::Feature::CxxModuleCMakeApi)) {
- return Cxx20SupportLevel::MissingExperimentalFlag;
+ cmValue scandepRule =
+ this->Target->GetMakefile()->GetDefinition("CMAKE_CXX_SCANDEP_SOURCE");
+ if (!scandepRule) {
+ return Cxx20SupportLevel::MissingRule;
}
return Cxx20SupportLevel::Supported;
}
@@ -9125,13 +9125,6 @@ void cmGeneratorTarget::CheckCxxModuleStatus(std::string const& config) const
"\" has C++ sources that export modules but the \"CXX\" "
"language has not been enabled"));
break;
- case cmGeneratorTarget::Cxx20SupportLevel::MissingExperimentalFlag:
- this->Makefile->IssueMessage(
- MessageType::FATAL_ERROR,
- cmStrCat("The target named \"", this->GetName(),
- "\" has C++ sources that export modules but its "
- "experimental support has not been requested"));
- break;
case cmGeneratorTarget::Cxx20SupportLevel::NoCxx20: {
cmStandardLevelResolver standardResolver(this->Makefile);
auto effStandard =
@@ -9149,6 +9142,7 @@ void cmGeneratorTarget::CheckCxxModuleStatus(std::string const& config) const
"\"cxx_std_20\" (or newer) among its `target_compile_features`",
effStandard));
} break;
+ case cmGeneratorTarget::Cxx20SupportLevel::MissingRule:
case cmGeneratorTarget::Cxx20SupportLevel::Supported:
// All is well.
break;
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index 751f907..72920d6 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -1288,10 +1288,10 @@ public:
{
// C++ is not available.
MissingCxx,
- // The experimental feature is not available.
- MissingExperimentalFlag,
// The target does not require at least C++20.
NoCxx20,
+ // C++20 module scanning rules are not present.
+ MissingRule,
// C++20 modules are available and working.
Supported,
};
diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx
index 1b47ec4..0fc4011 100644
--- a/Source/cmInstallCommand.cxx
+++ b/Source/cmInstallCommand.cxx
@@ -21,7 +21,6 @@
#include "cmArgumentParser.h"
#include "cmArgumentParserTypes.h"
#include "cmExecutionStatus.h"
-#include "cmExperimental.h"
#include "cmExportSet.h"
#include "cmFileSet.h"
#include "cmGeneratorExpression.h"
@@ -491,6 +490,7 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
publicHeaderArgs.Parse(argVectors.PublicHeader, &unknownArgs);
resourceArgs.Parse(argVectors.Resource, &unknownArgs);
includesArgs.Parse(&argVectors.Includes, &unknownArgs);
+ cxxModuleBmiArgs.Parse(argVectors.CxxModulesBmi, &unknownArgs);
for (std::size_t i = 0; i < argVectors.FileSets.size(); i++) {
// We have to create a separate object for the parsing because
// cmArgumentParser<void>::Bind() binds to a specific address, but the
@@ -501,15 +501,6 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
fileSetArgs[i] = std::move(fileSetArg);
}
- bool const supportCxx20FileSetTypes = cmExperimental::HasSupportEnabled(
- *helper.Makefile, cmExperimental::Feature::CxxModuleCMakeApi);
- if (!supportCxx20FileSetTypes) {
- std::copy(argVectors.CxxModulesBmi.begin(), argVectors.CxxModulesBmi.end(),
- std::back_inserter(unknownArgs));
- } else {
- cxxModuleBmiArgs.Parse(argVectors.CxxModulesBmi, &unknownArgs);
- }
-
if (!unknownArgs.empty()) {
// Unknown argument.
status.SetError(
@@ -541,12 +532,10 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
success = success && privateHeaderArgs.Finalize();
success = success && publicHeaderArgs.Finalize();
success = success && resourceArgs.Finalize();
+ success = success && cxxModuleBmiArgs.Finalize();
for (auto& fileSetArg : fileSetArgs) {
success = success && fileSetArg.Finalize();
}
- if (supportCxx20FileSetTypes) {
- success = success && cxxModuleBmiArgs.Finalize();
- }
if (!success) {
return false;
@@ -1173,8 +1162,7 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
}
}
- if (supportCxx20FileSetTypes &&
- !cxxModuleBmiArgs.GetDestination().empty()) {
+ if (!cxxModuleBmiArgs.GetDestination().empty()) {
cxxModuleBmiGenerator = cm::make_unique<cmInstallCxxModuleBmiGenerator>(
target.GetName(),
helper.GetCxxModulesBmiDestination(&cxxModuleBmiArgs),
@@ -2071,12 +2059,7 @@ bool HandleExportMode(std::vector<std::string> const& args,
ica.Bind("NAMESPACE"_s, name_space);
ica.Bind("EXPORT_LINK_INTERFACE_LIBRARIES"_s, exportOld);
ica.Bind("FILE"_s, filename);
-
- bool const supportCxx20FileSetTypes = cmExperimental::HasSupportEnabled(
- *helper.Makefile, cmExperimental::Feature::CxxModuleCMakeApi);
- if (supportCxx20FileSetTypes) {
- ica.Bind("CXX_MODULES_DIRECTORY"_s, cxx_modules_directory);
- }
+ ica.Bind("CXX_MODULES_DIRECTORY"_s, cxx_modules_directory);
std::vector<std::string> unknownArgs;
ica.Parse(args, &unknownArgs);
diff --git a/Source/cmTargetSourcesCommand.cxx b/Source/cmTargetSourcesCommand.cxx
index 3d484f5..babbaa5 100644
--- a/Source/cmTargetSourcesCommand.cxx
+++ b/Source/cmTargetSourcesCommand.cxx
@@ -10,7 +10,6 @@
#include "cmArgumentParser.h"
#include "cmArgumentParserTypes.h"
-#include "cmExperimental.h"
#include "cmFileSet.h"
#include "cmGeneratorExpression.h"
#include "cmList.h"
@@ -260,28 +259,18 @@ bool TargetSourcesImpl::HandleOneFileSet(
this->SetError("Must specify a TYPE when creating file set");
return false;
}
- bool const supportCxx20FileSetTypes = cmExperimental::HasSupportEnabled(
- *this->Makefile, cmExperimental::Feature::CxxModuleCMakeApi);
+ if (type != "HEADERS"_s && type != "CXX_MODULES"_s) {
+ this->SetError(
+ R"(File set TYPE may only be "HEADERS" or "CXX_MODULES")");
+ return false;
+ }
- if (supportCxx20FileSetTypes) {
- if (type != "HEADERS"_s && type != "CXX_MODULES"_s) {
+ if (cmFileSetVisibilityIsForInterface(visibility) &&
+ !cmFileSetVisibilityIsForSelf(visibility) &&
+ !this->Target->IsImported()) {
+ if (type == "CXX_MODULES"_s) {
this->SetError(
- R"(File set TYPE may only be "HEADERS" or "CXX_MODULES")");
- return false;
- }
-
- if (cmFileSetVisibilityIsForInterface(visibility) &&
- !cmFileSetVisibilityIsForSelf(visibility) &&
- !this->Target->IsImported()) {
- if (type == "CXX_MODULES"_s) {
- this->SetError(
- R"(File set TYPE "CXX_MODULES" may not have "INTERFACE" visibility)");
- return false;
- }
- }
- } else {
- if (type != "HEADERS"_s) {
- this->SetError("File set TYPE may only be \"HEADERS\"");
+ R"(File set TYPE "CXX_MODULES" may not have "INTERFACE" visibility)");
return false;
}
}