[Cmake-commits] CMake branch, next, updated. v3.6.0-rc2-403-gaf3d9d4

Brad King brad.king at kitware.com
Fri Jun 17 16:02:32 EDT 2016


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  af3d9d44d0d2b5b78c736add58d39467094b4100 (commit)
       via  802b36fb62c7dc9a471bdb630536c82491e9cd0e (commit)
       via  3c488ce89955d00785bb4637c87b960da6c55ec8 (commit)
       via  5467e7945d46f5f8540a6e11933c9b6b584036a2 (commit)
       via  49f10f0d24420f7d96c5153ba64a16b3f43c4736 (commit)
       via  0392f72bef5f1394c2dba3740f2a701fe1a98f0d (commit)
      from  3817aa9ae5796ac3cf971b843b85b5b2ee12d9d1 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=af3d9d44d0d2b5b78c736add58d39467094b4100
commit af3d9d44d0d2b5b78c736add58d39467094b4100
Merge: 3817aa9 802b36f
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Fri Jun 17 16:02:30 2016 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Fri Jun 17 16:02:30 2016 -0400

    Merge topic 'refactor-flags' into next
    
    802b36fb cmExtraSublimeTextGenerator: Use GetTargetCompileFlags
    3c488ce8 cmLocalGenerator: Adopt target compile flag generation
    5467e794 cmLocalGenerator: Add method to get Fortran-specific compiler flags
    49f10f0d cmGeneratorTarget: Adopt Fortran module directory generation
    0392f72b Refactor Makefile/Ninja tool working directory storage


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=802b36fb62c7dc9a471bdb630536c82491e9cd0e
commit 802b36fb62c7dc9a471bdb630536c82491e9cd0e
Author:     Tobias Hunger <tobias.hunger at qt.io>
AuthorDate: Fri Jun 10 18:09:13 2016 +0200
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Fri Jun 17 14:53:01 2016 -0400

    cmExtraSublimeTextGenerator: Use GetTargetCompileFlags
    
    Replace some custom code with equivalent code from the framework.
    
    This also fixes some fixmes left in the custom code.

diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx
index 9b3ea0b..2b9f64f 100644
--- a/Source/cmExtraSublimeTextGenerator.cxx
+++ b/Source/cmExtraSublimeTextGenerator.cxx
@@ -314,27 +314,14 @@ std::string cmExtraSublimeTextGenerator::ComputeFlagsForObject(
   cmSourceFile* source, cmLocalGenerator* lg, cmGeneratorTarget* gtgt)
 {
   std::string flags;
-
-  cmMakefile* makefile = lg->GetMakefile();
   std::string language = source->GetLanguage();
   if (language.empty()) {
     language = "C";
   }
-  const std::string& config = makefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
-  // Add language-specific flags.
-  lg->AddLanguageFlags(flags, language, config);
-
-  lg->AddArchitectureFlags(flags, gtgt, language, config);
+  std::string const& config =
+    lg->GetMakefile()->GetSafeDefinition("CMAKE_BUILD_TYPE");
 
-  // TODO: Fortran support.
-  // // Fortran-specific flags computed for this target.
-  // if(*l == "Fortran")
-  //   {
-  //   this->AddFortranFlags(flags);
-  //   }
-
-  // Add shared-library flags if needed.
-  lg->AddCMP0018Flags(flags, gtgt, language, config);
+  lg->GetTargetCompileFlags(gtgt, config, language, flags);
 
   // Add include directory flags.
   {
@@ -345,17 +332,9 @@ std::string cmExtraSublimeTextGenerator::ComputeFlagsForObject(
     lg->AppendFlags(flags, includeFlags);
   }
 
-  // Append old-style preprocessor definition flags.
-  lg->AppendFlags(flags, makefile->GetDefineFlags());
-
-  // Add target-specific flags.
-  lg->AddCompileOptions(flags, gtgt, language, config);
-
   // Add source file specific flags.
   lg->AppendFlags(flags, source->GetProperty("COMPILE_FLAGS"));
 
-  // TODO: Handle Apple frameworks.
-
   return flags;
 }
 

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3c488ce89955d00785bb4637c87b960da6c55ec8
commit 3c488ce89955d00785bb4637c87b960da6c55ec8
Author:     Tobias Hunger <tobias.hunger at qt.io>
AuthorDate: Fri Jun 10 18:04:58 2016 +0200
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Fri Jun 17 14:49:38 2016 -0400

    cmLocalGenerator: Adopt target compile flag generation
    
    Factor the flag generation out of cmCommonTargetGenerator::GetFlags
    into a new cmLocalGenerator::GetTargetCompileFlags method.
    This will allow it to be used without a target generator available.

diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx
index aa7f5c0..101093d 100644
--- a/Source/cmCommonTargetGenerator.cxx
+++ b/Source/cmCommonTargetGenerator.cxx
@@ -120,38 +120,9 @@ std::string cmCommonTargetGenerator::GetFlags(const std::string& l)
   ByLanguageMap::iterator i = this->FlagsByLanguage.find(l);
   if (i == this->FlagsByLanguage.end()) {
     std::string flags;
-    const char* lang = l.c_str();
 
-    // Add language feature flags.
-    this->AddFeatureFlags(flags, lang);
-
-    this->LocalGenerator->AddArchitectureFlags(flags, this->GeneratorTarget,
-                                               lang, this->ConfigName);
-
-    // Fortran-specific flags computed for this target.
-    if (l == "Fortran") {
-      this->LocalGenerator->AppendFlags(
-        flags, this->LocalGenerator->GetTargetFortranFlags(
-                 this->GeneratorTarget, this->ConfigName));
-    }
-
-    this->LocalGenerator->AddCMP0018Flags(flags, this->GeneratorTarget, lang,
-                                          this->ConfigName);
-
-    this->LocalGenerator->AddVisibilityPresetFlags(
-      flags, this->GeneratorTarget, lang);
-
-    // Append old-style preprocessor definition flags.
-    this->LocalGenerator->AppendFlags(flags, this->Makefile->GetDefineFlags());
-
-    // Add framework directory flags.
-    this->LocalGenerator->AppendFlags(
-      flags, this->LocalGenerator->GetFrameworkFlags(l, this->ConfigName,
-                                                     this->GeneratorTarget));
-
-    // Add target-specific flags.
-    this->LocalGenerator->AddCompileOptions(flags, this->GeneratorTarget, lang,
-                                            this->ConfigName);
+    this->LocalGenerator->GetTargetCompileFlags(this->GeneratorTarget,
+                                                this->ConfigName, l, flags);
 
     ByLanguageMap::value_type entry(l, flags);
     i = this->FlagsByLanguage.insert(entry).first;
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index a0263e4..e2e7aa1 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1272,6 +1272,33 @@ void cmLocalGenerator::GetTargetFlags(
   }
 }
 
+void cmLocalGenerator::GetTargetCompileFlags(cmGeneratorTarget* target,
+                                             std::string const& config,
+                                             std::string const& lang,
+                                             std::string& flags)
+{
+  cmMakefile* mf = this->GetMakefile();
+
+  // Add language-specific flags.
+  this->AddLanguageFlags(flags, lang, config);
+
+  if (target->GetFeatureAsBool("INTERPROCEDURAL_OPTIMIZATION", config)) {
+    this->AppendFeatureOptions(flags, lang, "IPO");
+  }
+
+  this->AddArchitectureFlags(flags, target, lang, config);
+
+  if (lang == "Fortran") {
+    this->AppendFlags(flags, this->GetTargetFortranFlags(target, config));
+  }
+
+  this->AddCMP0018Flags(flags, target, lang, config);
+  this->AddVisibilityPresetFlags(flags, target, lang);
+  this->AppendFlags(flags, mf->GetDefineFlags());
+  this->AppendFlags(flags, this->GetFrameworkFlags(lang, config, target));
+  this->AddCompileOptions(flags, target, lang, config);
+}
+
 static std::string GetFrameworkFlags(const std::string& lang,
                                      const std::string& config,
                                      cmGeneratorTarget* target)
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index d04a723..66fbe01 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -317,6 +317,9 @@ public:
   void GetTargetDefines(cmGeneratorTarget const* target,
                         std::string const& config, std::string const& lang,
                         std::set<std::string>& defines) const;
+  void GetTargetCompileFlags(cmGeneratorTarget* target,
+                             std::string const& config,
+                             std::string const& lang, std::string& flags);
 
   std::string GetFrameworkFlags(std::string const& l,
                                 std::string const& config,

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5467e7945d46f5f8540a6e11933c9b6b584036a2
commit 5467e7945d46f5f8540a6e11933c9b6b584036a2
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu Jun 16 11:14:18 2016 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Fri Jun 17 14:49:29 2016 -0400

    cmLocalGenerator: Add method to get Fortran-specific compiler flags
    
    Add a cmLocalGenerator::GetTargetFortranFlags virtual method to get
    generator-specific generation of Fortran-specific flags.  Implement it
    in cmLocalCommonGenerator by moving the implementation from
    cmCommonTargetGenerator::AddFortranFlags.  This will allow it to be used
    without having a target generator available.
    
    Inspired-by: Tobias Hunger <tobias.hunger at qt.io>

diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx
index eb1216e..aa7f5c0 100644
--- a/Source/cmCommonTargetGenerator.cxx
+++ b/Source/cmCommonTargetGenerator.cxx
@@ -88,51 +88,6 @@ void cmCommonTargetGenerator::AddModuleDefinitionFlag(std::string& flags)
   this->LocalGenerator->AppendFlags(flags, flag);
 }
 
-void cmCommonTargetGenerator::AddFortranFlags(std::string& flags)
-{
-  // Enable module output if necessary.
-  if (const char* modout_flag =
-        this->Makefile->GetDefinition("CMAKE_Fortran_MODOUT_FLAG")) {
-    this->LocalGenerator->AppendFlags(flags, modout_flag);
-  }
-
-  // Add a module output directory flag if necessary.
-  std::string mod_dir = this->GeneratorTarget->GetFortranModuleDirectory();
-  if (!mod_dir.empty()) {
-    mod_dir =
-      this->Convert(mod_dir, this->LocalGenerator->GetWorkingDirectory(),
-                    cmOutputConverter::SHELL);
-  } else {
-    mod_dir =
-      this->Makefile->GetSafeDefinition("CMAKE_Fortran_MODDIR_DEFAULT");
-  }
-  if (!mod_dir.empty()) {
-    const char* moddir_flag =
-      this->Makefile->GetRequiredDefinition("CMAKE_Fortran_MODDIR_FLAG");
-    std::string modflag = moddir_flag;
-    modflag += mod_dir;
-    this->LocalGenerator->AppendFlags(flags, modflag);
-  }
-
-  // If there is a separate module path flag then duplicate the
-  // include path with it.  This compiler does not search the include
-  // path for modules.
-  if (const char* modpath_flag =
-        this->Makefile->GetDefinition("CMAKE_Fortran_MODPATH_FLAG")) {
-    std::vector<std::string> includes;
-    const std::string& config = this->ConfigName;
-    this->LocalGenerator->GetIncludeDirectories(
-      includes, this->GeneratorTarget, "C", config);
-    for (std::vector<std::string>::const_iterator idi = includes.begin();
-         idi != includes.end(); ++idi) {
-      std::string flg = modpath_flag;
-      flg +=
-        this->Convert(*idi, cmOutputConverter::NONE, cmOutputConverter::SHELL);
-      this->LocalGenerator->AppendFlags(flags, flg);
-    }
-  }
-}
-
 void cmCommonTargetGenerator::AppendFortranFormatFlags(
   std::string& flags, cmSourceFile const& source)
 {
@@ -175,7 +130,9 @@ std::string cmCommonTargetGenerator::GetFlags(const std::string& l)
 
     // Fortran-specific flags computed for this target.
     if (l == "Fortran") {
-      this->AddFortranFlags(flags);
+      this->LocalGenerator->AppendFlags(
+        flags, this->LocalGenerator->GetTargetFortranFlags(
+                 this->GeneratorTarget, this->ConfigName));
     }
 
     this->LocalGenerator->AddCMP0018Flags(flags, this->GeneratorTarget, lang,
diff --git a/Source/cmCommonTargetGenerator.h b/Source/cmCommonTargetGenerator.h
index dc4974c..0bafde9 100644
--- a/Source/cmCommonTargetGenerator.h
+++ b/Source/cmCommonTargetGenerator.h
@@ -53,9 +53,6 @@ protected:
   // The windows module definition source file (.def), if any.
   cmSourceFile const* ModuleDefinitionFile;
 
-  // Compute target-specific Fortran language flags.
-  void AddFortranFlags(std::string& flags);
-
   std::string Convert(
     std::string const& source, cmOutputConverter::RelativeRoot relative,
     cmOutputConverter::OutputFormat output = cmOutputConverter::UNCHANGED);
diff --git a/Source/cmLocalCommonGenerator.cxx b/Source/cmLocalCommonGenerator.cxx
index 6cfeb10..5502296 100644
--- a/Source/cmLocalCommonGenerator.cxx
+++ b/Source/cmLocalCommonGenerator.cxx
@@ -35,3 +35,50 @@ void cmLocalCommonGenerator::SetConfigName()
     this->ConfigName = "";
   }
 }
+
+std::string cmLocalCommonGenerator::GetTargetFortranFlags(
+  cmGeneratorTarget const* target, std::string const& config)
+{
+  std::string flags;
+
+  // Enable module output if necessary.
+  if (const char* modout_flag =
+        this->Makefile->GetDefinition("CMAKE_Fortran_MODOUT_FLAG")) {
+    this->AppendFlags(flags, modout_flag);
+  }
+
+  // Add a module output directory flag if necessary.
+  std::string mod_dir = target->GetFortranModuleDirectory();
+  if (!mod_dir.empty()) {
+    mod_dir =
+      this->Convert(mod_dir, this->WorkingDirectory, cmOutputConverter::SHELL);
+  } else {
+    mod_dir =
+      this->Makefile->GetSafeDefinition("CMAKE_Fortran_MODDIR_DEFAULT");
+  }
+  if (!mod_dir.empty()) {
+    const char* moddir_flag =
+      this->Makefile->GetRequiredDefinition("CMAKE_Fortran_MODDIR_FLAG");
+    std::string modflag = moddir_flag;
+    modflag += mod_dir;
+    this->AppendFlags(flags, modflag);
+  }
+
+  // If there is a separate module path flag then duplicate the
+  // include path with it.  This compiler does not search the include
+  // path for modules.
+  if (const char* modpath_flag =
+        this->Makefile->GetDefinition("CMAKE_Fortran_MODPATH_FLAG")) {
+    std::vector<std::string> includes;
+    this->GetIncludeDirectories(includes, target, "C", config);
+    for (std::vector<std::string>::const_iterator idi = includes.begin();
+         idi != includes.end(); ++idi) {
+      std::string flg = modpath_flag;
+      flg +=
+        this->Convert(*idi, cmOutputConverter::NONE, cmOutputConverter::SHELL);
+      this->AppendFlags(flags, flg);
+    }
+  }
+
+  return flags;
+}
diff --git a/Source/cmLocalCommonGenerator.h b/Source/cmLocalCommonGenerator.h
index 10380db..fd17ae3 100644
--- a/Source/cmLocalCommonGenerator.h
+++ b/Source/cmLocalCommonGenerator.h
@@ -33,6 +33,9 @@ public:
     return this->WorkingDirectory;
   }
 
+  std::string GetTargetFortranFlags(cmGeneratorTarget const* target,
+                                    std::string const& config);
+
 protected:
   cmOutputConverter::RelativeRoot WorkingDirectory;
 
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 2f50b7f..a0263e4 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1344,6 +1344,13 @@ void cmLocalGenerator::GetTargetDefines(cmGeneratorTarget const* target,
   this->AddCompileDefinitions(defines, target, config, lang.c_str());
 }
 
+std::string cmLocalGenerator::GetTargetFortranFlags(cmGeneratorTarget const*,
+                                                    std::string const&)
+{
+  // Implemented by specific generators that override this.
+  return std::string();
+}
+
 std::string cmLocalGenerator::ConvertToLinkReference(std::string const& lib,
                                                      OutputFormat format)
 {
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index af561f6..d04a723 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -321,6 +321,8 @@ public:
   std::string GetFrameworkFlags(std::string const& l,
                                 std::string const& config,
                                 cmGeneratorTarget* target);
+  virtual std::string GetTargetFortranFlags(cmGeneratorTarget const* target,
+                                            std::string const& config);
 
   virtual void ComputeObjectFilenames(
     std::map<cmSourceFile const*, std::string>& mapping,

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=49f10f0d24420f7d96c5153ba64a16b3f43c4736
commit 49f10f0d24420f7d96c5153ba64a16b3f43c4736
Author:     Tobias Hunger <tobias.hunger at qt.io>
AuthorDate: Fri Jun 10 16:58:36 2016 +0200
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Fri Jun 17 14:22:29 2016 -0400

    cmGeneratorTarget: Adopt Fortran module directory generation
    
    Move code to create/get the fortran module directory from the
    cmCommonTargetGenerator to cmGeneratorTarget.
    
    Rename the ComputeFortranModuleDirectory method to
    CreateFortranModuleDirectory as this method *creates* the directory if
    it is missing.

diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx
index 1cc04ea..eb1216e 100644
--- a/Source/cmCommonTargetGenerator.cxx
+++ b/Source/cmCommonTargetGenerator.cxx
@@ -27,7 +27,6 @@ cmCommonTargetGenerator::cmCommonTargetGenerator(cmGeneratorTarget* gt)
       gt->LocalGenerator->GetGlobalGenerator()))
   , ConfigName(LocalGenerator->GetConfigName())
   , ModuleDefinitionFile(GeneratorTarget->GetModuleDefinitionFile(ConfigName))
-  , FortranModuleDirectoryComputed(false)
 {
 }
 
@@ -89,43 +88,6 @@ void cmCommonTargetGenerator::AddModuleDefinitionFlag(std::string& flags)
   this->LocalGenerator->AppendFlags(flags, flag);
 }
 
-std::string cmCommonTargetGenerator::ComputeFortranModuleDirectory() const
-{
-  std::string mod_dir;
-  const char* target_mod_dir =
-    this->GeneratorTarget->GetProperty("Fortran_MODULE_DIRECTORY");
-  const char* moddir_flag =
-    this->Makefile->GetDefinition("CMAKE_Fortran_MODDIR_FLAG");
-  if (target_mod_dir && moddir_flag) {
-    // Compute the full path to the module directory.
-    if (cmSystemTools::FileIsFullPath(target_mod_dir)) {
-      // Already a full path.
-      mod_dir = target_mod_dir;
-    } else {
-      // Interpret relative to the current output directory.
-      mod_dir = this->LocalGenerator->GetCurrentBinaryDirectory();
-      mod_dir += "/";
-      mod_dir += target_mod_dir;
-    }
-
-    // Make sure the module output directory exists.
-    cmSystemTools::MakeDirectory(mod_dir);
-  }
-  return mod_dir;
-}
-
-std::string cmCommonTargetGenerator::GetFortranModuleDirectory()
-{
-  // Compute the module directory.
-  if (!this->FortranModuleDirectoryComputed) {
-    this->FortranModuleDirectoryComputed = true;
-    this->FortranModuleDirectory = this->ComputeFortranModuleDirectory();
-  }
-
-  // Return the computed directory.
-  return this->FortranModuleDirectory;
-}
-
 void cmCommonTargetGenerator::AddFortranFlags(std::string& flags)
 {
   // Enable module output if necessary.
@@ -135,7 +97,7 @@ void cmCommonTargetGenerator::AddFortranFlags(std::string& flags)
   }
 
   // Add a module output directory flag if necessary.
-  std::string mod_dir = this->GetFortranModuleDirectory();
+  std::string mod_dir = this->GeneratorTarget->GetFortranModuleDirectory();
   if (!mod_dir.empty()) {
     mod_dir =
       this->Convert(mod_dir, this->LocalGenerator->GetWorkingDirectory(),
diff --git a/Source/cmCommonTargetGenerator.h b/Source/cmCommonTargetGenerator.h
index c35d22a..dc4974c 100644
--- a/Source/cmCommonTargetGenerator.h
+++ b/Source/cmCommonTargetGenerator.h
@@ -53,12 +53,6 @@ protected:
   // The windows module definition source file (.def), if any.
   cmSourceFile const* ModuleDefinitionFile;
 
-  // Target-wide Fortran module output directory.
-  bool FortranModuleDirectoryComputed;
-  std::string FortranModuleDirectory;
-  std::string GetFortranModuleDirectory();
-  virtual std::string ComputeFortranModuleDirectory() const;
-
   // Compute target-specific Fortran language flags.
   void AddFortranFlags(std::string& flags);
 
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 5f4b074..15b44a6 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -258,6 +258,7 @@ void CreatePropertyGeneratorExpressions(
 
 cmGeneratorTarget::cmGeneratorTarget(cmTarget* t, cmLocalGenerator* lg)
   : Target(t)
+  , FortranModuleDirectoryCreated(false)
   , SourceFileFlagsConstructed(false)
   , PolicyWarnedCMP0022(false)
   , DebugIncludesDone(false)
@@ -3842,6 +3843,40 @@ void cmGeneratorTarget::GetTargetVersion(bool soversion, int& major,
   }
 }
 
+std::string cmGeneratorTarget::GetFortranModuleDirectory() const
+{
+  if (!this->FortranModuleDirectoryCreated) {
+    this->FortranModuleDirectory = true;
+    this->FortranModuleDirectory = this->CreateFortranModuleDirectory();
+  }
+
+  return this->FortranModuleDirectory;
+}
+
+std::string cmGeneratorTarget::CreateFortranModuleDirectory() const
+{
+  static std::string mod_dir;
+  const char* target_mod_dir = this->GetProperty("Fortran_MODULE_DIRECTORY");
+  const char* moddir_flag =
+    this->Makefile->GetDefinition("CMAKE_Fortran_MODDIR_FLAG");
+  if (target_mod_dir && moddir_flag) {
+    // Compute the full path to the module directory.
+    if (cmSystemTools::FileIsFullPath(target_mod_dir)) {
+      // Already a full path.
+      mod_dir = target_mod_dir;
+    } else {
+      // Interpret relative to the current output directory.
+      mod_dir = this->LocalGenerator->GetCurrentBinaryDirectory();
+      mod_dir += "/";
+      mod_dir += target_mod_dir;
+    }
+
+    // Make sure the module output directory exists.
+    cmSystemTools::MakeDirectory(mod_dir);
+  }
+  return mod_dir;
+}
+
 std::string cmGeneratorTarget::GetFrameworkVersion() const
 {
   assert(this->GetType() != cmState::INTERFACE_LIBRARY);
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index 63208bc..2ee9bef 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -526,7 +526,13 @@ public:
   void GetTargetVersion(bool soversion, int& major, int& minor,
                         int& patch) const;
 
+  std::string GetFortranModuleDirectory() const;
+
 private:
+  std::string CreateFortranModuleDirectory() const;
+  mutable bool FortranModuleDirectoryCreated;
+  mutable std::string FortranModuleDirectory;
+
   friend class cmTargetTraceDependencies;
   struct SourceEntry
   {
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index daf05d3..8b341a1 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -962,7 +962,7 @@ void cmMakefileTargetGenerator::WriteTargetDependRules()
     << "\n"
     << "# Fortran module output directory.\n"
     << "set(CMAKE_Fortran_TARGET_MODULE_DIR \""
-    << this->GetFortranModuleDirectory() << "\")\n";
+    << this->GeneratorTarget->GetFortranModuleDirectory() << "\")\n";
   /* clang-format on */
 
   // and now write the rule to use it

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0392f72bef5f1394c2dba3740f2a701fe1a98f0d
commit 0392f72bef5f1394c2dba3740f2a701fe1a98f0d
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu Jun 16 10:54:20 2016 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Fri Jun 17 14:22:28 2016 -0400

    Refactor Makefile/Ninja tool working directory storage
    
    Move cmCommonTargetGenerator::WorkingDirectory to cmLocalCommonGenerator
    and add an access method.

diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx
index b893dd3..1cc04ea 100644
--- a/Source/cmCommonTargetGenerator.cxx
+++ b/Source/cmCommonTargetGenerator.cxx
@@ -19,10 +19,8 @@
 #include "cmSourceFile.h"
 #include "cmSystemTools.h"
 
-cmCommonTargetGenerator::cmCommonTargetGenerator(
-  cmOutputConverter::RelativeRoot wd, cmGeneratorTarget* gt)
-  : WorkingDirectory(wd)
-  , GeneratorTarget(gt)
+cmCommonTargetGenerator::cmCommonTargetGenerator(cmGeneratorTarget* gt)
+  : GeneratorTarget(gt)
   , Makefile(gt->Makefile)
   , LocalGenerator(static_cast<cmLocalCommonGenerator*>(gt->LocalGenerator))
   , GlobalGenerator(static_cast<cmGlobalCommonGenerator*>(
@@ -140,7 +138,8 @@ void cmCommonTargetGenerator::AddFortranFlags(std::string& flags)
   std::string mod_dir = this->GetFortranModuleDirectory();
   if (!mod_dir.empty()) {
     mod_dir =
-      this->Convert(mod_dir, this->WorkingDirectory, cmOutputConverter::SHELL);
+      this->Convert(mod_dir, this->LocalGenerator->GetWorkingDirectory(),
+                    cmOutputConverter::SHELL);
   } else {
     mod_dir =
       this->Makefile->GetSafeDefinition("CMAKE_Fortran_MODDIR_DEFAULT");
@@ -308,7 +307,8 @@ std::string cmCommonTargetGenerator::GetManifests()
   for (std::vector<cmSourceFile const*>::iterator mi = manifest_srcs.begin();
        mi != manifest_srcs.end(); ++mi) {
     manifests.push_back(this->Convert(
-      (*mi)->GetFullPath(), this->WorkingDirectory, cmOutputConverter::SHELL));
+      (*mi)->GetFullPath(), this->LocalGenerator->GetWorkingDirectory(),
+      cmOutputConverter::SHELL));
   }
 
   return cmJoin(manifests, " ");
diff --git a/Source/cmCommonTargetGenerator.h b/Source/cmCommonTargetGenerator.h
index ace5351..c35d22a 100644
--- a/Source/cmCommonTargetGenerator.h
+++ b/Source/cmCommonTargetGenerator.h
@@ -28,8 +28,7 @@ class cmSourceFile;
 class cmCommonTargetGenerator
 {
 public:
-  cmCommonTargetGenerator(cmOutputConverter::RelativeRoot wd,
-                          cmGeneratorTarget* gt);
+  cmCommonTargetGenerator(cmGeneratorTarget* gt);
   virtual ~cmCommonTargetGenerator();
 
   std::string const& GetConfigName() const;
@@ -45,7 +44,6 @@ protected:
   // Helper to add flag for windows .def file.
   void AddModuleDefinitionFlag(std::string& flags);
 
-  cmOutputConverter::RelativeRoot WorkingDirectory;
   cmGeneratorTarget* GeneratorTarget;
   cmMakefile* Makefile;
   cmLocalCommonGenerator* LocalGenerator;
diff --git a/Source/cmLocalCommonGenerator.cxx b/Source/cmLocalCommonGenerator.cxx
index 3ebd128..6cfeb10 100644
--- a/Source/cmLocalCommonGenerator.cxx
+++ b/Source/cmLocalCommonGenerator.cxx
@@ -13,9 +13,10 @@
 
 #include "cmMakefile.h"
 
-cmLocalCommonGenerator::cmLocalCommonGenerator(cmGlobalGenerator* gg,
-                                               cmMakefile* mf)
+cmLocalCommonGenerator::cmLocalCommonGenerator(
+  cmGlobalGenerator* gg, cmMakefile* mf, cmOutputConverter::RelativeRoot wd)
   : cmLocalGenerator(gg, mf)
+  , WorkingDirectory(wd)
 {
 }
 
diff --git a/Source/cmLocalCommonGenerator.h b/Source/cmLocalCommonGenerator.h
index d282054..10380db 100644
--- a/Source/cmLocalCommonGenerator.h
+++ b/Source/cmLocalCommonGenerator.h
@@ -22,12 +22,20 @@ class cmCommonTargetGenerator;
 class cmLocalCommonGenerator : public cmLocalGenerator
 {
 public:
-  cmLocalCommonGenerator(cmGlobalGenerator* gg, cmMakefile* mf);
+  cmLocalCommonGenerator(cmGlobalGenerator* gg, cmMakefile* mf,
+                         cmOutputConverter::RelativeRoot wd);
   ~cmLocalCommonGenerator();
 
   std::string const& GetConfigName() { return this->ConfigName; }
 
+  cmOutputConverter::RelativeRoot GetWorkingDirectory() const
+  {
+    return this->WorkingDirectory;
+  }
+
 protected:
+  cmOutputConverter::RelativeRoot WorkingDirectory;
+
   void SetConfigName();
   std::string ConfigName;
 
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx
index 6e676f1..0f488a6 100644
--- a/Source/cmLocalNinjaGenerator.cxx
+++ b/Source/cmLocalNinjaGenerator.cxx
@@ -25,7 +25,7 @@
 
 cmLocalNinjaGenerator::cmLocalNinjaGenerator(cmGlobalGenerator* gg,
                                              cmMakefile* mf)
-  : cmLocalCommonGenerator(gg, mf)
+  : cmLocalCommonGenerator(gg, mf, cmOutputConverter::HOME_OUTPUT)
   , HomeRelativeOutputPath("")
 {
   this->TargetImplib = "$TARGET_IMPLIB";
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index 4b5af8b..460f0e2 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -84,7 +84,7 @@ static std::string cmSplitExtension(std::string const& in, std::string& base)
 
 cmLocalUnixMakefileGenerator3::cmLocalUnixMakefileGenerator3(
   cmGlobalGenerator* gg, cmMakefile* mf)
-  : cmLocalCommonGenerator(gg, mf)
+  : cmLocalCommonGenerator(gg, mf, cmOutputConverter::START_OUTPUT)
 {
   this->MakefileVariableSize = 0;
   this->ColorMakefile = false;
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 3086bb1..daf05d3 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -32,7 +32,7 @@
 #include <ctype.h>
 
 cmMakefileTargetGenerator::cmMakefileTargetGenerator(cmGeneratorTarget* target)
-  : cmCommonTargetGenerator(cmOutputConverter::START_OUTPUT, target)
+  : cmCommonTargetGenerator(target)
   , OSXBundleGenerator(0)
   , MacOSXContentGenerator(0)
 {
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index 05a0a63..b413c33 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -58,7 +58,7 @@ cmNinjaTargetGenerator* cmNinjaTargetGenerator::New(cmGeneratorTarget* target)
 }
 
 cmNinjaTargetGenerator::cmNinjaTargetGenerator(cmGeneratorTarget* target)
-  : cmCommonTargetGenerator(cmOutputConverter::HOME_OUTPUT, target)
+  : cmCommonTargetGenerator(target)
   , MacOSXContentGenerator(0)
   , OSXBundleGenerator(0)
   , MacContentFolders()

-----------------------------------------------------------------------

Summary of changes:
 Source/cmCommonTargetGenerator.cxx       |  122 ++----------------------------
 Source/cmCommonTargetGenerator.h         |   13 +---
 Source/cmExtraSublimeTextGenerator.cxx   |   27 +------
 Source/cmGeneratorTarget.cxx             |   35 +++++++++
 Source/cmGeneratorTarget.h               |    6 ++
 Source/cmLocalCommonGenerator.cxx        |   52 ++++++++++++-
 Source/cmLocalCommonGenerator.h          |   13 +++-
 Source/cmLocalGenerator.cxx              |   34 +++++++++
 Source/cmLocalGenerator.h                |    5 ++
 Source/cmLocalNinjaGenerator.cxx         |    2 +-
 Source/cmLocalUnixMakefileGenerator3.cxx |    2 +-
 Source/cmMakefileTargetGenerator.cxx     |    4 +-
 Source/cmNinjaTargetGenerator.cxx        |    2 +-
 13 files changed, 157 insertions(+), 160 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list