Ninja: require Ninja 1.11 for C++ module support

See: https://gitlab.kitware.com/cmake/cmake/-/issues/18355#note_1296721
See: https://github.com/ninja-build/ninja/pull/1937
This commit is contained in:
Ben Boeckel
2023-01-20 09:38:43 -05:00
committed by Brad King
parent f9f34eb111
commit 7abddcab08
4 changed files with 19 additions and 12 deletions

View File

@@ -742,10 +742,13 @@ void cmGlobalNinjaGenerator::CheckNinjaFeatures()
this->NinjaSupportsMultilineDepfile =
!cmSystemTools::VersionCompare(cmSystemTools::OP_LESS, this->NinjaVersion,
RequiredNinjaVersionForMultilineDepfile());
this->NinjaSupportsDyndeps =
this->NinjaSupportsDyndepsCxx =
!cmSystemTools::VersionCompare(cmSystemTools::OP_LESS, this->NinjaVersion,
RequiredNinjaVersionForDyndeps());
if (!this->NinjaSupportsDyndeps) {
RequiredNinjaVersionForDyndepsCxx());
this->NinjaSupportsDyndepsFortran =
!cmSystemTools::VersionCompare(cmSystemTools::OP_LESS, this->NinjaVersion,
RequiredNinjaVersionForDyndepsFortran());
if (!this->NinjaSupportsDyndepsFortran) {
// The ninja version number is not new enough to have upstream support.
// Our ninja branch adds ".dyndep-#" to its version number,
// where '#' is a feature-specific version number. Extract it.
@@ -756,7 +759,7 @@ void cmGlobalNinjaGenerator::CheckNinjaFeatures()
unsigned long dyndep = 0;
cmStrToULong(fv, &dyndep);
if (dyndep == 1) {
this->NinjaSupportsDyndeps = true;
this->NinjaSupportsDyndepsFortran = true;
}
}
}
@@ -856,7 +859,7 @@ bool cmGlobalNinjaGenerator::CheckLanguages(
bool cmGlobalNinjaGenerator::CheckCxxModuleSupport()
{
this->CxxModuleSupportCheck();
if (this->NinjaSupportsDyndeps) {
if (this->NinjaSupportsDyndepsCxx) {
return true;
}
bool const diagnose = !this->DiagnosedCxxModuleNinjaSupport &&
@@ -869,7 +872,8 @@ bool cmGlobalNinjaGenerator::CheckCxxModuleSupport()
"using Ninja version \n"
" " << this->NinjaVersion << "\n"
"due to lack of required features. "
"Ninja " << RequiredNinjaVersionForDyndeps() << " or higher is required."
"Ninja " << RequiredNinjaVersionForDyndepsCxx() <<
" or higher is required."
;
/* clang-format on */
this->GetCMakeInstance()->IssueMessage(MessageType::FATAL_ERROR, e.str());
@@ -880,7 +884,7 @@ bool cmGlobalNinjaGenerator::CheckCxxModuleSupport()
bool cmGlobalNinjaGenerator::CheckFortran(cmMakefile* mf) const
{
if (this->NinjaSupportsDyndeps) {
if (this->NinjaSupportsDyndepsFortran) {
return true;
}
@@ -890,7 +894,8 @@ bool cmGlobalNinjaGenerator::CheckFortran(cmMakefile* mf) const
"The Ninja generator does not support Fortran using Ninja version\n"
" " << this->NinjaVersion << "\n"
"due to lack of required features. "
"Ninja " << RequiredNinjaVersionForDyndeps() << " or higher is required."
"Ninja " << RequiredNinjaVersionForDyndepsFortran() <<
" or higher is required."
;
/* clang-format on */
mf->IssueMessage(MessageType::FATAL_ERROR, e.str());

View File

@@ -389,7 +389,8 @@ public:
{
return "1.9";
}
static std::string RequiredNinjaVersionForDyndeps() { return "1.10"; }
static std::string RequiredNinjaVersionForDyndepsCxx() { return "1.11"; }
static std::string RequiredNinjaVersionForDyndepsFortran() { return "1.10"; }
static std::string RequiredNinjaVersionForRestatTool() { return "1.10"; }
static std::string RequiredNinjaVersionForUnconditionalRecompactTool()
{
@@ -578,7 +579,8 @@ private:
bool NinjaSupportsImplicitOuts = false;
bool NinjaSupportsManifestRestat = false;
bool NinjaSupportsMultilineDepfile = false;
bool NinjaSupportsDyndeps = false;
bool NinjaSupportsDyndepsCxx = false;
bool NinjaSupportsDyndepsFortran = false;
bool NinjaSupportsRestatTool = false;
bool NinjaSupportsUnconditionalRecompactTool = false;
bool NinjaSupportsMultipleOutputs = false;

View File

@@ -15,7 +15,7 @@ CMake Error:
.*
due to lack of required features. Ninja 1.10 or higher is required.
due to lack of required features. Ninja 1.11 or higher is required.
|CMake Error in CMakeLists.txt:
The "nodyndep" target contains C\+\+ module sources which are not supported

View File

@@ -38,7 +38,7 @@ endif ()
set(generator_supports_cxx_modules 0)
if (RunCMake_GENERATOR MATCHES "Ninja" AND
ninja_version VERSION_GREATER_EQUAL "1.10" AND
ninja_version VERSION_GREATER_EQUAL "1.11" AND
"cxx_std_20" IN_LIST CMAKE_CXX_COMPILE_FEATURES)
set(generator_supports_cxx_modules 1)
endif ()