summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/QtDialog/CMakeLists.txt6
-rw-r--r--Source/QtDialog/CMakeSetupDialog.cxx9
-rw-r--r--Source/cmCommonTargetGenerator.cxx122
-rw-r--r--Source/cmCommonTargetGenerator.h13
-rw-r--r--Source/cmDependsJavaParserHelper.cxx39
-rw-r--r--Source/cmDependsJavaParserHelper.h17
-rw-r--r--Source/cmExtraSublimeTextGenerator.cxx27
-rw-r--r--Source/cmGeneratorTarget.cxx35
-rw-r--r--Source/cmGeneratorTarget.h6
-rw-r--r--Source/cmLocalCommonGenerator.cxx52
-rw-r--r--Source/cmLocalCommonGenerator.h13
-rw-r--r--Source/cmLocalGenerator.cxx34
-rw-r--r--Source/cmLocalGenerator.h5
-rw-r--r--Source/cmLocalNinjaGenerator.cxx2
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx2
-rw-r--r--Source/cmMakefile.cxx24
-rw-r--r--Source/cmMakefileTargetGenerator.cxx4
-rw-r--r--Source/cmNinjaTargetGenerator.cxx2
-rw-r--r--Source/cmVS14CLFlagTable.h1
-rw-r--r--Source/cmake.cxx5
-rw-r--r--Source/cmake.h10
-rw-r--r--Source/cmakemain.cxx2
23 files changed, 225 insertions, 207 deletions
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index f2faea2..98d87b1 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,5 +1,5 @@
# CMake version number components.
set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 6)
-set(CMake_VERSION_PATCH 20160620)
+set(CMake_VERSION_PATCH 20160621)
#set(CMake_VERSION_RC 1)
diff --git a/Source/QtDialog/CMakeLists.txt b/Source/QtDialog/CMakeLists.txt
index a906f4a..68c65ac 100644
--- a/Source/QtDialog/CMakeLists.txt
+++ b/Source/QtDialog/CMakeLists.txt
@@ -150,12 +150,12 @@ if(APPLE)
MACOSX_PACKAGE_LOCATION Resources)
endif()
-if(CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL)
- install(FILES ${CMake_SOURCE_DIR}/Licenses/LGPLv2.1.txt
+if(USE_LGPL)
+ install(FILES ${CMake_SOURCE_DIR}/Licenses/LGPLv${USE_LGPL}.txt
DESTINATION ${CMAKE_DATA_DIR}/Licenses
${COMPONENT})
set_property(SOURCE CMakeSetupDialog.cxx
- PROPERTY COMPILE_DEFINITIONS CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL)
+ PROPERTY COMPILE_DEFINITIONS USE_LGPL="${USE_LGPL}")
endif()
set(CMAKE_INCLUDE_CURRENT_DIR ON)
diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx
index 712611d..fda3e58 100644
--- a/Source/QtDialog/CMakeSetupDialog.cxx
+++ b/Source/QtDialog/CMakeSetupDialog.cxx
@@ -830,17 +830,18 @@ void CMakeSetupDialog::doAbout()
"\n"
"CMake GUI maintained by csimsoft,\n"
"built using Qt %2 (qt-project.org).\n"
-#ifdef CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL
+#ifdef USE_LGPL
"\n"
"The Qt Toolkit is Copyright (C) Digia Plc and/or its subsidiary(-ies).\n"
- "Qt is licensed under terms of the GNU LGPLv2.1, available at:\n"
+ "Qt is licensed under terms of the GNU LGPLv" USE_LGPL ", available at:\n"
" \"%3\""
#endif
);
msg = msg.arg(cmVersion::GetCMakeVersion());
msg = msg.arg(qVersion());
-#ifdef CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL
- std::string lgpl = cmSystemTools::GetCMakeRoot() + "/Licenses/LGPLv2.1.txt";
+#ifdef USE_LGPL
+ std::string lgpl =
+ cmSystemTools::GetCMakeRoot() + "/Licenses/LGPLv" USE_LGPL ".txt";
msg = msg.arg(lgpl.c_str());
#endif
diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx
index b893dd3..101093d 100644
--- a/Source/cmCommonTargetGenerator.cxx
+++ b/Source/cmCommonTargetGenerator.cxx
@@ -19,17 +19,14 @@
#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*>(
gt->LocalGenerator->GetGlobalGenerator()))
, ConfigName(LocalGenerator->GetConfigName())
, ModuleDefinitionFile(GeneratorTarget->GetModuleDefinitionFile(ConfigName))
- , FortranModuleDirectoryComputed(false)
{
}
@@ -91,87 +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.
- 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->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->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)
{
@@ -204,36 +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->AddFortranFlags(flags);
- }
-
- 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;
@@ -308,7 +197,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..0bafde9 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;
@@ -55,15 +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);
-
std::string Convert(
std::string const& source, cmOutputConverter::RelativeRoot relative,
cmOutputConverter::OutputFormat output = cmOutputConverter::UNCHANGED);
diff --git a/Source/cmDependsJavaParserHelper.cxx b/Source/cmDependsJavaParserHelper.cxx
index bd3ee4d..238e7a1 100644
--- a/Source/cmDependsJavaParserHelper.cxx
+++ b/Source/cmDependsJavaParserHelper.cxx
@@ -35,7 +35,7 @@ cmDependsJavaParserHelper::~cmDependsJavaParserHelper()
}
void cmDependsJavaParserHelper::CurrentClass::AddFileNamesForPrinting(
- std::vector<std::string>* files, const char* prefix, const char* sep)
+ std::vector<std::string>* files, const char* prefix, const char* sep) const
{
std::string rname = "";
if (prefix) {
@@ -44,8 +44,8 @@ void cmDependsJavaParserHelper::CurrentClass::AddFileNamesForPrinting(
}
rname += this->Name;
files->push_back(rname);
- std::vector<CurrentClass>::iterator it;
- for (it = this->NestedClasses->begin(); it != this->NestedClasses->end();
+ std::vector<CurrentClass>::const_iterator it;
+ for (it = this->NestedClasses.begin(); it != this->NestedClasses.end();
++it) {
it->AddFileNamesForPrinting(files, rname.c_str(), sep);
}
@@ -191,25 +191,19 @@ void cmDependsJavaParserHelper::StartClass(const char* cls)
void cmDependsJavaParserHelper::EndClass()
{
- CurrentClass* parent = 0;
- CurrentClass* current = 0;
- if (!this->ClassStack.empty()) {
- current = &(*(this->ClassStack.end() - 1));
- if (this->ClassStack.size() > 1) {
- parent = &(*(this->ClassStack.end() - 2));
- }
- }
- if (current == 0) {
+ if (this->ClassStack.empty()) {
std::cerr << "Error when parsing. Current class is null" << std::endl;
abort();
}
- if (parent == 0) {
+ if (this->ClassStack.size() <= 1) {
std::cerr << "Error when parsing. Parent class is null" << std::endl;
abort();
}
+ CurrentClass& current = this->ClassStack.back();
+ CurrentClass& parent = this->ClassStack[this->ClassStack.size() - 2];
this->CurrentDepth--;
- parent->NestedClasses->push_back(*current);
- this->ClassStack.erase(this->ClassStack.end() - 1, this->ClassStack.end());
+ parent.NestedClasses.push_back(current);
+ this->ClassStack.pop_back();
}
void cmDependsJavaParserHelper::PrintClasses()
@@ -228,10 +222,10 @@ void cmDependsJavaParserHelper::PrintClasses()
std::vector<std::string> cmDependsJavaParserHelper::GetFilesProduced()
{
std::vector<std::string> files;
- CurrentClass* toplevel = &(*(this->ClassStack.begin()));
- std::vector<CurrentClass>::iterator it;
- for (it = toplevel->NestedClasses->begin();
- it != toplevel->NestedClasses->end(); ++it) {
+ CurrentClass const& toplevel = this->ClassStack.front();
+ std::vector<CurrentClass>::const_iterator it;
+ for (it = toplevel.NestedClasses.begin(); it != toplevel.NestedClasses.end();
+ ++it) {
it->AddFileNamesForPrinting(&files, 0, "$");
}
return files;
@@ -309,11 +303,10 @@ int cmDependsJavaParserHelper::LexInput(char* buf, int maxlen)
if (buf[0] == '\n') {
this->CurrentLine++;
}
- return (1);
- } else {
- buf[0] = '\n';
- return (0);
+ return 1;
}
+ buf[0] = '\n';
+ return 0;
}
void cmDependsJavaParserHelper::Error(const char* str)
{
diff --git a/Source/cmDependsJavaParserHelper.h b/Source/cmDependsJavaParserHelper.h
index a13d023..6ff0245 100644
--- a/Source/cmDependsJavaParserHelper.h
+++ b/Source/cmDependsJavaParserHelper.h
@@ -48,7 +48,7 @@ public:
// For yacc
void AddClassFound(const char* sclass);
- void PrepareElement(ParserType* opt);
+ void PrepareElement(ParserType* me);
void DeallocateParserType(char** pt);
void CheckEmpty(int line, int cnt, ParserType* pt);
void StartClass(const char* cls);
@@ -69,20 +69,9 @@ private:
{
public:
std::string Name;
- std::vector<CurrentClass>* NestedClasses;
- CurrentClass() { this->NestedClasses = new std::vector<CurrentClass>; }
- ~CurrentClass() { delete this->NestedClasses; }
- CurrentClass& operator=(CurrentClass const& c)
- {
- this->NestedClasses->clear();
- this->Name = c.Name;
- std::copy(c.NestedClasses->begin(), c.NestedClasses->end(),
- std::back_inserter(*this->NestedClasses));
- return *this;
- }
- CurrentClass(CurrentClass const& c) { (*this) = c; }
+ std::vector<CurrentClass> NestedClasses;
void AddFileNamesForPrinting(std::vector<std::string>* files,
- const char* prefix, const char* sep);
+ const char* prefix, const char* sep) const;
};
std::string CurrentPackage;
std::string::size_type InputBufferPos;
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;
}
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 5f4b074..9a025d9 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
+{
+ 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/cmLocalCommonGenerator.cxx b/Source/cmLocalCommonGenerator.cxx
index 3ebd128..5502296 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)
{
}
@@ -34,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 d282054..fd17ae3 100644
--- a/Source/cmLocalCommonGenerator.h
+++ b/Source/cmLocalCommonGenerator.h
@@ -22,12 +22,23 @@ 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;
+ }
+
+ std::string GetTargetFortranFlags(cmGeneratorTarget const* target,
+ std::string const& config);
+
protected:
+ cmOutputConverter::RelativeRoot WorkingDirectory;
+
void SetConfigName();
std::string ConfigName;
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 2f50b7f..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)
@@ -1344,6 +1371,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..66fbe01 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -317,10 +317,15 @@ 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,
cmGeneratorTarget* target);
+ virtual std::string GetTargetFortranFlags(cmGeneratorTarget const* target,
+ std::string const& config);
virtual void ComputeObjectFilenames(
std::map<cmSourceFile const*, std::string>& mapping,
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/cmMakefile.cxx b/Source/cmMakefile.cxx
index 5712070..e8c1576 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -37,6 +37,7 @@
#include <cmsys/FStream.hxx>
#include <cmsys/RegularExpression.hxx>
+#include <cmsys/SystemTools.hxx>
#include <cmsys/auto_ptr.hxx>
#include <assert.h>
@@ -175,8 +176,29 @@ cmListFileContext cmMakefile::GetExecutionContext() const
void cmMakefile::PrintCommandTrace(const cmListFileFunction& lff) const
{
+ // Check if current file in the list of requested to trace...
+ std::vector<std::string> const& trace_only_this_files =
+ this->GetCMakeInstance()->GetTraceSources();
+ std::string const& full_path = this->GetExecutionFilePath();
+ std::string const& only_filename = cmSystemTools::GetFilenameName(full_path);
+ bool trace = trace_only_this_files.empty();
+ if (!trace) {
+ for (std::vector<std::string>::const_iterator i =
+ trace_only_this_files.begin();
+ !trace && i != trace_only_this_files.end(); ++i) {
+ std::string::size_type const pos = full_path.rfind(*i);
+ trace = (pos != std::string::npos) &&
+ ((pos + i->size()) == full_path.size()) &&
+ (only_filename == cmSystemTools::GetFilenameName(*i));
+ }
+ // Do nothing if current file wasn't requested for trace...
+ if (!trace) {
+ return;
+ }
+ }
+
std::ostringstream msg;
- msg << this->GetExecutionFilePath() << "(" << lff.Line << "): ";
+ msg << full_path << "(" << lff.Line << "): ";
msg << lff.Name << "(";
bool expand = this->GetCMakeInstance()->GetTraceExpand();
std::string temp;
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 3086bb1..8b341a1 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)
{
@@ -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
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()
diff --git a/Source/cmVS14CLFlagTable.h b/Source/cmVS14CLFlagTable.h
index 4243f30..5812e79 100644
--- a/Source/cmVS14CLFlagTable.h
+++ b/Source/cmVS14CLFlagTable.h
@@ -16,7 +16,6 @@ static cmVS7FlagTable cmVS14CLFlagTable[] = {
{ "Optimization", "", "Custom", "Custom", 0 },
{ "Optimization", "Od", "Disabled", "Disabled", 0 },
- { "Optimization", "Os", "Minimize Size", "MinSize", 0 },
{ "Optimization", "O1", "Minimize Size", "MinSpace", 0 },
{ "Optimization", "O2", "Maximize Speed", "MaxSpeed", 0 },
{ "Optimization", "Ox", "Full Optimization", "Full", 0 },
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index db0072a..654100b 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -589,6 +589,11 @@ void cmake::SetArgs(const std::vector<std::string>& args,
std::cout << "Running with expanded trace output on.\n";
this->SetTrace(true);
this->SetTraceExpand(true);
+ } else if (arg.find("--trace-source=", 0) == 0) {
+ std::string file = arg.substr(strlen("--trace-source="));
+ cmSystemTools::ConvertToUnixSlashes(file);
+ this->AddTraceSource(file);
+ this->SetTrace(true);
} else if (arg.find("--trace", 0) == 0) {
std::cout << "Running with trace output on.\n";
this->SetTrace(true);
diff --git a/Source/cmake.h b/Source/cmake.h
index c5d7cbb..9ac6935 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -307,6 +307,14 @@ public:
void SetTrace(bool b) { this->Trace = b; }
bool GetTraceExpand() { return this->TraceExpand; }
void SetTraceExpand(bool b) { this->TraceExpand = b; }
+ void AddTraceSource(std::string const& file)
+ {
+ this->TraceOnlyThisSources.push_back(file);
+ }
+ std::vector<std::string> const& GetTraceSources() const
+ {
+ return this->TraceOnlyThisSources;
+ }
bool GetWarnUninitialized() { return this->WarnUninitialized; }
void SetWarnUninitialized(bool b) { this->WarnUninitialized = b; }
bool GetWarnUnused() { return this->WarnUnused; }
@@ -481,6 +489,8 @@ private:
cmState* State;
cmState::Snapshot CurrentSnapshot;
+ std::vector<std::string> TraceOnlyThisSources;
+
void UpdateConversionPathTable();
// Print a list of valid generators to stderr.
diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx
index 056671a..495aae5 100644
--- a/Source/cmakemain.cxx
+++ b/Source/cmakemain.cxx
@@ -73,6 +73,8 @@ static const char* cmDocumentationOptions[][2] = {
{ "--debug-output", "Put cmake in a debug mode." },
{ "--trace", "Put cmake in trace mode." },
{ "--trace-expand", "Put cmake in trace mode with variable expansion." },
+ { "--trace-source=<file>",
+ "Trace only this CMake file/module. Multiple options allowed." },
{ "--warn-uninitialized", "Warn about uninitialized values." },
{ "--warn-unused-vars", "Warn about unused variables." },
{ "--no-warn-unused-cli", "Don't warn about command line options." },