Bläddra i källkod

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
Alex Turbov 9 månader sedan
förälder
incheckning
b65930a7a7

+ 1 - 1
Auxiliary/vim/syntax/cmake.vim

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

+ 2 - 1
Help/manual/cmake-properties.7.rst

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

+ 5 - 10
Help/prop_tgt/Fortran_BUILDING_INSTRINSIC_MODULES.rst

@@ -1,16 +1,11 @@
 Fortran_BUILDING_INSTRINSIC_MODULES
 -----------------------------------
 
-.. versionadded:: 3.22
+.. deprecated:: 3.32
 
-Instructs the CMake Fortran preprocessor that the target is building
-Fortran intrinsics for building a Fortran compiler.
+  Please use the :prop_tgt:`Fortran_BUILDING_INTRINSIC_MODULES` instead.
 
-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.
+.. versionadded:: 3.22
 
-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.
+A misspelled variant of the :prop_tgt:`Fortran_BUILDING_INTRINSIC_MODULES`
+target property.

+ 16 - 0
Help/prop_tgt/Fortran_BUILDING_INTRINSIC_MODULES.rst

@@ -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.

+ 4 - 0
Source/cmDependsFortran.cxx

@@ -166,7 +166,11 @@ bool cmDependsFortran::Finalize(std::ostream& makeDepends,
     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 =
+    !mf->GetSafeDefinition("CMAKE_Fortran_TARGET_BUILDING_INTRINSIC_MODULES")
+       .empty() ||
     !mf->GetSafeDefinition("CMAKE_Fortran_TARGET_BUILDING_INSTRINSIC_MODULES")
        .empty();
 

+ 6 - 1
Source/cmGeneratorTarget.cxx

@@ -4043,8 +4043,13 @@ std::string cmGeneratorTarget::GetFortranModuleDirectory(
   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 =
         this->GetProperty("Fortran_BUILDING_INSTRINSIC_MODULES")) {
     return prop.IsOn();

+ 1 - 1
Source/cmGeneratorTarget.h

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

+ 2 - 2
Source/cmMakefileTargetGenerator.cxx

@@ -1498,11 +1498,11 @@ void cmMakefileTargetGenerator::WriteTargetDependRules()
     << this->GeneratorTarget->GetFortranModuleDirectory(working_dir)
     << "\")\n";
 
-  if (this->GeneratorTarget->IsFortranBuildingInstrinsicModules()) {
+  if (this->GeneratorTarget->IsFortranBuildingIntrinsicModules()) {
     *this->InfoFileStream
       << "\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 */