Fortran: Add Fortran_BUILDING_INTRINSIC_MODULES for building intrinsics

In commit fe3f846e1b (Makefiles: Add support for building Fortran
intrinsics, 2020-11-19, v3.22.0-rc1~565^2) the property was added with
incorrect spelling `Fortran_BUILDING_INSTRINSIC_MODULES`.  Add a new
property with the correct spelling.  Keep the old one for compatibility.

Issue: #21463
This commit is contained in:
Alex Turbov 2025-01-09 06:52:09 +04:00 committed by Brad King
parent 52b31ff751
commit b65930a7a7
8 changed files with 38 additions and 17 deletions

View File

@ -195,7 +195,7 @@ syn keyword cmakeProperty contained
\ FOLDER \ FOLDER
\ FRAMEWORK \ FRAMEWORK
\ FRAMEWORK_VERSION \ FRAMEWORK_VERSION
\ Fortran_BUILDING_INSTRINSIC_MODULES \ Fortran_BUILDING_INTRINSIC_MODULES
\ Fortran_FORMAT \ Fortran_FORMAT
\ Fortran_MODULE_DIRECTORY \ Fortran_MODULE_DIRECTORY
\ Fortran_PREPROCESS \ Fortran_PREPROCESS

View File

@ -226,7 +226,7 @@ Properties on Targets
/prop_tgt/EXPORT_NO_SYSTEM /prop_tgt/EXPORT_NO_SYSTEM
/prop_tgt/EXPORT_PROPERTIES /prop_tgt/EXPORT_PROPERTIES
/prop_tgt/FOLDER /prop_tgt/FOLDER
/prop_tgt/Fortran_BUILDING_INSTRINSIC_MODULES /prop_tgt/Fortran_BUILDING_INTRINSIC_MODULES
/prop_tgt/Fortran_FORMAT /prop_tgt/Fortran_FORMAT
/prop_tgt/Fortran_MODULE_DIRECTORY /prop_tgt/Fortran_MODULE_DIRECTORY
/prop_tgt/Fortran_PREPROCESS /prop_tgt/Fortran_PREPROCESS
@ -661,6 +661,7 @@ Deprecated Properties on Targets
:maxdepth: 1 :maxdepth: 1
/prop_tgt/COMPILE_DEFINITIONS_CONFIG /prop_tgt/COMPILE_DEFINITIONS_CONFIG
/prop_tgt/Fortran_BUILDING_INSTRINSIC_MODULES
/prop_tgt/IMPORTED_NO_SYSTEM /prop_tgt/IMPORTED_NO_SYSTEM
/prop_tgt/IOS_INSTALL_COMBINED /prop_tgt/IOS_INSTALL_COMBINED
/prop_tgt/POST_INSTALL_SCRIPT /prop_tgt/POST_INSTALL_SCRIPT

View File

@ -1,16 +1,11 @@
Fortran_BUILDING_INSTRINSIC_MODULES Fortran_BUILDING_INSTRINSIC_MODULES
----------------------------------- -----------------------------------
.. deprecated:: 3.32
Please use the :prop_tgt:`Fortran_BUILDING_INTRINSIC_MODULES` instead.
.. versionadded:: 3.22 .. versionadded:: 3.22
Instructs the CMake Fortran preprocessor that the target is building A misspelled variant of the :prop_tgt:`Fortran_BUILDING_INTRINSIC_MODULES`
Fortran intrinsics for building a Fortran compiler. target property.
This property is off by default and should be turned only on projects
that build a Fortran compiler. It should not be turned on for projects
that use a Fortran compiler.
Turning this property on will correctly add dependencies for building
Fortran intrinsic modules whereas turning the property off will ignore
Fortran intrinsic modules in the dependency graph as they are supplied
by the compiler itself.

View File

@ -0,0 +1,16 @@
Fortran_BUILDING_INTRINSIC_MODULES
----------------------------------
.. versionadded:: 3.32
Instructs the CMake Fortran preprocessor that the target is building
Fortran intrinsics for building a Fortran compiler.
This property is off by default and should be turned only on projects
that build a Fortran compiler. It should not be turned on for projects
that use a Fortran compiler.
Turning this property on will correctly add dependencies for building
Fortran intrinsic modules whereas turning the property off will ignore
Fortran intrinsic modules in the dependency graph as they are supplied
by the compiler itself.

View File

@ -166,7 +166,11 @@ bool cmDependsFortran::Finalize(std::ostream& makeDepends,
mod_dir = this->LocalGenerator->GetCurrentBinaryDirectory(); mod_dir = this->LocalGenerator->GetCurrentBinaryDirectory();
} }
// ATTENTION Before 3.32 the property name was misspelled.
// Check the correct name first and than the old name.
bool building_intrinsics = bool building_intrinsics =
!mf->GetSafeDefinition("CMAKE_Fortran_TARGET_BUILDING_INTRINSIC_MODULES")
.empty() ||
!mf->GetSafeDefinition("CMAKE_Fortran_TARGET_BUILDING_INSTRINSIC_MODULES") !mf->GetSafeDefinition("CMAKE_Fortran_TARGET_BUILDING_INSTRINSIC_MODULES")
.empty(); .empty();

View File

@ -4043,8 +4043,13 @@ std::string cmGeneratorTarget::GetFortranModuleDirectory(
return this->FortranModuleDirectory; return this->FortranModuleDirectory;
} }
bool cmGeneratorTarget::IsFortranBuildingInstrinsicModules() const bool cmGeneratorTarget::IsFortranBuildingIntrinsicModules() const
{ {
// ATTENTION Before 3.32 the property name was misspelled.
// Check the correct name first and than the old name.
if (cmValue prop = this->GetProperty("Fortran_BUILDING_INTRINSIC_MODULES")) {
return prop.IsOn();
}
if (cmValue prop = if (cmValue prop =
this->GetProperty("Fortran_BUILDING_INSTRINSIC_MODULES")) { this->GetProperty("Fortran_BUILDING_INSTRINSIC_MODULES")) {
return prop.IsOn(); return prop.IsOn();

View File

@ -1066,7 +1066,7 @@ public:
std::string const& config) const; std::string const& config) const;
std::string GetFortranModuleDirectory(std::string const& working_dir) const; std::string GetFortranModuleDirectory(std::string const& working_dir) const;
bool IsFortranBuildingInstrinsicModules() const; bool IsFortranBuildingIntrinsicModules() const;
bool IsLinkLookupScope(std::string const& n, bool IsLinkLookupScope(std::string const& n,
cmLocalGenerator const*& lg) const; cmLocalGenerator const*& lg) const;

View File

@ -1498,11 +1498,11 @@ void cmMakefileTargetGenerator::WriteTargetDependRules()
<< this->GeneratorTarget->GetFortranModuleDirectory(working_dir) << this->GeneratorTarget->GetFortranModuleDirectory(working_dir)
<< "\")\n"; << "\")\n";
if (this->GeneratorTarget->IsFortranBuildingInstrinsicModules()) { if (this->GeneratorTarget->IsFortranBuildingIntrinsicModules()) {
*this->InfoFileStream *this->InfoFileStream
<< "\n" << "\n"
<< "# Fortran compiler is building intrinsic modules.\n" << "# Fortran compiler is building intrinsic modules.\n"
<< "set(CMAKE_Fortran_TARGET_BUILDING_INSTRINSIC_MODULES ON) \n"; << "set(CMAKE_Fortran_TARGET_BUILDING_INTRINSIC_MODULES ON) \n";
} }
/* clang-format on */ /* clang-format on */