[Cmake-commits] CMake branch, next, updated. v3.3.0-1536-gba0ba5d
Brad King
brad.king at kitware.com
Wed Jul 29 13:39:00 EDT 2015
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 ba0ba5da9319c34f1f9fb50178c9d76f90e14f20 (commit)
via e90372a0db3248d4b78d8d7d7020c66cb5dc3803 (commit)
via 70c21301b274a28dde75b4f2adb141f9b170eb80 (commit)
via 7371d8f3b49c020a14f6324ba5264d17c7dbbaee (commit)
via 613bc08ac15b74a395ef0eca7668f7192b438204 (commit)
from 3a9ec35c7b11d020b7ef5d0b0943bb02e35c0fc5 (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 -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ba0ba5da9319c34f1f9fb50178c9d76f90e14f20
commit ba0ba5da9319c34f1f9fb50178c9d76f90e14f20
Merge: 3a9ec35 e90372a
Author: Brad King <brad.king at kitware.com>
AuthorDate: Wed Jul 29 13:38:59 2015 -0400
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Wed Jul 29 13:38:59 2015 -0400
Merge topic 'refactor-fortran-module-directory' into next
e90372a0 cmCommonTargetGenerator: Factor out Fortran module directory computation
70c21301 cmCommonTargetGenerator: Store working directory for relative paths
7371d8f3 cmCommonTargetGenerator: Return string from GetFortranModuleDirectory
613bc08a cmDependsFortran: Use string to store module directory
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e90372a0db3248d4b78d8d7d7020c66cb5dc3803
commit e90372a0db3248d4b78d8d7d7020c66cb5dc3803
Author: Brad King <brad.king at kitware.com>
AuthorDate: Wed Jul 29 13:07:02 2015 -0400
Commit: Brad King <brad.king at kitware.com>
CommitDate: Wed Jul 29 13:37:54 2015 -0400
cmCommonTargetGenerator: Factor out Fortran module directory computation
Move computation from GetFortranModuleDirectory to a virtual method
so it can be customized for each type of generator.
diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx
index 8a5746a..26ca375 100644
--- a/Source/cmCommonTargetGenerator.cxx
+++ b/Source/cmCommonTargetGenerator.cxx
@@ -105,36 +105,43 @@ void cmCommonTargetGenerator::AddModuleDefinitionFlag(std::string& flags)
}
//----------------------------------------------------------------------------
+std::string cmCommonTargetGenerator::ComputeFortranModuleDirectory() const
+{
+ std::string mod_dir;
+ const char* target_mod_dir =
+ this->Target->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->Makefile->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)
{
- const char* target_mod_dir =
- this->Target->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.
- this->FortranModuleDirectory = target_mod_dir;
- }
- else
- {
- // Interpret relative to the current output directory.
- this->FortranModuleDirectory =
- this->Makefile->GetCurrentBinaryDirectory();
- this->FortranModuleDirectory += "/";
- this->FortranModuleDirectory += target_mod_dir;
- }
-
- // Make sure the module output directory exists.
- cmSystemTools::MakeDirectory(this->FortranModuleDirectory.c_str());
- }
this->FortranModuleDirectoryComputed = true;
+ this->FortranModuleDirectory = this->ComputeFortranModuleDirectory();
}
// Return the computed directory.
diff --git a/Source/cmCommonTargetGenerator.h b/Source/cmCommonTargetGenerator.h
index 5fd976d..0a49e12 100644
--- a/Source/cmCommonTargetGenerator.h
+++ b/Source/cmCommonTargetGenerator.h
@@ -62,6 +62,7 @@ protected:
bool FortranModuleDirectoryComputed;
std::string FortranModuleDirectory;
std::string GetFortranModuleDirectory();
+ virtual std::string ComputeFortranModuleDirectory() const;
// Compute target-specific Fortran language flags.
void AddFortranFlags(std::string& flags);
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=70c21301b274a28dde75b4f2adb141f9b170eb80
commit 70c21301b274a28dde75b4f2adb141f9b170eb80
Author: Brad King <brad.king at kitware.com>
AuthorDate: Wed Jul 29 12:55:58 2015 -0400
Commit: Brad King <brad.king at kitware.com>
CommitDate: Wed Jul 29 13:20:03 2015 -0400
cmCommonTargetGenerator: Store working directory for relative paths
The Makefile generators run tools with the current working directory set
to the subdirectory of the build tree for the each target. The Ninja
generator runs tools with the current working directory set to the top
of the build tree. Tell cmCommonTargetGenerator where the working
directory will be so it can compute proper relative paths.
diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx
index eb93ebc..8a5746a 100644
--- a/Source/cmCommonTargetGenerator.cxx
+++ b/Source/cmCommonTargetGenerator.cxx
@@ -20,8 +20,12 @@
#include "cmSystemTools.h"
#include "cmTarget.h"
-cmCommonTargetGenerator::cmCommonTargetGenerator(cmGeneratorTarget* gt)
- : GeneratorTarget(gt)
+cmCommonTargetGenerator::cmCommonTargetGenerator(
+ cmOutputConverter::RelativeRoot wd,
+ cmGeneratorTarget* gt
+ )
+ : WorkingDirectory(wd)
+ , GeneratorTarget(gt)
, Target(gt->Target)
, Makefile(gt->Makefile)
, LocalGenerator(static_cast<cmLocalCommonGenerator*>(gt->LocalGenerator))
@@ -152,7 +156,7 @@ void cmCommonTargetGenerator::AddFortranFlags(std::string& flags)
if (!mod_dir.empty())
{
mod_dir = this->Convert(mod_dir,
- cmLocalGenerator::START_OUTPUT,
+ this->WorkingDirectory,
cmLocalGenerator::SHELL);
}
else
diff --git a/Source/cmCommonTargetGenerator.h b/Source/cmCommonTargetGenerator.h
index aec3148..5fd976d 100644
--- a/Source/cmCommonTargetGenerator.h
+++ b/Source/cmCommonTargetGenerator.h
@@ -29,7 +29,8 @@ class cmTarget;
class cmCommonTargetGenerator
{
public:
- cmCommonTargetGenerator(cmGeneratorTarget* gt);
+ cmCommonTargetGenerator(cmOutputConverter::RelativeRoot wd,
+ cmGeneratorTarget* gt);
virtual ~cmCommonTargetGenerator();
std::string const& GetConfigName() const;
@@ -46,6 +47,7 @@ protected:
// Helper to add flag for windows .def file.
void AddModuleDefinitionFlag(std::string& flags);
+ cmOutputConverter::RelativeRoot WorkingDirectory;
cmGeneratorTarget* GeneratorTarget;
cmTarget* Target;
cmMakefile* Makefile;
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 5a2333d..1304258 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -33,7 +33,7 @@
#include <ctype.h>
cmMakefileTargetGenerator::cmMakefileTargetGenerator(cmGeneratorTarget* target)
- : cmCommonTargetGenerator(target)
+ : cmCommonTargetGenerator(cmOutputConverter::START_OUTPUT, target)
, OSXBundleGenerator(0)
, MacOSXContentGenerator(0)
{
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index addf292..4e4dc3f 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -58,7 +58,7 @@ cmNinjaTargetGenerator::New(cmGeneratorTarget* target)
}
cmNinjaTargetGenerator::cmNinjaTargetGenerator(cmGeneratorTarget* target)
- : cmCommonTargetGenerator(target),
+ : cmCommonTargetGenerator(cmOutputConverter::HOME_OUTPUT, target),
MacOSXContentGenerator(0),
OSXBundleGenerator(0),
MacContentFolders(),
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7371d8f3b49c020a14f6324ba5264d17c7dbbaee
commit 7371d8f3b49c020a14f6324ba5264d17c7dbbaee
Author: Brad King <brad.king at kitware.com>
AuthorDate: Wed Jul 29 11:49:00 2015 -0400
Commit: Brad King <brad.king at kitware.com>
CommitDate: Wed Jul 29 13:18:46 2015 -0400
cmCommonTargetGenerator: Return string from GetFortranModuleDirectory
diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx
index c75ac23..eb93ebc 100644
--- a/Source/cmCommonTargetGenerator.cxx
+++ b/Source/cmCommonTargetGenerator.cxx
@@ -101,7 +101,7 @@ void cmCommonTargetGenerator::AddModuleDefinitionFlag(std::string& flags)
}
//----------------------------------------------------------------------------
-const char* cmCommonTargetGenerator::GetFortranModuleDirectory()
+std::string cmCommonTargetGenerator::GetFortranModuleDirectory()
{
// Compute the module directory.
if(!this->FortranModuleDirectoryComputed)
@@ -134,14 +134,7 @@ const char* cmCommonTargetGenerator::GetFortranModuleDirectory()
}
// Return the computed directory.
- if(this->FortranModuleDirectory.empty())
- {
- return 0;
- }
- else
- {
- return this->FortranModuleDirectory.c_str();
- }
+ return this->FortranModuleDirectory;
}
//----------------------------------------------------------------------------
@@ -155,19 +148,24 @@ void cmCommonTargetGenerator::AddFortranFlags(std::string& flags)
}
// Add a module output directory flag if necessary.
- const char* mod_dir = this->GetFortranModuleDirectory();
- if(!mod_dir)
+ std::string mod_dir = this->GetFortranModuleDirectory();
+ if (!mod_dir.empty())
+ {
+ mod_dir = this->Convert(mod_dir,
+ cmLocalGenerator::START_OUTPUT,
+ cmLocalGenerator::SHELL);
+ }
+ else
{
- mod_dir = this->Makefile->GetDefinition("CMAKE_Fortran_MODDIR_DEFAULT");
+ mod_dir =
+ this->Makefile->GetSafeDefinition("CMAKE_Fortran_MODDIR_DEFAULT");
}
- if(mod_dir)
+ if (!mod_dir.empty())
{
const char* moddir_flag =
this->Makefile->GetRequiredDefinition("CMAKE_Fortran_MODDIR_FLAG");
std::string modflag = moddir_flag;
- modflag += this->Convert(mod_dir,
- cmLocalGenerator::START_OUTPUT,
- cmLocalGenerator::SHELL);
+ modflag += mod_dir;
this->LocalGenerator->AppendFlags(flags, modflag);
}
diff --git a/Source/cmCommonTargetGenerator.h b/Source/cmCommonTargetGenerator.h
index 166508d..aec3148 100644
--- a/Source/cmCommonTargetGenerator.h
+++ b/Source/cmCommonTargetGenerator.h
@@ -59,7 +59,7 @@ protected:
// Target-wide Fortran module output directory.
bool FortranModuleDirectoryComputed;
std::string FortranModuleDirectory;
- const char* GetFortranModuleDirectory();
+ std::string GetFortranModuleDirectory();
// Compute target-specific Fortran language flags.
void AddFortranFlags(std::string& flags);
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 57ab2ca..5a2333d 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -1069,14 +1069,11 @@ void cmMakefileTargetGenerator::WriteTargetDependRules()
<< " )\n";
}
- // Check for a target-specific module output directory.
- if(const char* mdir = this->GetFortranModuleDirectory())
- {
- *this->InfoFileStream
- << "\n"
- << "# Fortran module output directory.\n"
- << "set(CMAKE_Fortran_TARGET_MODULE_DIR \"" << mdir << "\")\n";
- }
+ *this->InfoFileStream
+ << "\n"
+ << "# Fortran module output directory.\n"
+ << "set(CMAKE_Fortran_TARGET_MODULE_DIR \""
+ << this->GetFortranModuleDirectory() << "\")\n";
// and now write the rule to use it
std::vector<std::string> depends;
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=613bc08ac15b74a395ef0eca7668f7192b438204
commit 613bc08ac15b74a395ef0eca7668f7192b438204
Author: Brad King <brad.king at kitware.com>
AuthorDate: Wed Jul 29 11:44:25 2015 -0400
Commit: Brad King <brad.king at kitware.com>
CommitDate: Wed Jul 29 11:48:58 2015 -0400
cmDependsFortran: Use string to store module directory
diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx
index 13c6409..856dcd4 100644
--- a/Source/cmDependsFortran.cxx
+++ b/Source/cmDependsFortran.cxx
@@ -154,14 +154,10 @@ bool cmDependsFortran::Finalize(std::ostream& makeDepends,
const char* stamp_dir = this->TargetDirectory.c_str();
// Get the directory in which module files will be created.
- const char* mod_dir;
cmMakefile* mf = this->LocalGenerator->GetMakefile();
- if(const char* target_mod_dir =
- mf->GetDefinition("CMAKE_Fortran_TARGET_MODULE_DIR"))
- {
- mod_dir = target_mod_dir;
- }
- else
+ std::string mod_dir =
+ mf->GetSafeDefinition("CMAKE_Fortran_TARGET_MODULE_DIR");
+ if (mod_dir.empty())
{
mod_dir =
this->LocalGenerator->GetMakefile()->GetCurrentBinaryDirectory();
@@ -356,7 +352,8 @@ bool
cmDependsFortran
::WriteDependenciesReal(const char *obj,
cmFortranSourceInfo const& info,
- const char* mod_dir, const char* stamp_dir,
+ std::string const& mod_dir,
+ const char* stamp_dir,
std::ostream& makeDepends,
std::ostream& internalDepends)
{
diff --git a/Source/cmDependsFortran.h b/Source/cmDependsFortran.h
index d6ec7d7..a8a4013 100644
--- a/Source/cmDependsFortran.h
+++ b/Source/cmDependsFortran.h
@@ -66,7 +66,8 @@ protected:
// Actually write the depenencies to the streams.
bool WriteDependenciesReal(const char *obj,
cmFortranSourceInfo const& info,
- const char* mod_dir, const char* stamp_dir,
+ std::string const& mod_dir,
+ const char* stamp_dir,
std::ostream& makeDepends,
std::ostream& internalDepends);
-----------------------------------------------------------------------
Summary of changes:
Source/cmCommonTargetGenerator.cxx | 93 +++++++++++++++++++---------------
Source/cmCommonTargetGenerator.h | 7 ++-
Source/cmDependsFortran.cxx | 13 ++---
Source/cmDependsFortran.h | 3 +-
Source/cmMakefileTargetGenerator.cxx | 15 +++---
Source/cmNinjaTargetGenerator.cxx | 2 +-
6 files changed, 70 insertions(+), 63 deletions(-)
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list