From d3bb5da9294ddbfcc5fddf7ba3dafd2c3e0b32b2 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 2 Jun 2015 11:19:44 -0400 Subject: [PATCH 0001/1048] Begin post-3.3 development --- Help/release/dev/0-sample-topic.rst | 7 +++++++ Help/release/index.rst | 2 ++ Source/CMakeVersion.cmake | 4 ++-- 3 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 Help/release/dev/0-sample-topic.rst diff --git a/Help/release/dev/0-sample-topic.rst b/Help/release/dev/0-sample-topic.rst new file mode 100644 index 000000000..e4cc01e23 --- /dev/null +++ b/Help/release/dev/0-sample-topic.rst @@ -0,0 +1,7 @@ +0-sample-topic +-------------- + +* This is a sample release note for the change in a topic. + Developers should add similar notes for each topic branch + making a noteworthy change. Each document should be named + and titled to match the topic name to avoid merge conflicts. diff --git a/Help/release/index.rst b/Help/release/index.rst index 6b98e48e1..b558e9df9 100644 --- a/Help/release/index.rst +++ b/Help/release/index.rst @@ -5,6 +5,8 @@ CMake Release Notes This file should include the adjacent "dev.txt" file in development versions but not in release versions. +.. include:: dev.txt + Releases ======== diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 727cbccd3..697ea9178 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 3) -set(CMake_VERSION_PATCH 0) -set(CMake_VERSION_RC 1) +set(CMake_VERSION_PATCH 20150602) +#set(CMake_VERSION_RC 1) From 14e2c3ad181e2090cb0846fb87743f7543484d08 Mon Sep 17 00:00:00 2001 From: Silvio Traversaro Date: Thu, 28 May 2015 16:22:28 +0200 Subject: [PATCH 0002/1048] ExternalProject: Initialize only selected git submodules (#15590) Honor the GIT_SUBMODULES option added by commit v3.0.0-rc1~92^2 (ExternalProject: Add option GIT_SUBMODULES, 2014-01-09) during the 'git submodule init' step to avoid initalizing all modules since we are only going to update the specified subset anyway. This will be useful for project repositories that have many submodules (e.g. https://github.com/boostorg/boost). Reviewed-by: Daniele E. Domenichelli --- Modules/ExternalProject.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index 11a24b8e8..eee1841db 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -529,7 +529,7 @@ if(error_code) endif() execute_process( - COMMAND \"${git_EXECUTABLE}\" submodule init + COMMAND \"${git_EXECUTABLE}\" submodule init ${git_submodules} WORKING_DIRECTORY \"${work_dir}/${src_name}\" RESULT_VARIABLE error_code ) From 17e13f0a2de8dca416521cb5ad9775bf46030c83 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 23 May 2015 10:50:19 +0200 Subject: [PATCH 0003/1048] cmMakefile: Simplify CMP0000 handling. --- Source/cmMakefile.cxx | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 7c74a0fd4..f09c8cb4a 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -519,8 +519,10 @@ bool cmMakefile::ProcessBuildsystemFile(const char* listfile) { this->AddDefinition("CMAKE_PARENT_LIST_FILE", listfile); std::string curSrc = this->GetCurrentSourceDirectory(); - return this->ReadListFile(listfile, true, - curSrc == this->GetHomeDirectory()); + bool result = this->ReadListFile(listfile, true, + curSrc == this->GetHomeDirectory()); + this->EnforceDirectoryLevelRules(); + return result; } bool cmMakefile::ReadDependentFile(const char* listfile, bool noPolicyScope) @@ -619,13 +621,6 @@ bool cmMakefile::ReadListFileInternal(const char* filenametoread, } } - // If this is the directory-level CMakeLists.txt file then perform - // some extra checks. - if(this->ListFileStack.size() == 1) - { - this->EnforceDirectoryLevelRules(); - } - return true; } From b68f2ea8ae26b23639df5978116375b47b4123c3 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 29 May 2015 01:14:19 +0200 Subject: [PATCH 0004/1048] cmMakefile: Add API for elseif to create backtrace. --- Source/cmIfCommand.cxx | 7 ++----- Source/cmMakefile.cxx | 14 ++++++++++++++ Source/cmMakefile.h | 1 + 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx index 3551f837e..7c4792ca9 100644 --- a/Source/cmIfCommand.cxx +++ b/Source/cmIfCommand.cxx @@ -92,10 +92,6 @@ IsFunctionBlocked(const cmListFileFunction& lff, } else { - // Place this call on the call stack. - cmMakefileCall stack_manager(&mf, this->Functions[c], status); - static_cast(stack_manager); - // if trace is enabled, print the evaluated "elseif" statement if(mf.GetCMakeInstance()->GetTrace()) { @@ -119,7 +115,8 @@ IsFunctionBlocked(const cmListFileFunction& lff, { std::string err = cmIfCommandError(expandedArguments); err += errorString; - mf.IssueMessage(messType, err); + cmListFileBacktrace bt = mf.GetBacktrace(this->Functions[c]); + mf.GetCMakeInstance()->IssueMessage(messType, err, bt); if (messType == cmake::FATAL_ERROR) { cmSystemTools::SetFatalErrorOccured(); diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index f09c8cb4a..9f2a1bea7 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -286,6 +286,20 @@ cmListFileBacktrace cmMakefile::GetBacktrace() const return backtrace; } +//---------------------------------------------------------------------------- +cmListFileBacktrace +cmMakefile::GetBacktrace(cmListFileContext const& lfc) const +{ + cmListFileBacktrace backtrace(this->GetLocalGenerator()); + backtrace.Append(lfc); + for(CallStackType::const_reverse_iterator i = this->CallStack.rbegin(); + i != this->CallStack.rend(); ++i) + { + backtrace.Append(*i->Context); + } + return backtrace; +} + //---------------------------------------------------------------------------- cmListFileContext cmMakefile::GetExecutionContext() const { diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index efd73a1cd..29a706109 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -572,6 +572,7 @@ public: * Get the current context backtrace. */ cmListFileBacktrace GetBacktrace() const; + cmListFileBacktrace GetBacktrace(cmListFileContext const& lfc) const; cmListFileContext GetExecutionContext() const; /** From 52919ac8ac22e1646f8f46907fe9c8e753d954cf Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 30 May 2015 13:17:55 +0200 Subject: [PATCH 0005/1048] cmMakefile: Make cmListFileBacktrace default constructible. --- Source/cmCustomCommand.cxx | 4 ++-- Source/cmExportBuildFileGenerator.cxx | 2 +- Source/cmGeneratorExpression.cxx | 2 +- Source/cmGeneratorExpressionDAGChecker.cxx | 2 +- Source/cmListFileCache.h | 2 +- Source/cmTarget.cxx | 4 ++-- Source/cmTarget.h | 2 +- Source/cmake.h | 2 +- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Source/cmCustomCommand.cxx b/Source/cmCustomCommand.cxx index 015825dc8..4032b08e2 100644 --- a/Source/cmCustomCommand.cxx +++ b/Source/cmCustomCommand.cxx @@ -17,7 +17,7 @@ //---------------------------------------------------------------------------- cmCustomCommand::cmCustomCommand() - : Backtrace(NULL) + : Backtrace() { this->HaveComment = false; this->EscapeOldStyle = true; @@ -82,7 +82,7 @@ cmCustomCommand::cmCustomCommand(cmMakefile const* mf, WorkingDirectory(workingDirectory?workingDirectory:""), EscapeAllowMakeVars(false), EscapeOldStyle(true), - Backtrace(NULL) + Backtrace() { this->EscapeOldStyle = true; this->EscapeAllowMakeVars = false; diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx index bf18deb94..568ce892e 100644 --- a/Source/cmExportBuildFileGenerator.cxx +++ b/Source/cmExportBuildFileGenerator.cxx @@ -18,7 +18,7 @@ //---------------------------------------------------------------------------- cmExportBuildFileGenerator::cmExportBuildFileGenerator() - : Backtrace(NULL) + : Backtrace() { this->Makefile = 0; this->ExportSet = 0; diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx index a1c405b00..3655a8782 100644 --- a/Source/cmGeneratorExpression.cxx +++ b/Source/cmGeneratorExpression.cxx @@ -34,7 +34,7 @@ cmGeneratorExpression::Parse(std::string const& input) { return cmsys::auto_ptr( new cmCompiledGeneratorExpression( - this->Backtrace ? *this->Backtrace : cmListFileBacktrace(NULL), + this->Backtrace ? *this->Backtrace : cmListFileBacktrace(), input)); } diff --git a/Source/cmGeneratorExpressionDAGChecker.cxx b/Source/cmGeneratorExpressionDAGChecker.cxx index ff8790c93..851aacdba 100644 --- a/Source/cmGeneratorExpressionDAGChecker.cxx +++ b/Source/cmGeneratorExpressionDAGChecker.cxx @@ -35,7 +35,7 @@ cmGeneratorExpressionDAGChecker::cmGeneratorExpressionDAGChecker( const GeneratorExpressionContent *content, cmGeneratorExpressionDAGChecker *parent) : Parent(parent), Target(target), Property(property), - Content(content), Backtrace(NULL), TransitivePropertiesOnly(false) + Content(content), Backtrace(), TransitivePropertiesOnly(false) { Initialize(); } diff --git a/Source/cmListFileCache.h b/Source/cmListFileCache.h index 4a1d1813f..f85b430e4 100644 --- a/Source/cmListFileCache.h +++ b/Source/cmListFileCache.h @@ -74,7 +74,7 @@ struct cmListFileFunction: public cmListFileContext class cmListFileBacktrace: private std::vector { public: - cmListFileBacktrace(cmLocalGenerator* localGen) + cmListFileBacktrace(cmLocalGenerator* localGen = 0) : LocalGenerator(localGen) , Relative(localGen ? false : true) { diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 70005b4fa..dcbcb1346 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -94,13 +94,13 @@ class cmTargetInternals { public: cmTargetInternals() - : Backtrace(NULL) + : Backtrace() { this->PolicyWarnedCMP0022 = false; this->UtilityItemsDone = false; } cmTargetInternals(cmTargetInternals const&) - : Backtrace(NULL) + : Backtrace() { this->PolicyWarnedCMP0022 = false; this->UtilityItemsDone = false; diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 2150b8342..0cbb57519 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -66,7 +66,7 @@ public: class cmLinkImplItem: public cmLinkItem { public: - cmLinkImplItem(): cmLinkItem(), Backtrace(0), FromGenex(false) {} + cmLinkImplItem(): cmLinkItem(), Backtrace(), FromGenex(false) {} cmLinkImplItem(std::string const& n, cmTarget const* t, cmListFileBacktrace const& bt, diff --git a/Source/cmake.h b/Source/cmake.h index 12b7e6824..0fe7bfcc9 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -301,7 +301,7 @@ class cmake /** Display a message to the user. */ void IssueMessage(cmake::MessageType t, std::string const& text, - cmListFileBacktrace const& backtrace = cmListFileBacktrace(NULL)); + cmListFileBacktrace const& backtrace = cmListFileBacktrace()); void IssueMessage(cmake::MessageType t, std::string const& text, cmListFileContext const& lfc); From 80b433b05ea921e6144c10260cfeafb4b25e5bc1 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 27 May 2015 21:40:39 +0200 Subject: [PATCH 0006/1048] cmGlobalGenerator: Don't use else after a return. --- Source/cmGlobalGenerator.cxx | 43 ++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 24 deletions(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index cd05c54c6..2c2cbd870 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -87,18 +87,16 @@ bool cmGlobalGenerator::SetGeneratorPlatform(std::string const& p, { return true; } - else - { - std::ostringstream e; - e << - "Generator\n" - " " << this->GetName() << "\n" - "does not support platform specification, but platform\n" - " " << p << "\n" - "was specified."; - mf->IssueMessage(cmake::FATAL_ERROR, e.str()); - return false; - } + + std::ostringstream e; + e << + "Generator\n" + " " << this->GetName() << "\n" + "does not support platform specification, but platform\n" + " " << p << "\n" + "was specified."; + mf->IssueMessage(cmake::FATAL_ERROR, e.str()); + return false; } bool cmGlobalGenerator::SetGeneratorToolset(std::string const& ts, @@ -108,18 +106,15 @@ bool cmGlobalGenerator::SetGeneratorToolset(std::string const& ts, { return true; } - else - { - std::ostringstream e; - e << - "Generator\n" - " " << this->GetName() << "\n" - "does not support toolset specification, but toolset\n" - " " << ts << "\n" - "was specified."; - mf->IssueMessage(cmake::FATAL_ERROR, e.str()); - return false; - } + std::ostringstream e; + e << + "Generator\n" + " " << this->GetName() << "\n" + "does not support toolset specification, but toolset\n" + " " << ts << "\n" + "was specified."; + mf->IssueMessage(cmake::FATAL_ERROR, e.str()); + return false; } std::string cmGlobalGenerator::SelectMakeProgram( From 499ebb6564800c23bfb6e7b1b706a6202b3f971a Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 23 May 2015 13:50:12 +0200 Subject: [PATCH 0007/1048] cmListFileBacktrace: Internalize the step of making paths relative. Currently cmMakefile calls MakeRelative on a copy of the backtrace, emits the copy to the stream once, then discards the copy. There is no need to have API for the path conversion. --- Source/cmListFileCache.cxx | 26 ++++++++------------------ Source/cmListFileCache.h | 4 ---- Source/cmake.cxx | 1 - 3 files changed, 8 insertions(+), 23 deletions(-) diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx index 2756cd27e..ffe1a1ff9 100644 --- a/Source/cmListFileCache.cxx +++ b/Source/cmListFileCache.cxx @@ -405,29 +405,17 @@ void cmListFileBacktrace::Append(cmListFileContext const& context) this->push_back(context); } -//---------------------------------------------------------------------------- -void cmListFileBacktrace::MakeRelative() -{ - if (this->Relative) - { - return; - } - for (cmListFileBacktrace::iterator i = this->begin(); - i != this->end(); ++i) - { - i->FilePath = this->LocalGenerator->Convert(i->FilePath, - cmLocalGenerator::HOME); - } - this->Relative = true; -} - void cmListFileBacktrace::PrintTitle(std::ostream& out) { if (this->empty()) { return; } - out << (this->front().Line ? " at " : " in ") << this->front(); + + cmListFileContext lfc = this->front(); + lfc.FilePath = this->LocalGenerator->Convert(lfc.FilePath, + cmLocalGenerator::HOME); + out << (lfc.Line ? " at " : " in ") << lfc; } void cmListFileBacktrace::PrintCallStack(std::ostream& out) @@ -441,7 +429,9 @@ void cmListFileBacktrace::PrintCallStack(std::ostream& out) out << "Call Stack (most recent call first):\n"; while(i != this->end()) { - cmListFileContext const& lfc = *i; + cmListFileContext lfc = *i; + lfc.FilePath = this->LocalGenerator->Convert(lfc.FilePath, + cmLocalGenerator::HOME); out << " " << lfc << "\n"; ++i; } diff --git a/Source/cmListFileCache.h b/Source/cmListFileCache.h index f85b430e4..1971862a7 100644 --- a/Source/cmListFileCache.h +++ b/Source/cmListFileCache.h @@ -76,19 +76,15 @@ class cmListFileBacktrace: private std::vector public: cmListFileBacktrace(cmLocalGenerator* localGen = 0) : LocalGenerator(localGen) - , Relative(localGen ? false : true) { } void Append(cmListFileContext const& context); - void MakeRelative(); - void PrintTitle(std::ostream& out); void PrintCallStack(std::ostream& out); private: cmLocalGenerator* LocalGenerator; - bool Relative; }; struct cmListFile diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 23803ef78..6cd005e31 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -2519,7 +2519,6 @@ void cmake::IssueMessage(cmake::MessageType t, std::string const& text, cmListFileBacktrace const& bt) { cmListFileBacktrace backtrace = bt; - backtrace.MakeRelative(); std::ostringstream msg; if (!this->PrintMessagePreamble(t, msg)) From eb7b6f6db4b2de70aae80fd8143e701b0cfa4268 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 23 May 2015 20:30:37 +0200 Subject: [PATCH 0008/1048] cmVariableWatchCommand: Simplify error reporting. --- Source/cmVariableWatchCommand.cxx | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Source/cmVariableWatchCommand.cxx b/Source/cmVariableWatchCommand.cxx index 9473008e3..09cef5e5d 100644 --- a/Source/cmVariableWatchCommand.cxx +++ b/Source/cmVariableWatchCommand.cxx @@ -68,11 +68,8 @@ static void cmVariableWatchCommandVariableAccessed( cmExecutionStatus status; if(!makefile->ExecuteCommand(newLFF,status)) { - arg.FilePath = "Unknown"; - arg.Line = 0; std::ostringstream error; - error << "Error in cmake code at\n" - << arg.FilePath << ":" << arg.Line << ":\n" + error << "Error in cmake code at\nUnknown:0:\n" << "A command failed during the invocation of callback \"" << data->Command << "\"."; cmSystemTools::Error(error.str().c_str()); From da28f11523644cdc2138a0cde2c4c015948ff46c Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 31 May 2015 00:18:33 +0200 Subject: [PATCH 0009/1048] cmState: Add CreateBaseSnapshot method. --- Source/cmState.cxx | 18 ++++++++++++++---- Source/cmState.h | 1 + Source/cmake.cxx | 2 +- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/Source/cmState.cxx b/Source/cmState.cxx index 58885d3b9..eade817a4 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -659,12 +659,22 @@ void cmState::Snapshot::ComputeRelativePathTopBinary() } } +cmState::Snapshot cmState::CreateBaseSnapshot() +{ + PositionType pos = 0; + this->ParentPositions.push_back(pos); + this->Locations.resize(1); + this->OutputLocations.resize(1); + this->CurrentSourceDirectoryComponents.resize(1); + this->CurrentBinaryDirectoryComponents.resize(1); + this->RelativePathTopSource.resize(1); + this->RelativePathTopBinary.resize(1); + return cmState::Snapshot(this, pos); +} + cmState::Snapshot cmState::CreateSnapshot(Snapshot originSnapshot) { - if (!originSnapshot.IsValid()) - { - originSnapshot.State = this; - } + assert(originSnapshot.IsValid()); PositionType pos = this->ParentPositions.size(); this->ParentPositions.push_back(originSnapshot.Position); this->Locations.resize(this->Locations.size() + 1); diff --git a/Source/cmState.h b/Source/cmState.h index 77a066f9f..157bd9056 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -57,6 +57,7 @@ public: cmState::PositionType Position; }; + Snapshot CreateBaseSnapshot(); Snapshot CreateSnapshot(Snapshot originSnapshot); enum CacheEntryType{ BOOL=0, PATH, FILEPATH, STRING, INTERNAL,STATIC, diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 23803ef78..ee5d53c09 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -134,7 +134,7 @@ cmake::cmake() this->Policies = new cmPolicies(); this->State = new cmState(this); - this->CurrentSnapshot = this->State->CreateSnapshot(cmState::Snapshot()); + this->CurrentSnapshot = this->State->CreateBaseSnapshot(); #ifdef __APPLE__ struct rlimit rlp; From 942df88bf83e99abbfbd69207369096fa7cf67a2 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 23 May 2015 08:00:46 +0200 Subject: [PATCH 0010/1048] cmState: Rename CreateSnapshot method. Leave the namespace open for other snapshot types. --- Source/cmMakefile.cxx | 2 +- Source/cmState.cxx | 3 ++- Source/cmState.h | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 7c74a0fd4..60498efbb 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1619,7 +1619,7 @@ void cmMakefile::AddSubDirectory(const std::string& srcPath, } cmState::Snapshot newSnapshot = this->GetState() - ->CreateSnapshot(this->StateSnapshot); + ->CreateBuildsystemDirectorySnapshot(this->StateSnapshot); // create a new local generator and set its parent cmLocalGenerator *lg2 = this->GetGlobalGenerator() diff --git a/Source/cmState.cxx b/Source/cmState.cxx index eade817a4..87892b4dd 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -672,7 +672,8 @@ cmState::Snapshot cmState::CreateBaseSnapshot() return cmState::Snapshot(this, pos); } -cmState::Snapshot cmState::CreateSnapshot(Snapshot originSnapshot) +cmState::Snapshot +cmState::CreateBuildsystemDirectorySnapshot(Snapshot originSnapshot) { assert(originSnapshot.IsValid()); PositionType pos = this->ParentPositions.size(); diff --git a/Source/cmState.h b/Source/cmState.h index 157bd9056..24e0f7b4c 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -58,7 +58,7 @@ public: }; Snapshot CreateBaseSnapshot(); - Snapshot CreateSnapshot(Snapshot originSnapshot); + Snapshot CreateBuildsystemDirectorySnapshot(Snapshot originSnapshot); enum CacheEntryType{ BOOL=0, PATH, FILEPATH, STRING, INTERNAL,STATIC, UNINITIALIZED }; From cf1233a0eab7cec757d2929cc7373f94ba4fa8a8 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 23 May 2015 08:02:54 +0200 Subject: [PATCH 0011/1048] cmState: Rename GetParent method. Leave the namespace open for other Parent types. --- Source/cmLocalGenerator.cxx | 2 +- Source/cmMakefile.cxx | 3 ++- Source/cmState.cxx | 6 +++--- Source/cmState.h | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index eb6b87197..a16fc5541 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -73,7 +73,7 @@ cmLocalGenerator::~cmLocalGenerator() bool cmLocalGenerator::IsRootMakefile() const { - return !this->StateSnapshot.GetParent().IsValid(); + return !this->StateSnapshot.GetBuildsystemDirectoryParent().IsValid(); } //---------------------------------------------------------------------------- diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 60498efbb..00627bf71 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -4038,7 +4038,8 @@ const char *cmMakefile::GetProperty(const std::string& prop, output = ""; if (prop == "PARENT_DIRECTORY") { - cmState::Snapshot parent = this->StateSnapshot.GetParent(); + cmState::Snapshot parent = + this->StateSnapshot.GetBuildsystemDirectoryParent(); if(parent.IsValid()) { return parent.GetCurrentSourceDirectory(); diff --git a/Source/cmState.cxx b/Source/cmState.cxx index 87892b4dd..c6fb2998e 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -590,7 +590,7 @@ void cmState::Snapshot::ComputeRelativePathTopSource() snapshots.push_back(snapshot); while (true) { - snapshot = snapshot.GetParent(); + snapshot = snapshot.GetBuildsystemDirectoryParent(); if (snapshot.IsValid()) { snapshots.push_back(snapshot); @@ -622,7 +622,7 @@ void cmState::Snapshot::ComputeRelativePathTopBinary() snapshots.push_back(snapshot); while (true) { - snapshot = snapshot.GetParent(); + snapshot = snapshot.GetBuildsystemDirectoryParent(); if (snapshot.IsValid()) { snapshots.push_back(snapshot); @@ -775,7 +775,7 @@ bool cmState::Snapshot::IsValid() const return this->State ? true : false; } -cmState::Snapshot cmState::Snapshot::GetParent() const +cmState::Snapshot cmState::Snapshot::GetBuildsystemDirectoryParent() const { Snapshot snapshot; if (!this->State || this->Position == 0) diff --git a/Source/cmState.h b/Source/cmState.h index 24e0f7b4c..60b024f33 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -45,7 +45,7 @@ public: void SetRelativePathTopBinary(const char* dir); bool IsValid() const; - Snapshot GetParent() const; + Snapshot GetBuildsystemDirectoryParent() const; private: void ComputeRelativePathTopSource(); From 758392f51f4c1653c2f4dce936fb1a44d86d6a21 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Wed, 3 Jun 2015 00:01:08 -0400 Subject: [PATCH 0012/1048] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 697ea9178..c5d412d10 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 3) -set(CMake_VERSION_PATCH 20150602) +set(CMake_VERSION_PATCH 20150603) #set(CMake_VERSION_RC 1) From 721b7e3e56f8a9e7f6daf1602dcc5cd85677fc84 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 3 Jun 2015 08:47:49 -0400 Subject: [PATCH 0013/1048] CTest: Capture test stdout/stderr through one pipe (#15600) Use the KWSys Process "MergeOutput" option to give each test child process the same pipe for both stdout and stderr. This allows natural merging of stdout and stderr together instead of merging on arbitrary buffered read boundaries as before. --- Source/CTest/cmCTestRunTest.cxx | 3 +-- Source/CTest/cmProcess.cxx | 19 ++++--------------- Source/CTest/cmProcess.h | 7 ++----- .../CTestCommandLine/MergeOutput-stdout.txt | 13 +++++++++++++ .../CTestCommandLine/MergeOutput.cmake | 4 ++++ .../CTestCommandLine/RunCMakeTest.cmake | 13 +++++++++++++ 6 files changed, 37 insertions(+), 22 deletions(-) create mode 100644 Tests/RunCMake/CTestCommandLine/MergeOutput-stdout.txt create mode 100644 Tests/RunCMake/CTestCommandLine/MergeOutput.cmake diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx index d9e4bd4b9..d108592f6 100644 --- a/Source/CTest/cmCTestRunTest.cxx +++ b/Source/CTest/cmCTestRunTest.cxx @@ -57,8 +57,7 @@ bool cmCTestRunTest::CheckOutput() // Process has terminated and all output read. return false; } - else if(p == cmsysProcess_Pipe_STDOUT || - p == cmsysProcess_Pipe_STDERR) + else if(p == cmsysProcess_Pipe_STDOUT) { // Store this line of output. cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, diff --git a/Source/CTest/cmProcess.cxx b/Source/CTest/cmProcess.cxx index e1bd02b7f..0c25f4050 100644 --- a/Source/CTest/cmProcess.cxx +++ b/Source/CTest/cmProcess.cxx @@ -62,6 +62,7 @@ bool cmProcess::StartProcess() this->WorkingDirectory.c_str()); } cmsysProcess_SetTimeout(this->Process, this->Timeout); + cmsysProcess_SetOption(this->Process, cmsysProcess_Option_MergeOutput, 1); cmsysProcess_Execute(this->Process); return (cmsysProcess_GetState(this->Process) == cmsysProcess_State_Executing); @@ -124,14 +125,10 @@ int cmProcess::GetNextOutputLine(std::string& line, double timeout) for(;;) { // Look for lines already buffered. - if(this->StdOut.GetLine(line)) + if(this->Output.GetLine(line)) { return cmsysProcess_Pipe_STDOUT; } - else if(this->StdErr.GetLine(line)) - { - return cmsysProcess_Pipe_STDERR; - } // Check for more data from the process. char* data; @@ -143,11 +140,7 @@ int cmProcess::GetNextOutputLine(std::string& line, double timeout) } else if(p == cmsysProcess_Pipe_STDOUT) { - this->StdOut.insert(this->StdOut.end(), data, data+length); - } - else if(p == cmsysProcess_Pipe_STDERR) - { - this->StdErr.insert(this->StdErr.end(), data, data+length); + this->Output.insert(this->Output.end(), data, data+length); } else // p == cmsysProcess_Pipe_None { @@ -157,14 +150,10 @@ int cmProcess::GetNextOutputLine(std::string& line, double timeout) } // Look for partial last lines. - if(this->StdOut.GetLast(line)) + if(this->Output.GetLast(line)) { return cmsysProcess_Pipe_STDOUT; } - else if(this->StdErr.GetLast(line)) - { - return cmsysProcess_Pipe_STDERR; - } // No more data. Wait for process exit. if(!cmsysProcess_WaitForExit(this->Process, &timeout)) diff --git a/Source/CTest/cmProcess.h b/Source/CTest/cmProcess.h index 1479df05f..eddeeabe8 100644 --- a/Source/CTest/cmProcess.h +++ b/Source/CTest/cmProcess.h @@ -48,8 +48,7 @@ public: * Read one line of output but block for no more than timeout. * Returns: * cmsysProcess_Pipe_None = Process terminated and all output read - * cmsysProcess_Pipe_STDOUT = Line came from stdout - * cmsysProcess_Pipe_STDOUT = Line came from stderr + * cmsysProcess_Pipe_STDOUT = Line came from stdout or stderr * cmsysProcess_Pipe_Timeout = Timeout expired while waiting */ int GetNextOutputLine(std::string& line, double timeout); @@ -68,13 +67,11 @@ private: bool GetLine(std::string& line); bool GetLast(std::string& line); }; - Buffer StdErr; - Buffer StdOut; + Buffer Output; std::string Command; std::string WorkingDirectory; std::vector Arguments; std::vector ProcessArgs; - std::string Output; int Id; int ExitValue; }; diff --git a/Tests/RunCMake/CTestCommandLine/MergeOutput-stdout.txt b/Tests/RunCMake/CTestCommandLine/MergeOutput-stdout.txt new file mode 100644 index 000000000..af7cdc570 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/MergeOutput-stdout.txt @@ -0,0 +1,13 @@ +Test timeout computed to be: [^ +]+ +1: -- Output on stdout +1: Output on stderr +1: -- Output on stdout +1: Output on stderr +1: -- Output on stdout +1: Output on stderr +1: -- Output on stdout +1: Output on stderr +1: -- Output on stdout +1: Output on stderr +1/1 Test #1: MergeOutput diff --git a/Tests/RunCMake/CTestCommandLine/MergeOutput.cmake b/Tests/RunCMake/CTestCommandLine/MergeOutput.cmake new file mode 100644 index 000000000..528ac9014 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/MergeOutput.cmake @@ -0,0 +1,4 @@ +foreach(i RANGE 1 5) + message(STATUS "Output on stdout") + message("Output on stderr") +endforeach() diff --git a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake index 0cb11ac61..a3ce1399c 100644 --- a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake @@ -39,3 +39,16 @@ subdirs() run_cmake_command(BadCTestTestfile ${CMAKE_CTEST_COMMAND}) endfunction() run_BadCTestTestfile() + +function(run_MergeOutput) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/MergeOutput) + set(RunCMake_TEST_NO_CLEAN 1) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + file(WRITE "${RunCMake_TEST_BINARY_DIR}/CTestTestfile.cmake" " +add_test(MergeOutput \"${CMAKE_COMMAND}\" -P \"${RunCMake_SOURCE_DIR}/MergeOutput.cmake\") +") + + run_cmake_command(MergeOutput ${CMAKE_CTEST_COMMAND} -V) +endfunction() +run_MergeOutput() From 1335992c8f4e8b96f1a21d5dcc7d65a9fbd84c11 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 1 Jun 2015 19:56:46 +0200 Subject: [PATCH 0014/1048] Remove CMAKE_USE_RELATIVE_PATHS variable. The test for this variable was removed in commit v2.8.8~330^2~7 (complex: Remove ancient unused ComplexRelativePaths test, 2011-12-23). Commit v3.1.0-rc1~425^2~2 (backtrace: Convert to local paths in IssueMessage, 2014-03-12) appears to have accidentally made some backtraces print relative paths with the variable because conversions which used to be done at configure time, before the variable had an effect are now potentially done at generate time. The documentation of the variable says not to use it, and the docs are wrong in that the variable actually applies in per-directory scope. The read of the variable makes it harder to split conversion methods from cmLocalGenerator where they don't belong. Remove it now. --- .../dev/remove-CMAKE_USE_RELATIVE_PATHS.rst | 5 ++++ Help/variable/CMAKE_USE_RELATIVE_PATHS.rst | 9 ++----- Source/cmGlobalXCodeGenerator.cxx | 24 ++----------------- Source/cmLocalGenerator.cxx | 9 ++----- Source/cmLocalGenerator.h | 4 +--- Source/cmMakefileTargetGenerator.cxx | 8 +------ Source/cmake.cxx | 14 ----------- 7 files changed, 13 insertions(+), 60 deletions(-) create mode 100644 Help/release/dev/remove-CMAKE_USE_RELATIVE_PATHS.rst diff --git a/Help/release/dev/remove-CMAKE_USE_RELATIVE_PATHS.rst b/Help/release/dev/remove-CMAKE_USE_RELATIVE_PATHS.rst new file mode 100644 index 000000000..dd52acecc --- /dev/null +++ b/Help/release/dev/remove-CMAKE_USE_RELATIVE_PATHS.rst @@ -0,0 +1,5 @@ +remove-CMAKE_USE_RELATIVE_PATHS +------------------------------- + +* The :variable:`CMAKE_USE_RELATIVE_PATHS` variable no longer has any + effect. Previously it was partially implemented and unreliable. diff --git a/Help/variable/CMAKE_USE_RELATIVE_PATHS.rst b/Help/variable/CMAKE_USE_RELATIVE_PATHS.rst index af6f08c54..06fe0fbc6 100644 --- a/Help/variable/CMAKE_USE_RELATIVE_PATHS.rst +++ b/Help/variable/CMAKE_USE_RELATIVE_PATHS.rst @@ -1,10 +1,5 @@ CMAKE_USE_RELATIVE_PATHS ------------------------ -Use relative paths (May not work!). - -If this is set to TRUE, then CMake will use relative paths between the -source and binary tree. This option does not work for more -complicated projects, and relative paths are used when possible. In -general, it is not possible to move CMake generated makefiles to a -different location regardless of the value of this variable. +This variable has no effect. The partially implemented effect it +had in previous releases was removed in CMake 3.4. diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 7464e90ee..1301e3ebb 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -3804,33 +3804,13 @@ void cmGlobalXCodeGenerator::GetDocumentation(cmDocumentationEntry& entry) //---------------------------------------------------------------------------- std::string cmGlobalXCodeGenerator::ConvertToRelativeForMake(const char* p) { - if ( !this->CurrentMakefile->IsOn("CMAKE_USE_RELATIVE_PATHS") ) - { - return cmSystemTools::ConvertToOutputPath(p); - } - else - { - std::string ret = - this->CurrentLocalGenerator-> - ConvertToRelativePath(this->CurrentOutputDirectoryComponents, p); - return cmSystemTools::ConvertToOutputPath(ret.c_str()); - } + return cmSystemTools::ConvertToOutputPath(p); } //---------------------------------------------------------------------------- std::string cmGlobalXCodeGenerator::ConvertToRelativeForXCode(const char* p) { - if ( !this->CurrentMakefile->IsOn("CMAKE_USE_RELATIVE_PATHS") ) - { - return cmSystemTools::ConvertToOutputPath(p); - } - else - { - std::string ret = - this->CurrentLocalGenerator-> - ConvertToRelativePath(this->ProjectOutputDirectoryComponents, p); - return cmSystemTools::ConvertToOutputPath(ret.c_str()); - } + return cmSystemTools::ConvertToOutputPath(p); } //---------------------------------------------------------------------------- diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index eb6b87197..84461b1e5 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -59,7 +59,6 @@ cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg, this->Makefile = new cmMakefile(this); this->LinkScriptShell = false; - this->UseRelativePaths = false; this->Configured = false; this->EmitUniversalBinaryFlags = true; this->BackwardsCompatibility = 0; @@ -137,10 +136,6 @@ void cmLocalGenerator::Configure() this->Makefile->AddCMakeDependFilesFromUser(); - // Check whether relative paths should be used for optionally - // relative paths. - this->UseRelativePaths = this->Makefile->IsOn("CMAKE_USE_RELATIVE_PATHS"); - this->ComputeObjectMaxPath(); this->Configured = true; @@ -2705,7 +2700,7 @@ std::string cmLocalGenerator::Convert(const std::string& source, // Convert the path to a relative path. std::string result = source; - if (!optional || this->UseRelativePaths) + if (!optional) { switch (relative) { @@ -2786,7 +2781,7 @@ std::string cmLocalGenerator::Convert(RelativeRoot remote, // The relative root must have a path (i.e. not FULL or NONE) assert(remotePath != 0); - if(!local.empty() && (!optional || this->UseRelativePaths)) + if(!local.empty() && !optional) { std::vector components; cmSystemTools::SplitPath(local, components); diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 32b17f53f..03fe9ba5c 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -127,8 +127,7 @@ public: const char* GetRelativeRootPath(RelativeRoot relroot); /** - * Convert the given path to an output path that is optionally - * relative based on the cache option CMAKE_USE_RELATIVE_PATHS. The + * Convert the given path to an output path. The * remote path must use forward slashes and not already be escaped * or quoted. */ @@ -460,7 +459,6 @@ protected: std::set WarnCMP0063; bool LinkScriptShell; - bool UseRelativePaths; bool Configured; bool EmitUniversalBinaryFlags; diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 7b88bc7b2..d422e28f7 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -614,13 +614,7 @@ cmMakefileTargetGenerator } // Get the output paths for source and object files. - std::string sourceFile = source.GetFullPath(); - if(this->LocalGenerator->UseRelativePaths) - { - sourceFile = this->Convert(sourceFile, - cmLocalGenerator::START_OUTPUT); - } - sourceFile = this->Convert(sourceFile, + std::string sourceFile = this->Convert(source.GetFullPath(), cmLocalGenerator::NONE, cmLocalGenerator::SHELL); diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 23803ef78..e3fec5fb5 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -1437,20 +1437,6 @@ int cmake::ActualConfigure() cmState::PATH); } } - if(!this->State - ->GetInitializedCacheValue("CMAKE_USE_RELATIVE_PATHS")) - { - this->State->AddCacheEntry - ("CMAKE_USE_RELATIVE_PATHS", "OFF", - "If true, cmake will use relative paths in makefiles and projects.", - cmState::BOOL); - if (!this->State->GetCacheEntryProperty("CMAKE_USE_RELATIVE_PATHS", - "ADVANCED")) - { - this->State->SetCacheEntryProperty("CMAKE_USE_RELATIVE_PATHS", - "ADVANCED", "1"); - } - } if(cmSystemTools::GetFatalErrorOccured()) { From e44e6bcc045916fcab3b3798d9aa9951c35c1878 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 1 Jun 2015 20:07:26 +0200 Subject: [PATCH 0015/1048] Port away from obsolete method. --- Source/cmLocalVisualStudio6Generator.cxx | 72 ++++++++++++------------ Source/cmLocalVisualStudio7Generator.cxx | 6 +- 2 files changed, 38 insertions(+), 40 deletions(-) diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index ad3485701..e5f9f550d 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -498,7 +498,7 @@ void cmLocalVisualStudio6Generator // Tell MS-Dev what the source is. If the compiler knows how to // build it, then it will. fout << "SOURCE=" << - this->ConvertToOptionallyRelativeOutputPath(source.c_str()) << "\n\n"; + this->ConvertToOutputFormat(source.c_str(), SHELL) << "\n\n"; if(!depends.empty()) { // Write out the dependencies for the rule. @@ -507,7 +507,7 @@ void cmLocalVisualStudio6Generator d != depends.end(); ++d) { fout << "\\\n\t" << - this->ConvertToOptionallyRelativeOutputPath(d->c_str()); + this->ConvertToOutputFormat(d->c_str(), SHELL); } fout << "\n"; } @@ -663,7 +663,7 @@ cmLocalVisualStudio6Generator if(this->GetRealDependency(d->c_str(), config.c_str(), dep)) { fout << "\\\n\t" << - this->ConvertToOptionallyRelativeOutputPath(dep.c_str()); + this->ConvertToOutputFormat(dep.c_str(), SHELL); } } fout << "\n"; @@ -689,7 +689,7 @@ cmLocalVisualStudio6Generator ++o) { // Write a rule for every output generated by this command. - fout << this->ConvertToOptionallyRelativeOutputPath(o->c_str()) + fout << this->ConvertToOutputFormat(o->c_str(), SHELL) << " : \"$(SOURCE)\" \"$(INTDIR)\" \"$(OUTDIR)\"\n\t"; fout << script.c_str() << "\n\n"; } @@ -906,7 +906,7 @@ cmLocalVisualStudio6Generator::GetTargetIncludeOptions(cmTarget &target, for(i = includes.begin(); i != includes.end(); ++i) { std::string tmp = - this->ConvertToOptionallyRelativeOutputPath(i->c_str()); + this->ConvertToOutputFormat(i->c_str(), SHELL); if(useShortPath) { cmSystemTools::GetShortPath(tmp.c_str(), tmp); @@ -997,14 +997,14 @@ void cmLocalVisualStudio6Generator if(libPath.size()) { std::string lpath = - this->ConvertToOptionallyRelativeOutputPath(libPath.c_str()); + this->ConvertToOutputFormat(libPath.c_str(), SHELL); if(lpath.size() == 0) { lpath = "."; } std::string lpathIntDir = libPath + "$(INTDIR)"; lpathIntDir = - this->ConvertToOptionallyRelativeOutputPath(lpathIntDir.c_str()); + this->ConvertToOutputFormat(lpathIntDir.c_str(), SHELL); if(pathEmitted.insert(lpath).second) { libOptions += " /LIBPATH:"; @@ -1030,14 +1030,14 @@ void cmLocalVisualStudio6Generator if(exePath.size()) { std::string lpath = - this->ConvertToOptionallyRelativeOutputPath(exePath.c_str()); + this->ConvertToOutputFormat(exePath.c_str(), SHELL); if(lpath.size() == 0) { lpath = "."; } std::string lpathIntDir = exePath + "$(INTDIR)"; lpathIntDir = - this->ConvertToOptionallyRelativeOutputPath(lpathIntDir.c_str()); + this->ConvertToOutputFormat(lpathIntDir.c_str(), SHELL); if(pathEmitted.insert(lpath).second) { @@ -1071,14 +1071,14 @@ void cmLocalVisualStudio6Generator path += "/"; } std::string lpath = - this->ConvertToOptionallyRelativeOutputPath(path.c_str()); + this->ConvertToOutputFormat(path.c_str(), SHELL); if(lpath.size() == 0) { lpath = "."; } std::string lpathIntDir = path + "$(INTDIR)"; lpathIntDir = - this->ConvertToOptionallyRelativeOutputPath(lpathIntDir.c_str()); + this->ConvertToOutputFormat(lpathIntDir.c_str(), SHELL); if(pathEmitted.insert(lpath).second) { libOptions += " /LIBPATH:"; @@ -1142,9 +1142,9 @@ void cmLocalVisualStudio6Generator libDebug += ".lib"; } } - lib = this->ConvertToOptionallyRelativeOutputPath(lib.c_str()); + lib = this->ConvertToOutputFormat(lib.c_str(), SHELL); libDebug = - this->ConvertToOptionallyRelativeOutputPath(libDebug.c_str()); + this->ConvertToOutputFormat(libDebug.c_str(), SHELL); if (j->second == cmTarget::GENERAL) { @@ -1367,21 +1367,21 @@ void cmLocalVisualStudio6Generator { #ifdef CM_USE_OLD_VS6 outputDirOld = - removeQuotes(this->ConvertToOptionallyRelativeOutputPath - (target.GetDirectory().c_str())); + removeQuotes(this->ConvertToOutputFormat + (target.GetDirectory().c_str(), SHELL)); #endif outputDirDebug = - removeQuotes(this->ConvertToOptionallyRelativeOutputPath( - target.GetDirectory("Debug").c_str())); + removeQuotes(this->ConvertToOutputFormat( + target.GetDirectory("Debug").c_str(), SHELL)); outputDirRelease = - removeQuotes(this->ConvertToOptionallyRelativeOutputPath( - target.GetDirectory("Release").c_str())); + removeQuotes(this->ConvertToOutputFormat( + target.GetDirectory("Release").c_str(), SHELL)); outputDirMinSizeRel = - removeQuotes(this->ConvertToOptionallyRelativeOutputPath( - target.GetDirectory("MinSizeRel").c_str())); + removeQuotes(this->ConvertToOutputFormat( + target.GetDirectory("MinSizeRel").c_str(), SHELL)); outputDirRelWithDebInfo = - removeQuotes(this->ConvertToOptionallyRelativeOutputPath( - target.GetDirectory("RelWithDebInfo").c_str())); + removeQuotes(this->ConvertToOutputFormat( + target.GetDirectory("RelWithDebInfo").c_str(), SHELL)); } else if(target.GetType() == cmTarget::OBJECT_LIBRARY) { @@ -1449,15 +1449,13 @@ void cmLocalVisualStudio6Generator targetImplibFlagMinSizeRel = "/implib:"; targetImplibFlagRelWithDebInfo = "/implib:"; targetImplibFlagDebug += - this->ConvertToOptionallyRelativeOutputPath(fullPathImpDebug.c_str()); + this->ConvertToOutputFormat(fullPathImpDebug.c_str(), SHELL); targetImplibFlagRelease += - this->ConvertToOptionallyRelativeOutputPath(fullPathImpRelease.c_str()); + this->ConvertToOutputFormat(fullPathImpRelease.c_str(), SHELL); targetImplibFlagMinSizeRel += - this->ConvertToOptionallyRelativeOutputPath( - fullPathImpMinSizeRel.c_str()); + this->ConvertToOutputFormat(fullPathImpMinSizeRel.c_str(), SHELL); targetImplibFlagRelWithDebInfo += - this->ConvertToOptionallyRelativeOutputPath( - fullPathImpRelWithDebInfo.c_str()); + this->ConvertToOutputFormat(fullPathImpRelWithDebInfo.c_str(), SHELL); } #ifdef CM_USE_OLD_VS6 @@ -1669,12 +1667,12 @@ void cmLocalVisualStudio6Generator // to convert to output path for unix to win32 conversion cmSystemTools::ReplaceString (line, "LIBRARY_OUTPUT_PATH", - removeQuotes(this->ConvertToOptionallyRelativeOutputPath - (libPath.c_str())).c_str()); + removeQuotes(this->ConvertToOutputFormat + (libPath.c_str(), SHELL)).c_str()); cmSystemTools::ReplaceString (line, "EXECUTABLE_OUTPUT_PATH", - removeQuotes(this->ConvertToOptionallyRelativeOutputPath - (exePath.c_str())).c_str()); + removeQuotes(this->ConvertToOutputFormat + (exePath.c_str(), SHELL)).c_str()); #endif if(targetBuilds || target.GetType() == cmTarget::OBJECT_LIBRARY) @@ -1884,9 +1882,9 @@ void cmLocalVisualStudio6Generator } dir += "$(IntDir)"; options += "# ADD LINK32 /LIBPATH:"; - options += this->ConvertToOptionallyRelativeOutputPath(dir.c_str()); + options += this->ConvertToOutputFormat(dir.c_str(), SHELL); options += " /LIBPATH:"; - options += this->ConvertToOptionallyRelativeOutputPath(d->c_str()); + options += this->ConvertToOutputFormat(d->c_str(), SHELL); options += "\n"; } } @@ -1897,7 +1895,7 @@ void cmLocalVisualStudio6Generator if(l->IsPath) { options += - this->ConvertToOptionallyRelativeOutputPath(l->Value.c_str()); + this->ConvertToOutputFormat(l->Value.c_str(), SHELL); } else if (!l->Target || l->Target->GetType() != cmTarget::INTERFACE_LIBRARY) @@ -1933,7 +1931,7 @@ void cmLocalVisualStudio6Generator options += "# ADD "; options += tool; options += "32 "; - options += this->ConvertToOptionallyRelativeOutputPath(oi->c_str()); + options += this->ConvertToOutputFormat(oi->c_str(), SHELL); options += "\n"; } } diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 9c031cff6..c56563267 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -1087,7 +1087,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, if(!this->ModuleDefinitionFile.empty()) { std::string defFile = - this->ConvertToOptionallyRelativeOutputPath(this->ModuleDefinitionFile); + this->ConvertToOutputFormat(this->ModuleDefinitionFile, SHELL); linkOptions.AddFlag("ModuleDefinitionFile", defFile.c_str()); } switch(target.GetType()) @@ -2234,7 +2234,7 @@ std::string cmLocalVisualStudio7Generator::EscapeForXML(const std::string& s) std::string cmLocalVisualStudio7Generator ::ConvertToXMLOutputPath(const char* path) { - std::string ret = this->ConvertToOptionallyRelativeOutputPath(path); + std::string ret = this->ConvertToOutputFormat(path, SHELL); cmSystemTools::ReplaceString(ret, "&", "&"); cmSystemTools::ReplaceString(ret, "\"", """); cmSystemTools::ReplaceString(ret, "<", "<"); @@ -2245,7 +2245,7 @@ std::string cmLocalVisualStudio7Generator std::string cmLocalVisualStudio7Generator ::ConvertToXMLOutputPathSingle(const char* path) { - std::string ret = this->ConvertToOptionallyRelativeOutputPath(path); + std::string ret = this->ConvertToOutputFormat(path, SHELL); cmSystemTools::ReplaceString(ret, "\"", ""); cmSystemTools::ReplaceString(ret, "&", "&"); cmSystemTools::ReplaceString(ret, "<", "<"); From 3d8c6cd9648089c389c1496fb910d664a5773ab4 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 1 Jun 2015 20:11:53 +0200 Subject: [PATCH 0016/1048] cmLocalGenerator: Remove obsolete method. --- Source/cmLocalGenerator.cxx | 8 -------- Source/cmLocalGenerator.h | 7 ------- 2 files changed, 15 deletions(-) diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 84461b1e5..f35de0327 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -2669,14 +2669,6 @@ cmLocalGenerator::ConstructComment(cmCustomCommandGenerator const& ccg, return default_comment; } -//---------------------------------------------------------------------------- -std::string -cmLocalGenerator::ConvertToOptionallyRelativeOutputPath( - const std::string& remote) -{ - return this->Convert(remote, START_OUTPUT, SHELL, true); -} - //---------------------------------------------------------------------------- const char* cmLocalGenerator::GetRelativeRootPath(RelativeRoot relroot) { diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 03fe9ba5c..30b622e66 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -126,13 +126,6 @@ public: */ const char* GetRelativeRootPath(RelativeRoot relroot); - /** - * Convert the given path to an output path. The - * remote path must use forward slashes and not already be escaped - * or quoted. - */ - std::string ConvertToOptionallyRelativeOutputPath(const std::string& remote); - ///! set/get the parent generator cmLocalGenerator* GetParent() const {return this->Parent;} From 0cc7c9a74368d1db8acc1a98dec79a1eb472e74b Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Thu, 4 Jun 2015 00:01:06 -0400 Subject: [PATCH 0017/1048] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index c5d412d10..a4c877e86 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 3) -set(CMake_VERSION_PATCH 20150603) +set(CMake_VERSION_PATCH 20150604) #set(CMake_VERSION_RC 1) From c85367f408befa419185a4fec4816ea0ee3e1ee6 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 2 Jun 2015 11:49:07 -0400 Subject: [PATCH 0018/1048] VS: Compute project GUIDs deterministically Compute deterministic GUIDs that are unique to the build tree by hashing the path to the build tree with the GUID logical name. Avoid storing them in the cache, but honor any found there. This will allow project GUIDs to be reproduced in a fresh build tree so long as its path is the same as the original, which may be useful for incremental builds. --- Source/cmGlobalGenerator.h | 2 - Source/cmGlobalVisualStudio7Generator.cxx | 52 ++++++++-------------- Source/cmGlobalVisualStudio7Generator.h | 5 +-- Source/cmGlobalVisualStudio8Generator.cxx | 1 - Source/cmLocalVisualStudio10Generator.cxx | 3 +- Source/cmLocalVisualStudio7Generator.cxx | 11 +---- Source/cmMakefile.cxx | 15 ------- Source/cmVisualStudio10TargetGenerator.cxx | 4 -- 8 files changed, 22 insertions(+), 71 deletions(-) diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 979e97103..598f6ad93 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -310,8 +310,6 @@ public: { return this->BinaryDirectories.insert(dir).second; } - /** Supported systems creates a GUID for the given name */ - virtual void CreateGUID(const std::string&) {} /** Return true if the generated build tree may contain multiple builds. i.e. "Can I build Debug and Release in the same tree?" */ diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 4dd54d021..a24204615 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -513,8 +513,6 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution( cumulativePath = cumulativePath + "/" + *iter; } - - this->CreateGUID(cumulativePath.c_str()); } if (!cumulativePath.empty()) @@ -899,7 +897,6 @@ cmGlobalVisualStudio7Generator::WriteUtilityDepend(cmTarget const* target) fname += ".vcproj"; cmGeneratedFileStream fout(fname.c_str()); fout.SetCopyIfDifferent(true); - this->CreateGUID(pname.c_str()); std::string guid = this->GetGUID(pname.c_str()); fout << @@ -943,41 +940,28 @@ cmGlobalVisualStudio7Generator::WriteUtilityDepend(cmTarget const* target) return pname; } -std::string cmGlobalVisualStudio7Generator::GetGUID(const std::string& name) +//---------------------------------------------------------------------------- +std::string cmGlobalVisualStudio7Generator::GetGUID(std::string const& name) { - std::string guidStoreName = name; - guidStoreName += "_GUID_CMAKE"; - const char* storedGUID = - this->CMakeInstance->GetCacheDefinition(guidStoreName.c_str()); - if(storedGUID) + std::string const& guidStoreName = name + "_GUID_CMAKE"; + if (const char* storedGUID = + this->CMakeInstance->GetCacheDefinition(guidStoreName.c_str())) { return std::string(storedGUID); } - cmSystemTools::Error("Unknown Target referenced : ", - name.c_str()); - return ""; -} - - -void cmGlobalVisualStudio7Generator::CreateGUID(const std::string& name) -{ - std::string guidStoreName = name; - guidStoreName += "_GUID_CMAKE"; - if(this->CMakeInstance->GetCacheDefinition(guidStoreName.c_str())) - { - return; - } - std::string ret; - UUID uid; - unsigned short *uidstr; - UuidCreate(&uid); - UuidToStringW(&uid,&uidstr); - ret = cmsys::Encoding::ToNarrow(reinterpret_cast(uidstr)); - RpcStringFreeW(&uidstr); - ret = cmSystemTools::UpperCase(ret); - this->CMakeInstance->AddCacheEntry(guidStoreName.c_str(), - ret.c_str(), "Stored GUID", - cmState::INTERNAL); + // Compute a GUID that is deterministic but unique to the build tree. + std::string input = this->CMakeInstance->GetState()->GetBinaryDirectory(); + input += "|"; + input += name; + std::string md5 = cmSystemTools::ComputeStringMD5(input); + assert(md5.length() == 32); + std::string const& guid = + (md5.substr( 0,8)+"-"+ + md5.substr( 8,4)+"-"+ + md5.substr(12,4)+"-"+ + md5.substr(16,4)+"-"+ + md5.substr(20,12)); + return cmSystemTools::UpperCase(guid); } //---------------------------------------------------------------------------- diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h index c98d2697e..931ac9cf8 100644 --- a/Source/cmGlobalVisualStudio7Generator.h +++ b/Source/cmGlobalVisualStudio7Generator.h @@ -80,9 +80,8 @@ public: */ virtual void OutputSLNFile(); - ///! Create a GUID or get an existing one. - void CreateGUID(const std::string& name); - std::string GetGUID(const std::string& name); + ///! Lookup a stored GUID or compute one deterministically. + std::string GetGUID(std::string const& name); /** Append the subdirectory for the given configuration. */ virtual void AppendDirectoryForConfig(const std::string& prefix, diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index a3ebc6117..d24066fad 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -185,7 +185,6 @@ void cmGlobalVisualStudio8Generator void cmGlobalVisualStudio8Generator::Configure() { this->cmGlobalVisualStudio7Generator::Configure(); - this->CreateGUID(CMAKE_CHECK_BUILD_SYSTEM_TARGET); } //---------------------------------------------------------------------------- diff --git a/Source/cmLocalVisualStudio10Generator.cxx b/Source/cmLocalVisualStudio10Generator.cxx index ad6a020f7..9ded83ac0 100644 --- a/Source/cmLocalVisualStudio10Generator.cxx +++ b/Source/cmLocalVisualStudio10Generator.cxx @@ -107,10 +107,9 @@ void cmLocalVisualStudio10Generator cmVS10XMLParser parser; parser.ParseFile(path); - // if we can not find a GUID then create one + // if we can not find a GUID then we will generate one later if(parser.GUID.empty()) { - this->GlobalGenerator->CreateGUID(name); return; } diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 9c031cff6..28a74cb93 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -82,8 +82,6 @@ void cmLocalVisualStudio7Generator::AddHelperCommands() // Now create GUIDs for targets cmTargets &tgts = this->Makefile->GetTargets(); - cmGlobalVisualStudio7Generator* gg = - static_cast(this->GlobalGenerator); for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); l++) { if(l->second.GetType() == cmTarget::INTERFACE_LIBRARY) @@ -96,10 +94,6 @@ void cmLocalVisualStudio7Generator::AddHelperCommands() this->ReadAndStoreExternalGUID( l->second.GetName().c_str(), path); } - else - { - gg->CreateGUID(l->first.c_str()); - } } @@ -2312,12 +2306,9 @@ void cmLocalVisualStudio7Generator::ReadAndStoreExternalGUID( { cmVS7XMLParser parser; parser.ParseFile(path); - // if we can not find a GUID then create one + // if we can not find a GUID then we will generate one later if(parser.GUID.size() == 0) { - cmGlobalVisualStudio7Generator* gg = - static_cast(this->GlobalGenerator); - gg->CreateGUID(name); return; } std::string guidStoreName = name; diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 7c74a0fd4..137c28b38 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -2116,25 +2116,10 @@ void cmMakefile::AddSourceGroup(const std::vector& name, return; } // build the whole source group path - const char* fullname = sg->GetFullName(); - cmGlobalGenerator* gg = this->GetGlobalGenerator(); - if(strlen(fullname)) - { - std::string guidName = "SG_Filter_"; - guidName += fullname; - gg->CreateGUID(guidName); - } for(++i; i<=lastElement; ++i) { sg->AddChild(cmSourceGroup(name[i].c_str(), 0, sg->GetFullName())); sg = sg->LookupChild(name[i].c_str()); - fullname = sg->GetFullName(); - if(strlen(fullname)) - { - std::string guidName = "SG_Filter_"; - guidName += fullname; - gg->CreateGUID(guidName); - } } sg->SetGroupRegex(regex); diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 5dfdb148a..0be133543 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -178,7 +178,6 @@ cmVisualStudio10TargetGenerator(cmTarget* target, (cmLocalVisualStudio7Generator*) this->Makefile->GetLocalGenerator(); this->Name = this->Target->GetName(); - this->GlobalGenerator->CreateGUID(this->Name.c_str()); this->GUID = this->GlobalGenerator->GetGUID(this->Name.c_str()); this->Platform = gg->GetPlatformName(); this->NsightTegra = gg->IsNsightTegra(); @@ -1084,7 +1083,6 @@ void cmVisualStudio10TargetGenerator::WriteGroups() (*this->BuildFileStream) << name << "\">\n"; std::string guidName = "SG_Filter_"; guidName += name; - this->GlobalGenerator->CreateGUID(guidName.c_str()); this->WriteString("", 3); std::string guid = this->GlobalGenerator->GetGUID(guidName.c_str()); @@ -1099,7 +1097,6 @@ void cmVisualStudio10TargetGenerator::WriteGroups() { this->WriteString("\n", 2); std::string guidName = "SG_Filter_Object Libraries"; - this->GlobalGenerator->CreateGUID(guidName.c_str()); this->WriteString("", 3); std::string guid = this->GlobalGenerator->GetGUID(guidName.c_str()); @@ -1112,7 +1109,6 @@ void cmVisualStudio10TargetGenerator::WriteGroups() { this->WriteString("\n", 2); std::string guidName = "SG_Filter_Resource Files"; - this->GlobalGenerator->CreateGUID(guidName.c_str()); this->WriteString("", 3); std::string guid = this->GlobalGenerator->GetGUID(guidName.c_str()); From 6e570f857acd3322640db72112f2dc37b69396cf Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 1 Jun 2015 20:23:11 +0200 Subject: [PATCH 0019/1048] cmLocalGenerator: Remove 'optional' parameter from Convert. Port callers away from it. --- Source/cmGlobalVisualStudio8Generator.cxx | 8 +-- Source/cmLocalGenerator.cxx | 73 +++++++++++----------- Source/cmLocalGenerator.h | 3 +- Source/cmLocalVisualStudio6Generator.cxx | 7 +-- Source/cmLocalVisualStudio7Generator.cxx | 7 +-- Source/cmMakefileTargetGenerator.cxx | 5 +- Source/cmMakefileTargetGenerator.h | 5 +- Source/cmVisualStudio10TargetGenerator.cxx | 5 +- 8 files changed, 47 insertions(+), 66 deletions(-) diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index a3ebc6117..3102ebc1c 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -310,14 +310,10 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget() cmCustomCommandLine commandLine; commandLine.push_back(cmSystemTools::GetCMakeCommand()); std::string argH = "-H"; - argH += lg->Convert(mf->GetHomeDirectory(), - cmLocalGenerator::START_OUTPUT, - cmLocalGenerator::UNCHANGED, true); + argH += mf->GetHomeDirectory(); commandLine.push_back(argH); std::string argB = "-B"; - argB += lg->Convert(mf->GetHomeOutputDirectory(), - cmLocalGenerator::START_OUTPUT, - cmLocalGenerator::UNCHANGED, true); + argB += mf->GetHomeOutputDirectory(); commandLine.push_back(argB); commandLine.push_back("--check-stamp-list"); commandLine.push_back(stampList.c_str()); diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index f35de0327..c686ab1d8 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -517,7 +517,7 @@ void cmLocalGenerator::AddCustomCommandToCreateObject(const char* ofname, objectDir = this->Convert(objectDir,START_OUTPUT,SHELL); std::string objectFile = this->Convert(ofname,START_OUTPUT,SHELL); std::string sourceFile = - this->Convert(source.GetFullPath(),START_OUTPUT,SHELL,true); + this->ConvertToOutputFormat(source.GetFullPath(), SHELL); std::string varString = "CMAKE_"; varString += lang; varString += "_COMPILE_OBJECT"; @@ -1177,7 +1177,7 @@ cmLocalGenerator::ConvertToOutputForExistingCommon(const std::string& remote, std::string tmp; if(cmSystemTools::GetShortPath(remote, tmp)) { - return this->Convert(tmp, NONE, format, true); + return this->ConvertToOutputFormat(tmp, format); } } @@ -1191,8 +1191,10 @@ cmLocalGenerator::ConvertToOutputForExisting(const std::string& remote, RelativeRoot local, OutputFormat format) { + static_cast(local); + // Perform standard conversion. - std::string result = this->Convert(remote, local, format, true); + std::string result = this->ConvertToOutputFormat(remote, format); // Consider short-path. return this->ConvertToOutputForExistingCommon(remote, result, format); @@ -1311,8 +1313,7 @@ std::string cmLocalGenerator::GetIncludeFlags( { includeFlags << fwSearchFlag; } - includeFlags << this->Convert(frameworkDir, START_OUTPUT, - shellFormat, true) + includeFlags << this->ConvertToOutputFormat(frameworkDir, shellFormat) << " "; } continue; @@ -2686,42 +2687,39 @@ const char* cmLocalGenerator::GetRelativeRootPath(RelativeRoot relroot) //---------------------------------------------------------------------------- std::string cmLocalGenerator::Convert(const std::string& source, RelativeRoot relative, - OutputFormat output, - bool optional) + OutputFormat output) { // Convert the path to a relative path. std::string result = source; - if (!optional) + switch (relative) { - switch (relative) - { - case HOME: - //result = cmSystemTools::CollapseFullPath(result.c_str()); - result = this->ConvertToRelativePath( - this->GetState()->GetSourceDirectoryComponents(), result); - break; - case START: - //result = cmSystemTools::CollapseFullPath(result.c_str()); - result = this->ConvertToRelativePath( - this->StateSnapshot.GetCurrentSourceDirectoryComponents(), result); - break; - case HOME_OUTPUT: - //result = cmSystemTools::CollapseFullPath(result.c_str()); - result = this->ConvertToRelativePath( - this->GetState()->GetBinaryDirectoryComponents(), result); - break; - case START_OUTPUT: - //result = cmSystemTools::CollapseFullPath(result.c_str()); - result = this->ConvertToRelativePath( - this->StateSnapshot.GetCurrentBinaryDirectoryComponents(), result); - break; - case FULL: - result = cmSystemTools::CollapseFullPath(result); - break; - case NONE: - break; - } + case HOME: + //result = cmSystemTools::CollapseFullPath(result.c_str()); + result = this->ConvertToRelativePath( + this->GetState()->GetSourceDirectoryComponents(), result); + break; + case START: + //result = cmSystemTools::CollapseFullPath(result.c_str()); + result = this->ConvertToRelativePath( + this->StateSnapshot.GetCurrentSourceDirectoryComponents(), result); + break; + case HOME_OUTPUT: + //result = cmSystemTools::CollapseFullPath(result.c_str()); + result = this->ConvertToRelativePath( + this->GetState()->GetBinaryDirectoryComponents(), result); + break; + case START_OUTPUT: + //result = cmSystemTools::CollapseFullPath(result.c_str()); + result = this->ConvertToRelativePath( + this->StateSnapshot.GetCurrentBinaryDirectoryComponents(), result); + break; + case FULL: + result = cmSystemTools::CollapseFullPath(result); + break; + case NONE: + break; + } return this->ConvertToOutputFormat(result, output); } @@ -2765,8 +2763,7 @@ std::string cmLocalGenerator::ConvertToOutputFormat(const std::string& source, //---------------------------------------------------------------------------- std::string cmLocalGenerator::Convert(RelativeRoot remote, const std::string& local, - OutputFormat output, - bool optional) + OutputFormat output, bool optional) { const char* remotePath = this->GetRelativeRootPath(remote); diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 30b622e66..f02b5db4f 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -115,8 +115,7 @@ public: std::string ConvertToOutputFormat(const std::string& source, OutputFormat output); std::string Convert(const std::string& remote, RelativeRoot local, - OutputFormat output = UNCHANGED, - bool optional = false); + OutputFormat output = UNCHANGED); std::string Convert(RelativeRoot remote, const std::string& local, OutputFormat output = UNCHANGED, bool optional = false); diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index e5f9f550d..a26a1dd08 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -235,13 +235,10 @@ void cmLocalVisualStudio6Generator::AddDSPBuildRule(cmTarget& tgt) comment += makefileIn; std::string args; args = "-H"; - args += this->Convert(this->Makefile->GetHomeDirectory(), - START_OUTPUT, UNCHANGED, true); + args += this->Makefile->GetHomeDirectory(); commandLine.push_back(args); args = "-B"; - args += - this->Convert(this->Makefile->GetHomeOutputDirectory(), - START_OUTPUT, UNCHANGED, true); + args += this->Makefile->GetHomeOutputDirectory(); commandLine.push_back(args); std::vector const& listFiles = this->Makefile->GetListFiles(); diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index c56563267..717f33fc1 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -305,13 +305,10 @@ cmSourceFile* cmLocalVisualStudio7Generator::CreateVCProjBuildRule() comment += makefileIn; std::string args; args = "-H"; - args += this->Convert(this->Makefile->GetHomeDirectory(), - START_OUTPUT, UNCHANGED, true); + args += this->Makefile->GetHomeDirectory(); commandLine.push_back(args); args = "-B"; - args += - this->Convert(this->Makefile->GetHomeOutputDirectory(), - START_OUTPUT, UNCHANGED, true); + args += this->Makefile->GetHomeOutputDirectory(); commandLine.push_back(args); commandLine.push_back("--check-stamp-file"); std::string stampFilename = this->Convert(stampName.c_str(), FULL, diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index d422e28f7..9ac9ddb26 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -1589,9 +1589,8 @@ std::string cmMakefileTargetGenerator::GetFrameworkFlags(std::string const& l) if(emitted.insert(*i).second) { flags += fwSearchFlag; - flags += this->Convert(*i, - cmLocalGenerator::START_OUTPUT, - cmLocalGenerator::SHELL, true); + flags += this->LocalGenerator + ->ConvertToOutputFormat(*i, cmLocalGenerator::SHELL); flags += " "; } } diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h index 58044e80c..2e1b05261 100644 --- a/Source/cmMakefileTargetGenerator.h +++ b/Source/cmMakefileTargetGenerator.h @@ -273,10 +273,9 @@ protected: std::string Convert(const std::string& source, cmLocalGenerator::RelativeRoot relative, cmLocalGenerator::OutputFormat output = - cmLocalGenerator::UNCHANGED, - bool optional = false) + cmLocalGenerator::UNCHANGED) { - return this->LocalGenerator->Convert(source, relative, output, optional); + return this->LocalGenerator->Convert(source, relative, output); } }; diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 5dfdb148a..527524e27 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -923,10 +923,7 @@ cmVisualStudio10TargetGenerator::ConvertPath(std::string const& path, return forceRelative ? cmSystemTools::RelativePath( this->Makefile->GetCurrentBinaryDirectory(), path.c_str()) - : this->LocalGenerator->Convert(path.c_str(), - cmLocalGenerator::START_OUTPUT, - cmLocalGenerator::UNCHANGED, - /* optional = */ true); + : path.c_str(); } void cmVisualStudio10TargetGenerator::ConvertToWindowsSlash(std::string& s) From 363caa2fa540190ea394122fca3cb72d951823ad Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 30 May 2015 19:12:38 +0200 Subject: [PATCH 0020/1048] cmLocalGenerator: De-virtualize Configure(). The generators that override it do so in order to populate data members which can instead be populated in Generate(). --- Source/cmLocalGenerator.h | 2 +- Source/cmLocalNinjaGenerator.cxx | 28 ++++++++---------------- Source/cmLocalNinjaGenerator.h | 2 -- Source/cmLocalUnixMakefileGenerator3.cxx | 7 +----- Source/cmLocalUnixMakefileGenerator3.h | 6 ----- 5 files changed, 11 insertions(+), 34 deletions(-) diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index f02b5db4f..b63518044 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -50,7 +50,7 @@ public: * Process the CMakeLists files for this directory to fill in the * Makefile ivar */ - virtual void Configure(); + void Configure(); /** * Calls TraceVSDependencies() on all targets of this generator. diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index c08c91f12..427ae106c 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -41,6 +41,15 @@ cmLocalNinjaGenerator::~cmLocalNinjaGenerator() void cmLocalNinjaGenerator::Generate() { + // Compute the path to use when referencing the current output + // directory from the top output directory. + this->HomeRelativeOutputPath = + this->Convert(this->Makefile->GetCurrentBinaryDirectory(), HOME_OUTPUT); + if(this->HomeRelativeOutputPath == ".") + { + this->HomeRelativeOutputPath = ""; + } + this->SetConfigName(); this->WriteProcessedMakefile(this->GetBuildFileStream()); @@ -91,25 +100,6 @@ void cmLocalNinjaGenerator::Generate() this->WriteCustomCommandBuildStatements(); } -// Implemented in: -// cmLocalUnixMakefileGenerator3. -// Used in: -// Source/cmMakefile.cxx -// Source/cmGlobalGenerator.cxx -void cmLocalNinjaGenerator::Configure() -{ - // Compute the path to use when referencing the current output - // directory from the top output directory. - this->HomeRelativeOutputPath = - this->Convert(this->Makefile->GetCurrentBinaryDirectory(), HOME_OUTPUT); - if(this->HomeRelativeOutputPath == ".") - { - this->HomeRelativeOutputPath = ""; - } - this->cmLocalGenerator::Configure(); - -} - // TODO: Picked up from cmLocalUnixMakefileGenerator3. Refactor it. std::string cmLocalNinjaGenerator ::GetTargetDirectory(cmTarget const& target) const diff --git a/Source/cmLocalNinjaGenerator.h b/Source/cmLocalNinjaGenerator.h index 7ae97de35..ce966fff3 100644 --- a/Source/cmLocalNinjaGenerator.h +++ b/Source/cmLocalNinjaGenerator.h @@ -38,8 +38,6 @@ public: virtual void Generate(); - virtual void Configure(); - virtual std::string GetTargetDirectory(cmTarget const& target) const; const cmGlobalNinjaGenerator* GetGlobalNinjaGenerator() const; diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 3eea59b29..c9eea5665 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -98,7 +98,7 @@ cmLocalUnixMakefileGenerator3::~cmLocalUnixMakefileGenerator3() } //---------------------------------------------------------------------------- -void cmLocalUnixMakefileGenerator3::Configure() +void cmLocalUnixMakefileGenerator3::Generate() { // Compute the path to use when referencing the current output // directory from the top output directory. @@ -112,12 +112,7 @@ void cmLocalUnixMakefileGenerator3::Configure() { this->HomeRelativeOutputPath += "/"; } - this->cmLocalGenerator::Configure(); -} -//---------------------------------------------------------------------------- -void cmLocalUnixMakefileGenerator3::Generate() -{ // Store the configuration name that will be generated. if(const char* config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE")) { diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index 988d66046..f2a138993 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -39,12 +39,6 @@ public: cmState::Snapshot snapshot); virtual ~cmLocalUnixMakefileGenerator3(); - /** - * Process the CMakeLists files for this directory to fill in the - * Makefile ivar - */ - virtual void Configure(); - /** * Generate the makefile for this directory. */ From 27e11c6fea8e863b59c0fdfd63f1e9f2528dbac4 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 30 May 2015 19:26:32 +0200 Subject: [PATCH 0021/1048] Merge Configure state with GeneratingBuildSystem state. --- Source/cmGlobalGenerator.cxx | 1 - Source/cmLocalGenerator.cxx | 12 +++--------- Source/cmLocalGenerator.h | 3 --- Source/cmMakefile.cxx | 4 ++-- Source/cmMakefile.h | 6 +++--- Source/cmTarget.cxx | 12 ++++++------ 6 files changed, 14 insertions(+), 24 deletions(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index cd05c54c6..4fa7a61eb 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1280,7 +1280,6 @@ void cmGlobalGenerator::Generate() // Generate project files for (i = 0; i < this->LocalGenerators.size(); ++i) { - this->LocalGenerators[i]->GetMakefile()->SetGeneratingBuildSystem(); this->SetCurrentLocalGenerator(this->LocalGenerators[i]); this->LocalGenerators[i]->Generate(); if(!this->LocalGenerators[i]->GetMakefile()->IsOn( diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index c686ab1d8..6bebaa74e 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -59,7 +59,6 @@ cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg, this->Makefile = new cmMakefile(this); this->LinkScriptShell = false; - this->Configured = false; this->EmitUniversalBinaryFlags = true; this->BackwardsCompatibility = 0; this->BackwardsCompatibilityFinal = false; @@ -128,7 +127,7 @@ void cmLocalGenerator::Configure() std::vector::iterator sdi = subdirs.begin(); for (; sdi != subdirs.end(); ++sdi) { - if (!(*sdi)->Configured) + if (!(*sdi)->GetMakefile()->IsConfigured()) { this->Makefile->ConfigureSubDirectory(*sdi); } @@ -138,7 +137,7 @@ void cmLocalGenerator::Configure() this->ComputeObjectMaxPath(); - this->Configured = true; + this->Makefile->SetConfigured(); } //---------------------------------------------------------------------------- @@ -3179,11 +3178,6 @@ bool cmLocalGenerator::IsNMake() const return this->GetState()->UseNMake(); } -void cmLocalGenerator::SetConfiguredCMP0014(bool configured) -{ - this->Configured = configured; -} - //---------------------------------------------------------------------------- std::string cmLocalGenerator @@ -3465,7 +3459,7 @@ cmIML_INT_uint64_t cmLocalGenerator::GetBackwardsCompatibility() } } this->BackwardsCompatibility = CMake_VERSION_ENCODE(major, minor, patch); - this->BackwardsCompatibilityFinal = this->Configured; + this->BackwardsCompatibilityFinal = this->Makefile->IsConfigured(); } return this->BackwardsCompatibility; diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index b63518044..8a1649e1e 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -383,8 +383,6 @@ public: bool IsMinGWMake() const; bool IsNMake() const; - void SetConfiguredCMP0014(bool configured); - protected: ///! put all the libraries for a target on into the given stream void OutputLinkLibraries(std::string& linkLibraries, @@ -451,7 +449,6 @@ protected: std::set WarnCMP0063; bool LinkScriptShell; - bool Configured; bool EmitUniversalBinaryFlags; // Hack for ExpandRuleVariable until object-oriented version is diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 7c74a0fd4..d537f34b6 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -146,7 +146,7 @@ cmMakefile::cmMakefile(cmLocalGenerator* localGenerator) this->WarnUnused = this->GetCMakeInstance()->GetWarnUnused(); this->CheckSystemVars = this->GetCMakeInstance()->GetCheckSystemVars(); - this->GeneratingBuildSystem = false; + this->Configured = false; this->SuppressWatches = false; // Setup the default include file regular expression (match everything). @@ -1594,7 +1594,7 @@ void cmMakefile::ConfigureSubDirectory(cmLocalGenerator *lg2) // NEW behavior prints the error. this->IssueMessage(cmake::FATAL_ERROR, e.str()); } - lg2->SetConfiguredCMP0014(true); + lg2->GetMakefile()->SetConfigured(); return; } // finally configure the subdir diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index efd73a1cd..a45d8374c 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -781,8 +781,8 @@ public: return this->CompileDefinitionsEntries; } - bool IsGeneratingBuildSystem() const { return this->GeneratingBuildSystem; } - void SetGeneratingBuildSystem(){ this->GeneratingBuildSystem = true; } + bool IsConfigured() const { return this->Configured; } + void SetConfigured(){ this->Configured = true; } void AddQtUiFileWithOptions(cmSourceFile *sf); std::vector GetQtUiFilesWithOptions() const; @@ -994,7 +994,7 @@ private: long line, bool removeEmpty, bool replaceAt) const; - bool GeneratingBuildSystem; + bool Configured; /** * Old version of GetSourceFileWithOutput(const std::string&) kept for * backward-compatibility. It implements a linear search and support diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 70005b4fa..1d1dcede9 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -764,7 +764,7 @@ void cmTarget::GetSourceFiles(std::vector &files, "SOURCES") != debugProperties.end(); - if (this->Makefile->IsGeneratingBuildSystem()) + if (this->Makefile->IsConfigured()) { this->DebugSourcesDone = true; } @@ -2106,7 +2106,7 @@ cmTarget::GetIncludeDirectories(const std::string& config, "INCLUDE_DIRECTORIES") != debugProperties.end(); - if (this->Makefile->IsGeneratingBuildSystem()) + if (this->Makefile->IsConfigured()) { this->DebugIncludesDone = true; } @@ -2277,7 +2277,7 @@ void cmTarget::GetCompileOptions(std::vector &result, "COMPILE_OPTIONS") != debugProperties.end(); - if (this->Makefile->IsGeneratingBuildSystem()) + if (this->Makefile->IsConfigured()) { this->DebugCompileOptionsDone = true; } @@ -2348,7 +2348,7 @@ void cmTarget::GetCompileDefinitions(std::vector &list, "COMPILE_DEFINITIONS") != debugProperties.end(); - if (this->Makefile->IsGeneratingBuildSystem()) + if (this->Makefile->IsConfigured()) { this->DebugCompileDefinitionsDone = true; } @@ -2449,7 +2449,7 @@ void cmTarget::GetCompileFeatures(std::vector &result, "COMPILE_FEATURES") != debugProperties.end(); - if (this->Makefile->IsGeneratingBuildSystem()) + if (this->Makefile->IsConfigured()) { this->DebugCompileFeaturesDone = true; } @@ -4857,7 +4857,7 @@ cmTarget::ReportPropertyOrigin(const std::string &p, p) != debugProperties.end(); - if (this->Makefile->IsGeneratingBuildSystem()) + if (this->Makefile->IsConfigured()) { this->DebugCompatiblePropertiesDone[p] = true; } From 0863797037b82f01cb356cb2cd4cdcef7ca8ae48 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 30 May 2015 19:34:09 +0200 Subject: [PATCH 0022/1048] cmLocalGenerator: ComputeObjectMaxPath just before generating. --- Source/cmGlobalGenerator.cxx | 1 + Source/cmLocalGenerator.cxx | 2 -- Source/cmLocalGenerator.h | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 4fa7a61eb..d1842c1aa 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1223,6 +1223,7 @@ void cmGlobalGenerator::Generate() this->CreateDefaultGlobalTargets(&globalTargets); for (i = 0; i < this->LocalGenerators.size(); ++i) { + this->LocalGenerators[i]->ComputeObjectMaxPath(); cmMakefile* mf = this->LocalGenerators[i]->GetMakefile(); cmTargets* targets = &(mf->GetTargets()); cmTargets::iterator tit; diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 6bebaa74e..8931e6f46 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -135,8 +135,6 @@ void cmLocalGenerator::Configure() this->Makefile->AddCMakeDependFilesFromUser(); - this->ComputeObjectMaxPath(); - this->Makefile->SetConfigured(); } diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 8a1649e1e..c972e8f5b 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -383,6 +383,7 @@ public: bool IsMinGWMake() const; bool IsNMake() const; + void ComputeObjectMaxPath(); protected: ///! put all the libraries for a target on into the given stream void OutputLinkLibraries(std::string& linkLibraries, @@ -428,7 +429,6 @@ protected: std::string& CreateSafeUniqueObjectFileName(const std::string& sin, std::string const& dir_max); - void ComputeObjectMaxPath(); virtual std::string ConvertToLinkReference(std::string const& lib, OutputFormat format = SHELL); From 69a038a9e90a8839b69f4cb8826688be611e8b0d Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 30 May 2015 19:39:08 +0200 Subject: [PATCH 0023/1048] cmMakefile: Refactor directories specified with the subdirs command. Store the directories on the cmMakefile as explicitly not-configured-yet. --- Source/cmLocalGenerator.cxx | 11 ++++------- Source/cmMakefile.cxx | 13 +++++++++++++ Source/cmMakefile.h | 7 +++++++ 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 8931e6f46..58366d1a9 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -119,18 +119,15 @@ void cmLocalGenerator::Configure() assert(cmSystemTools::FileExists(currentStart.c_str(), true)); this->Makefile->ProcessBuildsystemFile(currentStart.c_str()); - // at the end of the ReadListFile handle any old style subdirs - // first get all the subdirectories - std::vector subdirs = this->GetChildren(); + // at the end handle any old style subdirs + std::vector subdirs = + this->GetMakefile()->GetUnConfiguredDirectories(); // for each subdir recurse std::vector::iterator sdi = subdirs.begin(); for (; sdi != subdirs.end(); ++sdi) { - if (!(*sdi)->GetMakefile()->IsConfigured()) - { - this->Makefile->ConfigureSubDirectory(*sdi); - } + this->Makefile->ConfigureSubDirectory(*sdi); } this->Makefile->AddCMakeDependFilesFromUser(); diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index d537f34b6..ffc6bf975 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1599,6 +1599,15 @@ void cmMakefile::ConfigureSubDirectory(cmLocalGenerator *lg2) } // finally configure the subdir lg2->Configure(); + + // at the end handle any old style subdirs + for (std::vector::iterator sdi = + this->UnConfiguredDirectories.begin(); + sdi != this->UnConfiguredDirectories.end(); ++sdi) + { + this->ConfigureSubDirectory(*sdi); + } + if (this->GetCMakeInstance()->GetDebugOutput()) { std::string msg=" Returning to "; @@ -1638,6 +1647,10 @@ void cmMakefile::AddSubDirectory(const std::string& srcPath, { this->ConfigureSubDirectory(lg2); } + else + { + this->UnConfiguredDirectories.push_back(lg2); + } } void cmMakefile::SetCurrentSourceDirectory(const std::string& dir) diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index a45d8374c..509f5c8ae 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -262,6 +262,11 @@ public: this->LinkDirectories = vec; } + std::vector GetUnConfiguredDirectories() const + { + return this->UnConfiguredDirectories; + } + /** * Add a subdirectory to the build. */ @@ -920,6 +925,8 @@ private: mutable cmsys::RegularExpression cmAtVarRegex; mutable cmsys::RegularExpression cmNamedCurly; + std::vector UnConfiguredDirectories; + cmPropertyMap Properties; // Unused variable flags From a653611db0d6e23456c5ef90f95e19ea5d70a428 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 30 May 2015 23:50:28 +0200 Subject: [PATCH 0024/1048] cmake: Replace CurrentLocalGenerator concept with CurrentMakefile. --- Source/cmGlobalGenerator.cxx | 6 +++--- Source/cmGlobalGenerator.h | 12 +++++++----- Source/cmLocalGenerator.cxx | 17 +++++++++-------- Source/cmQtAutoGenerators.cxx | 2 +- Source/cmakemain.cxx | 7 +------ 5 files changed, 21 insertions(+), 23 deletions(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index d1842c1aa..1ee550069 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -70,7 +70,7 @@ cmGlobalGenerator::cmGlobalGenerator(cmake* cm) this->TryCompileTimeout = 0; this->ExtraGenerator = 0; - this->CurrentLocalGenerator = 0; + this->CurrentMakefile = 0; this->TryCompileOuterMakefile = 0; } @@ -1281,7 +1281,7 @@ void cmGlobalGenerator::Generate() // Generate project files for (i = 0; i < this->LocalGenerators.size(); ++i) { - this->SetCurrentLocalGenerator(this->LocalGenerators[i]); + this->SetCurrentMakefile(this->LocalGenerators[i]->GetMakefile()); this->LocalGenerators[i]->Generate(); if(!this->LocalGenerators[i]->GetMakefile()->IsOn( "CMAKE_SKIP_INSTALL_RULES")) @@ -1293,7 +1293,7 @@ void cmGlobalGenerator::Generate() (static_cast(i)+1.0f)/ static_cast(this->LocalGenerators.size())); } - this->SetCurrentLocalGenerator(0); + this->SetCurrentMakefile(0); if(!this->GenerateCPackPropertiesFile()) { diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 979e97103..d2b850432 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -168,11 +168,13 @@ public: const std::vector& GetLocalGenerators() const { return this->LocalGenerators;} - cmLocalGenerator* GetCurrentLocalGenerator() - {return this->CurrentLocalGenerator;} + cmMakefile* GetCurrentMakefile() const + { + return this->CurrentMakefile; + } - void SetCurrentLocalGenerator(cmLocalGenerator* lg) - {this->CurrentLocalGenerator = lg;} + void SetCurrentMakefile(cmMakefile* mf) + {this->CurrentMakefile = mf;} void AddLocalGenerator(cmLocalGenerator *lg); @@ -406,7 +408,7 @@ protected: std::string ConfiguredFilesPath; cmake *CMakeInstance; std::vector LocalGenerators; - cmLocalGenerator* CurrentLocalGenerator; + cmMakefile* CurrentMakefile; // map from project name to vector of local generators in that project std::map > ProjectMap; std::map > diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 58366d1a9..4b9415b95 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -78,16 +78,17 @@ bool cmLocalGenerator::IsRootMakefile() const class cmLocalGeneratorCurrent { cmGlobalGenerator* GG; - cmLocalGenerator* LG; + cmMakefile* MF; cmState::Snapshot Snapshot; public: - cmLocalGeneratorCurrent(cmLocalGenerator* lg) + cmLocalGeneratorCurrent(cmMakefile* mf) { - this->GG = lg->GetGlobalGenerator(); - this->LG = this->GG->GetCurrentLocalGenerator(); + this->GG = mf->GetGlobalGenerator(); + this->MF = this->GG->GetCurrentMakefile(); this->Snapshot = this->GG->GetCMakeInstance()->GetCurrentSnapshot(); - this->GG->GetCMakeInstance()->SetCurrentSnapshot(lg->GetStateSnapshot()); - this->GG->SetCurrentLocalGenerator(lg); + this->GG->GetCMakeInstance()->SetCurrentSnapshot( + this->GG->GetCMakeInstance()->GetCurrentSnapshot()); + this->GG->SetCurrentMakefile(mf); #if defined(CMAKE_BUILD_WITH_CMAKE) this->GG->GetFileLockPool().PushFileScope(); #endif @@ -97,7 +98,7 @@ public: #if defined(CMAKE_BUILD_WITH_CMAKE) this->GG->GetFileLockPool().PopFileScope(); #endif - this->GG->SetCurrentLocalGenerator(this->LG); + this->GG->SetCurrentMakefile(this->MF); this->GG->GetCMakeInstance()->SetCurrentSnapshot(this->Snapshot); } }; @@ -106,7 +107,7 @@ public: void cmLocalGenerator::Configure() { // Manage the global generator's current local generator. - cmLocalGeneratorCurrent clg(this); + cmLocalGeneratorCurrent clg(this->GetMakefile()); static_cast(clg); // make sure the CMakeFiles dir is there diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index cbb06cde3..fbd294690 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -1215,7 +1215,7 @@ bool cmQtAutoGenerators::Run(const std::string& targetDirectory, cmLocalGenerator* lg = gg.MakeLocalGenerator(); lg->GetMakefile()->SetCurrentBinaryDirectory(targetDirectory); lg->GetMakefile()->SetCurrentSourceDirectory(targetDirectory); - gg.SetCurrentLocalGenerator(lg); + gg.SetCurrentMakefile(lg->GetMakefile()); this->ReadAutogenInfoFile(lg->GetMakefile(), targetDirectory, config); this->ReadOldMocDefinitionsFile(lg->GetMakefile(), targetDirectory); diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index e5f4700b7..cc3073251 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -113,12 +113,7 @@ static cmMakefile* cmakemainGetMakefile(void *clientdata) cmGlobalGenerator* gg=cm->GetGlobalGenerator(); if (gg) { - cmLocalGenerator* lg=gg->GetCurrentLocalGenerator(); - if (lg) - { - cmMakefile* mf = lg->GetMakefile(); - return mf; - } + return gg->GetCurrentMakefile(); } } return 0; From f059ed165bafff94f9bcd3823e12a8ce1f5ec647 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 30 May 2015 19:50:58 +0200 Subject: [PATCH 0025/1048] cmMakefile: Move Configure responsibility from cmLocalGenerator. The generator should only have a function at generate time. --- Source/cmGlobalGenerator.cxx | 2 +- Source/cmLocalGenerator.cxx | 62 -------------------------------- Source/cmLocalGenerator.h | 6 ---- Source/cmMakefile.cxx | 68 +++++++++++++++++++++++++++++++----- Source/cmMakefile.h | 7 ++-- 5 files changed, 62 insertions(+), 83 deletions(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 1ee550069..1d11475ec 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1106,7 +1106,7 @@ void cmGlobalGenerator::Configure() this->CMakeInstance->GetHomeOutputDirectory()); // now do it - lg->Configure(); + lg->GetMakefile()->Configure(); // update the cache entry for the number of local generators, this is used // for progress diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 4b9415b95..8fcc2ecd3 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -74,68 +74,6 @@ bool cmLocalGenerator::IsRootMakefile() const return !this->StateSnapshot.GetParent().IsValid(); } -//---------------------------------------------------------------------------- -class cmLocalGeneratorCurrent -{ - cmGlobalGenerator* GG; - cmMakefile* MF; - cmState::Snapshot Snapshot; -public: - cmLocalGeneratorCurrent(cmMakefile* mf) - { - this->GG = mf->GetGlobalGenerator(); - this->MF = this->GG->GetCurrentMakefile(); - this->Snapshot = this->GG->GetCMakeInstance()->GetCurrentSnapshot(); - this->GG->GetCMakeInstance()->SetCurrentSnapshot( - this->GG->GetCMakeInstance()->GetCurrentSnapshot()); - this->GG->SetCurrentMakefile(mf); -#if defined(CMAKE_BUILD_WITH_CMAKE) - this->GG->GetFileLockPool().PushFileScope(); -#endif - } - ~cmLocalGeneratorCurrent() - { -#if defined(CMAKE_BUILD_WITH_CMAKE) - this->GG->GetFileLockPool().PopFileScope(); -#endif - this->GG->SetCurrentMakefile(this->MF); - this->GG->GetCMakeInstance()->SetCurrentSnapshot(this->Snapshot); - } -}; - -//---------------------------------------------------------------------------- -void cmLocalGenerator::Configure() -{ - // Manage the global generator's current local generator. - cmLocalGeneratorCurrent clg(this->GetMakefile()); - static_cast(clg); - - // make sure the CMakeFiles dir is there - std::string filesDir = this->StateSnapshot.GetCurrentBinaryDirectory(); - filesDir += cmake::GetCMakeFilesDirectory(); - cmSystemTools::MakeDirectory(filesDir.c_str()); - - std::string currentStart = this->StateSnapshot.GetCurrentSourceDirectory(); - currentStart += "/CMakeLists.txt"; - assert(cmSystemTools::FileExists(currentStart.c_str(), true)); - this->Makefile->ProcessBuildsystemFile(currentStart.c_str()); - - // at the end handle any old style subdirs - std::vector subdirs = - this->GetMakefile()->GetUnConfiguredDirectories(); - - // for each subdir recurse - std::vector::iterator sdi = subdirs.begin(); - for (; sdi != subdirs.end(); ++sdi) - { - this->Makefile->ConfigureSubDirectory(*sdi); - } - - this->Makefile->AddCMakeDependFilesFromUser(); - - this->Makefile->SetConfigured(); -} - //---------------------------------------------------------------------------- void cmLocalGenerator::ComputeObjectMaxPath() { diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index c972e8f5b..1359dd6ba 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -46,12 +46,6 @@ public: */ virtual void Generate() {} - /** - * Process the CMakeLists files for this directory to fill in the - * Makefile ivar - */ - void Configure(); - /** * Calls TraceVSDependencies() on all targets of this generator. */ diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index ffc6bf975..05e80d7dd 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1553,6 +1553,64 @@ void cmMakefile::InitializeFromParent() this->ImportedTargets = parent->ImportedTargets; } +//---------------------------------------------------------------------------- +class cmMakefileCurrent +{ + cmGlobalGenerator* GG; + cmMakefile* MF; + cmState::Snapshot Snapshot; +public: + cmMakefileCurrent(cmMakefile* mf) + { + this->GG = mf->GetGlobalGenerator(); + this->MF = this->GG->GetCurrentMakefile(); + this->Snapshot = this->GG->GetCMakeInstance()->GetCurrentSnapshot(); + this->GG->GetCMakeInstance()->SetCurrentSnapshot( + this->GG->GetCMakeInstance()->GetCurrentSnapshot()); + this->GG->SetCurrentMakefile(mf); +#if defined(CMAKE_BUILD_WITH_CMAKE) + this->GG->GetFileLockPool().PushFileScope(); +#endif + } + ~cmMakefileCurrent() + { +#if defined(CMAKE_BUILD_WITH_CMAKE) + this->GG->GetFileLockPool().PopFileScope(); +#endif + this->GG->SetCurrentMakefile(this->MF); + this->GG->GetCMakeInstance()->SetCurrentSnapshot(this->Snapshot); + } +}; + +//---------------------------------------------------------------------------- +void cmMakefile::Configure() +{ + cmMakefileCurrent cmf(this); + + // make sure the CMakeFiles dir is there + std::string filesDir = this->StateSnapshot.GetCurrentBinaryDirectory(); + filesDir += cmake::GetCMakeFilesDirectory(); + cmSystemTools::MakeDirectory(filesDir.c_str()); + + std::string currentStart = this->StateSnapshot.GetCurrentSourceDirectory(); + currentStart += "/CMakeLists.txt"; + assert(cmSystemTools::FileExists(currentStart.c_str(), true)); + this->ProcessBuildsystemFile(currentStart.c_str()); + + // at the end handle any old style subdirs + std::vector subdirs = this->UnConfiguredDirectories; + + // for each subdir recurse + std::vector::iterator sdi = subdirs.begin(); + for (; sdi != subdirs.end(); ++sdi) + { + this->ConfigureSubDirectory(*sdi); + } + + this->AddCMakeDependFilesFromUser(); + this->SetConfigured(); +} + void cmMakefile::ConfigureSubDirectory(cmLocalGenerator *lg2) { lg2->GetMakefile()->InitializeFromParent(); @@ -1598,15 +1656,7 @@ void cmMakefile::ConfigureSubDirectory(cmLocalGenerator *lg2) return; } // finally configure the subdir - lg2->Configure(); - - // at the end handle any old style subdirs - for (std::vector::iterator sdi = - this->UnConfiguredDirectories.begin(); - sdi != this->UnConfiguredDirectories.end(); ++sdi) - { - this->ConfigureSubDirectory(*sdi); - } + lg2->GetMakefile()->Configure(); if (this->GetCMakeInstance()->GetDebugOutput()) { diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 509f5c8ae..e36df36fe 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -262,11 +262,6 @@ public: this->LinkDirectories = vec; } - std::vector GetUnConfiguredDirectories() const - { - return this->UnConfiguredDirectories; - } - /** * Add a subdirectory to the build. */ @@ -275,6 +270,8 @@ public: bool excludeFromAll, bool immediate); + void Configure(); + /** * Configure a subdirectory */ From d65e01235da2473e669d6e5c40988ad4015f0dc4 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 30 May 2015 19:53:02 +0200 Subject: [PATCH 0026/1048] cmMakefile: Implement ConfigureSubDirectory in terms of cmMakefile. --- Source/cmMakefile.cxx | 14 +++++++------- Source/cmMakefile.h | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 05e80d7dd..4079ccff1 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1604,17 +1604,17 @@ void cmMakefile::Configure() std::vector::iterator sdi = subdirs.begin(); for (; sdi != subdirs.end(); ++sdi) { - this->ConfigureSubDirectory(*sdi); + this->ConfigureSubDirectory((*sdi)->GetMakefile()); } this->AddCMakeDependFilesFromUser(); this->SetConfigured(); } -void cmMakefile::ConfigureSubDirectory(cmLocalGenerator *lg2) +void cmMakefile::ConfigureSubDirectory(cmMakefile *mf) { - lg2->GetMakefile()->InitializeFromParent(); - std::string currentStart = lg2->GetMakefile()->GetCurrentSourceDirectory(); + mf->InitializeFromParent(); + std::string currentStart = mf->GetCurrentSourceDirectory(); if (this->GetCMakeInstance()->GetDebugOutput()) { std::string msg=" Entering "; @@ -1652,11 +1652,11 @@ void cmMakefile::ConfigureSubDirectory(cmLocalGenerator *lg2) // NEW behavior prints the error. this->IssueMessage(cmake::FATAL_ERROR, e.str()); } - lg2->GetMakefile()->SetConfigured(); + mf->SetConfigured(); return; } // finally configure the subdir - lg2->GetMakefile()->Configure(); + mf->Configure(); if (this->GetCMakeInstance()->GetDebugOutput()) { @@ -1695,7 +1695,7 @@ void cmMakefile::AddSubDirectory(const std::string& srcPath, if (immediate) { - this->ConfigureSubDirectory(lg2); + this->ConfigureSubDirectory(lg2->GetMakefile()); } else { diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index e36df36fe..58077077e 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -275,7 +275,7 @@ public: /** * Configure a subdirectory */ - void ConfigureSubDirectory(cmLocalGenerator *); + void ConfigureSubDirectory(cmMakefile* mf); /** * Add an include directory to the build. From 4e8f242d170ab46d4071254a3a81f7db264b8bc7 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 3 Jun 2015 00:55:00 +0200 Subject: [PATCH 0027/1048] cmMakefile: Store unconfigured cmMakefiles. Not cmLocalGenerators. --- Source/cmMakefile.cxx | 8 ++++---- Source/cmMakefile.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 4079ccff1..ae9fe326b 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1598,13 +1598,13 @@ void cmMakefile::Configure() this->ProcessBuildsystemFile(currentStart.c_str()); // at the end handle any old style subdirs - std::vector subdirs = this->UnConfiguredDirectories; + std::vector subdirs = this->UnConfiguredDirectories; // for each subdir recurse - std::vector::iterator sdi = subdirs.begin(); + std::vector::iterator sdi = subdirs.begin(); for (; sdi != subdirs.end(); ++sdi) { - this->ConfigureSubDirectory((*sdi)->GetMakefile()); + this->ConfigureSubDirectory(*sdi); } this->AddCMakeDependFilesFromUser(); @@ -1699,7 +1699,7 @@ void cmMakefile::AddSubDirectory(const std::string& srcPath, } else { - this->UnConfiguredDirectories.push_back(lg2); + this->UnConfiguredDirectories.push_back(lg2->GetMakefile()); } } diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 58077077e..4174f4444 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -922,7 +922,7 @@ private: mutable cmsys::RegularExpression cmAtVarRegex; mutable cmsys::RegularExpression cmNamedCurly; - std::vector UnConfiguredDirectories; + std::vector UnConfiguredDirectories; cmPropertyMap Properties; From 7657e8b1df64ed3b5429be34416e8756b659d525 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 3 Jun 2015 00:57:31 +0200 Subject: [PATCH 0028/1048] cmMakefile: Introduce a local cmMakefile variable. --- Source/cmMakefile.cxx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index ae9fe326b..7e103bc98 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1685,21 +1685,23 @@ void cmMakefile::AddSubDirectory(const std::string& srcPath, ->MakeLocalGenerator(newSnapshot, this->LocalGenerator); this->GetGlobalGenerator()->AddLocalGenerator(lg2); + cmMakefile* subMf = lg2->GetMakefile(); + // set the subdirs start dirs - lg2->GetMakefile()->SetCurrentSourceDirectory(srcPath); - lg2->GetMakefile()->SetCurrentBinaryDirectory(binPath); + subMf->SetCurrentSourceDirectory(srcPath); + subMf->SetCurrentBinaryDirectory(binPath); if(excludeFromAll) { - lg2->GetMakefile()->SetProperty("EXCLUDE_FROM_ALL", "TRUE"); + subMf->SetProperty("EXCLUDE_FROM_ALL", "TRUE"); } if (immediate) { - this->ConfigureSubDirectory(lg2->GetMakefile()); + this->ConfigureSubDirectory(subMf); } else { - this->UnConfiguredDirectories.push_back(lg2->GetMakefile()); + this->UnConfiguredDirectories.push_back(subMf); } } From 6cafd8ed0bc8458ba2c6eb0e792c894cf4f37f90 Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Wed, 3 Jun 2015 14:25:01 -0400 Subject: [PATCH 0029/1048] KWSys 2015-06-03 (8533a79b) Extract upstream KWSys using the following shell commands. $ git archive --prefix=upstream-kwsys/ 8533a79b | tar x $ git shortlog --no-merges --abbrev=8 --format='%h %s' 61e0419f..8533a79b Zack Galbreath (1): 8533a79b SystemInformation: Add GetLoadAverage() method --- CMakeLists.txt | 9 ++++ SystemInformation.cxx | 98 +++++++++++++++++++++++++++++++++++++++ SystemInformation.hxx.in | 4 ++ kwsysPlatformTestsCXX.cxx | 13 ++++++ testSystemInformation.cxx | 1 + 5 files changed, 125 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index c88e8880f..7eb678bc4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -786,6 +786,15 @@ IF(KWSYS_USE_SystemInformation) SET_PROPERTY(SOURCE SystemInformation.cxx APPEND PROPERTY COMPILE_DEFINITIONS KWSYS_BUILD_SHARED=1) ENDIF() + + IF(UNIX AND NOT CYGWIN) + KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_GETLOADAVG + "Checking whether CXX compiler has getloadavg" DIRECT) + IF(KWSYS_CXX_HAS_GETLOADAVG) + SET_PROPERTY(SOURCE SystemInformation.cxx APPEND PROPERTY + COMPILE_DEFINITIONS KWSYS_CXX_HAS_GETLOADAVG=1) + ENDIF() + ENDIF() ENDIF() #----------------------------------------------------------------------------- diff --git a/SystemInformation.cxx b/SystemInformation.cxx index b0434f49a..6e81b0b8f 100644 --- a/SystemInformation.cxx +++ b/SystemInformation.cxx @@ -81,6 +81,11 @@ typedef int siginfo_t; # include // extern int errno; #endif +#if defined (__CYGWIN__) && !defined(_WIN32) +# include +# undef _WIN32 +#endif + #ifdef __FreeBSD__ # include # include @@ -366,6 +371,8 @@ public: const char *procLimitEnvVarName); LongLong GetProcMemoryUsed(); + double GetLoadAverage(); + // enable/disable stack trace signal handler. static void SetStackTraceOnError(int enable); @@ -820,6 +827,11 @@ SystemInformation::LongLong SystemInformation::GetProcMemoryUsed() return this->Implementation->GetProcMemoryUsed(); } +double SystemInformation::GetLoadAverage() +{ + return this->Implementation->GetLoadAverage(); +} + SystemInformation::LongLong SystemInformation::GetProcessId() { return this->Implementation->GetProcessId(); @@ -1490,6 +1502,60 @@ void SymbolProperties::Initialize(void *address) } #endif // don't define this class if we're not using it +// -------------------------------------------------------------------------- +#if defined(_WIN32) || defined(__CYGWIN__) +# define KWSYS_SYSTEMINFORMATION_USE_GetSystemTimes +#endif +#if defined(_MSC_VER) && _MSC_VER < 1310 +# undef KWSYS_SYSTEMINFORMATION_USE_GetSystemTimes +#endif +#if defined(KWSYS_SYSTEMINFORMATION_USE_GetSystemTimes) +double calculateCPULoad(unsigned __int64 idleTicks, + unsigned __int64 totalTicks) +{ + static double previousLoad = -0.0; + static unsigned __int64 previousIdleTicks = 0; + static unsigned __int64 previousTotalTicks = 0; + + unsigned __int64 const idleTicksSinceLastTime = + idleTicks - previousIdleTicks; + unsigned __int64 const totalTicksSinceLastTime = + totalTicks - previousTotalTicks; + + double load; + if (previousTotalTicks == 0 || totalTicksSinceLastTime == 0) + { + // No new information. Use previous result. + load = previousLoad; + } + else + { + // Calculate load since last time. + load = 1.0 - double(idleTicksSinceLastTime) / totalTicksSinceLastTime; + + // Smooth if possible. + if (previousLoad > 0) + { + load = 0.25 * load + 0.75 * previousLoad; + } + } + + previousLoad = load; + previousIdleTicks = idleTicks; + previousTotalTicks = totalTicks; + + return load; +} + +unsigned __int64 fileTimeToUInt64(FILETIME const& ft) +{ + LARGE_INTEGER out; + out.HighPart = ft.dwHighDateTime; + out.LowPart = ft.dwLowDateTime; + return out.QuadPart; +} +#endif + } // anonymous namespace @@ -3612,6 +3678,38 @@ SystemInformationImplementation::GetProcMemoryUsed() #endif } +double SystemInformationImplementation::GetLoadAverage() +{ +#if defined(KWSYS_CXX_HAS_GETLOADAVG) + double loadavg[3] = { 0.0, 0.0, 0.0 }; + if (getloadavg(loadavg, 3) > 0) + { + return loadavg[0]; + } + return -0.0; +#elif defined(KWSYS_SYSTEMINFORMATION_USE_GetSystemTimes) + // Old windows.h headers do not provide GetSystemTimes. + typedef BOOL (WINAPI *GetSystemTimesType)(LPFILETIME, LPFILETIME, + LPFILETIME); + static GetSystemTimesType pGetSystemTimes = + (GetSystemTimesType)GetProcAddress(GetModuleHandleW(L"kernel32"), + "GetSystemTimes"); + FILETIME idleTime, kernelTime, userTime; + if (pGetSystemTimes && pGetSystemTimes(&idleTime, &kernelTime, &userTime)) + { + unsigned __int64 const idleTicks = + fileTimeToUInt64(idleTime); + unsigned __int64 const totalTicks = + fileTimeToUInt64(kernelTime) + fileTimeToUInt64(userTime); + return calculateCPULoad(idleTicks, totalTicks) * GetNumberOfPhysicalCPU(); + } + return -0.0; +#else + // Not implemented on this platform. + return -0.0; +#endif +} + /** Get the process id of the running process. */ diff --git a/SystemInformation.hxx.in b/SystemInformation.hxx.in index a9fd05def..4acdc4f0a 100644 --- a/SystemInformation.hxx.in +++ b/SystemInformation.hxx.in @@ -130,6 +130,10 @@ public: // Get system RAM used by this process id in units of KiB. LongLong GetProcMemoryUsed(); + // Return the load average of the machine or -0.0 if it cannot + // be determined. + double GetLoadAverage(); + // enable/disable stack trace signal handler. In order to // produce an informative stack trace the application should // be dynamically linked and compiled with debug symbols. diff --git a/kwsysPlatformTestsCXX.cxx b/kwsysPlatformTestsCXX.cxx index 82620dadf..1596fe466 100644 --- a/kwsysPlatformTestsCXX.cxx +++ b/kwsysPlatformTestsCXX.cxx @@ -452,6 +452,19 @@ int main() } #endif +#ifdef TEST_KWSYS_CXX_HAS_GETLOADAVG +// Match feature definitions from SystemInformation.cxx +#if (defined(__GNUC__) || defined(__PGI)) && !defined(_GNU_SOURCE) +# define _GNU_SOURCE +#endif +#include +int main() +{ + double loadavg[3] = { 0.0, 0.0, 0.0 }; + return getloadavg(loadavg, 3); +} +#endif + #ifdef TEST_KWSYS_CXX_HAS_RLIMIT64 # if defined(KWSYS_HAS_LFS) # define _LARGEFILE_SOURCE diff --git a/testSystemInformation.cxx b/testSystemInformation.cxx index 53d51ac40..fc8ea55d8 100644 --- a/testSystemInformation.cxx +++ b/testSystemInformation.cxx @@ -87,6 +87,7 @@ int testSystemInformation(int, char*[]) printMethod3(info, GetProcMemoryAvailable("KWSHL","KWSPL"), "KiB"); printMethod3(info, GetHostMemoryUsed(), "KiB"); printMethod3(info, GetProcMemoryUsed(), "KiB"); + printMethod(info, GetLoadAverage); for (long int i = 0; i <= 31; i++) { From 1f4ef39603f3184ac3f78e1f52529947303b1bd1 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 4 Jun 2015 19:25:37 +0200 Subject: [PATCH 0030/1048] cmLocalGenerator: Remove some commented lines of code. They've been commented out for a decade, which seems long enough. --- Source/cmLocalGenerator.cxx | 5 ----- 1 file changed, 5 deletions(-) diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index da95a4db0..fe71d0fb4 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -2622,28 +2622,23 @@ std::string cmLocalGenerator::Convert(const std::string& source, RelativeRoot relative, OutputFormat output) { - // Convert the path to a relative path. std::string result = source; switch (relative) { case HOME: - //result = cmSystemTools::CollapseFullPath(result.c_str()); result = this->ConvertToRelativePath( this->GetState()->GetSourceDirectoryComponents(), result); break; case START: - //result = cmSystemTools::CollapseFullPath(result.c_str()); result = this->ConvertToRelativePath( this->StateSnapshot.GetCurrentSourceDirectoryComponents(), result); break; case HOME_OUTPUT: - //result = cmSystemTools::CollapseFullPath(result.c_str()); result = this->ConvertToRelativePath( this->GetState()->GetBinaryDirectoryComponents(), result); break; case START_OUTPUT: - //result = cmSystemTools::CollapseFullPath(result.c_str()); result = this->ConvertToRelativePath( this->StateSnapshot.GetCurrentBinaryDirectoryComponents(), result); break; From a82441572493e4f420fca24041b594da9d3c14e6 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 4 Jun 2015 19:33:38 +0200 Subject: [PATCH 0031/1048] cmState::Snapshot: Provide accessor for the cmState. --- Source/cmState.cxx | 5 +++++ Source/cmState.h | 2 ++ 2 files changed, 7 insertions(+) diff --git a/Source/cmState.cxx b/Source/cmState.cxx index c6fb2998e..3278d56f9 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -787,3 +787,8 @@ cmState::Snapshot cmState::Snapshot::GetBuildsystemDirectoryParent() const return snapshot; } + +cmState* cmState::Snapshot::GetState() const +{ + return this->State; +} diff --git a/Source/cmState.h b/Source/cmState.h index 60b024f33..39c9b761a 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -47,6 +47,8 @@ public: bool IsValid() const; Snapshot GetBuildsystemDirectoryParent() const; + cmState* GetState() const; + private: void ComputeRelativePathTopSource(); void ComputeRelativePathTopBinary(); From 1b323949fe6770fa36846a5a85d049121c7ce2c4 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 23 May 2015 09:54:07 +0200 Subject: [PATCH 0032/1048] cmState: Extend Snapshot concept with a SnapshotType. Store it together with the Parent position. --- Source/cmState.cxx | 27 ++++++++++++++++++++------- Source/cmState.h | 8 +++++++- 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/Source/cmState.cxx b/Source/cmState.cxx index c6fb2998e..4691a00de 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -18,6 +18,12 @@ #include +struct cmState::SnapshotDataType +{ + cmState::PositionType DirectoryParent; + cmState::SnapshotType SnapshotType; +}; + cmState::cmState(cmake* cm) : CMakeInstance(cm), IsInTryCompile(false), @@ -202,7 +208,7 @@ void cmState::Reset() assert(this->Locations.size() > 0); assert(this->OutputLocations.size() > 0); - assert(this->ParentPositions.size() > 0); + assert(this->SnapshotData.size() > 0); assert(this->CurrentSourceDirectoryComponents.size() > 0); assert(this->CurrentBinaryDirectoryComponents.size() > 0); assert(this->RelativePathTopSource.size() > 0); @@ -211,8 +217,8 @@ void cmState::Reset() this->Locations.erase(this->Locations.begin() + 1, this->Locations.end()); this->OutputLocations.erase(this->OutputLocations.begin() + 1, this->OutputLocations.end()); - this->ParentPositions.erase(this->ParentPositions.begin() + 1, - this->ParentPositions.end()); + this->SnapshotData.erase(this->SnapshotData.begin() + 1, + this->SnapshotData.end()); this->CurrentSourceDirectoryComponents.erase( this->CurrentSourceDirectoryComponents.begin() + 1, this->CurrentSourceDirectoryComponents.end()); @@ -662,7 +668,10 @@ void cmState::Snapshot::ComputeRelativePathTopBinary() cmState::Snapshot cmState::CreateBaseSnapshot() { PositionType pos = 0; - this->ParentPositions.push_back(pos); + this->SnapshotData.resize(1); + SnapshotDataType& snp = this->SnapshotData.back(); + snp.DirectoryParent = 0; + snp.SnapshotType = BuildsystemDirectoryType; this->Locations.resize(1); this->OutputLocations.resize(1); this->CurrentSourceDirectoryComponents.resize(1); @@ -676,8 +685,11 @@ cmState::Snapshot cmState::CreateBuildsystemDirectorySnapshot(Snapshot originSnapshot) { assert(originSnapshot.IsValid()); - PositionType pos = this->ParentPositions.size(); - this->ParentPositions.push_back(originSnapshot.Position); + PositionType pos = this->SnapshotData.size(); + this->SnapshotData.resize(this->SnapshotData.size() + 1); + SnapshotDataType& snp = this->SnapshotData.back(); + snp.DirectoryParent = originSnapshot.Position; + snp.SnapshotType = BuildsystemDirectoryType; this->Locations.resize(this->Locations.size() + 1); this->OutputLocations.resize(this->OutputLocations.size() + 1); this->CurrentSourceDirectoryComponents.resize( @@ -782,7 +794,8 @@ cmState::Snapshot cmState::Snapshot::GetBuildsystemDirectoryParent() const { return snapshot; } - PositionType parentPos = this->State->ParentPositions[this->Position]; + PositionType parentPos = + this->State->SnapshotData[this->Position].DirectoryParent; snapshot = Snapshot(this->State, parentPos); return snapshot; diff --git a/Source/cmState.h b/Source/cmState.h index 60b024f33..024c9a98f 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -21,12 +21,18 @@ class cmCommand; class cmState { + struct SnapshotDataType; typedef std::vector::size_type PositionType; friend class Snapshot; public: cmState(cmake* cm); ~cmState(); + enum SnapshotType + { + BuildsystemDirectoryType + }; + class Snapshot { public: Snapshot(cmState* state = 0, PositionType position = 0); @@ -160,7 +166,7 @@ private: cmake* CMakeInstance; std::vector Locations; std::vector OutputLocations; - std::vector ParentPositions; + std::vector SnapshotData; std::vector > CurrentSourceDirectoryComponents; std::vector > CurrentBinaryDirectoryComponents; From 7b9c75860d25479a153831740d289e8aca540f4d Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 23 May 2015 10:37:07 +0200 Subject: [PATCH 0033/1048] cmState: Group BuildsystemDirectory state together in a struct. It needs to be snapshotted independently of other state. --- Source/cmState.cxx | 137 +++++++++++++++++++++++++-------------------- Source/cmState.h | 16 ++---- 2 files changed, 80 insertions(+), 73 deletions(-) diff --git a/Source/cmState.cxx b/Source/cmState.cxx index 4691a00de..161cee40b 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -22,6 +22,24 @@ struct cmState::SnapshotDataType { cmState::PositionType DirectoryParent; cmState::SnapshotType SnapshotType; + std::vector::size_type + BuildSystemDirectoryPosition; +}; + +struct cmState::BuildsystemDirectoryStateType +{ + std::string Location; + std::string OutputLocation; + + std::vector CurrentSourceDirectoryComponents; + std::vector CurrentBinaryDirectoryComponents; + // The top-most directories for relative path conversion. Both the + // source and destination location of a relative path conversion + // must be underneath one of these directories (both under source or + // both under binary) in order for the relative path to be evaluated + // safely by the build tools. + std::string RelativePathTopSource; + std::string RelativePathTopBinary; }; cmState::cmState(cmake* cm) @@ -206,29 +224,13 @@ void cmState::Reset() this->GlobalProperties.clear(); this->PropertyDefinitions.clear(); - assert(this->Locations.size() > 0); - assert(this->OutputLocations.size() > 0); + assert(this->BuildsystemDirectory.size() > 0); assert(this->SnapshotData.size() > 0); - assert(this->CurrentSourceDirectoryComponents.size() > 0); - assert(this->CurrentBinaryDirectoryComponents.size() > 0); - assert(this->RelativePathTopSource.size() > 0); - assert(this->RelativePathTopBinary.size() > 0); - this->Locations.erase(this->Locations.begin() + 1, this->Locations.end()); - this->OutputLocations.erase(this->OutputLocations.begin() + 1, - this->OutputLocations.end()); + this->BuildsystemDirectory.erase(this->BuildsystemDirectory.begin() + 1, + this->BuildsystemDirectory.end()); this->SnapshotData.erase(this->SnapshotData.begin() + 1, this->SnapshotData.end()); - this->CurrentSourceDirectoryComponents.erase( - this->CurrentSourceDirectoryComponents.begin() + 1, - this->CurrentSourceDirectoryComponents.end()); - this->CurrentBinaryDirectoryComponents.erase( - this->CurrentBinaryDirectoryComponents.begin() + 1, - this->CurrentBinaryDirectoryComponents.end()); - this->RelativePathTopSource.erase(this->RelativePathTopSource.begin() + 1, - this->RelativePathTopSource.end()); - this->RelativePathTopBinary.erase(this->RelativePathTopBinary.begin() + 1, - this->RelativePathTopBinary.end()); this->DefineProperty ("RULE_LAUNCH_COMPILE", cmProperty::DIRECTORY, @@ -618,7 +620,9 @@ void cmState::Snapshot::ComputeRelativePathTopSource() result = currentSource; } } - this->State->RelativePathTopSource[this->Position] = result; + PositionType pos = + this->State->SnapshotData[this->Position].BuildSystemDirectoryPosition; + this->State->BuildsystemDirectory[pos].RelativePathTopSource = result; } void cmState::Snapshot::ComputeRelativePathTopBinary() @@ -652,16 +656,18 @@ void cmState::Snapshot::ComputeRelativePathTopBinary() } } + PositionType pos = + this->State->SnapshotData[this->Position].BuildSystemDirectoryPosition; // The current working directory on Windows cannot be a network // path. Therefore relative paths cannot work when the binary tree // is a network path. if(result.size() < 2 || result.substr(0, 2) != "//") { - this->State->RelativePathTopBinary[this->Position] = result; + this->State->BuildsystemDirectory[pos].RelativePathTopBinary = result; } else { - this->State->RelativePathTopBinary[this->Position] = ""; + this->State->BuildsystemDirectory[pos].RelativePathTopBinary = ""; } } @@ -672,12 +678,8 @@ cmState::Snapshot cmState::CreateBaseSnapshot() SnapshotDataType& snp = this->SnapshotData.back(); snp.DirectoryParent = 0; snp.SnapshotType = BuildsystemDirectoryType; - this->Locations.resize(1); - this->OutputLocations.resize(1); - this->CurrentSourceDirectoryComponents.resize(1); - this->CurrentBinaryDirectoryComponents.resize(1); - this->RelativePathTopSource.resize(1); - this->RelativePathTopBinary.resize(1); + snp.BuildSystemDirectoryPosition = 0; + this->BuildsystemDirectory.resize(1); return cmState::Snapshot(this, pos); } @@ -690,14 +692,8 @@ cmState::CreateBuildsystemDirectorySnapshot(Snapshot originSnapshot) SnapshotDataType& snp = this->SnapshotData.back(); snp.DirectoryParent = originSnapshot.Position; snp.SnapshotType = BuildsystemDirectoryType; - this->Locations.resize(this->Locations.size() + 1); - this->OutputLocations.resize(this->OutputLocations.size() + 1); - this->CurrentSourceDirectoryComponents.resize( - this->CurrentSourceDirectoryComponents.size() + 1); - this->CurrentBinaryDirectoryComponents.resize( - this->CurrentBinaryDirectoryComponents.size() + 1); - this->RelativePathTopSource.resize(this->RelativePathTopSource.size() + 1); - this->RelativePathTopBinary.resize(this->RelativePathTopBinary.size() + 1); + snp.BuildSystemDirectoryPosition = this->BuildsystemDirectory.size(); + this->BuildsystemDirectory.resize(this->BuildsystemDirectory.size() + 1); return cmState::Snapshot(this, pos); } @@ -710,76 +706,95 @@ cmState::Snapshot::Snapshot(cmState* state, PositionType position) const char* cmState::Snapshot::GetCurrentSourceDirectory() const { - return this->State->Locations[this->Position].c_str(); + PositionType pos = + this->State->SnapshotData[this->Position].BuildSystemDirectoryPosition; + return this->State->BuildsystemDirectory[pos].Location.c_str(); } void cmState::Snapshot::SetCurrentSourceDirectory(std::string const& dir) { assert(this->State); - assert(this->State->Locations.size() > this->Position); - this->State->Locations[this->Position] = dir; - cmSystemTools::ConvertToUnixSlashes( - this->State->Locations[this->Position]); - this->State->Locations[this->Position] = - cmSystemTools::CollapseFullPath(this->State->Locations[this->Position]); + assert(this->State->SnapshotData.size() > this->Position); + PositionType pos = + this->State->SnapshotData[this->Position].BuildSystemDirectoryPosition; + std::string& loc = this->State->BuildsystemDirectory[pos].Location; + loc = dir; + cmSystemTools::ConvertToUnixSlashes(loc); + loc = cmSystemTools::CollapseFullPath(loc); cmSystemTools::SplitPath( - this->State->Locations[this->Position], - this->State->CurrentSourceDirectoryComponents[this->Position]); + loc, + this->State->BuildsystemDirectory[pos].CurrentSourceDirectoryComponents); this->ComputeRelativePathTopSource(); } const char* cmState::Snapshot::GetCurrentBinaryDirectory() const { - return this->State->OutputLocations[this->Position].c_str(); + PositionType pos = + this->State->SnapshotData[this->Position].BuildSystemDirectoryPosition; + return this->State->BuildsystemDirectory[pos].OutputLocation.c_str(); } void cmState::Snapshot::SetCurrentBinaryDirectory(std::string const& dir) { - assert(this->State->OutputLocations.size() > this->Position); - this->State->OutputLocations[this->Position] = dir; - cmSystemTools::ConvertToUnixSlashes( - this->State->OutputLocations[this->Position]); - this->State->OutputLocations[this->Position] = - cmSystemTools::CollapseFullPath( - this->State->OutputLocations[this->Position]); + assert(this->State->SnapshotData.size() > this->Position); + PositionType pos = + this->State->SnapshotData[this->Position].BuildSystemDirectoryPosition; + std::string& loc = this->State->BuildsystemDirectory[pos].OutputLocation; + loc = dir; + cmSystemTools::ConvertToUnixSlashes(loc); + loc = cmSystemTools::CollapseFullPath(loc); cmSystemTools::SplitPath( - this->State->OutputLocations[this->Position], - this->State->CurrentBinaryDirectoryComponents[this->Position]); + loc, + this->State->BuildsystemDirectory[pos].CurrentBinaryDirectoryComponents); this->ComputeRelativePathTopBinary(); } std::vector const& cmState::Snapshot::GetCurrentSourceDirectoryComponents() { - return this->State->CurrentSourceDirectoryComponents[this->Position]; + PositionType pos = + this->State->SnapshotData[this->Position].BuildSystemDirectoryPosition; + return this->State + ->BuildsystemDirectory[pos].CurrentSourceDirectoryComponents; } std::vector const& cmState::Snapshot::GetCurrentBinaryDirectoryComponents() { - return this->State->CurrentBinaryDirectoryComponents[this->Position]; + PositionType pos = + this->State->SnapshotData[this->Position].BuildSystemDirectoryPosition; + return this->State + ->BuildsystemDirectory[pos].CurrentBinaryDirectoryComponents; } const char* cmState::Snapshot::GetRelativePathTopSource() const { - return this->State->RelativePathTopSource[this->Position].c_str(); + PositionType pos = + this->State->SnapshotData[this->Position].BuildSystemDirectoryPosition; + return this->State->BuildsystemDirectory[pos].RelativePathTopSource.c_str(); } const char* cmState::Snapshot::GetRelativePathTopBinary() const { - return this->State->RelativePathTopBinary[this->Position].c_str(); + PositionType pos = + this->State->SnapshotData[this->Position].BuildSystemDirectoryPosition; + return this->State->BuildsystemDirectory[pos].RelativePathTopBinary.c_str(); } void cmState::Snapshot::SetRelativePathTopSource(const char* dir) { - this->State->RelativePathTopSource[this->Position] = dir; + PositionType pos = + this->State->SnapshotData[this->Position].BuildSystemDirectoryPosition; + this->State->BuildsystemDirectory[pos].RelativePathTopSource = dir; } void cmState::Snapshot::SetRelativePathTopBinary(const char* dir) { - this->State->RelativePathTopBinary[this->Position] = dir; + PositionType pos = + this->State->SnapshotData[this->Position].BuildSystemDirectoryPosition; + this->State->BuildsystemDirectory[pos].RelativePathTopBinary = dir; } bool cmState::Snapshot::IsValid() const diff --git a/Source/cmState.h b/Source/cmState.h index 024c9a98f..4589a72af 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -164,19 +164,11 @@ private: std::map Commands; cmPropertyMap GlobalProperties; cmake* CMakeInstance; - std::vector Locations; - std::vector OutputLocations; - std::vector SnapshotData; - std::vector > CurrentSourceDirectoryComponents; - std::vector > CurrentBinaryDirectoryComponents; - // The top-most directories for relative path conversion. Both the - // source and destination location of a relative path conversion - // must be underneath one of these directories (both under source or - // both under binary) in order for the relative path to be evaluated - // safely by the build tools. - std::vector RelativePathTopSource; - std::vector RelativePathTopBinary; + struct BuildsystemDirectoryStateType; + std::vector BuildsystemDirectory; + + std::vector SnapshotData; std::vector SourceDirectoryComponents; std::vector BinaryDirectoryComponents; From 4e5c70abe27997f17318cc6aca38eeddec486798 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 23 May 2015 00:04:09 +0200 Subject: [PATCH 0034/1048] cmState: Extract a cmLinkedTree container adaptor. This will be used to contain most of the content of the cmState in several different trees. Refer to the BuildsystemDirectory state from the SnapshotData state. Currently these trees have the same structure, but that will change when we have more snapshot types. --- Source/CMakeLists.txt | 1 + Source/cmLinkedTree.h | 164 ++++++++++++++++++++++++++++++++++++++++++ Source/cmState.cxx | 112 +++++++++++------------------ Source/cmState.h | 9 +-- 4 files changed, 211 insertions(+), 75 deletions(-) create mode 100644 Source/cmLinkedTree.h diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index a7adb5125..e8d5107ee 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -281,6 +281,7 @@ set(SRCS cmInstallTargetGenerator.cxx cmInstallDirectoryGenerator.h cmInstallDirectoryGenerator.cxx + cmLinkedTree.h cmListFileCache.cxx cmListFileCache.h cmListFileLexer.c diff --git a/Source/cmLinkedTree.h b/Source/cmLinkedTree.h new file mode 100644 index 000000000..d2339c4f5 --- /dev/null +++ b/Source/cmLinkedTree.h @@ -0,0 +1,164 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2015 Stephen Kelly + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#ifndef cmLinkedTree_h +#define cmLinkedTree_h + +#include "cmStandardIncludes.h" + +#include + +/** + @brief A adaptor for traversing a tree structure in a vector + + This class is not intended to be wholly generic like a standard library + container adaptor. Mostly it exists to facilitate code sharing for the + needs of the cmState. For example, the Truncate() method is a specific + requirement of the cmState. + + An empty cmLinkedTree provides a Root() method, and an Extend() method, + each of which return iterators. A Tree can be built up by extending + from the root, and then extending from any other iterator. + + An iterator resulting from this tree construction can be + forward-only-iterated toward the root. Extending the tree never + invalidates existing iterators. + */ +template +class cmLinkedTree +{ + typedef typename std::vector::size_type PositionType; + typedef T* PointerType; + typedef T& ReferenceType; +public: + class iterator : public std::iterator + { + friend class cmLinkedTree; + cmLinkedTree* Tree; + + // The Position is always 'one past the end'. + PositionType Position; + + iterator(cmLinkedTree* tree, PositionType pos) + : Tree(tree), Position(pos) + { + + } + + public: + iterator() + : Tree(0), Position(0) + { + + } + + void operator++() + { + assert(this->Tree); + assert(this->Tree->UpPositions.size() == this->Tree->Data.size()); + assert(this->Position <= this->Tree->Data.size()); + assert(this->Position > 0); + this->Position = this->Tree->UpPositions[this->Position - 1]; + } + + PointerType operator->() const + { + assert(this->Tree); + assert(this->Tree->UpPositions.size() == this->Tree->Data.size()); + assert(this->Position <= this->Tree->Data.size()); + assert(this->Position > 0); + return this->Tree->GetPointer(this->Position - 1); + } + + PointerType operator->() + { + assert(this->Tree); + assert(this->Tree->UpPositions.size() == this->Tree->Data.size()); + assert(this->Position <= this->Tree->Data.size()); + assert(this->Position > 0); + return this->Tree->GetPointer(this->Position - 1); + } + + bool operator==(iterator other) const + { + assert(this->Tree); + assert(this->Tree->UpPositions.size() == this->Tree->Data.size()); + assert(this->Tree == other.Tree); + return this->Position == other.Position; + } + + bool operator!=(iterator other) const + { + assert(this->Tree); + assert(this->Tree->UpPositions.size() == this->Tree->Data.size()); + return !(*this == other); + } + + bool IsValid() const + { + if (!this->Tree) + { + return false; + } + return this->Position <= this->Tree->Data.size(); + } + }; + + iterator Root() const + { + return iterator(const_cast(this), 0); + } + + iterator Extend(iterator it) + { + return Extend_impl(it, T()); + } + + iterator Extend(iterator it, T t) + { + return Extend_impl(it, t); + } + + iterator Truncate() + { + assert(this->UpPositions.size() > 0); + this->UpPositions.erase(this->UpPositions.begin() + 1, + this->UpPositions.end()); + assert(this->Data.size() > 0); + this->Data.erase(this->Data.begin() + 1, this->Data.end()); + return iterator(this, 1); + } + +private: + T& GetReference(PositionType pos) + { + return this->Data[pos]; + } + + T* GetPointer(PositionType pos) + { + return &this->Data[pos]; + } + + iterator Extend_impl(iterator it, T t) + { + assert(this->UpPositions.size() == this->Data.size()); + assert(it.Position <= this->UpPositions.size()); + this->UpPositions.push_back(it.Position); + this->Data.push_back(t); + return iterator(this, this->UpPositions.size()); + } + + std::vector Data; + std::vector UpPositions; +}; + +#endif diff --git a/Source/cmState.cxx b/Source/cmState.cxx index 161cee40b..a2ebb24b1 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -22,8 +22,8 @@ struct cmState::SnapshotDataType { cmState::PositionType DirectoryParent; cmState::SnapshotType SnapshotType; - std::vector::size_type - BuildSystemDirectoryPosition; + cmLinkedTree::iterator + BuildSystemDirectory; }; struct cmState::BuildsystemDirectoryStateType @@ -224,13 +224,8 @@ void cmState::Reset() this->GlobalProperties.clear(); this->PropertyDefinitions.clear(); - assert(this->BuildsystemDirectory.size() > 0); - assert(this->SnapshotData.size() > 0); - - this->BuildsystemDirectory.erase(this->BuildsystemDirectory.begin() + 1, - this->BuildsystemDirectory.end()); - this->SnapshotData.erase(this->SnapshotData.begin() + 1, - this->SnapshotData.end()); + this->BuildsystemDirectory.Truncate(); + this->SnapshotData.Truncate(); this->DefineProperty ("RULE_LAUNCH_COMPILE", cmProperty::DIRECTORY, @@ -620,9 +615,7 @@ void cmState::Snapshot::ComputeRelativePathTopSource() result = currentSource; } } - PositionType pos = - this->State->SnapshotData[this->Position].BuildSystemDirectoryPosition; - this->State->BuildsystemDirectory[pos].RelativePathTopSource = result; + this->Position->BuildSystemDirectory->RelativePathTopSource = result; } void cmState::Snapshot::ComputeRelativePathTopBinary() @@ -656,30 +649,26 @@ void cmState::Snapshot::ComputeRelativePathTopBinary() } } - PositionType pos = - this->State->SnapshotData[this->Position].BuildSystemDirectoryPosition; // The current working directory on Windows cannot be a network // path. Therefore relative paths cannot work when the binary tree // is a network path. if(result.size() < 2 || result.substr(0, 2) != "//") { - this->State->BuildsystemDirectory[pos].RelativePathTopBinary = result; + this->Position->BuildSystemDirectory->RelativePathTopBinary = result; } else { - this->State->BuildsystemDirectory[pos].RelativePathTopBinary = ""; + this->Position->BuildSystemDirectory->RelativePathTopBinary = ""; } } cmState::Snapshot cmState::CreateBaseSnapshot() { - PositionType pos = 0; - this->SnapshotData.resize(1); - SnapshotDataType& snp = this->SnapshotData.back(); - snp.DirectoryParent = 0; - snp.SnapshotType = BuildsystemDirectoryType; - snp.BuildSystemDirectoryPosition = 0; - this->BuildsystemDirectory.resize(1); + PositionType pos = this->SnapshotData.Extend(this->SnapshotData.Root()); + pos->DirectoryParent = this->SnapshotData.Root(); + pos->SnapshotType = BuildsystemDirectoryType; + pos->BuildSystemDirectory = + this->BuildsystemDirectory.Extend(this->BuildsystemDirectory.Root()); return cmState::Snapshot(this, pos); } @@ -687,13 +676,12 @@ cmState::Snapshot cmState::CreateBuildsystemDirectorySnapshot(Snapshot originSnapshot) { assert(originSnapshot.IsValid()); - PositionType pos = this->SnapshotData.size(); - this->SnapshotData.resize(this->SnapshotData.size() + 1); - SnapshotDataType& snp = this->SnapshotData.back(); - snp.DirectoryParent = originSnapshot.Position; - snp.SnapshotType = BuildsystemDirectoryType; - snp.BuildSystemDirectoryPosition = this->BuildsystemDirectory.size(); - this->BuildsystemDirectory.resize(this->BuildsystemDirectory.size() + 1); + PositionType pos = this->SnapshotData.Extend(originSnapshot.Position); + pos->DirectoryParent = originSnapshot.Position; + pos->SnapshotType = BuildsystemDirectoryType; + pos->BuildSystemDirectory = + this->BuildsystemDirectory.Extend( + originSnapshot.Position->BuildSystemDirectory); return cmState::Snapshot(this, pos); } @@ -706,112 +694,94 @@ cmState::Snapshot::Snapshot(cmState* state, PositionType position) const char* cmState::Snapshot::GetCurrentSourceDirectory() const { - PositionType pos = - this->State->SnapshotData[this->Position].BuildSystemDirectoryPosition; - return this->State->BuildsystemDirectory[pos].Location.c_str(); + return this->Position->BuildSystemDirectory->Location.c_str(); } void cmState::Snapshot::SetCurrentSourceDirectory(std::string const& dir) { assert(this->State); - assert(this->State->SnapshotData.size() > this->Position); - PositionType pos = - this->State->SnapshotData[this->Position].BuildSystemDirectoryPosition; - std::string& loc = this->State->BuildsystemDirectory[pos].Location; + std::string& loc = this->Position->BuildSystemDirectory->Location; loc = dir; cmSystemTools::ConvertToUnixSlashes(loc); loc = cmSystemTools::CollapseFullPath(loc); cmSystemTools::SplitPath( loc, - this->State->BuildsystemDirectory[pos].CurrentSourceDirectoryComponents); + this->Position->BuildSystemDirectory->CurrentSourceDirectoryComponents); this->ComputeRelativePathTopSource(); } const char* cmState::Snapshot::GetCurrentBinaryDirectory() const { - PositionType pos = - this->State->SnapshotData[this->Position].BuildSystemDirectoryPosition; - return this->State->BuildsystemDirectory[pos].OutputLocation.c_str(); + return this->Position->BuildSystemDirectory->OutputLocation.c_str(); } void cmState::Snapshot::SetCurrentBinaryDirectory(std::string const& dir) { - assert(this->State->SnapshotData.size() > this->Position); - PositionType pos = - this->State->SnapshotData[this->Position].BuildSystemDirectoryPosition; - std::string& loc = this->State->BuildsystemDirectory[pos].OutputLocation; + std::string& loc = this->Position->BuildSystemDirectory->OutputLocation; loc = dir; cmSystemTools::ConvertToUnixSlashes(loc); loc = cmSystemTools::CollapseFullPath(loc); cmSystemTools::SplitPath( loc, - this->State->BuildsystemDirectory[pos].CurrentBinaryDirectoryComponents); + this->Position->BuildSystemDirectory->CurrentBinaryDirectoryComponents); this->ComputeRelativePathTopBinary(); } std::vector const& cmState::Snapshot::GetCurrentSourceDirectoryComponents() { - PositionType pos = - this->State->SnapshotData[this->Position].BuildSystemDirectoryPosition; - return this->State - ->BuildsystemDirectory[pos].CurrentSourceDirectoryComponents; + return this->Position->BuildSystemDirectory + ->CurrentSourceDirectoryComponents; } std::vector const& cmState::Snapshot::GetCurrentBinaryDirectoryComponents() { - PositionType pos = - this->State->SnapshotData[this->Position].BuildSystemDirectoryPosition; - return this->State - ->BuildsystemDirectory[pos].CurrentBinaryDirectoryComponents; + return this->Position->BuildSystemDirectory + ->CurrentBinaryDirectoryComponents; } const char* cmState::Snapshot::GetRelativePathTopSource() const { - PositionType pos = - this->State->SnapshotData[this->Position].BuildSystemDirectoryPosition; - return this->State->BuildsystemDirectory[pos].RelativePathTopSource.c_str(); + return this->Position->BuildSystemDirectory->RelativePathTopSource.c_str(); } const char* cmState::Snapshot::GetRelativePathTopBinary() const { - PositionType pos = - this->State->SnapshotData[this->Position].BuildSystemDirectoryPosition; - return this->State->BuildsystemDirectory[pos].RelativePathTopBinary.c_str(); + return this->Position->BuildSystemDirectory->RelativePathTopBinary.c_str(); } void cmState::Snapshot::SetRelativePathTopSource(const char* dir) { - PositionType pos = - this->State->SnapshotData[this->Position].BuildSystemDirectoryPosition; - this->State->BuildsystemDirectory[pos].RelativePathTopSource = dir; + this->Position->BuildSystemDirectory->RelativePathTopSource = dir; } void cmState::Snapshot::SetRelativePathTopBinary(const char* dir) { - PositionType pos = - this->State->SnapshotData[this->Position].BuildSystemDirectoryPosition; - this->State->BuildsystemDirectory[pos].RelativePathTopBinary = dir; + this->Position->BuildSystemDirectory->RelativePathTopBinary = dir; } bool cmState::Snapshot::IsValid() const { - return this->State ? true : false; + return this->State && this->Position.IsValid() + ? this->Position != this->State->SnapshotData.Root() + : false; } cmState::Snapshot cmState::Snapshot::GetBuildsystemDirectoryParent() const { Snapshot snapshot; - if (!this->State || this->Position == 0) + if (!this->State || this->Position == this->State->SnapshotData.Root()) { return snapshot; } - PositionType parentPos = - this->State->SnapshotData[this->Position].DirectoryParent; - snapshot = Snapshot(this->State, parentPos); + PositionType parentPos = this->Position->DirectoryParent; + if (parentPos != this->State->SnapshotData.Root()) + { + snapshot = Snapshot(this->State, parentPos); + } return snapshot; } diff --git a/Source/cmState.h b/Source/cmState.h index 4589a72af..1411e2f01 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -15,6 +15,7 @@ #include "cmStandardIncludes.h" #include "cmPropertyDefinitionMap.h" #include "cmPropertyMap.h" +#include "cmLinkedTree.h" class cmake; class cmCommand; @@ -22,7 +23,7 @@ class cmCommand; class cmState { struct SnapshotDataType; - typedef std::vector::size_type PositionType; + typedef cmLinkedTree::iterator PositionType; friend class Snapshot; public: cmState(cmake* cm); @@ -35,7 +36,7 @@ public: class Snapshot { public: - Snapshot(cmState* state = 0, PositionType position = 0); + Snapshot(cmState* state = 0, PositionType position = PositionType()); const char* GetCurrentSourceDirectory() const; void SetCurrentSourceDirectory(std::string const& dir); @@ -166,9 +167,9 @@ private: cmake* CMakeInstance; struct BuildsystemDirectoryStateType; - std::vector BuildsystemDirectory; + cmLinkedTree BuildsystemDirectory; - std::vector SnapshotData; + cmLinkedTree SnapshotData; std::vector SourceDirectoryComponents; std::vector BinaryDirectoryComponents; From d5dc4169ac1c4dd5abd385b1e8499119df88c657 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 31 May 2015 18:19:58 +0200 Subject: [PATCH 0035/1048] cmMakefile: Create a unified raii for function scopes. --- Source/cmFunctionCommand.cxx | 14 +++----------- Source/cmMakefile.cxx | 33 +++++++++++++++++++++++++++++++++ Source/cmMakefile.h | 16 +++++++++++++++- 3 files changed, 51 insertions(+), 12 deletions(-) diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx index 001adb18c..dc6d2d270 100644 --- a/Source/cmFunctionCommand.cxx +++ b/Source/cmFunctionCommand.cxx @@ -73,7 +73,6 @@ public: cmPolicies::PolicyMap Policies; }; - bool cmFunctionHelperCommand::InvokeInitialPass (const std::vector& args, cmExecutionStatus & inStatus) @@ -93,14 +92,8 @@ bool cmFunctionHelperCommand::InvokeInitialPass return false; } - // we push a scope on the makefile - cmMakefile::ScopePushPop varScope(this->Makefile); - cmMakefile::LexicalPushPop lexScope(this->Makefile); - static_cast(varScope); - - // Push a weak policy scope which restores the policies recorded at - // function creation. - cmMakefile::PolicyPushPop polScope(this->Makefile, true, this->Policies); + cmMakefile::FunctionPushPop functionScope(this->Makefile, + this->Policies); // set the value of argc std::ostringstream strStream; @@ -145,8 +138,7 @@ bool cmFunctionHelperCommand::InvokeInitialPass { // The error message should have already included the call stack // so we do not need to report an error here. - lexScope.Quiet(); - polScope.Quiet(); + functionScope.Quiet(); inStatus.SetNestedError(true); return false; } diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index b5d976a9b..70127010b 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1562,6 +1562,26 @@ void cmMakefile::InitializeFromParent() this->ImportedTargets = parent->ImportedTargets; } +void cmMakefile::PushFunctionScope(const cmPolicies::PolicyMap& pm) +{ + this->PushScope(); + + this->PushFunctionBlockerBarrier(); + + this->PushPolicy(true, pm); + this->PushPolicyBarrier(); +} + +void cmMakefile::PopFunctionScope(bool reportError) +{ + this->PopPolicyBarrier(reportError); + this->PopPolicy(); + + this->PopFunctionBlockerBarrier(reportError); + + this->PopScope(); +} + //---------------------------------------------------------------------------- class cmMakefileCurrent { @@ -5418,3 +5438,16 @@ AddRequiredTargetCFeature(cmTarget *target, const std::string& feature) const } return true; } + + +cmMakefile::FunctionPushPop::FunctionPushPop(cmMakefile* mf, + cmPolicies::PolicyMap const& pm) + : Makefile(mf), ReportError(true) +{ + this->Makefile->PushFunctionScope(pm); +} + +cmMakefile::FunctionPushPop::~FunctionPushPop() +{ + this->Makefile->PopFunctionScope(this->ReportError); +} diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 431ed086b..ed9bc7008 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -746,7 +746,21 @@ public: const std::vector& GetTestGenerators() const { return this->TestGenerators; } - // push and pop variable scopes + class FunctionPushPop + { + public: + FunctionPushPop(cmMakefile* mf, + cmPolicies::PolicyMap const& pm); + ~FunctionPushPop(); + + void Quiet() { this->ReportError = false; } + private: + cmMakefile* Makefile; + bool ReportError; + }; + + void PushFunctionScope(cmPolicies::PolicyMap const& pm); + void PopFunctionScope(bool reportError); void PushScope(); void PopScope(); void RaiseScope(const std::string& var, const char *value); From ca140c2e898ca74a7daa305449b136b1294a41f0 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 31 May 2015 18:32:01 +0200 Subject: [PATCH 0036/1048] cmMakefile: Create a unified raii for macro scopes. --- Source/cmMacroCommand.cxx | 11 +++-------- Source/cmMakefile.cxx | 29 +++++++++++++++++++++++++++++ Source/cmMakefile.h | 15 +++++++++++++++ 3 files changed, 47 insertions(+), 8 deletions(-) diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx index 7ac44320c..028ab6223 100644 --- a/Source/cmMacroCommand.cxx +++ b/Source/cmMacroCommand.cxx @@ -96,12 +96,8 @@ bool cmMacroHelperCommand::InvokeInitialPass return false; } - // Enforce matching logical blocks inside the macro. - cmMakefile::LexicalPushPop lexScope(this->Makefile); - - // Push a weak policy scope which restores the policies recorded at - // macro creation. - cmMakefile::PolicyPushPop polScope(this->Makefile, true, this->Policies); + cmMakefile::MacroPushPop macroScope(this->Makefile, + this->Policies); // set the value of argc std::ostringstream argcDefStream; @@ -191,8 +187,7 @@ bool cmMacroHelperCommand::InvokeInitialPass { // The error message should have already included the call stack // so we do not need to report an error here. - lexScope.Quiet(); - polScope.Quiet(); + macroScope.Quiet(); inStatus.SetNestedError(true); return false; } diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 70127010b..d3a81218e 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1582,6 +1582,22 @@ void cmMakefile::PopFunctionScope(bool reportError) this->PopScope(); } +void cmMakefile::PushMacroScope(const cmPolicies::PolicyMap& pm) +{ + this->PushFunctionBlockerBarrier(); + + this->PushPolicy(true, pm); + this->PushPolicyBarrier(); +} + +void cmMakefile::PopMacroScope(bool reportError) +{ + this->PopPolicyBarrier(reportError); + this->PopPolicy(); + + this->PopFunctionBlockerBarrier(reportError); +} + //---------------------------------------------------------------------------- class cmMakefileCurrent { @@ -5451,3 +5467,16 @@ cmMakefile::FunctionPushPop::~FunctionPushPop() { this->Makefile->PopFunctionScope(this->ReportError); } + + +cmMakefile::MacroPushPop::MacroPushPop(cmMakefile* mf, + const cmPolicies::PolicyMap& pm) + : Makefile(mf), ReportError(true) +{ + this->Makefile->PushMacroScope(pm); +} + +cmMakefile::MacroPushPop::~MacroPushPop() +{ + this->Makefile->PopMacroScope(this->ReportError); +} diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index ed9bc7008..0914a99d4 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -759,8 +759,23 @@ public: bool ReportError; }; + class MacroPushPop + { + public: + MacroPushPop(cmMakefile* mf, + cmPolicies::PolicyMap const& pm); + ~MacroPushPop(); + + void Quiet() { this->ReportError = false; } + private: + cmMakefile* Makefile; + bool ReportError; + }; + void PushFunctionScope(cmPolicies::PolicyMap const& pm); void PopFunctionScope(bool reportError); + void PushMacroScope(cmPolicies::PolicyMap const& pm); + void PopMacroScope(bool reportError); void PushScope(); void PopScope(); void RaiseScope(const std::string& var, const char *value); From 8d0347b57166cc14a2c6668742d801d5d2828772 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Fri, 5 Jun 2015 00:01:10 -0400 Subject: [PATCH 0037/1048] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index a4c877e86..890dde457 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 3) -set(CMake_VERSION_PATCH 20150604) +set(CMake_VERSION_PATCH 20150605) #set(CMake_VERSION_RC 1) From cdf2cba3e71b92c5bddf7afe760c131953f999a4 Mon Sep 17 00:00:00 2001 From: Nils Gladitz Date: Thu, 4 Jun 2015 15:48:03 +0200 Subject: [PATCH 0038/1048] VS: Use cmUuid RFC 4122 compliant hash based UUID generation --- Source/cmGlobalVisualStudio7Generator.cxx | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index a24204615..0ced24569 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -15,6 +15,7 @@ #include "cmGeneratedFileStream.h" #include "cmLocalVisualStudio7Generator.h" #include "cmMakefile.h" +#include "cmUuid.h" #include "cmake.h" #include @@ -953,14 +954,15 @@ std::string cmGlobalVisualStudio7Generator::GetGUID(std::string const& name) std::string input = this->CMakeInstance->GetState()->GetBinaryDirectory(); input += "|"; input += name; - std::string md5 = cmSystemTools::ComputeStringMD5(input); - assert(md5.length() == 32); - std::string const& guid = - (md5.substr( 0,8)+"-"+ - md5.substr( 8,4)+"-"+ - md5.substr(12,4)+"-"+ - md5.substr(16,4)+"-"+ - md5.substr(20,12)); + + cmUuid uuidGenerator; + + std::vector uuidNamespace; + uuidGenerator.StringToBinary( + "ee30c4be-5192-4fb0-b335-722a2dffe760", uuidNamespace); + + std::string guid = uuidGenerator.FromMd5(uuidNamespace, input); + return cmSystemTools::UpperCase(guid); } From 50a1bd3df13d47167d55fb1584b2c1bc7235884b Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sat, 6 Jun 2015 00:01:04 -0400 Subject: [PATCH 0039/1048] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 890dde457..29e81a635 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 3) -set(CMake_VERSION_PATCH 20150605) +set(CMake_VERSION_PATCH 20150606) #set(CMake_VERSION_RC 1) From 6d7abb6326d422dabdf72e8486b492ac20f8b347 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 12 Apr 2015 13:15:51 +0200 Subject: [PATCH 0040/1048] cmOutputConverter: Extract from cmLocalGenerator. The Convert methods never belonged to the local generator concept, so split them out now. The cmOutputConverter is cheap to construct and destroy, so it can be instantiated where needed to perform conversions. This will allow further decoupling of cmLocalGenerator from the configure step. Inherit cmLocalGenerator from cmOutputConverter for the purpose of source compatibility. --- Source/CMakeLists.txt | 2 + Source/cmLocalGenerator.cxx | 418 +------------------------------- Source/cmLocalGenerator.h | 82 +------ Source/cmOutputConverter.cxx | 447 +++++++++++++++++++++++++++++++++++ Source/cmOutputConverter.h | 106 +++++++++ bootstrap | 1 + 6 files changed, 559 insertions(+), 497 deletions(-) create mode 100644 Source/cmOutputConverter.cxx create mode 100644 Source/cmOutputConverter.h diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index a7adb5125..b434327ae 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -299,6 +299,8 @@ set(SRCS cmMakefileUtilityTargetGenerator.cxx cmOSXBundleGenerator.cxx cmOSXBundleGenerator.h + cmOutputConverter.cxx + cmOutputConverter.h cmNewLineStyle.h cmNewLineStyle.cxx cmOrderDirectories.cxx diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index fe71d0fb4..f8d1bee83 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -46,7 +46,7 @@ cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg, cmLocalGenerator* parent, cmState::Snapshot snapshot) - : StateSnapshot(snapshot) + : cmOutputConverter(snapshot), StateSnapshot(snapshot) { assert(snapshot.IsValid()); this->GlobalGenerator = gg; @@ -58,7 +58,6 @@ cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg, this->Makefile = new cmMakefile(this); - this->LinkScriptShell = false; this->EmitUniversalBinaryFlags = true; this->BackwardsCompatibility = 0; this->BackwardsCompatibilityFinal = false; @@ -1095,58 +1094,6 @@ void cmLocalGenerator::InsertRuleLauncher(std::string& s, cmTarget* target, } } -//---------------------------------------------------------------------------- -std::string -cmLocalGenerator::ConvertToOutputForExistingCommon(const std::string& remote, - std::string const& result, - OutputFormat format) -{ - // If this is a windows shell, the result has a space, and the path - // already exists, we can use a short-path to reference it without a - // space. - if(this->GetState()->UseWindowsShell() && result.find(' ') != result.npos && - cmSystemTools::FileExists(remote.c_str())) - { - std::string tmp; - if(cmSystemTools::GetShortPath(remote, tmp)) - { - return this->ConvertToOutputFormat(tmp, format); - } - } - - // Otherwise, leave it unchanged. - return result; -} - -//---------------------------------------------------------------------------- -std::string -cmLocalGenerator::ConvertToOutputForExisting(const std::string& remote, - RelativeRoot local, - OutputFormat format) -{ - static_cast(local); - - // Perform standard conversion. - std::string result = this->ConvertToOutputFormat(remote, format); - - // Consider short-path. - return this->ConvertToOutputForExistingCommon(remote, result, format); -} - -//---------------------------------------------------------------------------- -std::string -cmLocalGenerator::ConvertToOutputForExisting(RelativeRoot remote, - const std::string& local, - OutputFormat format) -{ - // Perform standard conversion. - std::string result = this->Convert(remote, local, format, true); - - // Consider short-path. - const char* remotePath = this->GetRelativeRootPath(remote); - return this->ConvertToOutputForExistingCommon(remotePath, result, format); -} - //---------------------------------------------------------------------------- std::string cmLocalGenerator::ConvertToIncludeReference(std::string const& path, @@ -2603,225 +2550,6 @@ cmLocalGenerator::ConstructComment(cmCustomCommandGenerator const& ccg, return default_comment; } -//---------------------------------------------------------------------------- -const char* cmLocalGenerator::GetRelativeRootPath(RelativeRoot relroot) -{ - switch (relroot) - { - case HOME: return this->GetState()->GetSourceDirectory(); - case START: return this->StateSnapshot.GetCurrentSourceDirectory(); - case HOME_OUTPUT: return this->GetState()->GetBinaryDirectory(); - case START_OUTPUT: return this->StateSnapshot.GetCurrentBinaryDirectory(); - default: break; - } - return 0; -} - -//---------------------------------------------------------------------------- -std::string cmLocalGenerator::Convert(const std::string& source, - RelativeRoot relative, - OutputFormat output) -{ - std::string result = source; - - switch (relative) - { - case HOME: - result = this->ConvertToRelativePath( - this->GetState()->GetSourceDirectoryComponents(), result); - break; - case START: - result = this->ConvertToRelativePath( - this->StateSnapshot.GetCurrentSourceDirectoryComponents(), result); - break; - case HOME_OUTPUT: - result = this->ConvertToRelativePath( - this->GetState()->GetBinaryDirectoryComponents(), result); - break; - case START_OUTPUT: - result = this->ConvertToRelativePath( - this->StateSnapshot.GetCurrentBinaryDirectoryComponents(), result); - break; - case FULL: - result = cmSystemTools::CollapseFullPath(result); - break; - case NONE: - break; - - } - return this->ConvertToOutputFormat(result, output); -} - -//---------------------------------------------------------------------------- -std::string cmLocalGenerator::ConvertToOutputFormat(const std::string& source, - OutputFormat output) -{ - std::string result = source; - // Convert it to an output path. - if (output == MAKERULE) - { - result = cmSystemTools::ConvertToOutputPath(result.c_str()); - } - else if(output == SHELL || output == WATCOMQUOTE) - { - // For the MSYS shell convert drive letters to posix paths, so - // that c:/some/path becomes /c/some/path. This is needed to - // avoid problems with the shell path translation. - if(this->GetState()->UseMSYSShell() && !this->LinkScriptShell) - { - if(result.size() > 2 && result[1] == ':') - { - result[1] = result[0]; - result[0] = '/'; - } - } - if(this->GetState()->UseWindowsShell()) - { - std::replace(result.begin(), result.end(), '/', '\\'); - } - result = this->EscapeForShell(result, true, false, output == WATCOMQUOTE); - } - else if(output == RESPONSE) - { - result = this->EscapeForShell(result, false, false, false); - } - return result; -} - -//---------------------------------------------------------------------------- -std::string cmLocalGenerator::Convert(RelativeRoot remote, - const std::string& local, - OutputFormat output, bool optional) -{ - const char* remotePath = this->GetRelativeRootPath(remote); - - // The relative root must have a path (i.e. not FULL or NONE) - assert(remotePath != 0); - - if(!local.empty() && !optional) - { - std::vector components; - cmSystemTools::SplitPath(local, components); - std::string result = this->ConvertToRelativePath(components, remotePath); - return this->ConvertToOutputFormat(result, output); - } - else - { - return this->ConvertToOutputFormat(remotePath, output); - } -} - -//---------------------------------------------------------------------------- -static bool cmLocalGeneratorNotAbove(const char* a, const char* b) -{ - return (cmSystemTools::ComparePath(a, b) || - cmSystemTools::IsSubDirectory(a, b)); -} - -//---------------------------------------------------------------------------- -std::string -cmLocalGenerator::ConvertToRelativePath(const std::vector& local, - const std::string& in_remote, - bool force) -{ - // The path should never be quoted. - assert(in_remote[0] != '\"'); - - // The local path should never have a trailing slash. - assert(!local.empty() && !(local[local.size()-1] == "")); - - // If the path is already relative then just return the path. - if(!cmSystemTools::FileIsFullPath(in_remote.c_str())) - { - return in_remote; - } - - if(!force) - { - // Skip conversion if the path and local are not both in the source - // or both in the binary tree. - std::string local_path = cmSystemTools::JoinPath(local); - if(!((cmLocalGeneratorNotAbove(local_path.c_str(), - this->StateSnapshot.GetRelativePathTopBinary()) && - cmLocalGeneratorNotAbove(in_remote.c_str(), - this->StateSnapshot.GetRelativePathTopBinary())) || - (cmLocalGeneratorNotAbove(local_path.c_str(), - this->StateSnapshot.GetRelativePathTopSource()) && - cmLocalGeneratorNotAbove(in_remote.c_str(), - this->StateSnapshot.GetRelativePathTopSource())))) - { - return in_remote; - } - } - - // Identify the longest shared path component between the remote - // path and the local path. - std::vector remote; - cmSystemTools::SplitPath(in_remote, remote); - unsigned int common=0; - while(common < remote.size() && - common < local.size() && - cmSystemTools::ComparePath(remote[common], - local[common])) - { - ++common; - } - - // If no part of the path is in common then return the full path. - if(common == 0) - { - return in_remote; - } - - // If the entire path is in common then just return a ".". - if(common == remote.size() && - common == local.size()) - { - return "."; - } - - // If the entire path is in common except for a trailing slash then - // just return a "./". - if(common+1 == remote.size() && - remote[common].empty() && - common == local.size()) - { - return "./"; - } - - // Construct the relative path. - std::string relative; - - // First add enough ../ to get up to the level of the shared portion - // of the path. Leave off the trailing slash. Note that the last - // component of local will never be empty because local should never - // have a trailing slash. - for(unsigned int i=common; i < local.size(); ++i) - { - relative += ".."; - if(i < local.size()-1) - { - relative += "/"; - } - } - - // Now add the portion of the destination path that is not included - // in the shared portion of the path. Add a slash the first time - // only if there was already something in the path. If there was a - // trailing slash in the input then the last iteration of the loop - // will add a slash followed by an empty string which will preserve - // the trailing slash in the output. - - if(!relative.empty() && !remote.empty()) - { - relative += "/"; - } - relative += cmJoin(cmRange(remote).advance(common), "/"); - - // Finally return the path. - return relative; -} - //---------------------------------------------------------------------------- class cmInstallTargetGeneratorLocal: public cmInstallTargetGenerator { @@ -3214,150 +2942,6 @@ cmLocalGenerator return source.GetLanguage(); } -//---------------------------------------------------------------------------- -static bool cmLocalGeneratorIsShellOperator(const std::string& str) -{ - static std::set shellOperators; - if(shellOperators.empty()) - { - shellOperators.insert("<"); - shellOperators.insert(">"); - shellOperators.insert("<<"); - shellOperators.insert(">>"); - shellOperators.insert("|"); - shellOperators.insert("||"); - shellOperators.insert("&&"); - shellOperators.insert("&>"); - shellOperators.insert("1>"); - shellOperators.insert("2>"); - shellOperators.insert("2>&1"); - shellOperators.insert("1>&2"); - } - return shellOperators.count(str) > 0; -} - -//---------------------------------------------------------------------------- -std::string cmLocalGenerator::EscapeForShell(const std::string& str, - bool makeVars, - bool forEcho, - bool useWatcomQuote) -{ - // Do not escape shell operators. - if(cmLocalGeneratorIsShellOperator(str)) - { - return str; - } - - // Compute the flags for the target shell environment. - int flags = 0; - if(this->GetState()->UseWindowsVSIDE()) - { - flags |= cmsysSystem_Shell_Flag_VSIDE; - } - else if(!this->LinkScriptShell) - { - flags |= cmsysSystem_Shell_Flag_Make; - } - if(makeVars) - { - flags |= cmsysSystem_Shell_Flag_AllowMakeVariables; - } - if(forEcho) - { - flags |= cmsysSystem_Shell_Flag_EchoWindows; - } - if(useWatcomQuote) - { - flags |= cmsysSystem_Shell_Flag_WatcomQuote; - } - if(this->GetState()->UseWatcomWMake()) - { - flags |= cmsysSystem_Shell_Flag_WatcomWMake; - } - if(this->GetState()->UseMinGWMake()) - { - flags |= cmsysSystem_Shell_Flag_MinGWMake; - } - if(this->GetState()->UseNMake()) - { - flags |= cmsysSystem_Shell_Flag_NMake; - } - - // Compute the buffer size needed. - int size = (this->GetState()->UseWindowsShell() ? - cmsysSystem_Shell_GetArgumentSizeForWindows(str.c_str(), flags) : - cmsysSystem_Shell_GetArgumentSizeForUnix(str.c_str(), flags)); - - // Compute the shell argument itself. - std::vector arg(size); - if(this->GetState()->UseWindowsShell()) - { - cmsysSystem_Shell_GetArgumentForWindows(str.c_str(), &arg[0], flags); - } - else - { - cmsysSystem_Shell_GetArgumentForUnix(str.c_str(), &arg[0], flags); - } - return std::string(&arg[0]); -} - -//---------------------------------------------------------------------------- -std::string cmLocalGenerator::EscapeForCMake(const std::string& str) -{ - // Always double-quote the argument to take care of most escapes. - std::string result = "\""; - for(const char* c = str.c_str(); *c; ++c) - { - if(*c == '"') - { - // Escape the double quote to avoid ending the argument. - result += "\\\""; - } - else if(*c == '$') - { - // Escape the dollar to avoid expanding variables. - result += "\\$"; - } - else if(*c == '\\') - { - // Escape the backslash to avoid other escapes. - result += "\\\\"; - } - else - { - // Other characters will be parsed correctly. - result += *c; - } - } - result += "\""; - return result; -} - -//---------------------------------------------------------------------------- -cmLocalGenerator::FortranFormat -cmLocalGenerator::GetFortranFormat(const char* value) -{ - FortranFormat format = FortranFormatNone; - if(value && *value) - { - std::vector fmt; - cmSystemTools::ExpandListArgument(value, fmt); - for(std::vector::iterator fi = fmt.begin(); - fi != fmt.end(); ++fi) - { - if(*fi == "FIXED") - { - format = FortranFormatFixed; - } - if(*fi == "FREE") - { - format = FortranFormatFree; - } - } - } - return format; -} - //---------------------------------------------------------------------------- std::string cmLocalGenerator::GetTargetDirectory(cmTarget const&) const diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 1359dd6ba..583159f05 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -14,6 +14,7 @@ #include "cmStandardIncludes.h" #include "cmState.h" +#include "cmOutputConverter.h" class cmMakefile; class cmGlobalGenerator; @@ -31,7 +32,7 @@ class cmCustomCommandGenerator; * platforms. This class should never be constructed directly. A * GlobalGenerator will create it and invoke the appropriate commands on it. */ -class cmLocalGenerator +class cmLocalGenerator : public cmOutputConverter { public: cmLocalGenerator(cmGlobalGenerator* gg, cmLocalGenerator* parent, @@ -90,35 +91,6 @@ public: cmState* GetState() const; cmState::Snapshot GetStateSnapshot() const; - /** - * Convert something to something else. This is a centralized conversion - * routine used by the generators to handle relative paths and the like. - * The flags determine what is actually done. - * - * relative: treat the argument as a directory and convert it to make it - * relative or full or unchanged. If relative (HOME, START etc) then that - * specifies what it should be relative to. - * - * output: make the result suitable for output to a... - * - * optional: should any relative path operation be controlled by the rel - * path setting - */ - enum RelativeRoot { NONE, FULL, HOME, START, HOME_OUTPUT, START_OUTPUT }; - enum OutputFormat { UNCHANGED, MAKERULE, SHELL, WATCOMQUOTE, RESPONSE }; - std::string ConvertToOutputFormat(const std::string& source, - OutputFormat output); - std::string Convert(const std::string& remote, RelativeRoot local, - OutputFormat output = UNCHANGED); - std::string Convert(RelativeRoot remote, const std::string& local, - OutputFormat output = UNCHANGED, - bool optional = false); - - /** - * Get path for the specified relative root. - */ - const char* GetRelativeRootPath(RelativeRoot relroot); - ///! set/get the parent generator cmLocalGenerator* GetParent() const {return this->Parent;} @@ -194,17 +166,6 @@ public: bool GetRealDependency(const std::string& name, const std::string& config, std::string& dep); - ///! for existing files convert to output path and short path if spaces - std::string ConvertToOutputForExisting(const std::string& remote, - RelativeRoot local = START_OUTPUT, - OutputFormat format = SHELL); - - /** For existing path identified by RelativeRoot convert to output - path and short path if spaces. */ - std::string ConvertToOutputForExisting(RelativeRoot remote, - const std::string& local = "", - OutputFormat format = SHELL); - virtual std::string ConvertToIncludeReference(std::string const& path, OutputFormat format = SHELL, bool forceFullPaths = false); @@ -276,40 +237,6 @@ public: const char* FilterPrefix; }; - /** Set whether to treat conversions to SHELL as a link script shell. */ - void SetLinkScriptShell(bool b) { this->LinkScriptShell = b; } - - /** Escape the given string to be used as a command line argument in - the native build system shell. Optionally allow the build - system to replace make variable references. Optionally adjust - escapes for the special case of passing to the native echo - command. */ - std::string EscapeForShell(const std::string& str, bool makeVars = false, - bool forEcho = false, - bool useWatcomQuote = false); - - /** Escape the given string as an argument in a CMake script. */ - static std::string EscapeForCMake(const std::string& str); - - enum FortranFormat - { - FortranFormatNone, - FortranFormatFixed, - FortranFormatFree - }; - FortranFormat GetFortranFormat(const char* value); - - /** - * Convert the given remote path to a relative path with respect to - * the given local path. The local path must be given in component - * form (see SystemTools::SplitPath) without a trailing slash. The - * remote path must use forward slashes and not already be escaped - * or quoted. - */ - std::string ConvertToRelativePath(const std::vector& local, - const std::string& remote, - bool force=false); - /** * Get the relative path from the generator output directory to a * per-target support directory. @@ -442,7 +369,6 @@ protected: std::set WarnCMP0063; - bool LinkScriptShell; bool EmitUniversalBinaryFlags; // Hack for ExpandRuleVariable until object-oriented version is @@ -452,10 +378,6 @@ protected: cmIML_INT_uint64_t BackwardsCompatibility; bool BackwardsCompatibilityFinal; private: - std::string ConvertToOutputForExistingCommon(const std::string& remote, - std::string const& result, - OutputFormat format); - void AddSharedFlags(std::string& flags, const std::string& lang, bool shared); bool GetShouldUseOldFlags(bool shared, const std::string &lang) const; diff --git a/Source/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx new file mode 100644 index 000000000..db73a3438 --- /dev/null +++ b/Source/cmOutputConverter.cxx @@ -0,0 +1,447 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2009 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#include "cmOutputConverter.h" + +#include "cmAlgorithms.h" +#include "cmake.h" + +#include + +#include + +cmOutputConverter::cmOutputConverter(cmState::Snapshot snapshot) + : StateSnapshot(snapshot), LinkScriptShell(false) +{ +} + +//---------------------------------------------------------------------------- +std::string +cmOutputConverter::ConvertToOutputForExistingCommon(const std::string& remote, + std::string const& result, + OutputFormat format) +{ + // If this is a windows shell, the result has a space, and the path + // already exists, we can use a short-path to reference it without a + // space. + if(this->GetState()->UseWindowsShell() && result.find(' ') != result.npos && + cmSystemTools::FileExists(remote.c_str())) + { + std::string tmp; + if(cmSystemTools::GetShortPath(remote, tmp)) + { + return this->ConvertToOutputFormat(tmp, format); + } + } + + // Otherwise, leave it unchanged. + return result; +} + +//---------------------------------------------------------------------------- +std::string +cmOutputConverter::ConvertToOutputForExisting(const std::string& remote, + RelativeRoot local, + OutputFormat format) +{ + static_cast(local); + + // Perform standard conversion. + std::string result = this->ConvertToOutputFormat(remote, format); + + // Consider short-path. + return this->ConvertToOutputForExistingCommon(remote, result, format); +} + +//---------------------------------------------------------------------------- +std::string +cmOutputConverter::ConvertToOutputForExisting(RelativeRoot remote, + const std::string& local, + OutputFormat format) +{ + // Perform standard conversion. + std::string result = this->Convert(remote, local, format, true); + + // Consider short-path. + const char* remotePath = this->GetRelativeRootPath(remote); + return this->ConvertToOutputForExistingCommon(remotePath, result, format); +} + +//---------------------------------------------------------------------------- +const char* cmOutputConverter::GetRelativeRootPath(RelativeRoot relroot) +{ + switch (relroot) + { + case HOME: return this->GetState()->GetSourceDirectory(); + case START: return this->StateSnapshot.GetCurrentSourceDirectory(); + case HOME_OUTPUT: return this->GetState()->GetBinaryDirectory(); + case START_OUTPUT: return this->StateSnapshot.GetCurrentBinaryDirectory(); + default: break; + } + return 0; +} + +std::string cmOutputConverter::Convert(const std::string& source, + RelativeRoot relative, + OutputFormat output) +{ + // Convert the path to a relative path. + std::string result = source; + + switch (relative) + { + case HOME: + result = this->ConvertToRelativePath( + this->GetState()->GetSourceDirectoryComponents(), result); + break; + case START: + result = this->ConvertToRelativePath( + this->StateSnapshot.GetCurrentSourceDirectoryComponents(), result); + break; + case HOME_OUTPUT: + result = this->ConvertToRelativePath( + this->GetState()->GetBinaryDirectoryComponents(), result); + break; + case START_OUTPUT: + result = this->ConvertToRelativePath( + this->StateSnapshot.GetCurrentBinaryDirectoryComponents(), result); + break; + case FULL: + result = cmSystemTools::CollapseFullPath(result); + break; + case NONE: + break; + } + return this->ConvertToOutputFormat(result, output); +} + +//---------------------------------------------------------------------------- +std::string cmOutputConverter::ConvertToOutputFormat(const std::string& source, + OutputFormat output) +{ + std::string result = source; + // Convert it to an output path. + if (output == MAKERULE) + { + result = cmSystemTools::ConvertToOutputPath(result.c_str()); + } + else if(output == SHELL || output == WATCOMQUOTE) + { + // For the MSYS shell convert drive letters to posix paths, so + // that c:/some/path becomes /c/some/path. This is needed to + // avoid problems with the shell path translation. + if(this->GetState()->UseMSYSShell() && !this->LinkScriptShell) + { + if(result.size() > 2 && result[1] == ':') + { + result[1] = result[0]; + result[0] = '/'; + } + } + if(this->GetState()->UseWindowsShell()) + { + std::replace(result.begin(), result.end(), '/', '\\'); + } + result = this->EscapeForShell(result, true, false, output == WATCOMQUOTE); + } + else if(output == RESPONSE) + { + result = this->EscapeForShell(result, false, false, false); + } + return result; +} + +//---------------------------------------------------------------------------- +std::string cmOutputConverter::Convert(RelativeRoot remote, + const std::string& local, + OutputFormat output, + bool optional) +{ + const char* remotePath = this->GetRelativeRootPath(remote); + + // The relative root must have a path (i.e. not FULL or NONE) + assert(remotePath != 0); + + if(!local.empty() && !optional) + { + std::vector components; + cmSystemTools::SplitPath(local, components); + std::string result = this->ConvertToRelativePath(components, remotePath); + return this->ConvertToOutputFormat(result, output); + } + + return this->ConvertToOutputFormat(remotePath, output); +} + +//---------------------------------------------------------------------------- +static bool cmOutputConverterNotAbove(const char* a, const char* b) +{ + return (cmSystemTools::ComparePath(a, b) || + cmSystemTools::IsSubDirectory(a, b)); +} + +//---------------------------------------------------------------------------- +std::string +cmOutputConverter::ConvertToRelativePath(const std::vector& local, + const std::string& in_remote, + bool force) +{ + // The path should never be quoted. + assert(in_remote[0] != '\"'); + + // The local path should never have a trailing slash. + assert(!local.empty() && !(local[local.size()-1] == "")); + + // If the path is already relative then just return the path. + if(!cmSystemTools::FileIsFullPath(in_remote.c_str())) + { + return in_remote; + } + + if(!force) + { + // Skip conversion if the path and local are not both in the source + // or both in the binary tree. + std::string local_path = cmSystemTools::JoinPath(local); + if(!((cmOutputConverterNotAbove(local_path.c_str(), + this->StateSnapshot.GetRelativePathTopBinary()) && + cmOutputConverterNotAbove(in_remote.c_str(), + this->StateSnapshot.GetRelativePathTopBinary())) || + (cmOutputConverterNotAbove(local_path.c_str(), + this->StateSnapshot.GetRelativePathTopSource()) && + cmOutputConverterNotAbove(in_remote.c_str(), + this->StateSnapshot.GetRelativePathTopSource())))) + { + return in_remote; + } + } + + // Identify the longest shared path component between the remote + // path and the local path. + std::vector remote; + cmSystemTools::SplitPath(in_remote, remote); + unsigned int common=0; + while(common < remote.size() && + common < local.size() && + cmSystemTools::ComparePath(remote[common], + local[common])) + { + ++common; + } + + // If no part of the path is in common then return the full path. + if(common == 0) + { + return in_remote; + } + + // If the entire path is in common then just return a ".". + if(common == remote.size() && + common == local.size()) + { + return "."; + } + + // If the entire path is in common except for a trailing slash then + // just return a "./". + if(common+1 == remote.size() && + remote[common].empty() && + common == local.size()) + { + return "./"; + } + + // Construct the relative path. + std::string relative; + + // First add enough ../ to get up to the level of the shared portion + // of the path. Leave off the trailing slash. Note that the last + // component of local will never be empty because local should never + // have a trailing slash. + for(unsigned int i=common; i < local.size(); ++i) + { + relative += ".."; + if(i < local.size()-1) + { + relative += "/"; + } + } + + // Now add the portion of the destination path that is not included + // in the shared portion of the path. Add a slash the first time + // only if there was already something in the path. If there was a + // trailing slash in the input then the last iteration of the loop + // will add a slash followed by an empty string which will preserve + // the trailing slash in the output. + + if(!relative.empty() && !remote.empty()) + { + relative += "/"; + } + relative += cmJoin(cmRange(remote).advance(common), "/"); + + // Finally return the path. + return relative; +} + +//---------------------------------------------------------------------------- +static bool cmOutputConverterIsShellOperator(const std::string& str) +{ + static std::set shellOperators; + if(shellOperators.empty()) + { + shellOperators.insert("<"); + shellOperators.insert(">"); + shellOperators.insert("<<"); + shellOperators.insert(">>"); + shellOperators.insert("|"); + shellOperators.insert("||"); + shellOperators.insert("&&"); + shellOperators.insert("&>"); + shellOperators.insert("1>"); + shellOperators.insert("2>"); + shellOperators.insert("2>&1"); + shellOperators.insert("1>&2"); + } + return shellOperators.count(str) > 0; +} + +//---------------------------------------------------------------------------- +std::string cmOutputConverter::EscapeForShell(const std::string& str, + bool makeVars, + bool forEcho, + bool useWatcomQuote) +{ + // Do not escape shell operators. + if(cmOutputConverterIsShellOperator(str)) + { + return str; + } + + // Compute the flags for the target shell environment. + int flags = 0; + if(this->GetState()->UseWindowsVSIDE()) + { + flags |= cmsysSystem_Shell_Flag_VSIDE; + } + else if(!this->LinkScriptShell) + { + flags |= cmsysSystem_Shell_Flag_Make; + } + if(makeVars) + { + flags |= cmsysSystem_Shell_Flag_AllowMakeVariables; + } + if(forEcho) + { + flags |= cmsysSystem_Shell_Flag_EchoWindows; + } + if(useWatcomQuote) + { + flags |= cmsysSystem_Shell_Flag_WatcomQuote; + } + if(this->GetState()->UseWatcomWMake()) + { + flags |= cmsysSystem_Shell_Flag_WatcomWMake; + } + if(this->GetState()->UseMinGWMake()) + { + flags |= cmsysSystem_Shell_Flag_MinGWMake; + } + if(this->GetState()->UseNMake()) + { + flags |= cmsysSystem_Shell_Flag_NMake; + } + + // Compute the buffer size needed. + int size = (this->GetState()->UseWindowsShell() ? + cmsysSystem_Shell_GetArgumentSizeForWindows(str.c_str(), flags) : + cmsysSystem_Shell_GetArgumentSizeForUnix(str.c_str(), flags)); + + // Compute the shell argument itself. + std::vector arg(size); + if(this->GetState()->UseWindowsShell()) + { + cmsysSystem_Shell_GetArgumentForWindows(str.c_str(), &arg[0], flags); + } + else + { + cmsysSystem_Shell_GetArgumentForUnix(str.c_str(), &arg[0], flags); + } + return std::string(&arg[0]); +} + +//---------------------------------------------------------------------------- +std::string cmOutputConverter::EscapeForCMake(const std::string& str) +{ + // Always double-quote the argument to take care of most escapes. + std::string result = "\""; + for(const char* c = str.c_str(); *c; ++c) + { + if(*c == '"') + { + // Escape the double quote to avoid ending the argument. + result += "\\\""; + } + else if(*c == '$') + { + // Escape the dollar to avoid expanding variables. + result += "\\$"; + } + else if(*c == '\\') + { + // Escape the backslash to avoid other escapes. + result += "\\\\"; + } + else + { + // Other characters will be parsed correctly. + result += *c; + } + } + result += "\""; + return result; +} + +//---------------------------------------------------------------------------- +cmOutputConverter::FortranFormat +cmOutputConverter::GetFortranFormat(const char* value) +{ + FortranFormat format = FortranFormatNone; + if(value && *value) + { + std::vector fmt; + cmSystemTools::ExpandListArgument(value, fmt); + for(std::vector::iterator fi = fmt.begin(); + fi != fmt.end(); ++fi) + { + if(*fi == "FIXED") + { + format = FortranFormatFixed; + } + if(*fi == "FREE") + { + format = FortranFormatFree; + } + } + } + return format; +} + +void cmOutputConverter::SetLinkScriptShell(bool linkScriptShell) +{ + this->LinkScriptShell = linkScriptShell; +} + +cmState* cmOutputConverter::GetState() const +{ + return this->StateSnapshot.GetState(); +} diff --git a/Source/cmOutputConverter.h b/Source/cmOutputConverter.h new file mode 100644 index 000000000..1d3f8c75f --- /dev/null +++ b/Source/cmOutputConverter.h @@ -0,0 +1,106 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2009 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#ifndef cmOutputConverter_h +#define cmOutputConverter_h + +#include "cmStandardIncludes.h" + +#include "cmGlobalGenerator.h" +#include "cmState.h" + +class cmOutputConverter +{ +public: + cmOutputConverter(cmState::Snapshot snapshot); + + /** + * Convert something to something else. This is a centralized conversion + * routine used by the generators to handle relative paths and the like. + * The flags determine what is actually done. + * + * relative: treat the argument as a directory and convert it to make it + * relative or full or unchanged. If relative (HOME, START etc) then that + * specifies what it should be relative to. + * + * output: make the result suitable for output to a... + * + * optional: should any relative path operation be controlled by the rel + * path setting + */ + enum RelativeRoot { NONE, FULL, HOME, START, HOME_OUTPUT, START_OUTPUT }; + enum OutputFormat { UNCHANGED, MAKERULE, SHELL, WATCOMQUOTE, RESPONSE }; + std::string ConvertToOutputFormat(const std::string& source, + OutputFormat output); + std::string Convert(const std::string& remote, RelativeRoot local, + OutputFormat output = UNCHANGED); + std::string Convert(RelativeRoot remote, const std::string& local, + OutputFormat output = UNCHANGED, + bool optional = false); + + /** + * Get path for the specified relative root. + */ + const char* GetRelativeRootPath(RelativeRoot relroot); + + ///! for existing files convert to output path and short path if spaces + std::string ConvertToOutputForExisting(const std::string& remote, + RelativeRoot local = START_OUTPUT, + OutputFormat format = SHELL); + + /** For existing path identified by RelativeRoot convert to output + path and short path if spaces. */ + std::string ConvertToOutputForExisting(RelativeRoot remote, + const std::string& local = "", + OutputFormat format = SHELL); + + void SetLinkScriptShell(bool linkScriptShell); + + std::string EscapeForShell(const std::string& str, + bool makeVars = false, + bool forEcho = false, + bool useWatcomQuote = false); + + static std::string EscapeForCMake(const std::string& str); + + enum FortranFormat + { + FortranFormatNone, + FortranFormatFixed, + FortranFormatFree + }; + static FortranFormat GetFortranFormat(const char* value); + + /** + * Convert the given remote path to a relative path with respect to + * the given local path. The local path must be given in component + * form (see SystemTools::SplitPath) without a trailing slash. The + * remote path must use forward slashes and not already be escaped + * or quoted. + */ + std::string ConvertToRelativePath(const std::vector& local, + const std::string& in_remote, + bool force = false); + +private: + cmState* GetState() const; + + std::string ConvertToOutputForExistingCommon(const std::string& remote, + std::string const& result, + OutputFormat format); + +private: + cmState::Snapshot StateSnapshot; + + bool LinkScriptShell; +}; + +#endif diff --git a/bootstrap b/bootstrap index 14046eeec..98cdcd0a7 100755 --- a/bootstrap +++ b/bootstrap @@ -299,6 +299,7 @@ CMAKE_CXX_SOURCES="\ cmMakefileLibraryTargetGenerator \ cmMakefileTargetGenerator \ cmMakefileUtilityTargetGenerator \ + cmOutputConverter \ cmOSXBundleGenerator \ cmNewLineStyle \ cmBootstrapCommands1 \ From 8680520feab8421f79c9762f1d3b6b92384c0b1e Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 4 Jun 2015 19:42:32 +0200 Subject: [PATCH 0041/1048] cmMakefile: Make the cmState::Snapshot accessible. --- Source/cmMakefile.cxx | 5 +++++ Source/cmMakefile.h | 2 ++ 2 files changed, 7 insertions(+) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index b5d976a9b..06febbfe4 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -4657,6 +4657,11 @@ void cmMakefile::StoreMatches(cmsys::RegularExpression& re) this->MarkVariableAsUsed(nMatchesVariable); } +cmState::Snapshot cmMakefile::GetStateSnapshot() const +{ + return this->StateSnapshot; +} + //---------------------------------------------------------------------------- cmPolicies::PolicyStatus cmMakefile::GetPolicyStatus(cmPolicies::PolicyID id) const diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 431ed086b..fa9f23d13 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -819,6 +819,8 @@ public: void ClearMatches(); void StoreMatches(cmsys::RegularExpression& re); + cmState::Snapshot GetStateSnapshot() const; + protected: // add link libraries and directories to the target void AddGlobalLinkInformation(const std::string& name, cmTarget& target); From 4d8b79ad7e132ff876d131526a03a21c4f424f33 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 4 Jun 2015 19:43:09 +0200 Subject: [PATCH 0042/1048] cmComputeLinkInformation: Port to cmOutputConverter. --- Source/cmComputeLinkInformation.cxx | 6 +++--- Source/cmComputeLinkInformation.h | 2 -- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index e6cbe6026..1f3046aee 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -16,7 +16,7 @@ #include "cmGlobalGenerator.h" #include "cmState.h" -#include "cmLocalGenerator.h" +#include "cmOutputConverter.h" #include "cmMakefile.h" #include "cmTarget.h" #include "cmake.h" @@ -246,7 +246,6 @@ cmComputeLinkInformation // Store context information. this->Target = target; this->Makefile = this->Target->GetMakefile(); - this->LocalGenerator = this->Makefile->GetLocalGenerator(); this->GlobalGenerator = this->Makefile->GetGlobalGenerator(); this->CMakeInstance = this->GlobalGenerator->GetCMakeInstance(); @@ -1395,7 +1394,8 @@ void cmComputeLinkInformation::AddFrameworkItem(std::string const& item) // Add the item using the -framework option. this->Items.push_back(Item("-framework", false)); - fw = this->LocalGenerator->EscapeForShell(fw); + cmOutputConverter converter(this->Makefile->GetStateSnapshot()); + fw = converter.EscapeForShell(fw); this->Items.push_back(Item(fw, false)); } diff --git a/Source/cmComputeLinkInformation.h b/Source/cmComputeLinkInformation.h index 88471413c..56a5c8210 100644 --- a/Source/cmComputeLinkInformation.h +++ b/Source/cmComputeLinkInformation.h @@ -18,7 +18,6 @@ class cmake; class cmGlobalGenerator; -class cmLocalGenerator; class cmMakefile; class cmTarget; class cmOrderDirectories; @@ -75,7 +74,6 @@ private: // Context information. cmTarget const* Target; cmMakefile* Makefile; - cmLocalGenerator* LocalGenerator; cmGlobalGenerator* GlobalGenerator; cmake* CMakeInstance; From 0f2a132437d7a553e20cc0427279c212b428e55d Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 4 Jun 2015 19:45:12 +0200 Subject: [PATCH 0043/1048] cmCommandArgumentParserHelper: Port to cmOutputConverter. --- Source/cmCommandArgumentParserHelper.cxx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Source/cmCommandArgumentParserHelper.cxx b/Source/cmCommandArgumentParserHelper.cxx index bd098a5f5..14e9e5661 100644 --- a/Source/cmCommandArgumentParserHelper.cxx +++ b/Source/cmCommandArgumentParserHelper.cxx @@ -14,7 +14,7 @@ #include "cmSystemTools.h" #include "cmMakefile.h" #include "cmState.h" -#include "cmLocalGenerator.h" +#include "cmOutputConverter.h" #include "cmCommandArgumentLexer.h" @@ -141,8 +141,9 @@ char* cmCommandArgumentParserHelper::ExpandVariable(const char* var) { std::ostringstream msg; cmListFileContext lfc; - lfc.FilePath = this->Makefile->GetLocalGenerator() - ->Convert(this->FileName, cmLocalGenerator::HOME); + cmOutputConverter converter(this->Makefile->GetStateSnapshot()); + lfc.FilePath = converter.Convert(this->FileName, + cmOutputConverter::HOME); lfc.Line = this->FileLine; msg << "uninitialized variable \'" << var << "\'"; From 2f1bd62b2308c234b5c4bc749afa27c7b616bdf1 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 4 Jun 2015 19:47:37 +0200 Subject: [PATCH 0044/1048] cmCustomCommandGenerator: Port to cmOutputConverter. --- Source/cmCustomCommandGenerator.cxx | 7 ++++--- Source/cmCustomCommandGenerator.h | 2 -- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx index d23f81520..11308c682 100644 --- a/Source/cmCustomCommandGenerator.cxx +++ b/Source/cmCustomCommandGenerator.cxx @@ -13,13 +13,13 @@ #include "cmMakefile.h" #include "cmCustomCommand.h" -#include "cmLocalGenerator.h" +#include "cmOutputConverter.h" #include "cmGeneratorExpression.h" //---------------------------------------------------------------------------- cmCustomCommandGenerator::cmCustomCommandGenerator( cmCustomCommand const& cc, const std::string& config, cmMakefile* mf): - CC(cc), Config(config), Makefile(mf), LG(mf->GetLocalGenerator()), + CC(cc), Config(config), Makefile(mf), OldStyle(cc.GetEscapeOldStyle()), MakeVars(cc.GetEscapeAllowMakeVars()), GE(new cmGeneratorExpression(&cc.GetBacktrace())), DependsDone(false) { @@ -96,7 +96,8 @@ cmCustomCommandGenerator } else { - cmd += this->LG->EscapeForShell(arg, this->MakeVars); + cmOutputConverter converter(this->Makefile->GetStateSnapshot()); + cmd += converter.EscapeForShell(arg, this->MakeVars); } } } diff --git a/Source/cmCustomCommandGenerator.h b/Source/cmCustomCommandGenerator.h index b4ae0142b..7ad95d1d8 100644 --- a/Source/cmCustomCommandGenerator.h +++ b/Source/cmCustomCommandGenerator.h @@ -16,7 +16,6 @@ class cmCustomCommand; class cmMakefile; -class cmLocalGenerator; class cmGeneratorExpression; class cmCustomCommandGenerator @@ -24,7 +23,6 @@ class cmCustomCommandGenerator cmCustomCommand const& CC; std::string Config; cmMakefile* Makefile; - cmLocalGenerator* LG; bool OldStyle; bool MakeVars; cmGeneratorExpression* GE; From 1cff330b0fcd635f47047bd1a2d94f344e88c0f9 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 4 Jun 2015 20:12:17 +0200 Subject: [PATCH 0045/1048] cmTarget: Port to cmOutputConverter. --- Source/cmTarget.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 443696658..27c484572 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -13,7 +13,7 @@ #include "cmake.h" #include "cmMakefile.h" #include "cmSourceFile.h" -#include "cmLocalGenerator.h" +#include "cmOutputConverter.h" #include "cmGlobalGenerator.h" #include "cmComputeLinkInformation.h" #include "cmListFileCache.h" @@ -1257,14 +1257,14 @@ void cmTarget::GetTllSignatureTraces(std::ostringstream &s, : "plain"); s << "The uses of the " << sigString << " signature are here:\n"; typedef std::vector > Container; - cmLocalGenerator* lg = this->GetMakefile()->GetLocalGenerator(); + cmOutputConverter converter(this->GetMakefile()->GetStateSnapshot()); for(Container::const_iterator it = this->TLLCommands.begin(); it != this->TLLCommands.end(); ++it) { if (it->first == sig) { cmListFileContext lfc = it->second; - lfc.FilePath = lg->Convert(lfc.FilePath, cmLocalGenerator::HOME); + lfc.FilePath = converter.Convert(lfc.FilePath, cmOutputConverter::HOME); s << " * " << lfc << std::endl; } } From 242dcc2c22535c00348de18bba41605428ccdb73 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 4 Jun 2015 20:00:14 +0200 Subject: [PATCH 0046/1048] cmListFileBacktrace: Replace local generator with cmState::Snapshot. Construct cmOutputConverter only when needed. --- Source/cmListFileCache.cxx | 8 ++++---- Source/cmListFileCache.h | 8 ++++---- Source/cmMakefile.cxx | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx index ffe1a1ff9..ca583145a 100644 --- a/Source/cmListFileCache.cxx +++ b/Source/cmListFileCache.cxx @@ -412,9 +412,9 @@ void cmListFileBacktrace::PrintTitle(std::ostream& out) return; } + cmOutputConverter converter(this->Snapshot); cmListFileContext lfc = this->front(); - lfc.FilePath = this->LocalGenerator->Convert(lfc.FilePath, - cmLocalGenerator::HOME); + lfc.FilePath = converter.Convert(lfc.FilePath, cmOutputConverter::HOME); out << (lfc.Line ? " at " : " in ") << lfc; } @@ -425,13 +425,13 @@ void cmListFileBacktrace::PrintCallStack(std::ostream& out) return; } + cmOutputConverter converter(this->Snapshot); const_iterator i = this->begin() + 1; out << "Call Stack (most recent call first):\n"; while(i != this->end()) { cmListFileContext lfc = *i; - lfc.FilePath = this->LocalGenerator->Convert(lfc.FilePath, - cmLocalGenerator::HOME); + lfc.FilePath = converter.Convert(lfc.FilePath, cmOutputConverter::HOME); out << " " << lfc << "\n"; ++i; } diff --git a/Source/cmListFileCache.h b/Source/cmListFileCache.h index 1971862a7..4002d94b0 100644 --- a/Source/cmListFileCache.h +++ b/Source/cmListFileCache.h @@ -14,7 +14,7 @@ #include "cmStandardIncludes.h" -class cmLocalGenerator; +#include "cmState.h" /** \class cmListFileCache * \brief A class to cache list file contents. @@ -74,8 +74,8 @@ struct cmListFileFunction: public cmListFileContext class cmListFileBacktrace: private std::vector { public: - cmListFileBacktrace(cmLocalGenerator* localGen = 0) - : LocalGenerator(localGen) + cmListFileBacktrace(cmState::Snapshot snapshot = cmState::Snapshot()) + : Snapshot(snapshot) { } @@ -84,7 +84,7 @@ class cmListFileBacktrace: private std::vector void PrintTitle(std::ostream& out); void PrintCallStack(std::ostream& out); private: - cmLocalGenerator* LocalGenerator; + cmState::Snapshot Snapshot; }; struct cmListFile diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 06febbfe4..f55b5dfeb 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -277,7 +277,7 @@ void cmMakefile::IssueMessage(cmake::MessageType t, //---------------------------------------------------------------------------- cmListFileBacktrace cmMakefile::GetBacktrace() const { - cmListFileBacktrace backtrace(this->GetLocalGenerator()); + cmListFileBacktrace backtrace(this->StateSnapshot); for(CallStackType::const_reverse_iterator i = this->CallStack.rbegin(); i != this->CallStack.rend(); ++i) { @@ -290,7 +290,7 @@ cmListFileBacktrace cmMakefile::GetBacktrace() const cmListFileBacktrace cmMakefile::GetBacktrace(cmListFileContext const& lfc) const { - cmListFileBacktrace backtrace(this->GetLocalGenerator()); + cmListFileBacktrace backtrace(this->StateSnapshot); backtrace.Append(lfc); for(CallStackType::const_reverse_iterator i = this->CallStack.rbegin(); i != this->CallStack.rend(); ++i) From 59e21ffa134faf0b089d9a704b3763e7f6f237d5 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 16 May 2015 00:55:21 +0200 Subject: [PATCH 0047/1048] Port static calls from cmLocalGenerator to cmOutputConverter. --- Source/cmCPackPropertiesGenerator.cxx | 8 ++--- Source/cmCoreTryCompile.cxx | 6 ++-- Source/cmIfCommand.cxx | 2 +- Source/cmLocalUnixMakefileGenerator3.cxx | 6 ++-- Source/cmMakefileTargetGenerator.cxx | 4 +-- Source/cmQtAutoGenerators.cxx | 40 ++++++++++++------------ Source/cmTestGenerator.cxx | 14 ++++----- 7 files changed, 40 insertions(+), 40 deletions(-) diff --git a/Source/cmCPackPropertiesGenerator.cxx b/Source/cmCPackPropertiesGenerator.cxx index cf24c136f..368a0e6de 100644 --- a/Source/cmCPackPropertiesGenerator.cxx +++ b/Source/cmCPackPropertiesGenerator.cxx @@ -1,6 +1,6 @@ #include "cmCPackPropertiesGenerator.h" -#include "cmLocalGenerator.h" +#include "cmOutputConverter.h" cmCPackPropertiesGenerator::cmCPackPropertiesGenerator( cmMakefile* mf, @@ -29,15 +29,15 @@ void cmCPackPropertiesGenerator::GenerateScriptForConfig(std::ostream& os, cmInstalledFile::Property const& property = i->second; os << indent << "set_property(INSTALL " << - cmLocalGenerator::EscapeForCMake(expandedFileName) << " PROPERTY " << - cmLocalGenerator::EscapeForCMake(name); + cmOutputConverter::EscapeForCMake(expandedFileName) << " PROPERTY " << + cmOutputConverter::EscapeForCMake(name); for(cmInstalledFile::ExpressionVectorType::const_iterator j = property.ValueExpressions.begin(); j != property.ValueExpressions.end(); ++j) { std::string value = (*j)->Evaluate(this->Makefile, config); - os << " " << cmLocalGenerator::EscapeForCMake(value); + os << " " << cmOutputConverter::EscapeForCMake(value); } os << ")\n"; diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index dd276a8a1..e1e1a5cf8 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -11,7 +11,7 @@ ============================================================================*/ #include "cmCoreTryCompile.h" #include "cmake.h" -#include "cmLocalGenerator.h" +#include "cmOutputConverter.h" #include "cmGlobalGenerator.h" #include "cmAlgorithms.h" #include "cmExportTryCompileFileGenerator.h" @@ -322,7 +322,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv) std::string langFlags = "CMAKE_" + *li + "_FLAGS"; const char* flags = this->Makefile->GetDefinition(langFlags); fprintf(fout, "set(CMAKE_%s_FLAGS %s)\n", li->c_str(), - cmLocalGenerator::EscapeForCMake(flags?flags:"").c_str()); + cmOutputConverter::EscapeForCMake(flags?flags:"").c_str()); fprintf(fout, "set(CMAKE_%s_FLAGS \"${CMAKE_%s_FLAGS}" " ${COMPILE_DEFINITIONS}\")\n", li->c_str(), li->c_str()); } @@ -355,7 +355,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv) const char* exeLinkFlags = this->Makefile->GetDefinition("CMAKE_EXE_LINKER_FLAGS"); fprintf(fout, "set(CMAKE_EXE_LINKER_FLAGS %s)\n", - cmLocalGenerator::EscapeForCMake( + cmOutputConverter::EscapeForCMake( exeLinkFlags ? exeLinkFlags : "").c_str()); } break; } diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx index 7c4792ca9..20448c163 100644 --- a/Source/cmIfCommand.cxx +++ b/Source/cmIfCommand.cxx @@ -27,7 +27,7 @@ static std::string cmIfCommandError( i != args.end(); ++i) { err += " "; - err += cmLocalGenerator::EscapeForCMake(i->GetValue()); + err += cmOutputConverter::EscapeForCMake(i->GetValue()); } err += "\n"; return err; diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index c9eea5665..f1fd806f9 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -1254,7 +1254,7 @@ cmLocalUnixMakefileGenerator3 f != files.end(); ++f) { std::string fc = this->Convert(*f,START_OUTPUT,UNCHANGED); - fout << " " << cmLocalGenerator::EscapeForCMake(fc) << "\n"; + fout << " " << cmOutputConverter::EscapeForCMake(fc) << "\n"; } fout << ")\n"; } @@ -2052,7 +2052,7 @@ void cmLocalUnixMakefileGenerator3 di != defines.end(); ++di) { cmakefileStream - << " " << cmLocalGenerator::EscapeForCMake(*di) << "\n"; + << " " << cmOutputConverter::EscapeForCMake(*di) << "\n"; } cmakefileStream << " )\n"; @@ -2106,7 +2106,7 @@ void cmLocalUnixMakefileGenerator3 tri != transformRules.end(); ++tri) { cmakefileStream << " " - << cmLocalGenerator::EscapeForCMake(*tri) << "\n"; + << cmOutputConverter::EscapeForCMake(*tri) << "\n"; } cmakefileStream << " )\n"; diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 9ac9ddb26..c26bc601d 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -1126,8 +1126,8 @@ void cmMakefileTargetGenerator::WriteTargetDependRules() pi != this->MultipleOutputPairs.end(); ++pi) { *this->InfoFileStream - << " " << cmLocalGenerator::EscapeForCMake(pi->first) - << " " << cmLocalGenerator::EscapeForCMake(pi->second) + << " " << cmOutputConverter::EscapeForCMake(pi->first) + << " " << cmOutputConverter::EscapeForCMake(pi->second) << "\n"; } *this->InfoFileStream << " )\n\n"; diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index fbd294690..ef32c75f7 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -550,9 +550,9 @@ void cmQtAutoGenerators::SetupAutoGenerateTarget(cmTarget const* target) std::string autogenTargetName = getAutogenTargetName(target); makefile->AddDefinition("_moc_target_name", - cmLocalGenerator::EscapeForCMake(autogenTargetName).c_str()); + cmOutputConverter::EscapeForCMake(autogenTargetName).c_str()); makefile->AddDefinition("_origin_target_name", - cmLocalGenerator::EscapeForCMake(target->GetName()).c_str()); + cmOutputConverter::EscapeForCMake(target->GetName()).c_str()); std::string targetDir = getAutogenTargetDir(target); @@ -582,7 +582,7 @@ void cmQtAutoGenerators::SetupAutoGenerateTarget(cmTarget const* target) this->SetupSourceFiles(target); } makefile->AddDefinition("_cpp_files", - cmLocalGenerator::EscapeForCMake(this->Sources).c_str()); + cmOutputConverter::EscapeForCMake(this->Sources).c_str()); if (target->GetPropertyAsBool("AUTOMOC")) { this->SetupAutoMocTarget(target, autogenTargetName, @@ -764,11 +764,11 @@ void cmQtAutoGenerators::SetupAutoMocTarget(cmTarget const* target, const char* tmp = target->GetProperty("AUTOMOC_MOC_OPTIONS"); std::string _moc_options = (tmp!=0 ? tmp : ""); makefile->AddDefinition("_moc_options", - cmLocalGenerator::EscapeForCMake(_moc_options).c_str()); + cmOutputConverter::EscapeForCMake(_moc_options).c_str()); makefile->AddDefinition("_skip_moc", - cmLocalGenerator::EscapeForCMake(this->SkipMoc).c_str()); + cmOutputConverter::EscapeForCMake(this->SkipMoc).c_str()); makefile->AddDefinition("_moc_headers", - cmLocalGenerator::EscapeForCMake(this->Headers).c_str()); + cmOutputConverter::EscapeForCMake(this->Headers).c_str()); bool relaxedMode = makefile->IsOn("CMAKE_AUTOMOC_RELAXED_MODE"); makefile->AddDefinition("_moc_relaxed_mode", relaxedMode ? "TRUE" : "FALSE"); @@ -780,9 +780,9 @@ void cmQtAutoGenerators::SetupAutoMocTarget(cmTarget const* target, _moc_incs, _moc_compile_defs); makefile->AddDefinition("_moc_incs", - cmLocalGenerator::EscapeForCMake(_moc_incs).c_str()); + cmOutputConverter::EscapeForCMake(_moc_incs).c_str()); makefile->AddDefinition("_moc_compile_defs", - cmLocalGenerator::EscapeForCMake(_moc_compile_defs).c_str()); + cmOutputConverter::EscapeForCMake(_moc_compile_defs).c_str()); for (std::vector::const_iterator li = configs.begin(); li != configs.end(); ++li) @@ -795,7 +795,7 @@ void cmQtAutoGenerators::SetupAutoMocTarget(cmTarget const* target, if (config_moc_incs != _moc_incs) { configIncludes[*li] = - cmLocalGenerator::EscapeForCMake(config_moc_incs); + cmOutputConverter::EscapeForCMake(config_moc_incs); if(_moc_incs.empty()) { _moc_incs = config_moc_incs; @@ -804,7 +804,7 @@ void cmQtAutoGenerators::SetupAutoMocTarget(cmTarget const* target, if (config_moc_compile_defs != _moc_compile_defs) { configDefines[*li] = - cmLocalGenerator::EscapeForCMake(config_moc_compile_defs); + cmOutputConverter::EscapeForCMake(config_moc_compile_defs); if(_moc_compile_defs.empty()) { _moc_compile_defs = config_moc_compile_defs; @@ -906,7 +906,7 @@ void cmQtAutoGenerators::SetupAutoUicTarget(cmTarget const* target, skipped.insert(skipVec.begin(), skipVec.end()); makefile->AddDefinition("_skip_uic", - cmLocalGenerator::EscapeForCMake(this->SkipUic).c_str()); + cmOutputConverter::EscapeForCMake(this->SkipUic).c_str()); std::vector uiFilesWithOptions = makefile->GetQtUiFilesWithOptions(); @@ -920,7 +920,7 @@ void cmQtAutoGenerators::SetupAutoUicTarget(cmTarget const* target, if (!_uic_opts.empty()) { - _uic_opts = cmLocalGenerator::EscapeForCMake(_uic_opts); + _uic_opts = cmOutputConverter::EscapeForCMake(_uic_opts); makefile->AddDefinition("_uic_target_options", _uic_opts.c_str()); } for (std::vector::const_iterator li = configs.begin(); @@ -931,7 +931,7 @@ void cmQtAutoGenerators::SetupAutoUicTarget(cmTarget const* target, if (config_uic_opts != _uic_opts) { configUicOptions[*li] = - cmLocalGenerator::EscapeForCMake(config_uic_opts); + cmOutputConverter::EscapeForCMake(config_uic_opts); if(_uic_opts.empty()) { _uic_opts = config_uic_opts; @@ -966,9 +966,9 @@ void cmQtAutoGenerators::SetupAutoUicTarget(cmTarget const* target, } makefile->AddDefinition("_qt_uic_options_files", - cmLocalGenerator::EscapeForCMake(uiFileFiles).c_str()); + cmOutputConverter::EscapeForCMake(uiFileFiles).c_str()); makefile->AddDefinition("_qt_uic_options_options", - cmLocalGenerator::EscapeForCMake(uiFileOptions).c_str()); + cmOutputConverter::EscapeForCMake(uiFileOptions).c_str()); std::string targetName = target->GetName(); if (strcmp(qtVersion, "5") == 0) @@ -1141,15 +1141,15 @@ void cmQtAutoGenerators::SetupAutoRccTarget(cmTarget const* target) } } makefile->AddDefinition("_qt_rcc_inputs_" + target->GetName(), - cmLocalGenerator::EscapeForCMake(qrcInputs).c_str()); + cmOutputConverter::EscapeForCMake(qrcInputs).c_str()); makefile->AddDefinition("_rcc_files", - cmLocalGenerator::EscapeForCMake(_rcc_files).c_str()); + cmOutputConverter::EscapeForCMake(_rcc_files).c_str()); makefile->AddDefinition("_qt_rcc_options_files", - cmLocalGenerator::EscapeForCMake(rccFileFiles).c_str()); + cmOutputConverter::EscapeForCMake(rccFileFiles).c_str()); makefile->AddDefinition("_qt_rcc_options_options", - cmLocalGenerator::EscapeForCMake(rccFileOptions).c_str()); + cmOutputConverter::EscapeForCMake(rccFileOptions).c_str()); makefile->AddDefinition("_qt_rcc_executable", this->GetRccExecutable(target).c_str()); @@ -1434,7 +1434,7 @@ cmQtAutoGenerators::WriteOldMocDefinitionsFile( outfile.open(filename.c_str(), std::ios::trunc); outfile << "set(AM_OLD_COMPILE_SETTINGS " - << cmLocalGenerator::EscapeForCMake( + << cmOutputConverter::EscapeForCMake( this->CurrentCompileSettingsStr) << ")\n"; outfile.close(); diff --git a/Source/cmTestGenerator.cxx b/Source/cmTestGenerator.cxx index 7e11d8c84..546ad71b8 100644 --- a/Source/cmTestGenerator.cxx +++ b/Source/cmTestGenerator.cxx @@ -12,7 +12,7 @@ #include "cmTestGenerator.h" #include "cmGeneratorExpression.h" -#include "cmLocalGenerator.h" +#include "cmOutputConverter.h" #include "cmMakefile.h" #include "cmSystemTools.h" #include "cmTarget.h" @@ -97,13 +97,13 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os, cmSystemTools::ExpandListArgument(emulator, emulatorWithArgs); std::string emulatorExe(emulatorWithArgs[0]); cmSystemTools::ConvertToUnixSlashes(emulatorExe); - os << cmLocalGenerator::EscapeForCMake(emulatorExe) << " "; + os << cmOutputConverter::EscapeForCMake(emulatorExe) << " "; for(std::vector::const_iterator ei = emulatorWithArgs.begin()+1; ei != emulatorWithArgs.end(); ++ei) { - os << cmLocalGenerator::EscapeForCMake(*ei) << " "; + os << cmOutputConverter::EscapeForCMake(*ei) << " "; } } } @@ -115,11 +115,11 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os, } // Generate the command line with full escapes. - os << cmLocalGenerator::EscapeForCMake(exe); + os << cmOutputConverter::EscapeForCMake(exe); for(std::vector::const_iterator ci = command.begin()+1; ci != command.end(); ++ci) { - os << " " << cmLocalGenerator::EscapeForCMake( + os << " " << cmOutputConverter::EscapeForCMake( ge.Parse(*ci)->Evaluate(mf, config)); } @@ -136,7 +136,7 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os, i != pm.end(); ++i) { os << " " << i->first - << " " << cmLocalGenerator::EscapeForCMake( + << " " << cmOutputConverter::EscapeForCMake( ge.Parse(i->second.GetValue())->Evaluate(mf, config)); } os << ")" << std::endl; @@ -206,7 +206,7 @@ void cmTestGenerator::GenerateOldStyle(std::ostream& fout, i != pm.end(); ++i) { fout << " " << i->first - << " " << cmLocalGenerator::EscapeForCMake(i->second.GetValue()); + << " " << cmOutputConverter::EscapeForCMake(i->second.GetValue()); } fout << ")" << std::endl; } From db74ce5820e0d0a99649c6b472de74277e3fa6bf Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 31 May 2015 23:45:52 +0200 Subject: [PATCH 0048/1048] cmMakefile: Inline PushScope into PushFunctionScope. Make it possible to group the various methods here a different way. --- Source/cmMakefile.cxx | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index d3a81218e..207241845 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1564,7 +1564,13 @@ void cmMakefile::InitializeFromParent() void cmMakefile::PushFunctionScope(const cmPolicies::PolicyMap& pm) { - this->PushScope(); + this->Internal->PushDefinitions(); + + this->PushLoopBlockBarrier(); + +#if defined(CMAKE_BUILD_WITH_CMAKE) + this->GetGlobalGenerator()->GetFileLockPool().PushFunctionScope(); +#endif this->PushFunctionBlockerBarrier(); @@ -1579,7 +1585,15 @@ void cmMakefile::PopFunctionScope(bool reportError) this->PopFunctionBlockerBarrier(reportError); - this->PopScope(); +#if defined(CMAKE_BUILD_WITH_CMAKE) + this->GetGlobalGenerator()->GetFileLockPool().PopFunctionScope(); +#endif + + this->PopLoopBlockBarrier(); + + this->CheckForUnusedVariables(); + + this->Internal->PopDefinitions(); } void cmMakefile::PushMacroScope(const cmPolicies::PolicyMap& pm) From 00bfa047481ed9f75444cb4954d7d72f616aef0f Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 31 May 2015 19:03:46 +0200 Subject: [PATCH 0049/1048] cmMakefile: Out-of-line the cmMakefileCall. --- Source/cmMakefile.cxx | 12 ++++++++++++ Source/cmMakefile.h | 11 ++--------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 207241845..d4bf6c12f 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -5494,3 +5494,15 @@ cmMakefile::MacroPushPop::~MacroPushPop() { this->Makefile->PopMacroScope(this->ReportError); } + +cmMakefileCall::cmMakefileCall(cmMakefile* mf, const cmListFileContext& lfc, + cmExecutionStatus& status): Makefile(mf) +{ + cmMakefile::CallStackEntry entry = {&lfc, &status}; + this->Makefile->CallStack.push_back(entry); +} + +cmMakefileCall::~cmMakefileCall() +{ + this->Makefile->CallStack.pop_back(); +} diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 0914a99d4..0b328e932 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -1084,15 +1084,8 @@ class cmMakefileCall public: cmMakefileCall(cmMakefile* mf, cmListFileContext const& lfc, - cmExecutionStatus& status): Makefile(mf) - { - cmMakefile::CallStackEntry entry = {&lfc, &status}; - this->Makefile->CallStack.push_back(entry); - } - ~cmMakefileCall() - { - this->Makefile->CallStack.pop_back(); - } + cmExecutionStatus& status); + ~cmMakefileCall(); private: cmMakefile* Makefile; }; From 353e422b2ad3d51dfc6c6db968ebcece10cbcc8d Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 3 May 2015 00:47:53 +0200 Subject: [PATCH 0050/1048] cmMakefile: Remove unused GetPolicies method. --- Source/cmMakefile.h | 6 ------ Source/cmake.h | 3 --- 2 files changed, 9 deletions(-) diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 0b328e932..85451ad5e 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -14,7 +14,6 @@ #include "cmExecutionStatus.h" #include "cmListFileCache.h" -#include "cmPolicies.h" #include "cmPropertyMap.h" #include "cmSystemTools.h" #include "cmTarget.h" @@ -373,11 +372,6 @@ public: }; friend class PolicyPushPop; - /** - * Get the Policies Instance - */ - cmPolicies *GetPolicies() const; - mutable std::set CMP0054ReportedIds; /** diff --git a/Source/cmake.h b/Source/cmake.h index 0fe7bfcc9..f0f94115c 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -222,9 +222,6 @@ class cmake ///! this is called by generators to update the progress void UpdateProgress(const char *msg, float prog); - ///! get the cmake policies instance - cmPolicies *GetPolicies() {return this->Policies;} - ///! Get the variable watch object cmVariableWatch* GetVariableWatch() { return this->VariableWatch; } From 1981c9718b7099670b03535a241c735477d6bc6c Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 6 Jun 2015 09:17:45 +0200 Subject: [PATCH 0051/1048] cmMakefile: Simplify InitializeFromParent method. Provide a parent instead of requiring it to be computed through the cmLocalGenerator. --- Source/cmMakefile.cxx | 6 ++---- Source/cmMakefile.h | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index d4bf6c12f..3ac77e9ea 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1485,10 +1485,8 @@ void cmMakefile::AddLinkDirectory(const std::string& dir) } } -void cmMakefile::InitializeFromParent() +void cmMakefile::InitializeFromParent(cmMakefile* parent) { - cmMakefile *parent = this->LocalGenerator->GetParent()->GetMakefile(); - // Initialize definitions with the closure of the parent scope. this->Internal->InitializeDefinitions(parent); @@ -1672,7 +1670,7 @@ void cmMakefile::Configure() void cmMakefile::ConfigureSubDirectory(cmMakefile *mf) { - mf->InitializeFromParent(); + mf->InitializeFromParent(this); std::string currentStart = mf->GetCurrentSourceDirectory(); if (this->GetCMakeInstance()->GetDebugOutput()) { diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 85451ad5e..def0c23e9 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -728,7 +728,7 @@ public: cmPropertyMap &GetProperties() { return this->Properties; } ///! Initialize a makefile from its parent - void InitializeFromParent(); + void InitializeFromParent(cmMakefile* parent); void AddInstallGenerator(cmInstallGenerator* g) { if(g) this->InstallGenerators.push_back(g); } From 44a8115797cc3f804d653928d71b126b39e29210 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 6 Jun 2015 09:40:58 +0200 Subject: [PATCH 0052/1048] cmPolicies: Replace UNDEFINED bitset with WARN bitset. Might as well use the existing concept. --- Source/cmPolicies.cxx | 13 +++++-------- Source/cmPolicies.h | 3 +-- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index f8d61db8d..3498adc80 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -343,11 +343,6 @@ cmPolicies::GetRequiredAlwaysPolicyError(cmPolicies::PolicyID id) return e.str(); } -cmPolicies::PolicyMap::PolicyMap() -{ - this->UNDEFINED.set(); -} - cmPolicies::PolicyStatus cmPolicies::PolicyMap::Get(cmPolicies::PolicyID id) const { @@ -375,8 +370,8 @@ cmPolicies::PolicyMap::Get(cmPolicies::PolicyID id) const void cmPolicies::PolicyMap::Set(cmPolicies::PolicyID id, cmPolicies::PolicyStatus status) { - this->UNDEFINED.reset(id); this->OLD[id] = (status == cmPolicies::OLD); + this->WARN[id] = (status == cmPolicies::WARN); this->NEW[id] = (status == cmPolicies::NEW); this->REQUIRED_ALWAYS[id] = (status == cmPolicies::REQUIRED_ALWAYS); this->REQUIRED_IF_USED[id] = (status == cmPolicies::REQUIRED_IF_USED); @@ -384,10 +379,12 @@ void cmPolicies::PolicyMap::Set(cmPolicies::PolicyID id, bool cmPolicies::PolicyMap::IsDefined(cmPolicies::PolicyID id) const { - return !this->UNDEFINED[id]; + return this->OLD[id] || this->WARN[id] || this->NEW[id] + || this->REQUIRED_ALWAYS[id] || this->REQUIRED_IF_USED[id]; } bool cmPolicies::PolicyMap::IsEmpty() const { - return !this->UNDEFINED.none(); + return this->OLD.none() && this->WARN.none() && this->NEW.none() + && this->REQUIRED_ALWAYS.none() && this->REQUIRED_IF_USED.none(); } diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 00d857a63..8c72dfe4a 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -281,15 +281,14 @@ public: /** Represent a set of policy values. */ struct PolicyMap { - PolicyMap(); PolicyStatus Get(PolicyID id) const; void Set(PolicyID id, PolicyStatus status); bool IsDefined(PolicyID id) const; bool IsEmpty() const; private: - std::bitset UNDEFINED; std::bitset OLD; + std::bitset WARN; std::bitset NEW; std::bitset REQUIRED_IF_USED; std::bitset REQUIRED_ALWAYS; From ccbc2259137fe61a770bb0b5538a20bf5e00bc8f Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 6 Jun 2015 15:40:26 +0200 Subject: [PATCH 0053/1048] cmGeneratorTarget: Move Feature API from cmTarget. --- Source/cmGeneratorTarget.cxx | 30 ++++++++++++++++++++++- Source/cmGeneratorTarget.h | 5 ++++ Source/cmGlobalVisualStudio7Generator.cxx | 3 ++- Source/cmMakefileTargetGenerator.cxx | 4 +-- Source/cmNinjaTargetGenerator.cxx | 5 ++-- Source/cmTarget.cxx | 28 --------------------- Source/cmTarget.h | 5 ---- 7 files changed, 41 insertions(+), 39 deletions(-) diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index e2b8c459a..4901820cf 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -352,6 +352,34 @@ void cmGeneratorTarget::ComputeObjectMapping() } } +//---------------------------------------------------------------------------- +const char* cmGeneratorTarget::GetFeature(const std::string& feature, + const std::string& config) const +{ + if(!config.empty()) + { + std::string featureConfig = feature; + featureConfig += "_"; + featureConfig += cmSystemTools::UpperCase(config); + if(const char* value = this->Target->GetProperty(featureConfig)) + { + return value; + } + } + if(const char* value = this->Target->GetProperty(feature)) + { + return value; + } + return this->Makefile->GetFeature(feature, config); +} + +//---------------------------------------------------------------------------- +bool cmGeneratorTarget::GetFeatureAsBool(const std::string& feature, + const std::string& config) const +{ + return cmSystemTools::IsOn(this->GetFeature(feature, config)); +} + //---------------------------------------------------------------------------- const std::string& cmGeneratorTarget::GetObjectName(cmSourceFile const* file) { @@ -983,7 +1011,7 @@ cmGeneratorTarget::GetCreateRuleVariable(std::string const& lang, case cmTarget::STATIC_LIBRARY: { std::string var = "CMAKE_" + lang + "_CREATE_STATIC_LIBRARY"; - if(this->Target->GetFeatureAsBool( + if(this->GetFeatureAsBool( "INTERPROCEDURAL_OPTIMIZATION", config)) { std::string varIPO = var + "_IPO"; diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index c79aa728b..a8edcb8cb 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -67,6 +67,11 @@ public: void ComputeObjectMapping(); + const char* GetFeature(const std::string& feature, + const std::string& config) const; + bool GetFeatureAsBool(const std::string& feature, + const std::string& config) const; + cmTarget* Target; cmMakefile* Makefile; cmLocalGenerator* LocalGenerator; diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index a24204615..f2d58ec6b 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -1023,12 +1023,13 @@ cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild( { return activeConfigs; } + cmGeneratorTarget* gt = this->GetGeneratorTarget(target); // inspect EXCLUDE_FROM_DEFAULT_BUILD[_] properties for(std::vector::const_iterator i = configs.begin(); i != configs.end(); ++i) { const char* propertyValue = - target->GetFeature("EXCLUDE_FROM_DEFAULT_BUILD", i->c_str()); + gt->GetFeature("EXCLUDE_FROM_DEFAULT_BUILD", i->c_str()); if(cmSystemTools::IsOff(propertyValue)) { activeConfigs.insert(*i); diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 9ac9ddb26..b2a10a6c9 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -2086,13 +2086,13 @@ void cmMakefileTargetGenerator::AddModuleDefinitionFlag(std::string& flags) //---------------------------------------------------------------------------- const char* cmMakefileTargetGenerator::GetFeature(const std::string& feature) { - return this->Target->GetFeature(feature, this->ConfigName); + return this->GeneratorTarget->GetFeature(feature, this->ConfigName); } //---------------------------------------------------------------------------- bool cmMakefileTargetGenerator::GetFeatureAsBool(const std::string& feature) { - return this->Target->GetFeatureAsBool(feature, this->ConfigName); + return this->GeneratorTarget->GetFeatureAsBool(feature, this->ConfigName); } //---------------------------------------------------------------------------- diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 879d6b79e..b2aef689e 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -107,13 +107,14 @@ std::string cmNinjaTargetGenerator::LanguageCompilerRule( // TODO: Picked up from cmMakefileTargetGenerator. Refactor it. const char* cmNinjaTargetGenerator::GetFeature(const std::string& feature) { - return this->Target->GetFeature(feature, this->GetConfigName()); + return this->GeneratorTarget->GetFeature(feature, this->GetConfigName()); } // TODO: Picked up from cmMakefileTargetGenerator. Refactor it. bool cmNinjaTargetGenerator::GetFeatureAsBool(const std::string& feature) { - return this->Target->GetFeatureAsBool(feature, this->GetConfigName()); + return this->GeneratorTarget->GetFeatureAsBool(feature, + this->GetConfigName()); } // TODO: Picked up from cmMakefileTargetGenerator. Refactor it. diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 443696658..fd732d770 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -2813,34 +2813,6 @@ void cmTarget::GetTargetVersion(bool soversion, } } -//---------------------------------------------------------------------------- -const char* cmTarget::GetFeature(const std::string& feature, - const std::string& config) const -{ - if(!config.empty()) - { - std::string featureConfig = feature; - featureConfig += "_"; - featureConfig += cmSystemTools::UpperCase(config); - if(const char* value = this->GetProperty(featureConfig)) - { - return value; - } - } - if(const char* value = this->GetProperty(feature)) - { - return value; - } - return this->Makefile->GetFeature(feature, config); -} - -//---------------------------------------------------------------------------- -bool cmTarget::GetFeatureAsBool(const std::string& feature, - const std::string& config) const -{ - return cmSystemTools::IsOn(this->GetFeature(feature, config)); -} - //---------------------------------------------------------------------------- bool cmTarget::HandleLocationPropertyPolicy(cmMakefile* context) const { diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 0cbb57519..f20966abf 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -260,11 +260,6 @@ public: bool GetPropertyAsBool(const std::string& prop) const; void CheckProperty(const std::string& prop, cmMakefile* context) const; - const char* GetFeature(const std::string& feature, - const std::string& config) const; - bool GetFeatureAsBool(const std::string& feature, - const std::string& config) const; - bool IsImported() const {return this->IsImportedTarget;} void GetObjectLibrariesCMP0026(std::vector& objlibs) const; From f573bd22e4049746b53789fc0502cff8423dbe56 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 6 Jun 2015 15:42:31 +0200 Subject: [PATCH 0054/1048] cmLocalGenerator: Add Feature API from cmMakefile. --- Source/cmGeneratorTarget.cxx | 2 +- Source/cmLocalGenerator.cxx | 27 +++++++++++++++++++++++++++ Source/cmLocalGenerator.h | 3 +++ Source/cmMakefile.cxx | 27 --------------------------- Source/cmMakefile.h | 3 --- 5 files changed, 31 insertions(+), 31 deletions(-) diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 4901820cf..67d0d5433 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -370,7 +370,7 @@ const char* cmGeneratorTarget::GetFeature(const std::string& feature, { return value; } - return this->Makefile->GetFeature(feature, config); + return this->LocalGenerator->GetFeature(feature, config); } //---------------------------------------------------------------------------- diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index da95a4db0..899da5644 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -2572,6 +2572,33 @@ void cmLocalGenerator::AppendFeatureOptions( } } +//---------------------------------------------------------------------------- +const char* cmLocalGenerator::GetFeature(const std::string& feature, + const std::string& config) +{ + // TODO: Define accumulation policy for features (prepend, append, replace). + // Currently we always replace. + if(!config.empty()) + { + std::string featureConfig = feature; + featureConfig += "_"; + featureConfig += cmSystemTools::UpperCase(config); + if(const char* value = this->Makefile->GetProperty(featureConfig)) + { + return value; + } + } + if(const char* value = this->Makefile->GetProperty(feature)) + { + return value; + } + if(cmLocalGenerator* parent = this->GetParent()) + { + return parent->GetFeature(feature, config); + } + return 0; +} + //---------------------------------------------------------------------------- std::string cmLocalGenerator::ConstructComment(cmCustomCommandGenerator const& ccg, diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 1359dd6ba..3e3b4bc80 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -179,6 +179,9 @@ public: void AppendFeatureOptions(std::string& flags, const std::string& lang, const char* feature); + const char* GetFeature(const std::string& feature, + const std::string& config); + /** \brief Get absolute path to dependency \a name * * Translate a dependency as given in CMake code to the name to diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index b5d976a9b..806dc520f 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -4215,33 +4215,6 @@ bool cmMakefile::GetPropertyAsBool(const std::string& prop) const return cmSystemTools::IsOn(this->GetProperty(prop)); } -//---------------------------------------------------------------------------- -const char* cmMakefile::GetFeature(const std::string& feature, - const std::string& config) -{ - // TODO: Define accumulation policy for features (prepend, append, replace). - // Currently we always replace. - if(!config.empty()) - { - std::string featureConfig = feature; - featureConfig += "_"; - featureConfig += cmSystemTools::UpperCase(config); - if(const char* value = this->GetProperty(featureConfig)) - { - return value; - } - } - if(const char* value = this->GetProperty(feature)) - { - return value; - } - if(cmLocalGenerator* parent = this->LocalGenerator->GetParent()) - { - return parent->GetMakefile()->GetFeature(feature, config); - } - return 0; -} - cmTarget* cmMakefile::FindTarget(const std::string& name, bool excludeAliases) const { diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 431ed086b..a60106769 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -727,9 +727,6 @@ public: cmProperty::ScopeType scope) const; bool GetPropertyAsBool(const std::string& prop) const; - const char* GetFeature(const std::string& feature, - const std::string& config); - // Get the properties cmPropertyMap &GetProperties() { return this->Properties; } From cb1a9c7b9cc48ac1f908ece7bb55a342bd943fec Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sun, 7 Jun 2015 00:01:03 -0400 Subject: [PATCH 0055/1048] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 29e81a635..7ac1082aa 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 3) -set(CMake_VERSION_PATCH 20150606) +set(CMake_VERSION_PATCH 20150607) #set(CMake_VERSION_RC 1) From 93cc2eef38eab76831916bfee9d6fe16fbaaf4c1 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 6 Jun 2015 09:41:05 +0200 Subject: [PATCH 0056/1048] cmPolicies: Store all statuses in a single bitset. Currently there are an optimal number of policies (64) such that there are no wasted bits. When another policy is added, the cmPolicyMap will grow from 40 bytes to 80, and occupy 45. By storing all in a single bitset, we stay under the cache line size of 64 bytes until there are 512 policies in a range. --- Source/cmPolicies.cxx | 30 +++++++++++++++++------------- Source/cmPolicies.h | 7 ++----- 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index 3498adc80..5026893ba 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -348,19 +348,19 @@ cmPolicies::PolicyMap::Get(cmPolicies::PolicyID id) const { PolicyStatus status = cmPolicies::WARN; - if (this->OLD[id]) + if (this->Status[(POLICY_STATUS_COUNT * id) + OLD]) { status = cmPolicies::OLD; } - else if (this->NEW[id]) + else if (this->Status[(POLICY_STATUS_COUNT * id) + NEW]) { status = cmPolicies::NEW; } - else if (this->REQUIRED_ALWAYS[id]) + else if (this->Status[(POLICY_STATUS_COUNT * id) + REQUIRED_ALWAYS]) { status = cmPolicies::REQUIRED_ALWAYS; } - else if (this->REQUIRED_IF_USED[id]) + else if (this->Status[(POLICY_STATUS_COUNT * id) + REQUIRED_IF_USED]) { status = cmPolicies::REQUIRED_IF_USED; } @@ -370,21 +370,25 @@ cmPolicies::PolicyMap::Get(cmPolicies::PolicyID id) const void cmPolicies::PolicyMap::Set(cmPolicies::PolicyID id, cmPolicies::PolicyStatus status) { - this->OLD[id] = (status == cmPolicies::OLD); - this->WARN[id] = (status == cmPolicies::WARN); - this->NEW[id] = (status == cmPolicies::NEW); - this->REQUIRED_ALWAYS[id] = (status == cmPolicies::REQUIRED_ALWAYS); - this->REQUIRED_IF_USED[id] = (status == cmPolicies::REQUIRED_IF_USED); + this->Status[(POLICY_STATUS_COUNT * id) + OLD] = (status == OLD); + this->Status[(POLICY_STATUS_COUNT * id) + WARN] = (status == WARN); + this->Status[(POLICY_STATUS_COUNT * id) + NEW] = (status == NEW); + this->Status[(POLICY_STATUS_COUNT * id) + REQUIRED_ALWAYS] = + (status == REQUIRED_ALWAYS); + this->Status[(POLICY_STATUS_COUNT * id) + REQUIRED_IF_USED] = + (status == REQUIRED_IF_USED); } bool cmPolicies::PolicyMap::IsDefined(cmPolicies::PolicyID id) const { - return this->OLD[id] || this->WARN[id] || this->NEW[id] - || this->REQUIRED_ALWAYS[id] || this->REQUIRED_IF_USED[id]; + return this->Status[(POLICY_STATUS_COUNT * id) + OLD] + || this->Status[(POLICY_STATUS_COUNT * id) + WARN] + || this->Status[(POLICY_STATUS_COUNT * id) + NEW] + || this->Status[(POLICY_STATUS_COUNT * id) + REQUIRED_ALWAYS] + || this->Status[(POLICY_STATUS_COUNT * id) + REQUIRED_IF_USED]; } bool cmPolicies::PolicyMap::IsEmpty() const { - return this->OLD.none() && this->WARN.none() && this->NEW.none() - && this->REQUIRED_ALWAYS.none() && this->REQUIRED_IF_USED.none(); + return this->Status.none(); } diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 8c72dfe4a..8a3c27d9f 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -244,6 +244,7 @@ public: REQUIRED_IF_USED, REQUIRED_ALWAYS ///< Issue an error unless user sets policy status to NEW. }; +#define POLICY_STATUS_COUNT 5 /// Policy identifiers enum PolicyID @@ -287,11 +288,7 @@ public: bool IsEmpty() const; private: - std::bitset OLD; - std::bitset WARN; - std::bitset NEW; - std::bitset REQUIRED_IF_USED; - std::bitset REQUIRED_ALWAYS; + std::bitset Status; }; }; From 1c48edf8fc8cec71c780cbb1c587f10df0ab7185 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 6 Jun 2015 09:46:26 +0200 Subject: [PATCH 0057/1048] cmProperty: Remove needless Name member. Size goes from 72 to 40 bytes with GNU libstdc++-5.1. --- Source/cmProperty.cxx | 7 ++----- Source/cmProperty.h | 6 ++---- Source/cmPropertyMap.cxx | 4 ++-- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/Source/cmProperty.cxx b/Source/cmProperty.cxx index 40976db15..ef57068ad 100644 --- a/Source/cmProperty.cxx +++ b/Source/cmProperty.cxx @@ -12,17 +12,14 @@ #include "cmProperty.h" #include "cmSystemTools.h" -void cmProperty::Set(const std::string& name, const char *value) +void cmProperty::Set(const char *value) { - this->Name = name; this->Value = value; this->ValueHasBeenSet = true; } -void cmProperty::Append(const std::string& name, const char *value, - bool asString) +void cmProperty::Append(const char *value, bool asString) { - this->Name = name; if(!this->Value.empty() && *value && !asString) { this->Value += ";"; diff --git a/Source/cmProperty.h b/Source/cmProperty.h index 659c4c324..e026372db 100644 --- a/Source/cmProperty.h +++ b/Source/cmProperty.h @@ -21,11 +21,10 @@ public: TEST, VARIABLE, CACHED_VARIABLE, INSTALL }; // set this property - void Set(const std::string& name, const char *value); + void Set(const char *value); // append to this property - void Append(const std::string& name, const char *value, - bool asString = false); + void Append(const char *value, bool asString = false); // get the value const char *GetValue() const; @@ -34,7 +33,6 @@ public: cmProperty() { this->ValueHasBeenSet = false; } protected: - std::string Name; std::string Value; bool ValueHasBeenSet; }; diff --git a/Source/cmPropertyMap.cxx b/Source/cmPropertyMap.cxx index 070f6f1ed..03124dca5 100644 --- a/Source/cmPropertyMap.cxx +++ b/Source/cmPropertyMap.cxx @@ -40,7 +40,7 @@ void cmPropertyMap::SetProperty(const std::string& name, const char *value, (void)scope; cmProperty *prop = this->GetOrCreateProperty(name); - prop->Set(name,value); + prop->Set(value); } void cmPropertyMap::AppendProperty(const std::string& name, const char* value, @@ -54,7 +54,7 @@ void cmPropertyMap::AppendProperty(const std::string& name, const char* value, (void)scope; cmProperty *prop = this->GetOrCreateProperty(name); - prop->Append(name,value,asString); + prop->Append(value,asString); } const char *cmPropertyMap From 9058e27a431b01319b18cc4099780fa017ada113 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 6 Jun 2015 09:46:38 +0200 Subject: [PATCH 0058/1048] Constify property definition API. --- Source/cmGetPropertyCommand.cxx | 6 ++---- Source/cmPropertyDefinitionMap.cxx | 8 ++++---- Source/cmPropertyDefinitionMap.h | 4 ++-- Source/cmState.cxx | 28 +++++++++++++++++++++------- Source/cmState.h | 10 ++++++---- 5 files changed, 35 insertions(+), 21 deletions(-) diff --git a/Source/cmGetPropertyCommand.cxx b/Source/cmGetPropertyCommand.cxx index 250bd3551..36b6c6435 100644 --- a/Source/cmGetPropertyCommand.cxx +++ b/Source/cmGetPropertyCommand.cxx @@ -142,8 +142,7 @@ bool cmGetPropertyCommand { // Lookup brief documentation. std::string output; - if(cmPropertyDefinition* def = - this->Makefile->GetState()-> + if(cmPropertyDefinition const* def = this->Makefile->GetState()-> GetPropertyDefinition(this->PropertyName, scope)) { output = def->GetShortDescription(); @@ -158,8 +157,7 @@ bool cmGetPropertyCommand { // Lookup full documentation. std::string output; - if(cmPropertyDefinition* def = - this->Makefile->GetState()-> + if(cmPropertyDefinition const* def = this->Makefile->GetState()-> GetPropertyDefinition(this->PropertyName, scope)) { output = def->GetFullDescription(); diff --git a/Source/cmPropertyDefinitionMap.cxx b/Source/cmPropertyDefinitionMap.cxx index 3875318f4..776fad1dc 100644 --- a/Source/cmPropertyDefinitionMap.cxx +++ b/Source/cmPropertyDefinitionMap.cxx @@ -29,9 +29,9 @@ void cmPropertyDefinitionMap } } -bool cmPropertyDefinitionMap::IsPropertyDefined(const std::string& name) +bool cmPropertyDefinitionMap::IsPropertyDefined(const std::string& name) const { - cmPropertyDefinitionMap::iterator it = this->find(name); + cmPropertyDefinitionMap::const_iterator it = this->find(name); if (it == this->end()) { return false; @@ -40,9 +40,9 @@ bool cmPropertyDefinitionMap::IsPropertyDefined(const std::string& name) return true; } -bool cmPropertyDefinitionMap::IsPropertyChained(const std::string& name) +bool cmPropertyDefinitionMap::IsPropertyChained(const std::string& name) const { - cmPropertyDefinitionMap::iterator it = this->find(name); + cmPropertyDefinitionMap::const_iterator it = this->find(name); if (it == this->end()) { return false; diff --git a/Source/cmPropertyDefinitionMap.h b/Source/cmPropertyDefinitionMap.h index 00c7328c6..f95c721a8 100644 --- a/Source/cmPropertyDefinitionMap.h +++ b/Source/cmPropertyDefinitionMap.h @@ -27,10 +27,10 @@ public: bool chain); // has a named property been defined - bool IsPropertyDefined(const std::string& name); + bool IsPropertyDefined(const std::string& name) const; // is a named property set to chain - bool IsPropertyChained(const std::string& name); + bool IsPropertyChained(const std::string& name) const; }; #endif diff --git a/Source/cmState.cxx b/Source/cmState.cxx index c6fb2998e..15a463804 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -256,27 +256,41 @@ void cmState::DefineProperty(const std::string& name, chained); } -cmPropertyDefinition *cmState +cmPropertyDefinition const* cmState ::GetPropertyDefinition(const std::string& name, - cmProperty::ScopeType scope) + cmProperty::ScopeType scope) const { if (this->IsPropertyDefined(name,scope)) { - return &(this->PropertyDefinitions[scope][name]); + cmPropertyDefinitionMap const& defs = + this->PropertyDefinitions.find(scope)->second; + return &defs.find(name)->second; } return 0; } bool cmState::IsPropertyDefined(const std::string& name, - cmProperty::ScopeType scope) + cmProperty::ScopeType scope) const { - return this->PropertyDefinitions[scope].IsPropertyDefined(name); + std::map::const_iterator it + = this->PropertyDefinitions.find(scope); + if (it == this->PropertyDefinitions.end()) + { + return false; + } + return it->second.IsPropertyDefined(name); } bool cmState::IsPropertyChained(const std::string& name, - cmProperty::ScopeType scope) + cmProperty::ScopeType scope) const { - return this->PropertyDefinitions[scope].IsPropertyChained(name); + std::map::const_iterator it + = this->PropertyDefinitions.find(scope); + if (it == this->PropertyDefinitions.end()) + { + return false; + } + return it->second.IsPropertyChained(name); } void cmState::SetLanguageEnabled(std::string const& l) diff --git a/Source/cmState.h b/Source/cmState.h index 60b024f33..b06f77c9a 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -102,12 +102,14 @@ public: bool chain = false); // get property definition - cmPropertyDefinition *GetPropertyDefinition - (const std::string& name, cmProperty::ScopeType scope); + cmPropertyDefinition const* GetPropertyDefinition + (const std::string& name, cmProperty::ScopeType scope) const; // Is a property defined? - bool IsPropertyDefined(const std::string& name, cmProperty::ScopeType scope); - bool IsPropertyChained(const std::string& name, cmProperty::ScopeType scope); + bool IsPropertyDefined(const std::string& name, + cmProperty::ScopeType scope) const; + bool IsPropertyChained(const std::string& name, + cmProperty::ScopeType scope) const; void SetLanguageEnabled(std::string const& l); bool GetLanguageEnabled(std::string const& l) const; From 7c0aa672fe4f1b5c4a15a89d90cd80009a1399d0 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 6 Jun 2015 09:41:15 +0200 Subject: [PATCH 0059/1048] cmPropertyMap: Remove scope parameter from API where not used. --- Source/cmCPluginAPI.cxx | 5 ++--- Source/cmCacheManager.cxx | 4 ++-- Source/cmMakefile.cxx | 4 ++-- Source/cmPropertyMap.cxx | 7 ++----- Source/cmPropertyMap.h | 5 ++--- Source/cmSourceFile.cxx | 5 ++--- Source/cmState.cxx | 5 ++--- Source/cmTarget.cxx | 18 ++++++------------ Source/cmTest.cxx | 4 ++-- 9 files changed, 22 insertions(+), 35 deletions(-) diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx index c55ea3597..bd8c10cc5 100644 --- a/Source/cmCPluginAPI.cxx +++ b/Source/cmCPluginAPI.cxx @@ -662,7 +662,7 @@ void CCONV cmSourceFileSetProperty(void *arg,const char *prop, else if(prop) { if(!value) { value = "NOTFOUND"; } - sf->Properties.SetProperty(prop, value, cmProperty::SOURCE_FILE); + sf->Properties.SetProperty(prop, value); } } @@ -801,8 +801,7 @@ void CCONV cmSourceFileSetName2(void *arg, const char* name, const char* dir, // Implement the old SetName method code here. if(headerFileOnly) { - sf->Properties.SetProperty("HEADER_FILE_ONLY", "1", - cmProperty::SOURCE_FILE); + sf->Properties.SetProperty("HEADER_FILE_ONLY", "1"); } sf->SourceName = name; std::string fname = sf->SourceName; diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index 108208ef1..6af14f29f 100644 --- a/Source/cmCacheManager.cxx +++ b/Source/cmCacheManager.cxx @@ -763,7 +763,7 @@ void cmCacheManager::CacheEntry::SetProperty(const std::string& prop, } else { - this->Properties.SetProperty(prop, value, cmProperty::CACHE); + this->Properties.SetProperty(prop, value); } } @@ -789,7 +789,7 @@ void cmCacheManager::CacheEntry::AppendProperty(const std::string& prop, } else { - this->Properties.AppendProperty(prop, value, cmProperty::CACHE, asString); + this->Properties.AppendProperty(prop, value, asString); } } diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 3ac77e9ea..9c0d4b10c 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -4089,7 +4089,7 @@ void cmMakefile::SetProperty(const std::string& prop, const char* value) } } - this->Properties.SetProperty(prop,value,cmProperty::DIRECTORY); + this->Properties.SetProperty(prop, value); } void cmMakefile::AppendProperty(const std::string& prop, @@ -4129,7 +4129,7 @@ void cmMakefile::AppendProperty(const std::string& prop, return; } - this->Properties.AppendProperty(prop,value,cmProperty::DIRECTORY,asString); + this->Properties.AppendProperty(prop, value, asString); } const char *cmMakefile::GetProperty(const std::string& prop) const diff --git a/Source/cmPropertyMap.cxx b/Source/cmPropertyMap.cxx index 03124dca5..d1402c832 100644 --- a/Source/cmPropertyMap.cxx +++ b/Source/cmPropertyMap.cxx @@ -29,29 +29,26 @@ cmProperty *cmPropertyMap::GetOrCreateProperty(const std::string& name) return prop; } -void cmPropertyMap::SetProperty(const std::string& name, const char *value, - cmProperty::ScopeType scope) +void cmPropertyMap::SetProperty(const std::string& name, const char *value) { if(!value) { this->erase(name); return; } - (void)scope; cmProperty *prop = this->GetOrCreateProperty(name); prop->Set(value); } void cmPropertyMap::AppendProperty(const std::string& name, const char* value, - cmProperty::ScopeType scope, bool asString) + bool asString) { // Skip if nothing to append. if(!value || !*value) { return; } - (void)scope; cmProperty *prop = this->GetOrCreateProperty(name); prop->Append(value,asString); diff --git a/Source/cmPropertyMap.h b/Source/cmPropertyMap.h index 02d4235da..722732b56 100644 --- a/Source/cmPropertyMap.h +++ b/Source/cmPropertyMap.h @@ -21,11 +21,10 @@ class cmPropertyMap : public std::map public: cmProperty *GetOrCreateProperty(const std::string& name); - void SetProperty(const std::string& name, const char *value, - cmProperty::ScopeType scope); + void SetProperty(const std::string& name, const char *value); void AppendProperty(const std::string& name, const char* value, - cmProperty::ScopeType scope, bool asString=false); + bool asString=false); const char *GetPropertyValue(const std::string& name, cmProperty::ScopeType scope, diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx index 724ab3941..df511d832 100644 --- a/Source/cmSourceFile.cxx +++ b/Source/cmSourceFile.cxx @@ -299,7 +299,7 @@ bool cmSourceFile::Matches(cmSourceFileLocation const& loc) //---------------------------------------------------------------------------- void cmSourceFile::SetProperty(const std::string& prop, const char* value) { - this->Properties.SetProperty(prop, value, cmProperty::SOURCE_FILE); + this->Properties.SetProperty(prop, value); if (this->IsUiFile) { @@ -315,8 +315,7 @@ void cmSourceFile::SetProperty(const std::string& prop, const char* value) void cmSourceFile::AppendProperty(const std::string& prop, const char* value, bool asString) { - this->Properties.AppendProperty(prop, value, cmProperty::SOURCE_FILE, - asString); + this->Properties.AppendProperty(prop, value, asString); } //---------------------------------------------------------------------------- diff --git a/Source/cmState.cxx b/Source/cmState.cxx index 15a463804..7bfeda19a 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -438,14 +438,13 @@ void cmState::RemoveUserDefinedCommands() void cmState::SetGlobalProperty(const std::string& prop, const char* value) { - this->GlobalProperties.SetProperty(prop, value, cmProperty::GLOBAL); + this->GlobalProperties.SetProperty(prop, value); } void cmState::AppendGlobalProperty(const std::string& prop, const char* value, bool asString) { - this->GlobalProperties.AppendProperty(prop, value, - cmProperty::GLOBAL, asString); + this->GlobalProperties.AppendProperty(prop, value, asString); } const char *cmState::GetGlobalProperty(const std::string& prop) diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 443696658..873163246 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -1772,7 +1772,7 @@ void cmTarget::SetProperty(const std::string& prop, const char* value) } else { - this->Properties.SetProperty(prop, value, cmProperty::TARGET); + this->Properties.SetProperty(prop, value); this->MaybeInvalidatePropertyCache(prop); } } @@ -1857,7 +1857,7 @@ void cmTarget::AppendProperty(const std::string& prop, const char* value, } else { - this->Properties.AppendProperty(prop, value, cmProperty::TARGET, asString); + this->Properties.AppendProperty(prop, value, asString); this->MaybeInvalidatePropertyCache(prop); } } @@ -2938,8 +2938,7 @@ const char *cmTarget::GetProperty(const std::string& prop, // cannot take into account the per-configuration name of the // target because the configuration type may not be known at // CMake time. - this->Properties.SetProperty(propLOCATION, this->GetLocationForBuild(), - cmProperty::TARGET); + this->Properties.SetProperty(propLOCATION, this->GetLocationForBuild()); } // Support "LOCATION_". @@ -2950,9 +2949,7 @@ const char *cmTarget::GetProperty(const std::string& prop, return 0; } const char* configName = prop.c_str() + 9; - this->Properties.SetProperty(prop, - this->GetLocation(configName), - cmProperty::TARGET); + this->Properties.SetProperty(prop, this->GetLocation(configName)); } // Support "_LOCATION". else if(cmHasLiteralSuffix(prop, "_LOCATION")) @@ -2964,9 +2961,7 @@ const char *cmTarget::GetProperty(const std::string& prop, { return 0; } - this->Properties.SetProperty(prop, - this->GetLocation(configName), - cmProperty::TARGET); + this->Properties.SetProperty(prop, this->GetLocation(configName)); } } } @@ -3168,8 +3163,7 @@ const char *cmTarget::GetProperty(const std::string& prop, } } } - this->Properties.SetProperty("SOURCES", ss.str().c_str(), - cmProperty::TARGET); + this->Properties.SetProperty("SOURCES", ss.str().c_str()); } } diff --git a/Source/cmTest.cxx b/Source/cmTest.cxx index ff5d4119e..c60685967 100644 --- a/Source/cmTest.cxx +++ b/Source/cmTest.cxx @@ -69,12 +69,12 @@ bool cmTest::GetPropertyAsBool(const std::string& prop) const //---------------------------------------------------------------------------- void cmTest::SetProperty(const std::string& prop, const char* value) { - this->Properties.SetProperty(prop, value, cmProperty::TEST); + this->Properties.SetProperty(prop, value); } //---------------------------------------------------------------------------- void cmTest::AppendProperty(const std::string& prop, const char* value, bool asString) { - this->Properties.AppendProperty(prop, value, cmProperty::TEST, asString); + this->Properties.AppendProperty(prop, value, asString); } From 3ac4b90bfdcca97f1f63056c97afee38cf66ea12 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 6 Jun 2015 09:41:20 +0200 Subject: [PATCH 0060/1048] cmPropertyMap: Require a non-empty name parameter. The cmGetPropertyCommand already checks for this. --- Source/cmGetCMakePropertyCommand.cxx | 8 +++++--- Source/cmGetDirectoryPropertyCommand.cxx | 6 +++++- Source/cmGetSourceFilePropertyCommand.cxx | 6 +++++- Source/cmGetTargetPropertyCommand.cxx | 6 +++++- Source/cmGetTestPropertyCommand.cxx | 6 +++++- Source/cmPropertyMap.cxx | 7 +++---- 6 files changed, 28 insertions(+), 11 deletions(-) diff --git a/Source/cmGetCMakePropertyCommand.cxx b/Source/cmGetCMakePropertyCommand.cxx index 76803c103..6717035b7 100644 --- a/Source/cmGetCMakePropertyCommand.cxx +++ b/Source/cmGetCMakePropertyCommand.cxx @@ -52,9 +52,11 @@ bool cmGetCMakePropertyCommand } else { - const char *prop = - this->Makefile->GetState() - ->GetGlobalProperty(args[1]); + const char *prop = 0; + if (!args[1].empty()) + { + prop = this->Makefile->GetState()->GetGlobalProperty(args[1]); + } if (prop) { output = prop; diff --git a/Source/cmGetDirectoryPropertyCommand.cxx b/Source/cmGetDirectoryPropertyCommand.cxx index 4fe33189e..228e53cd2 100644 --- a/Source/cmGetDirectoryPropertyCommand.cxx +++ b/Source/cmGetDirectoryPropertyCommand.cxx @@ -84,7 +84,11 @@ bool cmGetDirectoryPropertyCommand return true; } - const char *prop = dir->GetProperty(*i); + const char *prop = 0; + if (!i->empty()) + { + prop = dir->GetProperty(*i); + } if (prop) { this->Makefile->AddDefinition(variable, prop); diff --git a/Source/cmGetSourceFilePropertyCommand.cxx b/Source/cmGetSourceFilePropertyCommand.cxx index 7667a8592..46daa349a 100644 --- a/Source/cmGetSourceFilePropertyCommand.cxx +++ b/Source/cmGetSourceFilePropertyCommand.cxx @@ -38,7 +38,11 @@ bool cmGetSourceFilePropertyCommand this->Makefile->AddDefinition(var, sf->GetLanguage().c_str()); return true; } - const char *prop = sf->GetPropertyForUser(args[2]); + const char *prop = 0; + if (!args[2].empty()) + { + prop = sf->GetPropertyForUser(args[2]); + } if (prop) { this->Makefile->AddDefinition(var, prop); diff --git a/Source/cmGetTargetPropertyCommand.cxx b/Source/cmGetTargetPropertyCommand.cxx index 315e85188..ca40bd077 100644 --- a/Source/cmGetTargetPropertyCommand.cxx +++ b/Source/cmGetTargetPropertyCommand.cxx @@ -40,7 +40,11 @@ bool cmGetTargetPropertyCommand else if(cmTarget* tgt = this->Makefile->FindTargetToUse(targetName)) { cmTarget& target = *tgt; - const char* prop_cstr = target.GetProperty(args[2], this->Makefile); + const char* prop_cstr = 0; + if (!args[2].empty()) + { + prop_cstr = target.GetProperty(args[2], this->Makefile); + } if(prop_cstr) { prop = prop_cstr; diff --git a/Source/cmGetTestPropertyCommand.cxx b/Source/cmGetTestPropertyCommand.cxx index b3df4c3bc..bf34589f4 100644 --- a/Source/cmGetTestPropertyCommand.cxx +++ b/Source/cmGetTestPropertyCommand.cxx @@ -29,7 +29,11 @@ bool cmGetTestPropertyCommand cmTest *test = this->Makefile->GetTest(testName); if (test) { - const char *prop = test->GetProperty(args[1]); + const char *prop = 0; + if (!args[1].empty()) + { + prop = test->GetProperty(args[1]); + } if (prop) { this->Makefile->AddDefinition(var, prop); diff --git a/Source/cmPropertyMap.cxx b/Source/cmPropertyMap.cxx index d1402c832..de2cd0582 100644 --- a/Source/cmPropertyMap.cxx +++ b/Source/cmPropertyMap.cxx @@ -14,6 +14,8 @@ #include "cmake.h" #include "cmState.h" +#include + cmProperty *cmPropertyMap::GetOrCreateProperty(const std::string& name) { cmPropertyMap::iterator it = this->find(name); @@ -60,10 +62,7 @@ const char *cmPropertyMap bool &chain) const { chain = false; - if (name.empty()) - { - return 0; - } + assert(!name.empty()); cmPropertyMap::const_iterator it = this->find(name); if (it == this->end()) From 5181fae264444ad7736614ceb1e78c51def2b97c Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 6 Jun 2015 09:41:30 +0200 Subject: [PATCH 0061/1048] cmPropertyMap: Remove chaining logic. The chaining logic doesn't belong to the container, and the CMakeInstance pointer doesn't need to be in cmPropertyMap. Size goes from 56 to 48 bytes with GNU libstdc++-5.1. --- Source/cmCPluginAPI.cxx | 10 ++-------- Source/cmCacheManager.cxx | 7 +------ Source/cmGlobalGenerator.cxx | 1 - Source/cmMakefile.cxx | 16 +++++++--------- Source/cmMakefile.h | 3 +-- Source/cmPropertyMap.cxx | 11 +---------- Source/cmPropertyMap.h | 13 +------------ Source/cmSetTestsPropertiesCommand.cxx | 6 ++++-- Source/cmSourceFile.cxx | 14 ++++++++------ Source/cmState.cxx | 4 +--- Source/cmTarget.cxx | 16 ++++++++-------- Source/cmTest.cxx | 14 ++++++++------ 12 files changed, 42 insertions(+), 73 deletions(-) diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx index bd8c10cc5..0d24ed5ed 100644 --- a/Source/cmCPluginAPI.cxx +++ b/Source/cmCPluginAPI.cxx @@ -526,11 +526,9 @@ void * CCONV cmCreateSourceFile(void) return (void*)new cmCPluginAPISourceFile; } -void * CCONV cmCreateNewSourceFile(void *arg) +void * CCONV cmCreateNewSourceFile(void *) { - cmMakefile *mf = static_cast(arg); cmCPluginAPISourceFile *sf = new cmCPluginAPISourceFile; - sf->Properties.SetCMakeInstance(mf->GetCMakeInstance()); return (void*)sf; } @@ -630,11 +628,7 @@ const char * CCONV cmSourceFileGetProperty(void *arg,const char *prop) { return sf->FullPath.c_str(); } - bool chain = false; - // Ignore chain because old code will not expect it and it is a - // pain to implement here anyway. - return sf->Properties.GetPropertyValue(prop, cmProperty::SOURCE_FILE, - chain); + return sf->Properties.GetPropertyValue(prop); } } diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index 6af14f29f..54209c5ce 100644 --- a/Source/cmCacheManager.cxx +++ b/Source/cmCacheManager.cxx @@ -161,7 +161,6 @@ bool cmCacheManager::LoadCache(const std::string& path, // Format is key:type=value std::string helpString; CacheEntry e; - e.Properties.SetCMakeInstance(this->CMakeInstance); cmSystemTools::GetLineFromStream(fin, buffer); realbuffer = buffer.c_str(); while(*realbuffer != '0' && @@ -323,7 +322,6 @@ bool cmCacheManager::ReadPropertyEntry(std::string const& entryKey, { // Create an entry and store the property. CacheEntry& ne = this->Cache[key]; - ne.Properties.SetCMakeInstance(this->CMakeInstance); ne.Type = cmState::UNINITIALIZED; ne.SetProperty(*p, e.Value.c_str()); } @@ -645,7 +643,6 @@ void cmCacheManager::AddCacheEntry(const std::string& key, cmState::CacheEntryType type) { CacheEntry& e = this->Cache[key]; - e.Properties.SetCMakeInstance(this->CMakeInstance); if ( value ) { e.Value = value; @@ -744,9 +741,7 @@ cmCacheManager::CacheEntry::GetProperty(const std::string& prop) const { return this->Value.c_str(); } - bool c = false; - return - this->Properties.GetPropertyValue(prop, cmProperty::CACHE, c); + return this->Properties.GetPropertyValue(prop); } //---------------------------------------------------------------------------- diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 481de1946..bd949bb42 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -2438,7 +2438,6 @@ cmTarget cmGlobalGenerator::CreateGlobalTarget( { // Package cmTarget target; - target.GetProperties().SetCMakeInstance(this->CMakeInstance); target.SetType(cmTarget::GLOBAL_TARGET, name); target.SetProperty("EXCLUDE_FROM_ALL","TRUE"); diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 9c0d4b10c..bc308f179 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -213,8 +213,6 @@ cmMakefile::cmMakefile(cmLocalGenerator* localGenerator) this->AddSourceGroup("Object Files", "\\.(lo|o|obj)$"); #endif - this->Properties.SetCMakeInstance(this->GetCMakeInstance()); - { const char* dir = this->GetCMakeInstance()->GetHomeDirectory(); this->AddDefinition("CMAKE_SOURCE_DIR", dir); @@ -4134,11 +4132,13 @@ void cmMakefile::AppendProperty(const std::string& prop, const char *cmMakefile::GetProperty(const std::string& prop) const { - return this->GetProperty(prop, cmProperty::DIRECTORY); + const bool chain = this->GetState()-> + IsPropertyChained(prop, cmProperty::DIRECTORY); + return this->GetProperty(prop, chain); } const char *cmMakefile::GetProperty(const std::string& prop, - cmProperty::ScopeType scope) const + bool chain) const { // watch for specific properties static std::string output; @@ -4242,15 +4242,13 @@ const char *cmMakefile::GetProperty(const std::string& prop, return output.c_str(); } - bool chain = false; - const char *retVal = - this->Properties.GetPropertyValue(prop, scope, chain); - if (chain) + const char *retVal = this->Properties.GetPropertyValue(prop); + if (!retVal && chain) { if(this->LocalGenerator->GetParent()) { return this->LocalGenerator->GetParent()->GetMakefile()-> - GetProperty(prop, scope); + GetProperty(prop, chain); } return this->GetState()->GetGlobalProperty(prop); } diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index def0c23e9..751863105 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -717,8 +717,7 @@ public: void AppendProperty(const std::string& prop, const char *value, bool asString=false); const char *GetProperty(const std::string& prop) const; - const char *GetProperty(const std::string& prop, - cmProperty::ScopeType scope) const; + const char *GetProperty(const std::string& prop, bool chain) const; bool GetPropertyAsBool(const std::string& prop) const; const char* GetFeature(const std::string& feature, diff --git a/Source/cmPropertyMap.cxx b/Source/cmPropertyMap.cxx index de2cd0582..ef09dbcf0 100644 --- a/Source/cmPropertyMap.cxx +++ b/Source/cmPropertyMap.cxx @@ -57,22 +57,13 @@ void cmPropertyMap::AppendProperty(const std::string& name, const char* value, } const char *cmPropertyMap -::GetPropertyValue(const std::string& name, - cmProperty::ScopeType scope, - bool &chain) const +::GetPropertyValue(const std::string& name) const { - chain = false; assert(!name.empty()); cmPropertyMap::const_iterator it = this->find(name); if (it == this->end()) { - // should we chain up? - if (this->CMakeInstance) - { - chain = this->CMakeInstance->GetState()-> - IsPropertyChained(name,scope); - } return 0; } return it->second.GetValue(); diff --git a/Source/cmPropertyMap.h b/Source/cmPropertyMap.h index 722732b56..a9062dbbd 100644 --- a/Source/cmPropertyMap.h +++ b/Source/cmPropertyMap.h @@ -14,8 +14,6 @@ #include "cmProperty.h" -class cmake; - class cmPropertyMap : public std::map { public: @@ -26,16 +24,7 @@ public: void AppendProperty(const std::string& name, const char* value, bool asString=false); - const char *GetPropertyValue(const std::string& name, - cmProperty::ScopeType scope, - bool &chain) const; - - void SetCMakeInstance(cmake *cm) { this->CMakeInstance = cm; } - - cmPropertyMap() { this->CMakeInstance = 0;} - -private: - cmake *CMakeInstance; + const char *GetPropertyValue(const std::string& name) const; }; #endif diff --git a/Source/cmSetTestsPropertiesCommand.cxx b/Source/cmSetTestsPropertiesCommand.cxx index e9cfaccea..53dc5a8a6 100644 --- a/Source/cmSetTestsPropertiesCommand.cxx +++ b/Source/cmSetTestsPropertiesCommand.cxx @@ -85,8 +85,10 @@ bool cmSetTestsPropertiesCommand unsigned int k; for (k = 0; k < propertyPairs.size(); k = k + 2) { - test->SetProperty(propertyPairs[k], - propertyPairs[k+1].c_str()); + if (!propertyPairs[k].empty()) + { + test->SetProperty(propertyPairs[k], propertyPairs[k+1].c_str()); + } } } else diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx index df511d832..86f0a7a87 100644 --- a/Source/cmSourceFile.cxx +++ b/Source/cmSourceFile.cxx @@ -22,7 +22,6 @@ cmSourceFile::cmSourceFile(cmMakefile* mf, const std::string& name): Location(mf, name) { this->CustomCommand = 0; - this->Properties.SetCMakeInstance(mf->GetCMakeInstance()); this->FindFullPathFailed = false; this->IsUiFile = (".ui" == cmSystemTools::GetFilenameLastExtension(this->Location.GetName())); @@ -361,13 +360,16 @@ const char* cmSourceFile::GetProperty(const std::string& prop) const } } - bool chain = false; - const char *retVal = - this->Properties.GetPropertyValue(prop, cmProperty::SOURCE_FILE, chain); - if (chain) + const char *retVal = this->Properties.GetPropertyValue(prop); + if (!retVal) { cmMakefile const* mf = this->Location.GetMakefile(); - return mf->GetProperty(prop,cmProperty::SOURCE_FILE); + const bool chain = mf->GetState()-> + IsPropertyChained(prop, cmProperty::SOURCE_FILE); + if (chain) + { + return mf->GetProperty(prop, chain); + } } return retVal; diff --git a/Source/cmState.cxx b/Source/cmState.cxx index 7bfeda19a..25b49663a 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -482,9 +482,7 @@ const char *cmState::GetGlobalProperty(const std::string& prop) return FOR_EACH_CXX_FEATURE(STRING_LIST_ELEMENT) + 1; } #undef STRING_LIST_ELEMENT - bool dummy = false; - return this->GlobalProperties.GetPropertyValue(prop, cmProperty::GLOBAL, - dummy); + return this->GlobalProperties.GetPropertyValue(prop); } bool cmState::GetGlobalPropertyAsBool(const std::string& prop) diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 873163246..d1399ef13 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -286,9 +286,6 @@ void cmTarget::SetMakefile(cmMakefile* mf) // Set our makefile. this->Makefile = mf; - // set the cmake instance of the properties - this->Properties.SetCMakeInstance(mf->GetCMakeInstance()); - // Check whether this is a DLL platform. this->DLLPlatform = (this->Makefile->IsOn("WIN32") || this->Makefile->IsOn("CYGWIN") || @@ -3167,12 +3164,15 @@ const char *cmTarget::GetProperty(const std::string& prop, } } - bool chain = false; - const char *retVal = - this->Properties.GetPropertyValue(prop, cmProperty::TARGET, chain); - if (chain) + const char *retVal = this->Properties.GetPropertyValue(prop); + if (!retVal) { - return this->Makefile->GetProperty(prop, cmProperty::TARGET); + const bool chain = this->GetMakefile()->GetState()-> + IsPropertyChained(prop, cmProperty::TARGET); + if (chain) + { + return this->Makefile->GetProperty(prop, chain); + } } return retVal; } diff --git a/Source/cmTest.cxx b/Source/cmTest.cxx index c60685967..6fcd0dc95 100644 --- a/Source/cmTest.cxx +++ b/Source/cmTest.cxx @@ -21,7 +21,6 @@ cmTest::cmTest(cmMakefile* mf) { this->Makefile = mf; this->OldStyle = true; - this->Properties.SetCMakeInstance(mf->GetCMakeInstance()); } //---------------------------------------------------------------------------- @@ -50,12 +49,15 @@ void cmTest::SetCommand(std::vector const& command) //---------------------------------------------------------------------------- const char *cmTest::GetProperty(const std::string& prop) const { - bool chain = false; - const char *retVal = - this->Properties.GetPropertyValue(prop, cmProperty::TEST, chain); - if (chain) + const char *retVal = this->Properties.GetPropertyValue(prop); + if (!retVal) { - return this->Makefile->GetProperty(prop,cmProperty::TEST); + const bool chain = this->Makefile->GetState()-> + IsPropertyChained(prop, cmProperty::TEST); + if (chain) + { + return this->Makefile->GetProperty(prop, chain); + } } return retVal; } From 6f148e4a48f3f879998e67d9bb30de07f5cf5608 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 6 Jun 2015 09:42:09 +0200 Subject: [PATCH 0062/1048] cmTarget: Use method abstraction for policy status. --- Source/cmTarget.cxx | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index d1399ef13..5e866efbf 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -5925,8 +5925,8 @@ cmTargetInternals::ComputeLinkInterfaceLibraries( // libraries and executables that export symbols. const char* explicitLibraries = 0; std::string linkIfaceProp; - if(thisTarget->PolicyStatusCMP0022 != cmPolicies::OLD && - thisTarget->PolicyStatusCMP0022 != cmPolicies::WARN) + if(thisTarget->GetPolicyStatusCMP0022() != cmPolicies::OLD && + thisTarget->GetPolicyStatusCMP0022() != cmPolicies::WARN) { // CMP0022 NEW behavior is to use INTERFACE_LINK_LIBRARIES. linkIfaceProp = "INTERFACE_LINK_LIBRARIES"; @@ -5952,7 +5952,7 @@ cmTargetInternals::ComputeLinkInterfaceLibraries( } if(explicitLibraries && - thisTarget->PolicyStatusCMP0022 == cmPolicies::WARN && + thisTarget->GetPolicyStatusCMP0022() == cmPolicies::WARN && !this->PolicyWarnedCMP0022) { // Compare the explicitly set old link interface properties to the @@ -5996,8 +5996,8 @@ cmTargetInternals::ComputeLinkInterfaceLibraries( iface.Libraries, iface.HadHeadSensitiveCondition); } - else if (thisTarget->PolicyStatusCMP0022 == cmPolicies::WARN - || thisTarget->PolicyStatusCMP0022 == cmPolicies::OLD) + else if (thisTarget->GetPolicyStatusCMP0022() == cmPolicies::WARN + || thisTarget->GetPolicyStatusCMP0022() == cmPolicies::OLD) // If CMP0022 is NEW then the plain tll signature sets the // INTERFACE_LINK_LIBRARIES, so if we get here then the project // cleared the property explicitly and we should not fall back @@ -6008,7 +6008,7 @@ cmTargetInternals::ComputeLinkInterfaceLibraries( thisTarget->GetLinkImplementationLibrariesInternal(config, headTarget); iface.Libraries.insert(iface.Libraries.end(), impl->Libraries.begin(), impl->Libraries.end()); - if(thisTarget->PolicyStatusCMP0022 == cmPolicies::WARN && + if(thisTarget->GetPolicyStatusCMP0022() == cmPolicies::WARN && !this->PolicyWarnedCMP0022 && !usage_requirements_only) { // Compare the link implementation fallback link interface to the @@ -6100,8 +6100,8 @@ void cmTargetInternals::ComputeLinkInterface(cmTarget const* thisTarget, } } } - else if (thisTarget->PolicyStatusCMP0022 == cmPolicies::WARN - || thisTarget->PolicyStatusCMP0022 == cmPolicies::OLD) + else if (thisTarget->GetPolicyStatusCMP0022() == cmPolicies::WARN + || thisTarget->GetPolicyStatusCMP0022() == cmPolicies::OLD) { // The link implementation is the default link interface. cmTarget::LinkImplementationLibraries const* @@ -6421,7 +6421,7 @@ std::string cmTarget::CheckCMP0004(std::string const& item) const if(lib != item) { cmake* cm = this->Makefile->GetCMakeInstance(); - switch(this->PolicyStatusCMP0004) + switch(this->GetPolicyStatusCMP0004()) { case cmPolicies::WARN: { From 647488570bfe7ce210bfd0675df0eb5147e36ab6 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 2 May 2015 14:50:02 +0200 Subject: [PATCH 0063/1048] cmTarget: Replace PolicyStatus members with PolicyMap. sizeof(cmTarget) goes from 856 to 840 with GNU libstdc++ 5.1. --- Source/cmTarget.cxx | 17 ++--------------- Source/cmTarget.h | 11 ++--------- 2 files changed, 4 insertions(+), 24 deletions(-) diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 5e866efbf..daf52822a 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -239,13 +239,6 @@ cmTargetInternals::~cmTargetInternals() //---------------------------------------------------------------------------- cmTarget::cmTarget() { -#define INITIALIZE_TARGET_POLICY_MEMBER(POLICY) \ - this->PolicyStatus ## POLICY = cmPolicies::WARN; - - CM_FOR_EACH_TARGET_POLICY(INITIALIZE_TARGET_POLICY_MEMBER) - -#undef INITIALIZE_TARGET_POLICY_MEMBER - this->Makefile = 0; #if defined(_WIN32) && !defined(__CYGWIN__) this->LinkLibrariesForVS6Analyzed = false; @@ -440,20 +433,14 @@ void cmTarget::SetMakefile(cmMakefile* mf) } // Record current policies for later use. -#define CAPTURE_TARGET_POLICY(POLICY) \ - this->PolicyStatus ## POLICY = \ - this->Makefile->GetPolicyStatus(cmPolicies::POLICY); - - CM_FOR_EACH_TARGET_POLICY(CAPTURE_TARGET_POLICY) - -#undef CAPTURE_TARGET_POLICY + this->Makefile->RecordPolicies(this->PolicyMap); if (this->TargetTypeValue == INTERFACE_LIBRARY) { // This policy is checked in a few conditions. The properties relevant // to the policy are always ignored for INTERFACE_LIBRARY targets, // so ensure that the conditions don't lead to nonsense. - this->PolicyStatusCMP0022 = cmPolicies::NEW; + this->PolicyMap.Set(cmPolicies::CMP0022, cmPolicies::NEW); } if (this->GetType() != INTERFACE_LIBRARY && this->GetType() != UTILITY) diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 0cbb57519..cade7ab9d 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -144,7 +144,7 @@ public: #define DECLARE_TARGET_POLICY(POLICY) \ cmPolicies::PolicyStatus GetPolicyStatus ## POLICY () const \ - { return this->PolicyStatus ## POLICY; } + { return this->PolicyMap.Get(cmPolicies::POLICY); } CM_FOR_EACH_TARGET_POLICY(DECLARE_TARGET_POLICY) @@ -828,14 +828,7 @@ private: // The cmMakefile instance that owns this target. This should // always be set. cmMakefile* Makefile; - - // Policy status recorded when target was created. -#define TARGET_POLICY_MEMBER(POLICY) \ - cmPolicies::PolicyStatus PolicyStatus ## POLICY; - - CM_FOR_EACH_TARGET_POLICY(TARGET_POLICY_MEMBER) - -#undef TARGET_POLICY_MEMBER + cmPolicies::PolicyMap PolicyMap; // Internal representation details. friend class cmTargetInternals; From 41fef23b9b8bfa795e2d61e27b12f055ef9bbc39 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 6 Jun 2015 09:44:47 +0200 Subject: [PATCH 0064/1048] cmTarget: Re-arrange data layout. Size with GNU libstdc++-5.1 goes from 840 bytes to 808 bytes. --- Source/cmTarget.h | 62 +++++++++++++++++++++-------------------------- 1 file changed, 28 insertions(+), 34 deletions(-) diff --git a/Source/cmTarget.h b/Source/cmTarget.h index cade7ab9d..ddc8d3572 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -642,12 +642,6 @@ public: private: bool HandleLocationPropertyPolicy(cmMakefile* context) const; - // The set of include directories that are marked as system include - // directories. - std::set SystemIncludeDirectories; - - std::vector > TLLCommands; - #if defined(_WIN32) && !defined(__CYGWIN__) /** * A list of direct dependencies. Use in conjunction with DependencyMap. @@ -742,40 +736,48 @@ private: void GetSourceFiles(std::vector &files, const std::string& config) const; private: - std::string Name; - std::vector PreBuildCommands; - std::vector PreLinkCommands; - std::vector PostBuildCommands; - TargetType TargetTypeValue; - LinkLibraryVectorType PrevLinkedLibraries; -#if defined(_WIN32) && !defined(__CYGWIN__) - LinkLibraryVectorType LinkLibrariesForVS6; - bool LinkLibrariesForVS6Analyzed; -#endif - std::vector LinkDirectories; + mutable cmPropertyMap Properties; + std::set SystemIncludeDirectories; std::set LinkDirectoriesEmmitted; - bool HaveInstallRule; + std::set Utilities; + mutable std::set LinkImplicitNullProperties; + std::map UtilityBacktraces; + mutable std::map DebugCompatiblePropertiesDone; + mutable std::map MaxLanguageStandards; + cmPolicies::PolicyMap PolicyMap; + std::string Name; std::string InstallPath; std::string RuntimeInstallPath; mutable std::string ExportMacro; - std::set Utilities; - std::map UtilityBacktraces; - bool RecordDependencies; - mutable cmPropertyMap Properties; + std::vector LinkDirectories; + std::vector PreBuildCommands; + std::vector PreLinkCommands; + std::vector PostBuildCommands; + std::vector > TLLCommands; + LinkLibraryVectorType PrevLinkedLibraries; LinkLibraryVectorType OriginalLinkLibraries; +#if defined(_WIN32) && !defined(__CYGWIN__) + LinkLibraryVectorType LinkLibrariesForVS6; +#endif + cmMakefile* Makefile; + cmTargetInternalPointer Internal; + TargetType TargetTypeValue; + bool HaveInstallRule; + bool RecordDependencies; bool DLLPlatform; bool IsAndroid; bool IsApple; bool IsImportedTarget; + bool BuildInterfaceIncludesAppended; mutable bool DebugIncludesDone; - mutable std::map DebugCompatiblePropertiesDone; mutable bool DebugCompileOptionsDone; mutable bool DebugCompileDefinitionsDone; mutable bool DebugSourcesDone; mutable bool DebugCompileFeaturesDone; - mutable std::set LinkImplicitNullProperties; - mutable std::map MaxLanguageStandards; - bool BuildInterfaceIncludesAppended; + mutable bool LinkImplementationLanguageIsContextDependent; +#if defined(_WIN32) && !defined(__CYGWIN__) + bool LinkLibrariesForVS6Analyzed; +#endif // Cache target output paths for each configuration. struct OutputInfo; @@ -825,16 +827,10 @@ private: void ProcessSourceExpression(std::string const& expr); - // The cmMakefile instance that owns this target. This should - // always be set. - cmMakefile* Makefile; - cmPolicies::PolicyMap PolicyMap; - // Internal representation details. friend class cmTargetInternals; friend class cmGeneratorTarget; friend class cmTargetTraceDependencies; - cmTargetInternalPointer Internal; void ComputeVersionedName(std::string& vName, std::string const& prefix, @@ -842,8 +838,6 @@ private: std::string const& suffix, std::string const& name, const char* version) const; - - mutable bool LinkImplementationLanguageIsContextDependent; }; #ifdef CMAKE_BUILD_WITH_CMAKE From c26696eb404888cec525bf3ee2e538ae8532156f Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 6 Jun 2015 09:45:50 +0200 Subject: [PATCH 0065/1048] cmSourceFile: Re-arrange data. Size goes from 304 to 296 bytes. --- Source/cmSourceFile.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/cmSourceFile.h b/Source/cmSourceFile.h index f8982600f..1433b54f0 100644 --- a/Source/cmSourceFile.h +++ b/Source/cmSourceFile.h @@ -107,8 +107,9 @@ private: std::string Extension; std::string Language; std::string FullPath; - bool FindFullPathFailed; std::string ObjectLibrary; + std::vector Depends; + bool FindFullPathFailed; bool IsUiFile; bool FindFullPath(std::string* error); @@ -116,7 +117,6 @@ private: void CheckExtension(); void CheckLanguage(std::string const& ext); - std::vector Depends; static const std::string propLANGUAGE; }; From e04217010345fd350d3ddd7897e47eb47eaec1d8 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 6 Jun 2015 09:45:56 +0200 Subject: [PATCH 0066/1048] cmMakefile: Re-arrange data layout. 2168 to 2152 bytes with GNU libstdc++-5.1. --- Source/cmMakefile.h | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 751863105..32223b42d 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -372,8 +372,6 @@ public: }; friend class PolicyPushPop; - mutable std::set CMP0054ReportedIds; - /** * Determine if the given context, name pair has already been reported * in context of CMP0054. @@ -848,6 +846,8 @@ protected: // Check for a an unused variable void LogUnused(const char* reason, const std::string& name) const; + mutable std::set CMP0054ReportedIds; + std::string ProjectName; // project name // libraries, classes, and executables @@ -949,10 +949,6 @@ private: cmPropertyMap Properties; - // Unused variable flags - bool WarnUnused; - bool CheckSystemVars; - // stack of list files being read std::vector ListFileStack; @@ -994,8 +990,6 @@ private: cmPolicies::PolicyStatus GetPolicyStatusInternal(cmPolicies::PolicyID id) const; - bool CheckCMP0000; - // Enforce rules about CMakeLists.txt files. void EnforceDirectoryLevelRules() const; @@ -1021,7 +1015,6 @@ private: long line, bool removeEmpty, bool replaceAt) const; - bool Configured; /** * Old version of GetSourceFileWithOutput(const std::string&) kept for * backward-compatibility. It implements a linear search and support @@ -1067,6 +1060,11 @@ private: void CheckForUnusedVariables() const; + // Unused variable flags + bool WarnUnused; + bool CheckSystemVars; + bool CheckCMP0000; + bool Configured; mutable bool SuppressWatches; }; From 3e087a408b4a5bad1eb079c61c982ce2dab0973a Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 6 Jun 2015 09:46:10 +0200 Subject: [PATCH 0067/1048] cmLocalUnixMakefileGenerator: Re-arrange data layout. Size goes from 536 to 528 bytes. --- Source/cmLocalUnixMakefileGenerator3.h | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index f2a138993..dcb301629 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -254,26 +254,10 @@ private: ImplicitDependTargetMap ImplicitDepends; - //========================================================================== - // Configuration settings. - int MakefileVariableSize; std::string ConfigurationName; - bool MakeCommandEscapeTargetTwice; - bool BorlandMakeCurlyHack; - //========================================================================== std::string HomeRelativeOutputPath; - /* Copy the setting of CMAKE_COLOR_MAKEFILE from the makefile at the - beginning of generation to avoid many duplicate lookups. */ - bool ColorMakefile; - - /* Copy the setting of CMAKE_SKIP_PREPROCESSED_SOURCE_RULES and - CMAKE_SKIP_ASSEMBLY_SOURCE_RULES at the beginning of generation to - avoid many duplicate lookups. */ - bool SkipPreprocessedSourceRules; - bool SkipAssemblySourceRules; - struct LocalObjectEntry { cmTarget* Target; @@ -302,6 +286,13 @@ private: /* does the work for each target */ std::map MakeVariableMap; std::map ShortMakeVariableMap; + + int MakefileVariableSize; + bool MakeCommandEscapeTargetTwice; + bool BorlandMakeCurlyHack; + bool ColorMakefile; + bool SkipPreprocessedSourceRules; + bool SkipAssemblySourceRules; }; #endif From 4cd13e80f00d4441112f400ff774d91a7fecfff8 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 6 Jun 2015 09:59:24 +0200 Subject: [PATCH 0068/1048] cmComputeLinkInformation: Re-arrange data layout. Size goes from 1944 to 1920 bytes. --- Source/cmComputeLinkInformation.h | 35 +++++++++++++++---------------- 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/Source/cmComputeLinkInformation.h b/Source/cmComputeLinkInformation.h index 88471413c..ccf520b21 100644 --- a/Source/cmComputeLinkInformation.h +++ b/Source/cmComputeLinkInformation.h @@ -82,7 +82,6 @@ private: // Configuration information. std::string Config; std::string LinkLanguage; - bool LinkDependsNoShared; // Modes for dealing with dependent shared libraries. enum SharedDepMode @@ -93,8 +92,6 @@ private: SharedDepModeLink // List file on link line }; - // System info. - bool UseImportLibrary; const char* LoaderFlag; std::string LibLinkFlag; std::string LibLinkFileFlag; @@ -102,22 +99,18 @@ private: std::string RuntimeFlag; std::string RuntimeSep; std::string RuntimeAlways; - bool RuntimeUseChrpath; - bool NoSONameUsesPath; - bool LinkWithRuntimePath; std::string RPathLinkFlag; SharedDepMode SharedDependencyMode; + enum LinkType { LinkUnknown, LinkStatic, LinkShared }; + void SetCurrentLinkType(LinkType lt); + // Link type adjustment. void ComputeLinkTypeInfo(); - enum LinkType { LinkUnknown, LinkStatic, LinkShared }; LinkType StartLinkType; LinkType CurrentLinkType; std::string StaticLinkTypeFlag; std::string SharedLinkTypeFlag; - bool LinkTypeEnabled; - void SetCurrentLinkType(LinkType lt); - bool ArchivesMayBeShared; // Link item parsing. void ComputeItemParserInfo(); @@ -129,7 +122,6 @@ private: cmsys::RegularExpression ExtractSharedLibraryName; cmsys::RegularExpression ExtractAnyLibraryName; std::string SharedRegexString; - bool OpenBSD; void AddLinkPrefix(const char* p); void AddLinkExtension(const char* e, LinkType type); std::string CreateExtensionRegex(std::vector const& exts, @@ -173,20 +165,27 @@ private: std::set OldLinkDirMask; std::vector OldLinkDirItems; std::vector OldUserFlagItems; - bool OldLinkDirMode; - - // CMP0060 warnings. - bool CMP0060Warn; std::set CMP0060WarnItems; - + // Dependent library path computation. + cmOrderDirectories* OrderDependentRPath; // Runtime path computation. cmOrderDirectories* OrderRuntimeSearchPath; + + bool OldLinkDirMode; + bool OpenBSD; + bool LinkDependsNoShared; + bool UseImportLibrary; + bool RuntimeUseChrpath; + bool NoSONameUsesPath; + bool LinkWithRuntimePath; + bool LinkTypeEnabled; + bool ArchivesMayBeShared; + bool CMP0060Warn; + void AddLibraryRuntimeInfo(std::string const& fullPath, cmTarget const* target); void AddLibraryRuntimeInfo(std::string const& fullPath); - // Dependent library path computation. - cmOrderDirectories* OrderDependentRPath; }; #endif From db24e41b9d939fb8ad9106f7a8511670505a8ad0 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 7 Jun 2015 09:40:57 +0200 Subject: [PATCH 0069/1048] cmCommandArgumentParserHelper: Re-arrange data. Size goes from 232 to 216 bytes. --- Source/cmCommandArgumentParserHelper.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/cmCommandArgumentParserHelper.h b/Source/cmCommandArgumentParserHelper.h index d375ae624..387afc639 100644 --- a/Source/cmCommandArgumentParserHelper.h +++ b/Source/cmCommandArgumentParserHelper.h @@ -80,8 +80,6 @@ private: std::string::size_type InputBufferPos; std::string InputBuffer; std::vector OutputBuffer; - int CurrentLine; - int Verbose; void Print(const char* place, const char* str); void SafePrintMissing(const char* str, int line, int cnt); @@ -94,12 +92,14 @@ private: std::vector Variables; const cmMakefile* Makefile; std::string Result; + std::string ErrorString; const char* FileName; + long FileLine; + int CurrentLine; + int Verbose; bool WarnUninitialized; bool CheckSystemVars; - long FileLine; bool EscapeQuotes; - std::string ErrorString; bool NoEscapeMode; bool ReplaceAtSyntax; bool RemoveEmpty; From d9df7fa70c854207bb36b45ca0fdca6665bd4bd8 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 7 Jun 2015 09:43:11 +0200 Subject: [PATCH 0070/1048] cmComputeComponentGraph: Re-arrange data layout. Size goes from 224 to 216 bytes. --- Source/cmComputeComponentGraph.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/cmComputeComponentGraph.h b/Source/cmComputeComponentGraph.h index a2ce946c1..4dbac4a2e 100644 --- a/Source/cmComputeComponentGraph.h +++ b/Source/cmComputeComponentGraph.h @@ -67,17 +67,17 @@ private: int Root; int VisitIndex; }; - int TarjanWalkId; std::vector TarjanVisited; std::vector TarjanComponents; std::vector TarjanEntries; + std::vector Components; std::stack TarjanStack; + int TarjanWalkId; int TarjanIndex; void Tarjan(); void TarjanVisit(int i); // Connected components. - std::vector Components; }; #endif From 7f3e16239fd120eded5e23ee8a836d9e73119244 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 7 Jun 2015 09:47:37 +0200 Subject: [PATCH 0071/1048] cmGlobalGenerator: Re-arrange data layout. Size goes from 1488 to 1480 bytes. --- Source/cmGlobalGenerator.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 3b368c694..f02df90c1 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -398,10 +398,6 @@ protected: std::vector depends, const char* workingDir, bool uses_terminal); - bool NeedSymbolicMark; - bool UseLinkScript; - bool ForceUnixPaths; - bool ToolSupportsColor; std::string FindMakeProgramFile; std::string ConfiguredFilesPath; cmake *CMakeInstance; @@ -414,7 +410,6 @@ protected: // Set of named installation components requested by the project. std::set InstallComponents; - bool InstallTargetEnabled; // Sets of named target exports cmExportSetMap ExportSets; std::map BuildExportSets; @@ -448,7 +443,6 @@ private: cmState::Snapshot snapshot); cmMakefile* TryCompileOuterMakefile; - float FirstTimeProgress; // If you add a new map here, make sure it is copied // in EnableLanguagesFromGenerator std::map IgnoreExtensions; @@ -521,6 +515,14 @@ private: // Pool of file locks cmFileLockPool FileLockPool; #endif + +protected: + float FirstTimeProgress; + bool NeedSymbolicMark; + bool UseLinkScript; + bool ForceUnixPaths; + bool ToolSupportsColor; + bool InstallTargetEnabled; }; #endif From 92b8b1fc3d885091cfef210216b682a389eaf2fb Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 7 Jun 2015 09:54:55 +0200 Subject: [PATCH 0072/1048] cmGraphVizWriter: Re-arrange data layout. Size goes from 272 to 264 bytes. --- Source/cmGraphVizWriter.cxx | 2 +- Source/cmGraphVizWriter.h | 15 +++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx index 7f4c4c949..fa29b4f71 100644 --- a/Source/cmGraphVizWriter.cxx +++ b/Source/cmGraphVizWriter.cxx @@ -48,6 +48,7 @@ cmGraphVizWriter::cmGraphVizWriter(const std::vector& ,GraphName("GG") ,GraphHeader("node [\n fontsize = \"12\"\n];") ,GraphNodePrefix("node") +,LocalGenerators(localGenerators) ,GenerateForExecutables(true) ,GenerateForStaticLibs(true) ,GenerateForSharedLibs(true) @@ -55,7 +56,6 @@ cmGraphVizWriter::cmGraphVizWriter(const std::vector& ,GenerateForExternals(true) ,GeneratePerTarget(true) ,GenerateDependers(true) -,LocalGenerators(localGenerators) ,HaveTargetsAndLibs(false) { } diff --git a/Source/cmGraphVizWriter.h b/Source/cmGraphVizWriter.h index a7acd0e54..64de68436 100644 --- a/Source/cmGraphVizWriter.h +++ b/Source/cmGraphVizWriter.h @@ -69,14 +69,6 @@ protected: std::string GraphHeader; std::string GraphNodePrefix; - bool GenerateForExecutables; - bool GenerateForStaticLibs; - bool GenerateForSharedLibs; - bool GenerateForModuleLibs; - bool GenerateForExternals; - bool GeneratePerTarget; - bool GenerateDependers; - std::vector TargetsToIgnoreRegex; const std::vector& LocalGenerators; @@ -85,6 +77,13 @@ protected: // maps from the actual target names to node names in dot: std::map TargetNamesNodes; + bool GenerateForExecutables; + bool GenerateForStaticLibs; + bool GenerateForSharedLibs; + bool GenerateForModuleLibs; + bool GenerateForExternals; + bool GeneratePerTarget; + bool GenerateDependers; bool HaveTargetsAndLibs; }; From 125c48660ce5f58e8fa9371cfb9c192f42b19401 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 7 Jun 2015 09:57:33 +0200 Subject: [PATCH 0073/1048] cmInstallFilesGenerator: Re-arrange data layout. Size goes from 296 to 288 bytes. --- Source/cmInstallFilesGenerator.cxx | 6 ++++-- Source/cmInstallFilesGenerator.h | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Source/cmInstallFilesGenerator.cxx b/Source/cmInstallFilesGenerator.cxx index 28c27c295..ff2c6e5b2 100644 --- a/Source/cmInstallFilesGenerator.cxx +++ b/Source/cmInstallFilesGenerator.cxx @@ -28,9 +28,11 @@ cmInstallFilesGenerator bool optional): cmInstallGenerator(dest, configurations, component, message), Makefile(mf), - Files(files), Programs(programs), + Files(files), FilePermissions(file_permissions), - Rename(rename), Optional(optional) + Rename(rename), + Programs(programs), + Optional(optional) { // We need per-config actions if any files have generator expressions. for(std::vector::const_iterator i = files.begin(); diff --git a/Source/cmInstallFilesGenerator.h b/Source/cmInstallFilesGenerator.h index 0dbd71271..bf482d6f6 100644 --- a/Source/cmInstallFilesGenerator.h +++ b/Source/cmInstallFilesGenerator.h @@ -43,9 +43,9 @@ protected: cmMakefile* Makefile; std::vector Files; - bool Programs; std::string FilePermissions; std::string Rename; + bool Programs; bool Optional; }; From dd0417c7becb9d00bf60827d299b3d520bb138c5 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 7 Jun 2015 10:01:00 +0200 Subject: [PATCH 0074/1048] cmInstallTargetGenerator: Re-arrange data layout. Remove unused cmGeneratorTarget member. Size goes from 238 to 232 bytes. --- Source/cmInstallTargetGenerator.cxx | 4 +++- Source/cmInstallTargetGenerator.h | 6 ++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index 082a78c18..511578805 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -29,7 +29,9 @@ cmInstallTargetGenerator MessageLevel message, bool optional): cmInstallGenerator(dest, configurations, component, message), Target(&t), - ImportLibrary(implib), FilePermissions(file_permissions), Optional(optional) + FilePermissions(file_permissions), + ImportLibrary(implib), + Optional(optional) { this->ActionsPerConfig = true; this->NamelinkMode = NamelinkModeNone; diff --git a/Source/cmInstallTargetGenerator.h b/Source/cmInstallTargetGenerator.h index 075c8a4bf..db69220a1 100644 --- a/Source/cmInstallTargetGenerator.h +++ b/Source/cmInstallTargetGenerator.h @@ -14,7 +14,6 @@ #include "cmInstallGenerator.h" #include "cmTarget.h" -#include "cmGeneratorTarget.h" /** \class cmInstallTargetGenerator * \brief Generate target installation rules. @@ -100,11 +99,10 @@ protected: const std::string& toDestDirPath); cmTarget* Target; - bool ImportLibrary; std::string FilePermissions; - bool Optional; NamelinkModeType NamelinkMode; - cmGeneratorTarget* GeneratorTarget; + bool ImportLibrary; + bool Optional; }; #endif From b1ff32afc67799d08130d457347290a41e426ed0 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 7 Jun 2015 10:06:19 +0200 Subject: [PATCH 0075/1048] cmOrderDirectories: Re-arrange data layout. Size goes from 680 to 672 bytes. --- Source/cmOrderDirectories.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Source/cmOrderDirectories.h b/Source/cmOrderDirectories.h index 07c85dd07..cb5a51f41 100644 --- a/Source/cmOrderDirectories.h +++ b/Source/cmOrderDirectories.h @@ -44,8 +44,6 @@ private: cmTarget const* Target; std::string Purpose; - bool Computed; - std::vector OrderedDirectories; std::vector ConstraintEntries; @@ -68,8 +66,9 @@ private: void OrderDirectories(); void VisitDirectory(unsigned int i); void DiagnoseCycle(); - bool CycleDiagnosed; int WalkId; + bool CycleDiagnosed; + bool Computed; // Adjacency-list representation of runtime path ordering graph. // This maps from directory to those that must come *before* it. From 40844a1487ea576987ecec148f77bbeebea9433d Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 7 Jun 2015 10:09:47 +0200 Subject: [PATCH 0076/1048] cmProcessTools: Re-arrange data layout. Size goes from 72 to 64 bytes. --- Source/cmProcessTools.cxx | 2 +- Source/cmProcessTools.h | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/cmProcessTools.cxx b/Source/cmProcessTools.cxx index d2f7bf320..15d9ed065 100644 --- a/Source/cmProcessTools.cxx +++ b/Source/cmProcessTools.cxx @@ -44,7 +44,7 @@ void cmProcessTools::RunProcess(struct cmsysProcess_s* cp, //---------------------------------------------------------------------------- cmProcessTools::LineParser::LineParser(char sep, bool ignoreCR): - Separator(sep), IgnoreCR(ignoreCR), Log(0), Prefix(0), LineEnd('\0') + Log(0), Prefix(0), Separator(sep), LineEnd('\0'), IgnoreCR(ignoreCR) { } diff --git a/Source/cmProcessTools.h b/Source/cmProcessTools.h index 439726dd0..23833cabd 100644 --- a/Source/cmProcessTools.h +++ b/Source/cmProcessTools.h @@ -51,12 +51,12 @@ public: /** Configure logging of lines as they are extracted. */ void SetLog(std::ostream* log, const char* prefix); protected: - char Separator; - bool IgnoreCR; std::ostream* Log; const char* Prefix; - char LineEnd; std::string Line; + char Separator; + char LineEnd; + bool IgnoreCR; virtual bool ProcessChunk(const char* data, int length); /** Implement in a subclass to process one line of input. It From b661d6c631884e48b27353b0ee9f4f0eb6f5eea7 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 7 Jun 2015 10:11:42 +0200 Subject: [PATCH 0077/1048] cmQtAutoGenerators: Re-arrange data layout. Size goes from 920 to 912 bytes. --- Source/cmQtAutoGenerators.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Source/cmQtAutoGenerators.h b/Source/cmQtAutoGenerators.h index f74e3c5b6..4c0fcbcb4 100644 --- a/Source/cmQtAutoGenerators.h +++ b/Source/cmQtAutoGenerators.h @@ -105,7 +105,6 @@ private: std::string SkipMoc; std::string SkipUic; std::string Headers; - bool IncludeProjectDirsBefore; std::string Srcdir; std::string Builddir; std::string MocExecutable; @@ -131,6 +130,7 @@ private: std::map RccOptions; std::map > RccInputs; + bool IncludeProjectDirsBefore; bool Verbose; bool ColorOutput; bool RunMocFailed; @@ -138,7 +138,6 @@ private: bool RunRccFailed; bool GenerateAll; bool RelaxedMode; - }; #endif From c197c6928128558e24ee094286e494e74b272f20 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 6 Jun 2015 22:44:44 +0200 Subject: [PATCH 0078/1048] cmDocumentation: Remove unused include. --- Source/cmDocumentation.h | 1 - 1 file changed, 1 deletion(-) diff --git a/Source/cmDocumentation.h b/Source/cmDocumentation.h index 8854c3618..b6c5fde7e 100644 --- a/Source/cmDocumentation.h +++ b/Source/cmDocumentation.h @@ -13,7 +13,6 @@ #define _cmDocumentation_h #include "cmStandardIncludes.h" -#include "cmProperty.h" #include "cmDocumentationFormatter.h" #include "cmDocumentationSection.h" #include "cmake.h" From e133e40937031004d11b0d16289cee1bf0dc5e4f Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 6 Jun 2015 22:52:44 +0200 Subject: [PATCH 0079/1048] cmExportTryCompileFileGenerator: Remove unused variable. --- Source/cmExportTryCompileFileGenerator.cxx | 2 -- 1 file changed, 2 deletions(-) diff --git a/Source/cmExportTryCompileFileGenerator.cxx b/Source/cmExportTryCompileFileGenerator.cxx index eb8d1935f..6c5f48fb9 100644 --- a/Source/cmExportTryCompileFileGenerator.cxx +++ b/Source/cmExportTryCompileFileGenerator.cxx @@ -99,8 +99,6 @@ cmExportTryCompileFileGenerator::PopulateProperties(cmTarget const* target, || i->first.find("IMPORTED_LINK_DEPENDENT_LIBRARIES") == 0 || i->first.find("INTERFACE_LINK_LIBRARIES") == 0) { - const std::string libs = i->second.GetValue(); - std::string evalResult = this->FindTargets(i->first, target, emitted); From 4ab7d407a5e46f91bf57fb1f9be7387ba989e0ec Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 6 Jun 2015 22:54:50 +0200 Subject: [PATCH 0080/1048] cmExportTryCompileFileGenerator: Add newline between methods. --- Source/cmExportTryCompileFileGenerator.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/Source/cmExportTryCompileFileGenerator.cxx b/Source/cmExportTryCompileFileGenerator.cxx index 6c5f48fb9..dfb991bf5 100644 --- a/Source/cmExportTryCompileFileGenerator.cxx +++ b/Source/cmExportTryCompileFileGenerator.cxx @@ -116,6 +116,7 @@ cmExportTryCompileFileGenerator::PopulateProperties(cmTarget const* target, } } } + std::string cmExportTryCompileFileGenerator::InstallNameDir(cmTarget* target, const std::string& config) From 54cb76f299ebcdd07e59d3d0c61f1aa0ffe03a33 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 7 Jun 2015 10:41:16 +0200 Subject: [PATCH 0081/1048] cmComputeLinkDepends: Re-arrange data layout. Size goes from 648 to 632 bytes. --- Source/cmComputeLinkDepends.h | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/Source/cmComputeLinkDepends.h b/Source/cmComputeLinkDepends.h index 09b9d7053..51a08c5c9 100644 --- a/Source/cmComputeLinkDepends.h +++ b/Source/cmComputeLinkDepends.h @@ -61,14 +61,7 @@ private: cmMakefile* Makefile; cmGlobalGenerator const* GlobalGenerator; cmake* CMakeInstance; - bool DebugMode; - - // Configuration information. - bool HasConfig; std::string Config; - cmTarget::LinkLibraryType LinkType; - - // Output information. EntryVector FinalLinkEntries; typedef cmTarget::LinkLibraryVectorType LinkLibraryVectorType; @@ -131,7 +124,7 @@ private: void OrderLinkEntires(); std::vector ComponentVisited; std::vector ComponentOrder; - int ComponentOrderId; + struct PendingComponent { // The real component id. Needed because the map is indexed by @@ -158,11 +151,14 @@ private: // Record of the original link line. std::vector OriginalEntries; - - // Compatibility help. - bool OldLinkDirMode; - void CheckWrongConfigItem(cmLinkItem const& item); std::set OldWrongConfigItems; + void CheckWrongConfigItem(cmLinkItem const& item); + + int ComponentOrderId; + cmTarget::LinkLibraryType LinkType; + bool HasConfig; + bool DebugMode; + bool OldLinkDirMode; }; #endif From 34e1d6db722b34bb6b4f7b8a7ea53a0bb61c5f58 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 7 Jun 2015 10:44:59 +0200 Subject: [PATCH 0082/1048] cmCustomCommand: Re-arrange data layout. Size goes from 240 to 224 bytes. --- Source/cmCustomCommand.cxx | 12 +++++------- Source/cmCustomCommand.h | 10 +++++----- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/Source/cmCustomCommand.cxx b/Source/cmCustomCommand.cxx index 4032b08e2..7418413c6 100644 --- a/Source/cmCustomCommand.cxx +++ b/Source/cmCustomCommand.cxx @@ -31,12 +31,12 @@ cmCustomCommand::cmCustomCommand(const cmCustomCommand& r): Byproducts(r.Byproducts), Depends(r.Depends), CommandLines(r.CommandLines), - HaveComment(r.HaveComment), + Backtrace(r.Backtrace), Comment(r.Comment), WorkingDirectory(r.WorkingDirectory), + HaveComment(r.HaveComment), EscapeAllowMakeVars(r.EscapeAllowMakeVars), EscapeOldStyle(r.EscapeOldStyle), - Backtrace(r.Backtrace), UsesTerminal(r.UsesTerminal) { } @@ -77,15 +77,13 @@ cmCustomCommand::cmCustomCommand(cmMakefile const* mf, Byproducts(byproducts), Depends(depends), CommandLines(commandLines), - HaveComment(comment?true:false), + Backtrace(), Comment(comment?comment:""), WorkingDirectory(workingDirectory?workingDirectory:""), + HaveComment(comment?true:false), EscapeAllowMakeVars(false), - EscapeOldStyle(true), - Backtrace() + EscapeOldStyle(true) { - this->EscapeOldStyle = true; - this->EscapeAllowMakeVars = false; if(mf) { this->Backtrace = mf->GetBacktrace(); diff --git a/Source/cmCustomCommand.h b/Source/cmCustomCommand.h index 0bfaef23b..cc5501fca 100644 --- a/Source/cmCustomCommand.h +++ b/Source/cmCustomCommand.h @@ -93,13 +93,13 @@ private: std::vector Byproducts; std::vector Depends; cmCustomCommandLines CommandLines; - bool HaveComment; - std::string Comment; - std::string WorkingDirectory; - bool EscapeAllowMakeVars; - bool EscapeOldStyle; cmListFileBacktrace Backtrace; ImplicitDependsList ImplicitDepends; + std::string Comment; + std::string WorkingDirectory; + bool HaveComment; + bool EscapeAllowMakeVars; + bool EscapeOldStyle; bool UsesTerminal; }; From 8174e5cd9424a7f45174562f21eb80eb06a3f3d0 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 7 Jun 2015 11:09:32 +0200 Subject: [PATCH 0083/1048] cmCustomCommand: Remove special member functions. The compiler generated ones are fine. The existing implementations here are incorrect as they omit some members. --- Source/cmCustomCommand.cxx | 45 -------------------------------------- Source/cmCustomCommand.h | 4 ---- 2 files changed, 49 deletions(-) diff --git a/Source/cmCustomCommand.cxx b/Source/cmCustomCommand.cxx index 7418413c6..7c37e3b96 100644 --- a/Source/cmCustomCommand.cxx +++ b/Source/cmCustomCommand.cxx @@ -25,46 +25,6 @@ cmCustomCommand::cmCustomCommand() this->UsesTerminal = false; } -//---------------------------------------------------------------------------- -cmCustomCommand::cmCustomCommand(const cmCustomCommand& r): - Outputs(r.Outputs), - Byproducts(r.Byproducts), - Depends(r.Depends), - CommandLines(r.CommandLines), - Backtrace(r.Backtrace), - Comment(r.Comment), - WorkingDirectory(r.WorkingDirectory), - HaveComment(r.HaveComment), - EscapeAllowMakeVars(r.EscapeAllowMakeVars), - EscapeOldStyle(r.EscapeOldStyle), - UsesTerminal(r.UsesTerminal) -{ -} - -//---------------------------------------------------------------------------- -cmCustomCommand& cmCustomCommand::operator=(cmCustomCommand const& r) -{ - if(this == &r) - { - return *this; - } - - this->Outputs = r.Outputs; - this->Byproducts= r.Byproducts; - this->Depends = r.Depends; - this->CommandLines = r.CommandLines; - this->HaveComment = r.HaveComment; - this->Comment = r.Comment; - this->WorkingDirectory = r.WorkingDirectory; - this->EscapeAllowMakeVars = r.EscapeAllowMakeVars; - this->EscapeOldStyle = r.EscapeOldStyle; - this->ImplicitDepends = r.ImplicitDepends; - this->Backtrace = r.Backtrace; - this->UsesTerminal = r.UsesTerminal; - - return *this; -} - //---------------------------------------------------------------------------- cmCustomCommand::cmCustomCommand(cmMakefile const* mf, const std::vector& outputs, @@ -90,11 +50,6 @@ cmCustomCommand::cmCustomCommand(cmMakefile const* mf, } } -//---------------------------------------------------------------------------- -cmCustomCommand::~cmCustomCommand() -{ -} - //---------------------------------------------------------------------------- const std::vector& cmCustomCommand::GetOutputs() const { diff --git a/Source/cmCustomCommand.h b/Source/cmCustomCommand.h index cc5501fca..f9b38c3c4 100644 --- a/Source/cmCustomCommand.h +++ b/Source/cmCustomCommand.h @@ -26,8 +26,6 @@ class cmCustomCommand public: /** Default and copy constructors for STL containers. */ cmCustomCommand(); - cmCustomCommand(const cmCustomCommand& r); - cmCustomCommand& operator=(cmCustomCommand const& r); /** Main constructor specifies all information for the command. */ cmCustomCommand(cmMakefile const* mf, @@ -38,8 +36,6 @@ public: const char* comment, const char* workingDirectory); - ~cmCustomCommand(); - /** Get the output file produced by the command. */ const std::vector& GetOutputs() const; From 021c4b6f2bced25c9adbb472b94148987e1b6398 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 7 Jun 2015 15:11:04 +0200 Subject: [PATCH 0084/1048] cmMakefile: Simplify handling of CACHE_VARIABLES property. --- Source/cmMakefile.cxx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 3ac77e9ea..b083f7065 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -4163,14 +4163,14 @@ const char *cmMakefile::GetProperty(const std::string& prop, output = cmJoin(this->ListFileStack, ";"); return output.c_str(); } - else if (prop == "VARIABLES" || prop == "CACHE_VARIABLES") + else if ( prop == "CACHE_VARIABLES" ) { - int cacheonly = 0; - if ( prop == "CACHE_VARIABLES" ) - { - cacheonly = 1; - } - output = cmJoin(this->GetDefinitions(cacheonly), ";"); + output = cmJoin(this->GetState()->GetCacheEntryKeys(), ";"); + return output.c_str(); + } + else if (prop == "VARIABLES") + { + output = cmJoin(this->GetDefinitions(), ";"); return output.c_str(); } else if (prop == "MACROS") From 046aafff12e6fa9834c7c114a59389df404ddf18 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 7 Jun 2015 15:11:42 +0200 Subject: [PATCH 0085/1048] cmGetCMakePropertyCommand: Don't explicitly specify default param. --- Source/cmGetCMakePropertyCommand.cxx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Source/cmGetCMakePropertyCommand.cxx b/Source/cmGetCMakePropertyCommand.cxx index 76803c103..61cf85b8e 100644 --- a/Source/cmGetCMakePropertyCommand.cxx +++ b/Source/cmGetCMakePropertyCommand.cxx @@ -32,8 +32,7 @@ bool cmGetCMakePropertyCommand if ( args[1] == "VARIABLES" ) { - int cacheonly = 0; - std::vector vars = this->Makefile->GetDefinitions(cacheonly); + std::vector vars = this->Makefile->GetDefinitions(); if (!vars.empty()) { output = cmJoin(vars, ";"); From 4c192fb53152a61015eb29c0a3826adeec16f8f8 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 7 Jun 2015 15:12:51 +0200 Subject: [PATCH 0086/1048] cmMakefile: Remove cacheOnly option from GetDefinitions. It is now unused. --- Source/cmMakefile.cxx | 13 +++---------- Source/cmMakefile.h | 2 +- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index b083f7065..2a3c51bd1 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -2497,18 +2497,11 @@ const char* cmMakefile::GetSafeDefinition(const std::string& def) const return ret; } -std::vector cmMakefile -::GetDefinitions(int cacheonly /* = 0 */) const +std::vector cmMakefile::GetDefinitions() const { - std::vector res; - if ( !cacheonly ) - { - res = this->Internal->ClosureKeys(); - } - std::vector cacheKeys = - this->GetState()->GetCacheEntryKeys(); + std::vector res = this->Internal->ClosureKeys(); + std::vector cacheKeys = this->GetState()->GetCacheEntryKeys(); res.insert(res.end(), cacheKeys.begin(), cacheKeys.end()); - std::sort(res.begin(), res.end()); return res; } diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index def0c23e9..ca7d4b0f3 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -511,7 +511,7 @@ public: * cacheonly is specified and is greater than 0, then only cache * variables will be listed. */ - std::vector GetDefinitions(int cacheonly=0) const; + std::vector GetDefinitions() const; /** * Test a boolean variable to see if it is true or false. From 9d68bd6a249e3c58fe4f7cb383ce27c14417c43c Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Mon, 8 Jun 2015 00:01:03 -0400 Subject: [PATCH 0087/1048] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 7ac1082aa..c9aec510b 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 3) -set(CMake_VERSION_PATCH 20150607) +set(CMake_VERSION_PATCH 20150608) #set(CMake_VERSION_RC 1) From 124243c0eb6977690d4f99f17e8019c748af3668 Mon Sep 17 00:00:00 2001 From: "Daniele E. Domenichelli" Date: Thu, 28 May 2015 19:39:19 +0200 Subject: [PATCH 0088/1048] ExternalProject: Add unit tests for GIT_SUBMODULES argument --- Tests/ExternalProject/CMakeLists.txt | 60 ++++++++++++++++++++++++++ Tests/ExternalProject/gitrepo-sub.tgz | Bin 0 -> 1911 bytes 2 files changed, 60 insertions(+) create mode 100644 Tests/ExternalProject/gitrepo-sub.tgz diff --git a/Tests/ExternalProject/CMakeLists.txt b/Tests/ExternalProject/CMakeLists.txt index de62ce7ac..b5041c7f8 100644 --- a/Tests/ExternalProject/CMakeLists.txt +++ b/Tests/ExternalProject/CMakeLists.txt @@ -364,6 +364,66 @@ if(do_git_tests) ) set_property(TARGET ${proj} PROPERTY FOLDER "GIT") + # Unzip/untar the git repository in our source folder so that other + # projects below may use it to test git args of ExternalProject_Add + # + set(proj SetupLocalGITRepositoryWithSubmodules) + ExternalProject_Add(${proj} + SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/LocalRepositories/GIT-with-submodules + URL ${CMAKE_CURRENT_SOURCE_DIR}/gitrepo-sub.tgz + BUILD_COMMAND "" + CONFIGURE_COMMAND "${GIT_EXECUTABLE}" --version + INSTALL_COMMAND "" + ) + set_property(TARGET ${proj} + PROPERTY FOLDER "SetupRepos/Local/Deeply/Nested/For/Testing") + + set(local_git_repo "../../LocalRepositories/GIT-with-submodules") + + set(proj TS1-GIT-no-GIT_SUBMODULES) + ExternalProject_Add(${proj} + GIT_REPOSITORY "${local_git_repo}" + CMAKE_GENERATOR "${CMAKE_GENERATOR}" + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH= + -DWITH_m1:BOOL=ON + -DWITH_m2:BOOL=ON + BUILD_COMMAND "" + INSTALL_COMMAND "" + DEPENDS "SetupLocalGITRepository" + "SetupLocalGITRepositoryWithSubmodules" + ) + set_property(TARGET ${proj} PROPERTY FOLDER "GIT") + + set(proj TS1-GIT-empty-GIT_SUBMODULES) + ExternalProject_Add(${proj} + GIT_REPOSITORY "${local_git_repo}" + GIT_SUBMODULES "" + CMAKE_GENERATOR "${CMAKE_GENERATOR}" + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH= + -DWITH_m1:BOOL=ON + -DWITH_m2:BOOL=ON + BUILD_COMMAND "" + INSTALL_COMMAND "" + DEPENDS "SetupLocalGITRepository" + "SetupLocalGITRepositoryWithSubmodules" + ) + set_property(TARGET ${proj} PROPERTY FOLDER "GIT") + + set(proj TS1-GIT-some-GIT_SUBMODULES) + ExternalProject_Add(${proj} + GIT_REPOSITORY "${local_git_repo}" + GIT_SUBMODULES "m/m1" + CMAKE_GENERATOR "${CMAKE_GENERATOR}" + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH= + -DWITH_m1:BOOL=ON + -DWITH_m2:BOOL=OFF + BUILD_COMMAND "" + INSTALL_COMMAND "" + DEPENDS "SetupLocalGITRepository" + "SetupLocalGITRepositoryWithSubmodules" + ) + set_property(TARGET ${proj} PROPERTY FOLDER "GIT") + endif() set(do_hg_tests 0) diff --git a/Tests/ExternalProject/gitrepo-sub.tgz b/Tests/ExternalProject/gitrepo-sub.tgz new file mode 100644 index 0000000000000000000000000000000000000000..c0b5360174893ff32cd7e69d24baf168205f74e9 GIT binary patch literal 1911 zcmV--2Z;C|iwFP~X>e5l1MQj%P*Z0X$0HUiSp;<33h3IaB9%(QedT2bA3zmB5R|ka zh**7f^M&fK|Q?&M_h|IYc&cfP1;)-Qms%bWa_ZWaVBqG>;MI5g8 z;3238!(lOwiEti_U@$J>L88a;WgIaxEMbBmo`%+|6%TlBp!c6p)DHR^6iX z9$tT3#0>%cUBLbHr}Zj>vnIjA>o3AF4CwC)9;m;OAT`XR`>+cv#vh=+SnQy`7#E{F z2!3?e1M`&Y9|ze*7Kl+9ibz#bk&1+IR3X7tG6llDV1|NM{O66}}yqg?$b2KnC=#LWzk<}PlW zx#xIhd&8~^4M86!jDM}*Y=AH#dndoM4~CG+^po`OhxiA`QnM%{ zy|=0{3lH>o6He@!ID2U&vZd$4FVD~D*#2Vd;`bF>44>Dh%fhV6Pz0;?5){5&zNz@- z=}9(&qPk_{p4lr5OzOVQ9eQ^rX?`WcGV-~}0Aon}nP_Y9iPQ6f zPR|jjChPmkj$U2aaqvQtH?vfVbbl(%>8bN6Jk=;cUa5a+Uqw-3X;EQTRa;}P=MMMz z>ut?~o^I+ud(&TAy^H30u9`9aUE=d=C#Gd;0=qQn>rw+pZ@Kkm`D=mC@vLP+>;B;x z`Rj$knA+Rk}_@^=z0Y%!M~xT-KLtZQ6Vc z6OM(GJ}&&?o6gw7=J}^%a^z$7`y3nDWoa3mt;uRlT)60R_Uoz*RO`M5OZ?V^FYt=D z-BW(BjTk%Y8C%rq=zq-I9655<>mEOiF8z!)o|KQW9?jkzKRJDkE$VPpVa>a5bPPRx zMLOkb)Yj7CXM1ONPg&t@t7~sxQ_^uWba}kuP~yH$pHq{3uMFMRFtxVk+b~OsFm+6& zS7yNnOxOYMvhUug-Y7$vo#?wJ4W7m)v5Kp#7gLHFJzT}2qr`|BFIC%5UHxn9NZ99c6XdFQw!O}G2< zvGOn1T5pZpdsXYbVAk%aV02(nK3s+MsuukAeFC2z;migNShi7vI(&Ll98^yMhEWYcSD- z7FxhkMg&qBOi*|Xp`oBxGg!)`C$w=UgMCK`u@u8XW`_F}Aa0&O+fc>Gsks3RC|Z2)=y{{hGNCk=WPt#+=Df#M&iCz>ov@O-lo-h?qf-U`T3z_Geem;KYBuUdyK0l2{W5!F!4Po z9YJgFj8S(7XOKFs1{E4iYLI0fFOKma`RdFFXZsj%{YND~_kR%79{(6F0{cIgz%A=j zA+WYTwK&GV{m7S63Y@wF7_k3?qmKXoLcsa2YnXWF|DSffp`|pNHWe~bl$KILDzjE= x5!}7u|JrQ=NF@LO0000000000000000000000000001yZ{2S$xC=vir003=8(suv= literal 0 HcmV?d00001 From 77ee6db50529abc784408d10156d5e4be61b8f18 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 2 Jun 2015 14:29:45 -0400 Subject: [PATCH 0089/1048] Help: Add notes for topic 'ExternalProject_init_selected_submodules' --- .../dev/ExternalProject_init_selected_submodules.rst | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 Help/release/dev/ExternalProject_init_selected_submodules.rst diff --git a/Help/release/dev/ExternalProject_init_selected_submodules.rst b/Help/release/dev/ExternalProject_init_selected_submodules.rst new file mode 100644 index 000000000..e642c1996 --- /dev/null +++ b/Help/release/dev/ExternalProject_init_selected_submodules.rst @@ -0,0 +1,7 @@ +ExternalProject_init_selected_submodules +---------------------------------------- + +* The :module:`ExternalProject` module :command:`ExternalProject_Add` + function ``GIT_SUBMODULES`` option now also limits the set of + submodules that are initialized in addition to the prior behavior + of limiting the set of submodules that are updated. From e2f349864dea91bec1d4c07428ab94225ff589dd Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 8 Jun 2015 15:15:47 -0400 Subject: [PATCH 0090/1048] Help: Document CMAKE_SYSTEM_FRAMEWORK_PATH variable --- Help/manual/cmake-variables.7.rst | 1 + Help/variable/CMAKE_SYSTEM_FRAMEWORK_PATH.rst | 8 ++++++++ 2 files changed, 9 insertions(+) create mode 100644 Help/variable/CMAKE_SYSTEM_FRAMEWORK_PATH.rst diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index bd02f8b8b..d62194532 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -147,6 +147,7 @@ Variables that Change Behavior /variable/CMAKE_PROJECT_PROJECT-NAME_INCLUDE /variable/CMAKE_SKIP_INSTALL_ALL_DEPENDENCY /variable/CMAKE_STAGING_PREFIX + /variable/CMAKE_SYSTEM_FRAMEWORK_PATH /variable/CMAKE_SYSTEM_IGNORE_PATH /variable/CMAKE_SYSTEM_INCLUDE_PATH /variable/CMAKE_SYSTEM_LIBRARY_PATH diff --git a/Help/variable/CMAKE_SYSTEM_FRAMEWORK_PATH.rst b/Help/variable/CMAKE_SYSTEM_FRAMEWORK_PATH.rst new file mode 100644 index 000000000..1e8b0d947 --- /dev/null +++ b/Help/variable/CMAKE_SYSTEM_FRAMEWORK_PATH.rst @@ -0,0 +1,8 @@ +CMAKE_SYSTEM_FRAMEWORK_PATH +--------------------------- + +Search path for OS X frameworks used by the :command:`find_library`, +:command:`find_package`, :command:`find_path`, and :command:`find_file` +commands. By default it contains the standard directories for the +current system. It is *not* intended to be modified by the project, +use :variable:`CMAKE_FRAMEWORK_PATH` for this. From 25b4483ef8d6f6f074f05cf99e0282abf22d8939 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 8 Jun 2015 15:21:47 -0400 Subject: [PATCH 0091/1048] Help: Document CMAKE_SYSTEM_APPBUNDLE_PATH variable --- Help/manual/cmake-variables.7.rst | 1 + Help/variable/CMAKE_SYSTEM_APPBUNDLE_PATH.rst | 7 +++++++ 2 files changed, 8 insertions(+) create mode 100644 Help/variable/CMAKE_SYSTEM_APPBUNDLE_PATH.rst diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index d62194532..4c51fe120 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -147,6 +147,7 @@ Variables that Change Behavior /variable/CMAKE_PROJECT_PROJECT-NAME_INCLUDE /variable/CMAKE_SKIP_INSTALL_ALL_DEPENDENCY /variable/CMAKE_STAGING_PREFIX + /variable/CMAKE_SYSTEM_APPBUNDLE_PATH /variable/CMAKE_SYSTEM_FRAMEWORK_PATH /variable/CMAKE_SYSTEM_IGNORE_PATH /variable/CMAKE_SYSTEM_INCLUDE_PATH diff --git a/Help/variable/CMAKE_SYSTEM_APPBUNDLE_PATH.rst b/Help/variable/CMAKE_SYSTEM_APPBUNDLE_PATH.rst new file mode 100644 index 000000000..3c6687c6e --- /dev/null +++ b/Help/variable/CMAKE_SYSTEM_APPBUNDLE_PATH.rst @@ -0,0 +1,7 @@ +CMAKE_SYSTEM_APPBUNDLE_PATH +--------------------------- + +Search path for OS X application bundles used by the :command:`find_program`, +and :command:`find_package` commands. By default it contains the standard +directories for the current system. It is *not* intended to be modified by +the project, use :variable:`CMAKE_APPBUNDLE_PATH` for this. From 8c64c4783dde25d84b1549945b95d192c1b7fd68 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 8 Jun 2015 15:36:31 -0400 Subject: [PATCH 0092/1048] Help: Document CMAKE_FIND_APPBUNDLE and CMAKE_FIND_FRAMEWORK Add dedicated documents for these and link to them instead of duplicating their documentation in every find command. --- Help/command/FIND_XXX.txt | 5 ++++- Help/command/FIND_XXX_MAC.txt | 24 ------------------------ Help/command/find_package.rst | 7 +++---- Help/manual/cmake-variables.7.rst | 2 ++ Help/variable/CMAKE_FIND_APPBUNDLE.rst | 22 ++++++++++++++++++++++ Help/variable/CMAKE_FIND_FRAMEWORK.rst | 22 ++++++++++++++++++++++ 6 files changed, 53 insertions(+), 29 deletions(-) delete mode 100644 Help/command/FIND_XXX_MAC.txt create mode 100644 Help/variable/CMAKE_FIND_APPBUNDLE.rst create mode 100644 Help/variable/CMAKE_FIND_FRAMEWORK.rst diff --git a/Help/command/FIND_XXX.txt b/Help/command/FIND_XXX.txt index 935832930..474127d23 100644 --- a/Help/command/FIND_XXX.txt +++ b/Help/command/FIND_XXX.txt @@ -100,6 +100,9 @@ If NO_DEFAULT_PATH is not specified, the search process is as follows: .. |FIND_ARGS_XXX| replace:: NAMES name -.. include:: FIND_XXX_MAC.txt +On OS X the :variable:`CMAKE_FIND_FRAMEWORK` and +:variable:`CMAKE_FIND_APPBUNDLE` variables determine the order of +preference between Apple-style and unix-style package components. + .. include:: FIND_XXX_ROOT.txt .. include:: FIND_XXX_ORDER.txt diff --git a/Help/command/FIND_XXX_MAC.txt b/Help/command/FIND_XXX_MAC.txt deleted file mode 100644 index eb3900cbb..000000000 --- a/Help/command/FIND_XXX_MAC.txt +++ /dev/null @@ -1,24 +0,0 @@ -On Darwin or systems supporting OS X Frameworks, the cmake variable -CMAKE_FIND_FRAMEWORK can be set to empty or one of the following: - -* FIRST: Try to find frameworks before standard libraries or headers. - This is the default on Darwin. - -* LAST: Try to find frameworks after standard libraries or headers. - -* ONLY: Only try to find frameworks. - -* NEVER: Never try to find frameworks. - -On Darwin or systems supporting OS X Application Bundles, the cmake -variable CMAKE_FIND_APPBUNDLE can be set to empty or one of the -following: - -* FIRST: Try to find application bundles before standard programs. - This is the default on Darwin. - -* LAST: Try to find application bundles after standard programs. - -* ONLY: Only try to find application bundles. - -* NEVER: Never try to find application bundles. diff --git a/Help/command/find_package.rst b/Help/command/find_package.rst index a5efba6d0..58dff9d39 100644 --- a/Help/command/find_package.rst +++ b/Help/command/find_package.rst @@ -228,9 +228,9 @@ installation directory. Those marked with (U) are intended for installations on UNIX platforms where the prefix is shared by multiple packages. This is merely a convention, so all (W) and (U) directories are still searched on all platforms. Directories marked with (A) are -intended for installations on Apple platforms. The cmake variables -``CMAKE_FIND_FRAMEWORK`` and ``CMAKE_FIND_APPBUNDLE`` -determine the order of preference as specified below. +intended for installations on Apple platforms. The +:variable:`CMAKE_FIND_FRAMEWORK` and :variable:`CMAKE_FIND_APPBUNDLE` +variables determine the order of preference. The set of installation prefixes is constructed using the following steps. If ``NO_DEFAULT_PATH`` is specified all ``NO_*`` options are @@ -295,7 +295,6 @@ enabled. .. |CMAKE_FIND_ROOT_PATH_MODE_XXX| replace:: :variable:`CMAKE_FIND_ROOT_PATH_MODE_PACKAGE` -.. include:: FIND_XXX_MAC.txt .. include:: FIND_XXX_ROOT.txt .. include:: FIND_XXX_ORDER.txt diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index 4c51fe120..f010d28b1 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -117,6 +117,8 @@ Variables that Change Behavior /variable/CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION /variable/CMAKE_EXPORT_NO_PACKAGE_REGISTRY /variable/CMAKE_SYSROOT + /variable/CMAKE_FIND_APPBUNDLE + /variable/CMAKE_FIND_FRAMEWORK /variable/CMAKE_FIND_LIBRARY_PREFIXES /variable/CMAKE_FIND_LIBRARY_SUFFIXES /variable/CMAKE_FIND_NO_INSTALL_PREFIX diff --git a/Help/variable/CMAKE_FIND_APPBUNDLE.rst b/Help/variable/CMAKE_FIND_APPBUNDLE.rst new file mode 100644 index 000000000..e0727b547 --- /dev/null +++ b/Help/variable/CMAKE_FIND_APPBUNDLE.rst @@ -0,0 +1,22 @@ +CMAKE_FIND_APPBUNDLE +-------------------- + +This variable affects how ``find_*`` commands choose between +OS X Application Bundles and unix-style package components. + +On Darwin or systems supporting OS X Application Bundles, the +``CMAKE_FIND_APPBUNDLE`` variable can be set to empty or +one of the following: + +``FIRST`` + Try to find application bundles before standard programs. + This is the default on Darwin. + +``LAST`` + Try to find application bundles after standard programs. + +``ONLY`` + Only try to find application bundles. + +``NEVER`` + Never try to find application bundles. diff --git a/Help/variable/CMAKE_FIND_FRAMEWORK.rst b/Help/variable/CMAKE_FIND_FRAMEWORK.rst new file mode 100644 index 000000000..790694ac5 --- /dev/null +++ b/Help/variable/CMAKE_FIND_FRAMEWORK.rst @@ -0,0 +1,22 @@ +CMAKE_FIND_FRAMEWORK +-------------------- + +This variable affects how ``find_*`` commands choose between +OS X Frameworks and unix-style package components. + +On Darwin or systems supporting OS X Frameworks, the +``CMAKE_FIND_FRAMEWORK`` variable can be set to empty or +one of the following: + +``FIRST`` + Try to find frameworks before standard libraries or headers. + This is the default on Darwin. + +``LAST`` + Try to find frameworks after standard libraries or headers. + +``ONLY`` + Only try to find frameworks. + +``NEVER`` + Never try to find frameworks. From 3de3544fcd38680652d5bbe0790b78477ffa26f1 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 8 Jun 2015 15:52:21 -0400 Subject: [PATCH 0093/1048] Help: Improve documentation formatting of find_* commands Use inline reStructuredText markup and add cross-references in more places. --- Help/command/FIND_XXX.txt | 56 +++++++++++++++++++--------------- Help/command/FIND_XXX_ROOT.txt | 16 +++++++--- Help/command/find_file.rst | 29 ++++++++++-------- Help/command/find_library.rst | 51 ++++++++++++++++--------------- Help/command/find_path.rst | 35 +++++++++++---------- Help/command/find_program.rst | 15 +++++---- 6 files changed, 113 insertions(+), 89 deletions(-) diff --git a/Help/command/FIND_XXX.txt b/Help/command/FIND_XXX.txt index 474127d23..966db06c2 100644 --- a/Help/command/FIND_XXX.txt +++ b/Help/command/FIND_XXX.txt @@ -33,36 +33,42 @@ and the search will not be repeated unless the variable is cleared. If nothing is found, the result will be ``-NOTFOUND``, and the search will be attempted again the next time |FIND_XXX| is invoked with the same variable. -The name of the |SEARCH_XXX| that -is searched for is specified by the names listed -after the NAMES argument. Additional search locations -can be specified after the PATHS argument. If ENV var is -found in the HINTS or PATHS section the environment variable var -will be read and converted from a system environment variable to -a cmake style list of paths. For example ENV PATH would be a way -to list the system path variable. The argument -after DOC will be used for the documentation string in -the cache. -PATH_SUFFIXES specifies additional subdirectories to check below -each search path. -If NO_DEFAULT_PATH is specified, then no additional paths are +Options include: + +``NAMES`` + Specify one or more possible names for the |SEARCH_XXX|. + +``HINTS``, ``PATHS`` + Specify directories to search in addition to the default locations. + The ``ENV var`` sub-option reads paths from a system environment + variable. + +``PATH_SUFFIXES`` + Specify additional subdirectories to check below each directory + location otherwise considered. + +``DOC`` + Specify the documentation string for the ```` cache entry. + +If ``NO_DEFAULT_PATH`` is specified, then no additional paths are added to the search. -If NO_DEFAULT_PATH is not specified, the search process is as follows: +If ``NO_DEFAULT_PATH`` is not specified, the search process is as follows: .. |CMAKE_PREFIX_PATH_XXX_SUBDIR| replace:: - /|XXX_SUBDIR| for each in CMAKE_PREFIX_PATH + |prefix_XXX_SUBDIR| for each ```` in :variable:`CMAKE_PREFIX_PATH` .. |SYSTEM_ENVIRONMENT_PREFIX_PATH_XXX_SUBDIR| replace:: - /|XXX_SUBDIR| for each /[s]bin in PATH, and - /|XXX_SUBDIR| for other entries in PATH + |prefix_XXX_SUBDIR| for each ``/[s]bin`` in ``PATH``, and + |entry_XXX_SUBDIR| for other entries in ``PATH`` .. |CMAKE_SYSTEM_PREFIX_PATH_XXX_SUBDIR| replace:: - /|XXX_SUBDIR| for each in CMAKE_SYSTEM_PREFIX_PATH + |prefix_XXX_SUBDIR| for each ```` in + :variable:`CMAKE_SYSTEM_PREFIX_PATH` 1. Search paths specified in cmake-specific cache variables. - These are intended to be used on the command line with a -DVAR=value. - This can be skipped if NO_CMAKE_PATH is passed. + These are intended to be used on the command line with a ``-DVAR=value``. + This can be skipped if ``NO_CMAKE_PATH`` is passed. * |CMAKE_PREFIX_PATH_XXX| * |CMAKE_XXX_PATH| @@ -70,24 +76,24 @@ If NO_DEFAULT_PATH is not specified, the search process is as follows: 2. Search paths specified in cmake-specific environment variables. These are intended to be set in the user's shell configuration. - This can be skipped if NO_CMAKE_ENVIRONMENT_PATH is passed. + This can be skipped if ``NO_CMAKE_ENVIRONMENT_PATH`` is passed. * |CMAKE_PREFIX_PATH_XXX| * |CMAKE_XXX_PATH| * |CMAKE_XXX_MAC_PATH| -3. Search the paths specified by the HINTS option. +3. Search the paths specified by the ``HINTS`` option. These should be paths computed by system introspection, such as a hint provided by the location of another item already found. - Hard-coded guesses should be specified with the PATHS option. + Hard-coded guesses should be specified with the ``PATHS`` option. 4. Search the standard system environment variables. - This can be skipped if NO_SYSTEM_ENVIRONMENT_PATH is an argument. + This can be skipped if ``NO_SYSTEM_ENVIRONMENT_PATH`` is an argument. * |SYSTEM_ENVIRONMENT_PATH_XXX| 5. Search cmake variables defined in the Platform files - for the current system. This can be skipped if NO_CMAKE_SYSTEM_PATH + for the current system. This can be skipped if ``NO_CMAKE_SYSTEM_PATH`` is passed. * |CMAKE_SYSTEM_PREFIX_PATH_XXX| diff --git a/Help/command/FIND_XXX_ROOT.txt b/Help/command/FIND_XXX_ROOT.txt index b5cab68b8..fab23037c 100644 --- a/Help/command/FIND_XXX_ROOT.txt +++ b/Help/command/FIND_XXX_ROOT.txt @@ -16,8 +16,14 @@ search there too. By default at first the directories listed in directory is searched, and then the non-rooted directories will be searched. The default behavior can be adjusted by setting |CMAKE_FIND_ROOT_PATH_MODE_XXX|. This behavior can be manually -overridden on a per-call basis. By using CMAKE_FIND_ROOT_PATH_BOTH -the search order will be as described above. If -NO_CMAKE_FIND_ROOT_PATH is used then :variable:`CMAKE_FIND_ROOT_PATH` will not be -used. If ONLY_CMAKE_FIND_ROOT_PATH is used then only the re-rooted -directories and directories below :variable:`CMAKE_STAGING_PREFIX` will be searched. +overridden on a per-call basis using options: + +``CMAKE_FIND_ROOT_PATH_BOTH`` + Search in the order described above. + +``NO_CMAKE_FIND_ROOT_PATH`` + Do not use the :variable:`CMAKE_FIND_ROOT_PATH` variable. + +``ONLY_CMAKE_FIND_ROOT_PATH`` + Search only the re-rooted directories and directories below + :variable:`CMAKE_STAGING_PREFIX`. diff --git a/Help/command/find_file.rst b/Help/command/find_file.rst index be309a530..bf7a91993 100644 --- a/Help/command/find_file.rst +++ b/Help/command/find_file.rst @@ -5,24 +5,27 @@ find_file .. |NAMES| replace:: NAMES name1 [name2 ...] .. |SEARCH_XXX| replace:: full path to a file .. |SEARCH_XXX_DESC| replace:: full path to named file -.. |XXX_SUBDIR| replace:: include +.. |prefix_XXX_SUBDIR| replace:: ``/include`` +.. |entry_XXX_SUBDIR| replace:: ``/include`` .. |CMAKE_PREFIX_PATH_XXX| replace:: - /include/ if CMAKE_LIBRARY_ARCHITECTURE is set, and - |CMAKE_PREFIX_PATH_XXX_SUBDIR| -.. |CMAKE_XXX_PATH| replace:: CMAKE_INCLUDE_PATH -.. |CMAKE_XXX_MAC_PATH| replace:: CMAKE_FRAMEWORK_PATH + ``/include/`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE` + is set, and |CMAKE_PREFIX_PATH_XXX_SUBDIR| +.. |CMAKE_XXX_PATH| replace:: :variable:`CMAKE_INCLUDE_PATH` +.. |CMAKE_XXX_MAC_PATH| replace:: :variable:`CMAKE_FRAMEWORK_PATH` -.. |SYSTEM_ENVIRONMENT_PATH_XXX| replace:: Directories in INCLUDE, - /include/ if CMAKE_LIBRARY_ARCHITECTURE is set, and - |SYSTEM_ENVIRONMENT_PREFIX_PATH_XXX_SUBDIR|, - and the directories in PATH itself. +.. |SYSTEM_ENVIRONMENT_PATH_XXX| replace:: Directories in ``INCLUDE``, + ``/include/`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE` + is set, and |SYSTEM_ENVIRONMENT_PREFIX_PATH_XXX_SUBDIR|, and the + directories in ``PATH`` itself. .. |CMAKE_SYSTEM_PREFIX_PATH_XXX| replace:: - /include/ if CMAKE_LIBRARY_ARCHITECTURE is set, and - |CMAKE_SYSTEM_PREFIX_PATH_XXX_SUBDIR| -.. |CMAKE_SYSTEM_XXX_PATH| replace:: CMAKE_SYSTEM_INCLUDE_PATH -.. |CMAKE_SYSTEM_XXX_MAC_PATH| replace:: CMAKE_SYSTEM_FRAMEWORK_PATH + ``/include/`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE` + is set, and |CMAKE_SYSTEM_PREFIX_PATH_XXX_SUBDIR| +.. |CMAKE_SYSTEM_XXX_PATH| replace:: + :variable:`CMAKE_SYSTEM_INCLUDE_PATH` +.. |CMAKE_SYSTEM_XXX_MAC_PATH| replace:: + :variable:`CMAKE_SYSTEM_FRAMEWORK_PATH` .. |CMAKE_FIND_ROOT_PATH_MODE_XXX| replace:: :variable:`CMAKE_FIND_ROOT_PATH_MODE_INCLUDE` diff --git a/Help/command/find_library.rst b/Help/command/find_library.rst index e3dcd2ba0..5d07574ad 100644 --- a/Help/command/find_library.rst +++ b/Help/command/find_library.rst @@ -5,33 +5,36 @@ find_library .. |NAMES| replace:: NAMES name1 [name2 ...] [NAMES_PER_DIR] .. |SEARCH_XXX| replace:: library .. |SEARCH_XXX_DESC| replace:: library -.. |XXX_SUBDIR| replace:: lib +.. |prefix_XXX_SUBDIR| replace:: ``/lib`` +.. |entry_XXX_SUBDIR| replace:: ``/lib`` .. |CMAKE_PREFIX_PATH_XXX| replace:: - /lib/ if CMAKE_LIBRARY_ARCHITECTURE is set, and - |CMAKE_PREFIX_PATH_XXX_SUBDIR| -.. |CMAKE_XXX_PATH| replace:: CMAKE_LIBRARY_PATH -.. |CMAKE_XXX_MAC_PATH| replace:: CMAKE_FRAMEWORK_PATH + ``/lib/`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE` is set, + and |CMAKE_PREFIX_PATH_XXX_SUBDIR| +.. |CMAKE_XXX_PATH| replace:: :variable:`CMAKE_LIBRARY_PATH` +.. |CMAKE_XXX_MAC_PATH| replace:: :variable:`CMAKE_FRAMEWORK_PATH` -.. |SYSTEM_ENVIRONMENT_PATH_XXX| replace:: Directories in LIB, - /lib/ if CMAKE_LIBRARY_ARCHITECTURE is set, and - |SYSTEM_ENVIRONMENT_PREFIX_PATH_XXX_SUBDIR|, - and the directories in PATH itself. +.. |SYSTEM_ENVIRONMENT_PATH_XXX| replace:: Directories in ``LIB``, + ``/lib/`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE` is set, + and |SYSTEM_ENVIRONMENT_PREFIX_PATH_XXX_SUBDIR|, + and the directories in ``PATH`` itself. .. |CMAKE_SYSTEM_PREFIX_PATH_XXX| replace:: - /lib/ if CMAKE_LIBRARY_ARCHITECTURE is set, and - |CMAKE_SYSTEM_PREFIX_PATH_XXX_SUBDIR| -.. |CMAKE_SYSTEM_XXX_PATH| replace:: CMAKE_SYSTEM_LIBRARY_PATH -.. |CMAKE_SYSTEM_XXX_MAC_PATH| replace:: CMAKE_SYSTEM_FRAMEWORK_PATH + ``/lib/`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE` is set, + and |CMAKE_SYSTEM_PREFIX_PATH_XXX_SUBDIR| +.. |CMAKE_SYSTEM_XXX_PATH| replace:: + :variable:`CMAKE_SYSTEM_LIBRARY_PATH` +.. |CMAKE_SYSTEM_XXX_MAC_PATH| replace:: + :variable:`CMAKE_SYSTEM_FRAMEWORK_PATH` .. |CMAKE_FIND_ROOT_PATH_MODE_XXX| replace:: :variable:`CMAKE_FIND_ROOT_PATH_MODE_LIBRARY` .. include:: FIND_XXX.txt -When more than one value is given to the NAMES option this command by +When more than one value is given to the ``NAMES`` option this command by default will consider one name at a time and search every directory -for it. The NAMES_PER_DIR option tells this command to consider one +for it. The ``NAMES_PER_DIR`` option tells this command to consider one directory at a time and search for all names in it. Each library name given to the ``NAMES`` option is first considered @@ -40,14 +43,14 @@ prefixes (e.g. ``lib``) and suffixes (e.g. ``.so``). Therefore one may specify library file names such as ``libfoo.a`` directly. This can be used to locate static libraries on UNIX-like systems. -If the library found is a framework, then VAR will be set to the full -path to the framework /A.framework. When a full path to a -framework is used as a library, CMake will use a -framework A, and a --F to link the framework to the target. +If the library found is a framework, then ```` will be set to the full +path to the framework ``/A.framework``. When a full path to a +framework is used as a library, CMake will use a ``-framework A``, and a +``-F`` to link the framework to the target. -If the global property FIND_LIBRARY_USE_LIB64_PATHS is set all search -paths will be tested as normal, with "64/" appended, and with all -matches of "lib/" replaced with "lib64/". This property is +If the :prop_gbl:`FIND_LIBRARY_USE_LIB64_PATHS` global property is set +all search paths will be tested as normal, with ``64/`` appended, and +with all matches of ``lib/`` replaced with ``lib64/``. This property is automatically set for the platforms that are known to need it if at -least one of the languages supported by the PROJECT command is -enabled. +least one of the languages supported by the :command:`project` command +is enabled. diff --git a/Help/command/find_path.rst b/Help/command/find_path.rst index b5a6e373f..4403cb5bc 100644 --- a/Help/command/find_path.rst +++ b/Help/command/find_path.rst @@ -5,31 +5,34 @@ find_path .. |NAMES| replace:: NAMES name1 [name2 ...] .. |SEARCH_XXX| replace:: file in a directory .. |SEARCH_XXX_DESC| replace:: directory containing the named file -.. |XXX_SUBDIR| replace:: include +.. |prefix_XXX_SUBDIR| replace:: ``/include`` +.. |entry_XXX_SUBDIR| replace:: ``/include`` .. |CMAKE_PREFIX_PATH_XXX| replace:: - /include/ if CMAKE_LIBRARY_ARCHITECTURE is set, and - |CMAKE_PREFIX_PATH_XXX_SUBDIR| -.. |CMAKE_XXX_PATH| replace:: CMAKE_INCLUDE_PATH -.. |CMAKE_XXX_MAC_PATH| replace:: CMAKE_FRAMEWORK_PATH + ``/include/`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE` + is set, and |CMAKE_PREFIX_PATH_XXX_SUBDIR| +.. |CMAKE_XXX_PATH| replace:: :variable:`CMAKE_INCLUDE_PATH` +.. |CMAKE_XXX_MAC_PATH| replace:: :variable:`CMAKE_FRAMEWORK_PATH` -.. |SYSTEM_ENVIRONMENT_PATH_XXX| replace:: Directories in INCLUDE, - /include/ if CMAKE_LIBRARY_ARCHITECTURE is set, and - |SYSTEM_ENVIRONMENT_PREFIX_PATH_XXX_SUBDIR|, - and the directories in PATH itself. +.. |SYSTEM_ENVIRONMENT_PATH_XXX| replace:: Directories in ``INCLUDE``, + ``/include/`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE` + is set, and |SYSTEM_ENVIRONMENT_PREFIX_PATH_XXX_SUBDIR|, and the + directories in ``PATH`` itself. .. |CMAKE_SYSTEM_PREFIX_PATH_XXX| replace:: - /include/ if CMAKE_LIBRARY_ARCHITECTURE is set, and - |CMAKE_SYSTEM_PREFIX_PATH_XXX_SUBDIR| -.. |CMAKE_SYSTEM_XXX_PATH| replace:: CMAKE_SYSTEM_INCLUDE_PATH -.. |CMAKE_SYSTEM_XXX_MAC_PATH| replace:: CMAKE_SYSTEM_FRAMEWORK_PATH + ``/include/`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE` + is set, and |CMAKE_SYSTEM_PREFIX_PATH_XXX_SUBDIR| +.. |CMAKE_SYSTEM_XXX_PATH| replace:: + :variable:`CMAKE_SYSTEM_INCLUDE_PATH` +.. |CMAKE_SYSTEM_XXX_MAC_PATH| replace:: + :variable:`CMAKE_SYSTEM_FRAMEWORK_PATH` .. |CMAKE_FIND_ROOT_PATH_MODE_XXX| replace:: :variable:`CMAKE_FIND_ROOT_PATH_MODE_INCLUDE` .. include:: FIND_XXX.txt -When searching for frameworks, if the file is specified as A/b.h, then -the framework search will look for A.framework/Headers/b.h. If that +When searching for frameworks, if the file is specified as ``A/b.h``, then +the framework search will look for ``A.framework/Headers/b.h``. If that is found the path will be set to the path to the framework. CMake -will convert this to the correct -F option to include the file. +will convert this to the correct ``-F`` option to include the file. diff --git a/Help/command/find_program.rst b/Help/command/find_program.rst index c62a8a5d2..2a5ce9a8d 100644 --- a/Help/command/find_program.rst +++ b/Help/command/find_program.rst @@ -5,19 +5,22 @@ find_program .. |NAMES| replace:: NAMES name1 [name2 ...] .. |SEARCH_XXX| replace:: program .. |SEARCH_XXX_DESC| replace:: program -.. |XXX_SUBDIR| replace:: [s]bin +.. |prefix_XXX_SUBDIR| replace:: ``/[s]bin`` +.. |entry_XXX_SUBDIR| replace:: ``/[s]bin`` .. |CMAKE_PREFIX_PATH_XXX| replace:: |CMAKE_PREFIX_PATH_XXX_SUBDIR| -.. |CMAKE_XXX_PATH| replace:: CMAKE_PROGRAM_PATH -.. |CMAKE_XXX_MAC_PATH| replace:: CMAKE_APPBUNDLE_PATH +.. |CMAKE_XXX_PATH| replace:: :variable:`CMAKE_PROGRAM_PATH` +.. |CMAKE_XXX_MAC_PATH| replace:: :variable:`CMAKE_APPBUNDLE_PATH` -.. |SYSTEM_ENVIRONMENT_PATH_XXX| replace:: PATH +.. |SYSTEM_ENVIRONMENT_PATH_XXX| replace:: ``PATH`` .. |CMAKE_SYSTEM_PREFIX_PATH_XXX| replace:: |CMAKE_SYSTEM_PREFIX_PATH_XXX_SUBDIR| -.. |CMAKE_SYSTEM_XXX_PATH| replace:: CMAKE_SYSTEM_PROGRAM_PATH -.. |CMAKE_SYSTEM_XXX_MAC_PATH| replace:: CMAKE_SYSTEM_APPBUNDLE_PATH +.. |CMAKE_SYSTEM_XXX_PATH| replace:: + :variable:`CMAKE_SYSTEM_PROGRAM_PATH` +.. |CMAKE_SYSTEM_XXX_MAC_PATH| replace:: + :variable:`CMAKE_SYSTEM_APPBUNDLE_PATH` .. |CMAKE_FIND_ROOT_PATH_MODE_XXX| replace:: :variable:`CMAKE_FIND_ROOT_PATH_MODE_PROGRAM` From 7ab0806fef24d4982adbbef9b37f48111d2eced4 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 8 Jun 2015 16:11:10 -0400 Subject: [PATCH 0094/1048] Help: Document find_* command versioned/unversioned name ordering Suggest in the NAMES option that unversioned names go first to prefer local builds over distro-provided files. --- Help/command/FIND_XXX.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Help/command/FIND_XXX.txt b/Help/command/FIND_XXX.txt index 966db06c2..bd4d2959d 100644 --- a/Help/command/FIND_XXX.txt +++ b/Help/command/FIND_XXX.txt @@ -39,6 +39,11 @@ Options include: ``NAMES`` Specify one or more possible names for the |SEARCH_XXX|. + When using this to specify names with and without a version + suffix, we recommend specifying the unversioned name first + so that locally-built packages can be found before those + provided by distributions. + ``HINTS``, ``PATHS`` Specify directories to search in addition to the default locations. The ``ENV var`` sub-option reads paths from a system environment From 8fc53c3ce89e76a4e5cf1968307c513041e9a7b7 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 8 Jun 2015 22:00:37 +0200 Subject: [PATCH 0095/1048] cmGetDirectoryPropertyCommand: Extract StoreResult method. --- Source/cmGetDirectoryPropertyCommand.cxx | 18 ++++++++++++------ Source/cmGetDirectoryPropertyCommand.h | 5 +++-- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/Source/cmGetDirectoryPropertyCommand.cxx b/Source/cmGetDirectoryPropertyCommand.cxx index 228e53cd2..bb1801ca0 100644 --- a/Source/cmGetDirectoryPropertyCommand.cxx +++ b/Source/cmGetDirectoryPropertyCommand.cxx @@ -89,12 +89,18 @@ bool cmGetDirectoryPropertyCommand { prop = dir->GetProperty(*i); } - if (prop) - { - this->Makefile->AddDefinition(variable, prop); - return true; - } - this->Makefile->AddDefinition(variable, ""); + this->StoreResult(variable, prop); return true; } +void cmGetDirectoryPropertyCommand::StoreResult(std::string const& variable, + const char* prop) +{ + if (prop) + { + this->Makefile->AddDefinition(variable, prop); + return; + } + this->Makefile->AddDefinition(variable, ""); +} + diff --git a/Source/cmGetDirectoryPropertyCommand.h b/Source/cmGetDirectoryPropertyCommand.h index 6c5750a9c..f4188861f 100644 --- a/Source/cmGetDirectoryPropertyCommand.h +++ b/Source/cmGetDirectoryPropertyCommand.h @@ -40,8 +40,9 @@ public: virtual std::string GetName() const { return "get_directory_property";} cmTypeMacro(cmGetDirectoryPropertyCommand, cmCommand); + +private: + void StoreResult(const std::string& variable, const char* prop); }; - - #endif From fe603c7dfb8a3d0dfc892b46f9df0b4c32a892f9 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 8 Jun 2015 22:03:07 +0200 Subject: [PATCH 0096/1048] cmGetDirectoryPropertyCommand: Move variable to the point of use. --- Source/cmGetDirectoryPropertyCommand.cxx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Source/cmGetDirectoryPropertyCommand.cxx b/Source/cmGetDirectoryPropertyCommand.cxx index bb1801ca0..f60eba707 100644 --- a/Source/cmGetDirectoryPropertyCommand.cxx +++ b/Source/cmGetDirectoryPropertyCommand.cxx @@ -26,7 +26,6 @@ bool cmGetDirectoryPropertyCommand std::vector::const_iterator i = args.begin(); std::string variable = *i; ++i; - std::string output = ""; // get the directory argument if there is one cmMakefile *dir = this->Makefile; @@ -79,7 +78,7 @@ bool cmGetDirectoryPropertyCommand "providing the name of the variable to get."); return false; } - output = dir->GetSafeDefinition(*i); + std::string output = dir->GetSafeDefinition(*i); this->Makefile->AddDefinition(variable, output.c_str()); return true; } From 52b9d828ab482f5eaae3313d821d9a4a492f069b Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 7 Jun 2015 14:50:54 +0200 Subject: [PATCH 0097/1048] cmMakefile: Move CMP0059 handling to command code. Don't pay a penalty for it in all GetProperty calls. Additionally, the storage of properties will eventually move to cmState, which should only contain state and not logic for policies like this. --- Source/cmGetDirectoryPropertyCommand.cxx | 17 +++++++++++++++++ Source/cmGetPropertyCommand.cxx | 16 ++++++++++++++++ Source/cmMakefile.cxx | 21 +++++---------------- Source/cmMakefile.h | 2 ++ 4 files changed, 40 insertions(+), 16 deletions(-) diff --git a/Source/cmGetDirectoryPropertyCommand.cxx b/Source/cmGetDirectoryPropertyCommand.cxx index f60eba707..c056d9527 100644 --- a/Source/cmGetDirectoryPropertyCommand.cxx +++ b/Source/cmGetDirectoryPropertyCommand.cxx @@ -86,6 +86,23 @@ bool cmGetDirectoryPropertyCommand const char *prop = 0; if (!i->empty()) { + if (*i == "DEFINITIONS") + { + switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0059)) + { + case cmPolicies::WARN: + this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, + cmPolicies::GetPolicyWarning(cmPolicies::CMP0059)); + case cmPolicies::OLD: + this->StoreResult(variable, + this->Makefile->GetDefineFlagsCMP0059()); + return true; + case cmPolicies::NEW: + case cmPolicies::REQUIRED_ALWAYS: + case cmPolicies::REQUIRED_IF_USED: + break; + } + } prop = dir->GetProperty(*i); } this->StoreResult(variable, prop); diff --git a/Source/cmGetPropertyCommand.cxx b/Source/cmGetPropertyCommand.cxx index 36b6c6435..33d638b6a 100644 --- a/Source/cmGetPropertyCommand.cxx +++ b/Source/cmGetPropertyCommand.cxx @@ -279,6 +279,22 @@ bool cmGetPropertyCommand::HandleDirectoryMode() } } + if (this->PropertyName == "DEFINITIONS") + { + switch(mf->GetPolicyStatus(cmPolicies::CMP0059)) + { + case cmPolicies::WARN: + mf->IssueMessage(cmake::AUTHOR_WARNING, + cmPolicies::GetPolicyWarning(cmPolicies::CMP0059)); + case cmPolicies::OLD: + return this->StoreResult(mf->GetDefineFlagsCMP0059()); + case cmPolicies::NEW: + case cmPolicies::REQUIRED_ALWAYS: + case cmPolicies::REQUIRED_IF_USED: + break; + } + } + // Get the property. return this->StoreResult(mf->GetProperty(this->PropertyName)); } diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index a8b163a87..63dbe27fc 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -4171,22 +4171,6 @@ const char *cmMakefile::GetProperty(const std::string& prop, this->GetListOfMacros(output); return output.c_str(); } - else if (prop == "DEFINITIONS") - { - switch(this->GetPolicyStatus(cmPolicies::CMP0059)) - { - case cmPolicies::WARN: - this->IssueMessage(cmake::AUTHOR_WARNING, cmPolicies:: - GetPolicyWarning(cmPolicies::CMP0059)); - case cmPolicies::OLD: - output += this->DefineFlagsOrig; - return output.c_str(); - case cmPolicies::NEW: - case cmPolicies::REQUIRED_ALWAYS: - case cmPolicies::REQUIRED_IF_USED: - break; - } - } else if (prop == "LINK_DIRECTORIES") { output = cmJoin(this->GetLinkDirectories(), ";"); @@ -4674,6 +4658,11 @@ cmState::Snapshot cmMakefile::GetStateSnapshot() const return this->StateSnapshot; } +const char* cmMakefile::GetDefineFlagsCMP0059() const +{ + return this->DefineFlagsOrig.c_str(); +} + //---------------------------------------------------------------------------- cmPolicies::PolicyStatus cmMakefile::GetPolicyStatus(cmPolicies::PolicyID id) const diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 6f6ed278b..86bde0ca7 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -838,6 +838,8 @@ public: cmState::Snapshot GetStateSnapshot() const; + const char* GetDefineFlagsCMP0059() const; + protected: // add link libraries and directories to the target void AddGlobalLinkInformation(const std::string& name, cmTarget& target); From c3f40f4fd98388a2fd31c707e7225d33a7fc76f6 Mon Sep 17 00:00:00 2001 From: Michael Scott Date: Thu, 4 Jun 2015 22:51:22 +0100 Subject: [PATCH 0098/1048] Help: Improve formatting of command documentation Use inline reStructuredText markup and add cross-references in more places. --- Help/command/add_subdirectory.rst | 14 +- Help/command/aux_source_directory.rst | 2 +- Help/command/build_name.rst | 5 +- .../command/cmake_host_system_information.rst | 6 +- Help/command/cmake_minimum_required.rst | 2 +- Help/command/create_test_sourcelist.rst | 18 +-- Help/command/ctest_run_script.rst | 6 +- Help/command/ctest_start.rst | 2 +- Help/command/define_property.rst | 28 ++-- Help/command/else.rst | 2 +- Help/command/elseif.rst | 2 +- Help/command/enable_language.rst | 2 +- Help/command/enable_testing.rst | 8 +- Help/command/endforeach.rst | 4 +- Help/command/endfunction.rst | 2 +- Help/command/endif.rst | 2 +- Help/command/endmacro.rst | 2 +- Help/command/endwhile.rst | 2 +- Help/command/exec_program.rst | 8 +- Help/command/execute_process.rst | 14 +- Help/command/export.rst | 18 +-- Help/command/export_library_dependencies.rst | 12 +- Help/command/fltk_wrap_ui.rst | 2 +- Help/command/foreach.rst | 6 +- Help/command/get_cmake_property.rst | 8 +- Help/command/get_directory_property.rst | 6 +- Help/command/get_filename_component.rst | 12 +- Help/command/get_source_file_property.rst | 10 +- Help/command/get_target_property.rst | 6 +- Help/command/get_test_property.rst | 8 +- Help/command/include.rst | 18 +-- Help/command/include_external_msproject.rst | 6 +- Help/command/include_regular_expression.rst | 4 +- Help/command/install_files.rst | 18 +-- Help/command/install_programs.rst | 23 +-- Help/command/install_targets.rst | 12 +- Help/command/link_directories.rst | 8 +- Help/command/list.rst | 48 +++--- Help/command/load_cache.rst | 4 +- Help/command/load_command.rst | 6 +- Help/command/make_directory.rst | 2 +- Help/command/mark_as_advanced.rst | 8 +- Help/command/math.rst | 2 +- Help/command/message.rst | 2 +- Help/command/option.rst | 6 +- Help/command/qt_wrap_cpp.rst | 2 +- Help/command/qt_wrap_ui.rst | 6 +- Help/command/remove.rst | 8 +- Help/command/remove_definitions.rst | 6 +- Help/command/return.rst | 14 +- Help/command/separate_arguments.rst | 8 +- Help/command/set_target_properties.rst | 145 +++++++++--------- Help/command/string.rst | 66 ++++---- Help/command/subdirs.rst | 12 +- Help/command/unset.rst | 10 +- Help/command/utility_source.rst | 4 +- Help/command/variable_requires.rst | 8 +- Help/command/while.rst | 8 +- Help/command/write_file.rst | 14 +- 59 files changed, 352 insertions(+), 345 deletions(-) diff --git a/Help/command/add_subdirectory.rst b/Help/command/add_subdirectory.rst index 29b50174c..e97925302 100644 --- a/Help/command/add_subdirectory.rst +++ b/Help/command/add_subdirectory.rst @@ -12,23 +12,23 @@ Add a subdirectory to the build. The source_dir specifies the directory in which the source CMakeLists.txt and code files are located. If it is a relative path it will be evaluated with respect to the current directory (the typical usage), but it may also be an -absolute path. The binary_dir specifies the directory in which to +absolute path. The ``binary_dir`` specifies the directory in which to place the output files. If it is a relative path it will be evaluated with respect to the current output directory, but it may also be an -absolute path. If binary_dir is not specified, the value of -source_dir, before expanding any relative path, will be used (the +absolute path. If ``binary_dir`` is not specified, the value of +``source_dir``, before expanding any relative path, will be used (the typical usage). The CMakeLists.txt file in the specified source directory will be processed immediately by CMake before processing in the current input file continues beyond this command. -If the EXCLUDE_FROM_ALL argument is provided then targets in the -subdirectory will not be included in the ALL target of the parent +If the ``EXCLUDE_FROM_ALL`` argument is provided then targets in the +subdirectory will not be included in the ``ALL`` target of the parent directory by default, and will be excluded from IDE project files. Users must explicitly build targets in the subdirectory. This is meant for use when the subdirectory contains a separate part of the project that is useful but not necessary, such as a set of examples. -Typically the subdirectory should contain its own project() command -invocation so that a full build system will be generated in the +Typically the subdirectory should contain its own :command:`project` +command invocation so that a full build system will be generated in the subdirectory (such as a VS IDE solution file). Note that inter-target dependencies supercede this exclusion. If a target built by the parent project depends on a target in the subdirectory, the dependee diff --git a/Help/command/aux_source_directory.rst b/Help/command/aux_source_directory.rst index 434d7a919..dcd1cdfc3 100644 --- a/Help/command/aux_source_directory.rst +++ b/Help/command/aux_source_directory.rst @@ -8,7 +8,7 @@ Find all source files in a directory. aux_source_directory( ) Collects the names of all the source files in the specified directory -and stores the list in the provided. This command is +and stores the list in the ```` provided. This command is intended to be used by projects that use explicit template instantiation. Template instantiation files can be stored in a "Templates" subdirectory and collected automatically using this diff --git a/Help/command/build_name.rst b/Help/command/build_name.rst index 53cd05ec1..f717db1dd 100644 --- a/Help/command/build_name.rst +++ b/Help/command/build_name.rst @@ -3,7 +3,7 @@ build_name Disallowed. See CMake Policy :policy:`CMP0036`. -Use ${CMAKE_SYSTEM} and ${CMAKE_CXX_COMPILER} instead. +Use ``${CMAKE_SYSTEM}`` and ``${CMAKE_CXX_COMPILER}`` instead. :: @@ -11,4 +11,5 @@ Use ${CMAKE_SYSTEM} and ${CMAKE_CXX_COMPILER} instead. Sets the specified variable to a string representing the platform and compiler settings. These values are now available through the -CMAKE_SYSTEM and CMAKE_CXX_COMPILER variables. +:variable:`CMAKE_SYSTEM` and +:variable:`CMAKE_CXX_COMPILER _COMPILER>` variables. diff --git a/Help/command/cmake_host_system_information.rst b/Help/command/cmake_host_system_information.rst index ba545d5e2..9402d57e9 100644 --- a/Help/command/cmake_host_system_information.rst +++ b/Help/command/cmake_host_system_information.rst @@ -8,10 +8,10 @@ Query host system specific information. cmake_host_system_information(RESULT QUERY ...) Queries system information of the host system on which cmake runs. -One or more can be provided to select the information to be -queried. The list of queried values is stored in . +One or more ```` can be provided to select the information to be +queried. The list of queried values is stored in ````. - can be one of the following values: +```` can be one of the following values: :: diff --git a/Help/command/cmake_minimum_required.rst b/Help/command/cmake_minimum_required.rst index 9865eeb75..857321817 100644 --- a/Help/command/cmake_minimum_required.rst +++ b/Help/command/cmake_minimum_required.rst @@ -25,7 +25,7 @@ When version 2.4 or lower is given the command implicitly invokes which enables compatibility features for CMake 2.4 and lower. -The FATAL_ERROR option is accepted but ignored by CMake 2.6 and +The ``FATAL_ERROR`` option is accepted but ignored by CMake 2.6 and higher. It should be specified so CMake versions 2.4 and lower fail with an error instead of just a warning. diff --git a/Help/command/create_test_sourcelist.rst b/Help/command/create_test_sourcelist.rst index 9addd6720..dde6812e1 100644 --- a/Help/command/create_test_sourcelist.rst +++ b/Help/command/create_test_sourcelist.rst @@ -14,17 +14,17 @@ A test driver is a program that links together many small tests into a single executable. This is useful when building static executables with large libraries to shrink the total required size. The list of source files needed to build the test driver will be in -sourceListName. DriverName is the name of the test driver program. +``sourceListName``. ``driverName`` is the name of the test driver program. The rest of the arguments consist of a list of test source files, can be semicolon separated. Each test source file should have a function in it that is the same name as the file with no extension (foo.cxx -should have int foo(int, char*[]);) DriverName will be able to call -each of the tests by name on the command line. If EXTRA_INCLUDE is +should have int foo(int, char*[]);) ``driverName`` will be able to call +each of the tests by name on the command line. If ``EXTRA_INCLUDE`` is specified, then the next argument is included into the generated file. -If FUNCTION is specified, then the next argument is taken as a +If ``FUNCTION`` is specified, then the next argument is taken as a function name that is passed a pointer to ac and av. This can be used -to add extra command line processing to each test. The cmake variable -CMAKE_TESTDRIVER_BEFORE_TESTMAIN can be set to have code that will be -placed directly before calling the test main function. -CMAKE_TESTDRIVER_AFTER_TESTMAIN can be set to have code that will be -placed directly after the call to the test main function. +to add extra command line processing to each test. The +``CMAKE_TESTDRIVER_BEFORE_TESTMAIN`` cmake variable can be set to +have code that will be placed directly before calling the test main function. +``CMAKE_TESTDRIVER_AFTER_TESTMAIN`` can be set to have code that +will be placed directly after the call to the test main function. diff --git a/Help/command/ctest_run_script.rst b/Help/command/ctest_run_script.rst index 0f3501928..5ec543ed1 100644 --- a/Help/command/ctest_run_script.rst +++ b/Help/command/ctest_run_script.rst @@ -10,6 +10,6 @@ runs a ctest -S script Runs a script or scripts much like if it was run from ctest -S. If no argument is provided then the current script is run using the current -settings of the variables. If NEW_PROCESS is specified then each -script will be run in a separate process.If RETURN_VALUE is specified -the return value of the last script run will be put into var. +settings of the variables. If ``NEW_PROCESS`` is specified then each +script will be run in a separate process.If ``RETURN_VALUE`` is specified +the return value of the last script run will be put into ``var``. diff --git a/Help/command/ctest_start.rst b/Help/command/ctest_start.rst index b5c7b34a5..63db32f4e 100644 --- a/Help/command/ctest_start.rst +++ b/Help/command/ctest_start.rst @@ -14,7 +14,7 @@ after the binary directory is initialized. If the 'source' and If the track is specified, the submissions will go to the specified track. If APPEND is used, the existing TAG is used rather than creating a new one based -on the current time stamp. If QUIET is used, CTest will suppress any +on the current time stamp. If ``QUIET`` is used, CTest will suppress any non-error messages that it otherwise would have printed to the console. If the :variable:`CTEST_CHECKOUT_COMMAND` variable diff --git a/Help/command/define_property.rst b/Help/command/define_property.rst index 62bcd1bf1..873c6cabb 100644 --- a/Help/command/define_property.rst +++ b/Help/command/define_property.rst @@ -11,11 +11,11 @@ Define and document custom properties. BRIEF_DOCS [docs...] FULL_DOCS [docs...]) -Define one property in a scope for use with the set_property and -get_property commands. This is primarily useful to associate +Define one property in a scope for use with the :command:`set_property` and +:command:`get_property` commands. This is primarily useful to associate documentation with property names that may be retrieved with the -get_property command. The first argument determines the kind of scope -in which the property should be used. It must be one of the +:command:`get_property` command. The first argument determines the kind of +scope in which the property should be used. It must be one of the following: :: @@ -28,18 +28,18 @@ following: VARIABLE = documents a CMake language variable CACHED_VARIABLE = documents a CMake cache variable -Note that unlike set_property and get_property no actual scope needs -to be given; only the kind of scope is important. +Note that unlike :command:`set_property` and :command:`get_property` no +actual scope needs to be given; only the kind of scope is important. -The required PROPERTY option is immediately followed by the name of +The required ``PROPERTY`` option is immediately followed by the name of the property being defined. -If the INHERITED option then the get_property command will chain up to -the next higher scope when the requested property is not set in the -scope given to the command. DIRECTORY scope chains to GLOBAL. -TARGET, SOURCE, and TEST chain to DIRECTORY. +If the ``INHERITED`` option then the :command:`get_property` command will +chain up to the next higher scope when the requested property is not set +in the scope given to the command. ``DIRECTORY`` scope chains to +``GLOBAL``. ``TARGET``, ``SOURCE``, and ``TEST`` chain to ``DIRECTORY``. -The BRIEF_DOCS and FULL_DOCS options are followed by strings to be +The ``BRIEF_DOCS`` and ``FULL_DOCS`` options are followed by strings to be associated with the property as its brief and full documentation. -Corresponding options to the get_property command will retrieve the -documentation. +Corresponding options to the :command:`get_property` command will retrieve +the documentation. diff --git a/Help/command/else.rst b/Help/command/else.rst index 5eece9566..0e5a19810 100644 --- a/Help/command/else.rst +++ b/Help/command/else.rst @@ -7,4 +7,4 @@ Starts the else portion of an if block. else(expression) -See the if command. +See the :command:`if` command. diff --git a/Help/command/elseif.rst b/Help/command/elseif.rst index 96ee0e924..9a8dfed1d 100644 --- a/Help/command/elseif.rst +++ b/Help/command/elseif.rst @@ -7,4 +7,4 @@ Starts the elseif portion of an if block. elseif(expression) -See the if command. +See the :command:`if` command. diff --git a/Help/command/enable_language.rst b/Help/command/enable_language.rst index d46ff7ed1..444556151 100644 --- a/Help/command/enable_language.rst +++ b/Help/command/enable_language.rst @@ -18,5 +18,5 @@ targets using the named language directly for compiling sources or indirectly through link dependencies. It is simplest to enable all needed languages in the top-level directory of a project. -The OPTIONAL keyword is a placeholder for future implementation and +The ``OPTIONAL`` keyword is a placeholder for future implementation and does not currently work. diff --git a/Help/command/enable_testing.rst b/Help/command/enable_testing.rst index 41ecd5b1b..1e3e2799c 100644 --- a/Help/command/enable_testing.rst +++ b/Help/command/enable_testing.rst @@ -7,7 +7,7 @@ Enable testing for current directory and below. enable_testing() -Enables testing for this directory and below. See also the add_test -command. Note that ctest expects to find a test file in the build -directory root. Therefore, this command should be in the source -directory root. +Enables testing for this directory and below. See also the +:command:`add_test` command. Note that ctest expects to find a test file +in the build directory root. Therefore, this command should be in the +source directory root. diff --git a/Help/command/endforeach.rst b/Help/command/endforeach.rst index f23552d06..9af972bee 100644 --- a/Help/command/endforeach.rst +++ b/Help/command/endforeach.rst @@ -1,10 +1,10 @@ endforeach ---------- -Ends a list of commands in a FOREACH block. +Ends a list of commands in a foreach block. :: endforeach(expression) -See the FOREACH command. +See the :command:`foreach` command. diff --git a/Help/command/endfunction.rst b/Help/command/endfunction.rst index 63e70ba3c..6cc196cde 100644 --- a/Help/command/endfunction.rst +++ b/Help/command/endfunction.rst @@ -7,4 +7,4 @@ Ends a list of commands in a function block. endfunction(expression) -See the function command. +See the :command:`function` command. diff --git a/Help/command/endif.rst b/Help/command/endif.rst index 4c9955c2e..a0163bf33 100644 --- a/Help/command/endif.rst +++ b/Help/command/endif.rst @@ -7,4 +7,4 @@ Ends a list of commands in an if block. endif(expression) -See the if command. +See the :command:`if` command. diff --git a/Help/command/endmacro.rst b/Help/command/endmacro.rst index 524fc80e7..47327a783 100644 --- a/Help/command/endmacro.rst +++ b/Help/command/endmacro.rst @@ -7,4 +7,4 @@ Ends a list of commands in a macro block. endmacro(expression) -See the macro command. +See the :command:`macro` command. diff --git a/Help/command/endwhile.rst b/Help/command/endwhile.rst index 11fdc1be5..798c20e71 100644 --- a/Help/command/endwhile.rst +++ b/Help/command/endwhile.rst @@ -7,4 +7,4 @@ Ends a list of commands in a while block. endwhile(expression) -See the while command. +See the :command:`while` command. diff --git a/Help/command/exec_program.rst b/Help/command/exec_program.rst index aaa0dacc1..6dfdad394 100644 --- a/Help/command/exec_program.rst +++ b/Help/command/exec_program.rst @@ -1,7 +1,7 @@ exec_program ------------ -Deprecated. Use the execute_process() command instead. +Deprecated. Use the :command:`execute_process` command instead. Run an executable program during the processing of the CMakeList.txt file. @@ -15,10 +15,10 @@ file. The executable is run in the optionally specified directory. The executable can include arguments if it is double quoted, but it is -better to use the optional ARGS argument to specify arguments to the +better to use the optional ``ARGS`` argument to specify arguments to the program. This is because cmake will then be able to escape spaces in -the executable path. An optional argument OUTPUT_VARIABLE specifies a +the executable path. An optional argument ``OUTPUT_VARIABLE`` specifies a variable in which to store the output. To capture the return value of -the execution, provide a RETURN_VALUE. If OUTPUT_VARIABLE is +the execution, provide a ``RETURN_VALUE``. If ``OUTPUT_VARIABLE`` is specified, then no output will go to the stdout/stderr of the console running cmake. diff --git a/Help/command/execute_process.rst b/Help/command/execute_process.rst index c38ec1ae2..ca44b534c 100644 --- a/Help/command/execute_process.rst +++ b/Help/command/execute_process.rst @@ -26,7 +26,7 @@ A single standard error pipe is used for all processes. Options: -COMMAND +``COMMAND`` A child process command line. CMake executes the child process using operating system APIs directly. @@ -36,31 +36,31 @@ COMMAND (Use the ``INPUT_*``, ``OUTPUT_*``, and ``ERROR_*`` options to redirect stdin, stdout, and stderr.) -WORKING_DIRECTORY +``WORKING_DIRECTORY`` The named directory will be set as the current working directory of the child processes. -TIMEOUT +``TIMEOUT`` The child processes will be terminated if they do not finish in the specified number of seconds (fractions are allowed). -RESULT_VARIABLE +``RESULT_VARIABLE`` The variable will be set to contain the result of running the processes. This will be an integer return code from the last child or a string describing an error condition. -OUTPUT_VARIABLE, ERROR_VARIABLE +``OUTPUT_VARIABLE``, ``ERROR_VARIABLE`` The variable named will be set with the contents of the standard output and standard error pipes, respectively. If the same variable is named for both pipes their output will be merged in the order produced. -INPUT_FILE, OUTPUT_FILE, ERROR_FILE +``INPUT_FILE, OUTPUT_FILE``, ``ERROR_FILE`` The file named will be attached to the standard input of the first process, standard output of the last process, or standard error of all processes, respectively. If the same file is named for both output and error then it will be used for both. -OUTPUT_QUIET, ERROR_QUIET +``OUTPUT_QUIET``, ``ERROR_QUIET`` The standard output or standard error results will be quietly ignored. If more than one ``OUTPUT_*`` or ``ERROR_*`` option is given for the diff --git a/Help/command/export.rst b/Help/command/export.rst index d4bab352a..4419dc120 100644 --- a/Help/command/export.rst +++ b/Help/command/export.rst @@ -7,20 +7,20 @@ Export targets from the build tree for use by outside projects. export(EXPORT [NAMESPACE ] [FILE ]) -Create a file that may be included by outside projects to +Create a file ```` that may be included by outside projects to import targets from the current project's build tree. This is useful during cross-compiling to build utility executables that can run on the host platform in one project and then import them into another -project being compiled for the target platform. If the NAMESPACE -option is given the string will be prepended to all target +project being compiled for the target platform. If the ``NAMESPACE`` +option is given the ```` string will be prepended to all target names written to the file. -Target installations are associated with the export +Target installations are associated with the export ```` using the ``EXPORT`` option of the :command:`install(TARGETS)` command. The file created by this command is specific to the build tree and -should never be installed. See the install(EXPORT) command to export -targets from an installation tree. +should never be installed. See the :command:`install(EXPORT)` command to +export targets from an installation tree. The properties set on the generated IMPORTED targets will have the same values as the final values of the input TARGETS. @@ -45,12 +45,12 @@ unspecified. export(PACKAGE ) Store the current build directory in the CMake user package registry -for package . The find_package command may consider the -directory while searching for package . This helps dependent +for package ````. The find_package command may consider the +directory while searching for package ````. This helps dependent projects find and use a package from the current project's build tree without help from the user. Note that the entry in the package registry that this command creates works only in conjunction with a -package configuration file (Config.cmake) that works with the +package configuration file (``Config.cmake``) that works with the build tree. In some cases, for example for packaging and for system wide installations, it is not desirable to write the user package registry. If the :variable:`CMAKE_EXPORT_NO_PACKAGE_REGISTRY` variable diff --git a/Help/command/export_library_dependencies.rst b/Help/command/export_library_dependencies.rst index 73c0b4240..2cb437e77 100644 --- a/Help/command/export_library_dependencies.rst +++ b/Help/command/export_library_dependencies.rst @@ -7,22 +7,22 @@ Use :command:`install(EXPORT)` or :command:`export` command. This command generates an old-style library dependencies file. Projects requiring CMake 2.6 or later should not use the command. Use -instead the install(EXPORT) command to help export targets from an -installation tree and the export() command to export targets from a +instead the :command:`install(EXPORT)` command to help export targets from an +installation tree and the :command:`export` command to export targets from a build tree. The old-style library dependencies file does not take into account -per-configuration names of libraries or the LINK_INTERFACE_LIBRARIES -target property. +per-configuration names of libraries or the +:prop_tgt:`LINK_INTERFACE_LIBRARIES` target property. :: export_library_dependencies( [APPEND]) -Create a file named that can be included into a CMake listfile +Create a file named ```` that can be included into a CMake listfile with the INCLUDE command. The file will contain a number of SET commands that will set all the variables needed for library dependency information. This should be the last command in the top level -CMakeLists.txt file of the project. If the APPEND option is +CMakeLists.txt file of the project. If the ``APPEND`` option is specified, the SET commands will be appended to the given file instead of replacing it. diff --git a/Help/command/fltk_wrap_ui.rst b/Help/command/fltk_wrap_ui.rst index 448ae644d..041e5a7e3 100644 --- a/Help/command/fltk_wrap_ui.rst +++ b/Help/command/fltk_wrap_ui.rst @@ -10,5 +10,5 @@ Create FLTK user interfaces Wrappers. Produce .h and .cxx files for all the .fl and .fld files listed. The resulting .h and .cxx files will be added to a variable named -resultingLibraryName_FLTK_UI_SRCS which should be added to your +``resultingLibraryName_FLTK_UI_SRCS`` which should be added to your library. diff --git a/Help/command/foreach.rst b/Help/command/foreach.rst index 348ebd875..c0f3679d9 100644 --- a/Help/command/foreach.rst +++ b/Help/command/foreach.rst @@ -15,7 +15,7 @@ All commands between foreach and the matching endforeach are recorded without being invoked. Once the endforeach is evaluated, the recorded list of commands is invoked once for each argument listed in the original foreach command. Before each iteration of the loop -"${loop_var}" will be set as a variable with the current value in the +``${loop_var}`` will be set as a variable with the current value in the list. :: @@ -40,8 +40,8 @@ three types of this iteration: foreach(loop_var IN [LISTS [list1 [...]]] [ITEMS [item1 [...]]]) -Iterates over a precise list of items. The LISTS option names +Iterates over a precise list of items. The ``LISTS`` option names list-valued variables to be traversed, including empty elements (an empty string is a zero-length list). (Note macro -arguments are not variables.) The ITEMS option ends argument +arguments are not variables.) The ``ITEMS`` option ends argument parsing and includes all arguments following it in the iteration. diff --git a/Help/command/get_cmake_property.rst b/Help/command/get_cmake_property.rst index bcfc5e831..3a6fb41e1 100644 --- a/Help/command/get_cmake_property.rst +++ b/Help/command/get_cmake_property.rst @@ -8,8 +8,8 @@ Get a property of the CMake instance. get_cmake_property(VAR property) Get a property from the CMake instance. The value of the property is -stored in the variable VAR. If the property is not found, VAR will be -set to "NOTFOUND". Some supported properties include: VARIABLES, -CACHE_VARIABLES, COMMANDS, MACROS, and COMPONENTS. +stored in the variable ``VAR``. If the property is not found, ``VAR`` +will be set to "NOTFOUND". See the :manual:`cmake-properties(7)` manual +for available properties. -See also the more general get_property() command. +See also the more general :command:`get_property` command. diff --git a/Help/command/get_directory_property.rst b/Help/command/get_directory_property.rst index f2a0a803e..e50abe0e9 100644 --- a/Help/command/get_directory_property.rst +++ b/Help/command/get_directory_property.rst @@ -1,14 +1,14 @@ get_directory_property ---------------------- -Get a property of DIRECTORY scope. +Get a property of ``DIRECTORY`` scope. :: get_directory_property( [DIRECTORY ] ) Store a property of directory scope in the named variable. If the -property is not defined the empty-string is returned. The DIRECTORY +property is not defined the empty-string is returned. The ``DIRECTORY`` argument specifies another directory from which to retrieve the property value. The specified directory must have already been traversed by CMake. @@ -21,4 +21,4 @@ traversed by CMake. Get a variable definition from a directory. This form is useful to get a variable definition from another directory. -See also the more general get_property() command. +See also the more general :command:`get_property` command. diff --git a/Help/command/get_filename_component.rst b/Help/command/get_filename_component.rst index 5eec79229..60488dad5 100644 --- a/Help/command/get_filename_component.rst +++ b/Help/command/get_filename_component.rst @@ -7,7 +7,7 @@ Get a specific component of a full filename. get_filename_component( [CACHE]) -Set to a component of , where is one of: +Set ```` to a component of ````, where ```` is one of: :: @@ -21,7 +21,7 @@ Set to a component of , where is one of: Paths are returned with forward slashes and have no trailing slahes. The longest file extension is always considered. If the optional -CACHE argument is specified, the result variable is added to the +``CACHE`` argument is specified, the result variable is added to the cache. :: @@ -30,8 +30,8 @@ cache. PROGRAM [PROGRAM_ARGS ] [CACHE]) -The program in FileName will be found in the system search path or -left as a full path. If PROGRAM_ARGS is present with PROGRAM, then -any command-line arguments present in the FileName string are split -from the program name and stored in . This is used to +The program in ``FileName`` will be found in the system search path or +left as a full path. If ``PROGRAM_ARGS`` is present with ``PROGRAM``, then +any command-line arguments present in the ``FileName`` string are split +from the program name and stored in ````. This is used to separate a program name from its arguments in a command line string. diff --git a/Help/command/get_source_file_property.rst b/Help/command/get_source_file_property.rst index 80c512b4b..3e975c2f9 100644 --- a/Help/command/get_source_file_property.rst +++ b/Help/command/get_source_file_property.rst @@ -8,9 +8,9 @@ Get a property for a source file. get_source_file_property(VAR file property) Get a property from a source file. The value of the property is -stored in the variable VAR. If the property is not found, VAR will be -set to "NOTFOUND". Use set_source_files_properties to set property -values. Source file properties usually control how the file is built. -One property that is always there is LOCATION +stored in the variable ``VAR``. If the property is not found, ``VAR`` +will be set to "NOTFOUND". Use :command:`set_source_files_properties` +to set property values. Source file properties usually control how the +file is built. One property that is always there is :prop_sf:`LOCATION` -See also the more general get_property() command. +See also the more general :command:`get_property` command. diff --git a/Help/command/get_target_property.rst b/Help/command/get_target_property.rst index 4017d31d4..779825299 100644 --- a/Help/command/get_target_property.rst +++ b/Help/command/get_target_property.rst @@ -8,11 +8,11 @@ Get a property from a target. get_target_property(VAR target property) Get a property from a target. The value of the property is stored in -the variable VAR. If the property is not found, VAR will be set to -"NOTFOUND". Use set_target_properties to set property values. +the variable ``VAR``. If the property is not found, ``VAR`` will be set to +"NOTFOUND". Use :command:`set_target_properties` to set property values. Properties are usually used to control how a target is built, but some query the target instead. This command can get properties for any target so far created. The targets do not need to be in the current CMakeLists.txt file. -See also the more general get_property() command. +See also the more general :command:`get_property` command. diff --git a/Help/command/get_test_property.rst b/Help/command/get_test_property.rst index 391a32ee4..e359f4b3d 100644 --- a/Help/command/get_test_property.rst +++ b/Help/command/get_test_property.rst @@ -8,8 +8,8 @@ Get a property of the test. get_test_property(test property VAR) Get a property from the test. The value of the property is stored in -the variable VAR. If the test or property is not found, VAR will be -set to "NOTFOUND". For a list of standard properties you can type cmake ---help-property-list. +the variable ``VAR``. If the test or property is not found, ``VAR`` will +be set to "NOTFOUND". For a list of standard properties you can type +``cmake --help-property-list``. -See also the more general get_property() command. +See also the more general :command:`get_property` command. diff --git a/Help/command/include.rst b/Help/command/include.rst index a9074c1b6..c391561b1 100644 --- a/Help/command/include.rst +++ b/Help/command/include.rst @@ -9,17 +9,17 @@ Load and run CMake code from a file or module. [NO_POLICY_SCOPE]) Load and run CMake code from the file given. Variable reads and -writes access the scope of the caller (dynamic scoping). If OPTIONAL +writes access the scope of the caller (dynamic scoping). If ``OPTIONAL`` is present, then no error is raised if the file does not exist. If -RESULT_VARIABLE is given the variable will be set to the full filename +``RESULT_VARIABLE`` is given the variable will be set to the full filename which has been included or NOTFOUND if it failed. If a module is specified instead of a file, the file with name -.cmake is searched first in CMAKE_MODULE_PATH, then in the -CMake module directory. There is one exception to this: if the file -which calls include() is located itself in the CMake module directory, -then first the CMake module directory is searched and -CMAKE_MODULE_PATH afterwards. See also policy CMP0017. +.cmake is searched first in :variable:`CMAKE_MODULE_PATH`, +then in the CMake module directory. There is one exception to this: if +the file which calls ``include()`` is located itself in the CMake module +directory, then first the CMake module directory is searched and +:variable:`CMAKE_MODULE_PATH` afterwards. See also policy :policy:`CMP0017`. -See the cmake_policy() command documentation for discussion of the -NO_POLICY_SCOPE option. +See the :command:`cmake_policy` command documentation for discussion of the +``NO_POLICY_SCOPE`` option. diff --git a/Help/command/include_external_msproject.rst b/Help/command/include_external_msproject.rst index ba9a3934a..595762d7a 100644 --- a/Help/command/include_external_msproject.rst +++ b/Help/command/include_external_msproject.rst @@ -13,10 +13,10 @@ Include an external Microsoft project file in a workspace. Includes an external Microsoft project in the generated workspace file. Currently does nothing on UNIX. This will create a target -named [projectname]. This can be used in the add_dependencies command -to make things depend on the external project. +named [projectname]. This can be used in the :command:`add_dependencies` +command to make things depend on the external project. -TYPE, GUID and PLATFORM are optional parameters that allow one to +``TYPE``, ``GUID`` and ``PLATFORM`` are optional parameters that allow one to specify the type of project, id (GUID) of the project and the name of the target platform. This is useful for projects requiring values other than the default (e.g. WIX projects). These options are not diff --git a/Help/command/include_regular_expression.rst b/Help/command/include_regular_expression.rst index dd887df5d..ab5a56325 100644 --- a/Help/command/include_regular_expression.rst +++ b/Help/command/include_regular_expression.rst @@ -8,8 +8,8 @@ Set the regular expression used for dependency checking. include_regular_expression(regex_match [regex_complain]) Set the regular expressions used in dependency checking. Only files -matching regex_match will be traced as dependencies. Only files -matching regex_complain will generate warnings if they cannot be found +matching ``regex_match`` will be traced as dependencies. Only files +matching ``regex_complain`` will generate warnings if they cannot be found (standard header paths are not searched). The defaults are: :: diff --git a/Help/command/install_files.rst b/Help/command/install_files.rst index 7b6bd8114..1850be6e1 100644 --- a/Help/command/install_files.rst +++ b/Help/command/install_files.rst @@ -1,13 +1,13 @@ install_files ------------- -Deprecated. Use the install(FILES ) command instead. +Deprecated. Use the :command:`install(FILES)` command instead. -This command has been superceded by the install command. It is -provided for compatibility with older CMake code. The FILES form is -directly replaced by the FILES form of the install command. The -regexp form can be expressed more clearly using the GLOB form of the -file command. +This command has been superceded by the :command:`install` command. It is +provided for compatibility with older CMake code. The ``FILES`` form is +directly replaced by the ``FILES`` form of the :command:`install` +command. The regexp form can be expressed more clearly using the ``GLOB`` +form of the :command:`file` command. :: @@ -32,8 +32,8 @@ expression will be installed. install_files( FILES file file ...) -Any files listed after the FILES keyword will be installed explicitly +Any files listed after the ``FILES`` keyword will be installed explicitly from the names given. Full paths are allowed in this form. -The directory is relative to the installation prefix, which is -stored in the variable CMAKE_INSTALL_PREFIX. +The directory ```` is relative to the installation prefix, which is +stored in the variable :variable:`CMAKE_INSTALL_PREFIX`. diff --git a/Help/command/install_programs.rst b/Help/command/install_programs.rst index 26789d8db..79aa486a3 100644 --- a/Help/command/install_programs.rst +++ b/Help/command/install_programs.rst @@ -1,13 +1,13 @@ install_programs ---------------- -Deprecated. Use the install(PROGRAMS ) command instead. +Deprecated. Use the :command:`install(PROGRAMS)` command instead. -This command has been superceded by the install command. It is -provided for compatibility with older CMake code. The FILES form is -directly replaced by the PROGRAMS form of the INSTALL command. The -regexp form can be expressed more clearly using the GLOB form of the -FILE command. +This command has been superceded by the :command:`install` command. It is +provided for compatibility with older CMake code. The ``FILES`` form is +directly replaced by the ``PROGRAMS`` form of the :command:`install` +command. The regexp form can be expressed more clearly using the ``GLOB`` +form of the :command:`file` command. :: @@ -15,7 +15,7 @@ FILE command. install_programs( FILES file1 [file2 ...]) Create rules to install the listed programs into the given directory. -Use the FILES argument to guarantee that the file list version of the +Use the ``FILES`` argument to guarantee that the file list version of the command will be used even when there is only one argument. :: @@ -26,8 +26,9 @@ In the second form any program in the current source directory that matches the regular expression will be installed. This command is intended to install programs that are not built by -cmake, such as shell scripts. See the TARGETS form of the INSTALL -command to create installation rules for targets built by cmake. +cmake, such as shell scripts. See the ``TARGETS`` form of the +:command:`install` command to create installation rules for targets built +by cmake. -The directory is relative to the installation prefix, which is -stored in the variable CMAKE_INSTALL_PREFIX. +The directory ```` is relative to the installation prefix, which is +stored in the variable :variable:`CMAKE_INSTALL_PREFIX`. diff --git a/Help/command/install_targets.rst b/Help/command/install_targets.rst index caa933f4b..49ca69694 100644 --- a/Help/command/install_targets.rst +++ b/Help/command/install_targets.rst @@ -1,9 +1,9 @@ install_targets --------------- -Deprecated. Use the install(TARGETS ) command instead. +Deprecated. Use the :command:`install(TARGETS)` command instead. -This command has been superceded by the install command. It is +This command has been superceded by the :command:`install` command. It is provided for compatibility with older CMake code. :: @@ -11,7 +11,7 @@ provided for compatibility with older CMake code. install_targets( [RUNTIME_DIRECTORY dir] target target) Create rules to install the listed targets into the given directory. -The directory is relative to the installation prefix, which is -stored in the variable CMAKE_INSTALL_PREFIX. If RUNTIME_DIRECTORY is -specified, then on systems with special runtime files (Windows DLL), -the files will be copied to that directory. +The directory ```` is relative to the installation prefix, which is +stored in the variable :variable:`CMAKE_INSTALL_PREFIX`. If +``RUNTIME_DIRECTORY`` is specified, then on systems with special runtime +files (Windows DLL), the files will be copied to that directory. diff --git a/Help/command/link_directories.rst b/Help/command/link_directories.rst index bdc94cd73..5c64bc609 100644 --- a/Help/command/link_directories.rst +++ b/Help/command/link_directories.rst @@ -10,10 +10,10 @@ Specify directories in which the linker will look for libraries. Specify the paths in which the linker should search for libraries. The command will apply only to targets created after it is called. Relative paths given to this command are interpreted as relative to -the current source directory, see CMP0015. +the current source directory, see :policy:`CMP0015`. Note that this command is rarely necessary. Library locations -returned by find_package() and find_library() are absolute paths. -Pass these absolute library file paths directly to the -target_link_libraries() command. CMake will ensure the linker finds +returned by :command:`find_package` and :command:`find_library` are +absolute paths. Pass these absolute library file paths directly to the +:command:`target_link_libraries` command. CMake will ensure the linker finds them. diff --git a/Help/command/list.rst b/Help/command/list.rst index aeb1e940a..a7a05c7af 100644 --- a/Help/command/list.rst +++ b/Help/command/list.rst @@ -17,45 +17,45 @@ List operations. list(REVERSE ) list(SORT ) -LENGTH will return a given list's length. +``LENGTH`` will return a given list's length. -GET will return list of elements specified by indices from the list. +``GET`` will return list of elements specified by indices from the list. -APPEND will append elements to the list. +``APPEND`` will append elements to the list. -FIND will return the index of the element specified in the list or -1 +``FIND`` will return the index of the element specified in the list or -1 if it wasn't found. -INSERT will insert elements to the list to the specified location. +``INSERT`` will insert elements to the list to the specified location. -REMOVE_AT and REMOVE_ITEM will remove items from the list. The -difference is that REMOVE_ITEM will remove the given items, while -REMOVE_AT will remove the items at the given indices. +``REMOVE_AT`` and ``REMOVE_ITEM`` will remove items from the list. The +difference is that ``REMOVE_ITEM`` will remove the given items, while +``REMOVE_AT`` will remove the items at the given indices. -REMOVE_DUPLICATES will remove duplicated items in the list. +``REMOVE_DUPLICATES`` will remove duplicated items in the list. -REVERSE reverses the contents of the list in-place. +``REVERSE`` reverses the contents of the list in-place. -SORT sorts the list in-place alphabetically. +``SORT`` sorts the list in-place alphabetically. -The list subcommands APPEND, INSERT, REMOVE_AT, REMOVE_ITEM, -REMOVE_DUPLICATES, REVERSE and SORT may create new values for the list -within the current CMake variable scope. Similar to the SET command, -the LIST command creates new variable values in the current scope, -even if the list itself is actually defined in a parent scope. To -propagate the results of these operations upwards, use SET with -PARENT_SCOPE, SET with CACHE INTERNAL, or some other means of value -propagation. +The list subcommands ``APPEND``, ``INSERT``, ``REMOVE_AT``, ``REMOVE_ITEM``, +``REMOVE_DUPLICATES``, ``REVERSE`` and ``SORT`` may create new values for +the list within the current CMake variable scope. Similar to the +:command:`set` command, the LIST command creates new variable values in the +current scope, even if the list itself is actually defined in a parent +scope. To propagate the results of these operations upwards, use +:command:`set` with ``PARENT_SCOPE``, :command:`set` with +``CACHE INTERNAL``, or some other means of value propagation. -NOTES: A list in cmake is a ; separated group of strings. To create a -list the set command can be used. For example, set(var a b c d e) -creates a list with a;b;c;d;e, and set(var "a b c d e") creates a +NOTES: A list in cmake is a ``;`` separated group of strings. To create a +list the set command can be used. For example, ``set(var a b c d e)`` +creates a list with ``a;b;c;d;e``, and ``set(var "a b c d e")`` creates a string or a list with one item in it. (Note macro arguments are not variables, and therefore cannot be used in LIST commands.) -When specifying index values, if is 0 or greater, it +When specifying index values, if ```` is 0 or greater, it is indexed from the beginning of the list, with 0 representing the -first list element. If is -1 or lesser, it is indexed +first list element. If ```` is -1 or lesser, it is indexed from the end of the list, with -1 representing the last list element. Be careful when counting with negative indices: they do not start from 0. -0 is equivalent to 0, the first list element. diff --git a/Help/command/load_cache.rst b/Help/command/load_cache.rst index b7484cb6d..f1134472d 100644 --- a/Help/command/load_cache.rst +++ b/Help/command/load_cache.rst @@ -19,9 +19,9 @@ does not create entries in the local project's cache. Load in the values from another cache and store them in the local project's cache as internal entries. This is useful for a project -that depends on another project built in a different tree. EXCLUDE +that depends on another project built in a different tree. ``EXCLUDE`` option can be used to provide a list of entries to be excluded. -INCLUDE_INTERNALS can be used to provide a list of internal entries to +``INCLUDE_INTERNALS`` can be used to provide a list of internal entries to be included. Normally, no internal entries are brought in. Use of this form of the command is strongly discouraged, but it is provided for backward compatibility. diff --git a/Help/command/load_command.rst b/Help/command/load_command.rst index fc316d4d1..a1576e8b5 100644 --- a/Help/command/load_command.rst +++ b/Help/command/load_command.rst @@ -11,9 +11,9 @@ Load a command into a running CMake. The given locations are searched for a library whose name is cmCOMMAND_NAME. If found, it is loaded as a module and the command is -added to the set of available CMake commands. Usually, TRY_COMPILE is -used before this command to compile the module. If the command is -successfully loaded a variable named +added to the set of available CMake commands. Usually, +:command:`try_compile` is used before this command to compile the +module. If the command is successfully loaded a variable named :: diff --git a/Help/command/make_directory.rst b/Help/command/make_directory.rst index 44dbe970f..27ecf5194 100644 --- a/Help/command/make_directory.rst +++ b/Help/command/make_directory.rst @@ -1,7 +1,7 @@ make_directory -------------- -Deprecated. Use the file(MAKE_DIRECTORY ) command instead. +Deprecated. Use the :command:`file(MAKE_DIRECTORY)` command instead. :: diff --git a/Help/command/mark_as_advanced.rst b/Help/command/mark_as_advanced.rst index 30b1289f7..c3f94fc48 100644 --- a/Help/command/mark_as_advanced.rst +++ b/Help/command/mark_as_advanced.rst @@ -9,10 +9,10 @@ Mark cmake cached variables as advanced. Mark the named cached variables as advanced. An advanced variable will not be displayed in any of the cmake GUIs unless the show -advanced option is on. If CLEAR is the first argument advanced -variables are changed back to unadvanced. If FORCE is the first -argument, then the variable is made advanced. If neither FORCE nor -CLEAR is specified, new values will be marked as advanced, but if the +advanced option is on. If ``CLEAR`` is the first argument advanced +variables are changed back to unadvanced. If ``FORCE`` is the first +argument, then the variable is made advanced. If neither ``FORCE`` nor +``CLEAR`` is specified, new values will be marked as advanced, but if the variable already has an advanced/non-advanced state, it will not be changed. diff --git a/Help/command/math.rst b/Help/command/math.rst index 38fde1d9d..d4deb16e4 100644 --- a/Help/command/math.rst +++ b/Help/command/math.rst @@ -7,7 +7,7 @@ Mathematical expressions. math(EXPR ) -EXPR evaluates mathematical expression and returns result in the +``EXPR`` evaluates mathematical expression and returns result in the output variable. Example mathematical expression is '5 * ( 10 + 13 )'. Supported operators are + - * / % | & ^ ~ << >> * / %. They have the same meaning as they do in C code. diff --git a/Help/command/message.rst b/Help/command/message.rst index a20325a23..04c62fdff 100644 --- a/Help/command/message.rst +++ b/Help/command/message.rst @@ -7,7 +7,7 @@ Display a message to the user. message([] "message to display" ...) -The optional keyword determines the type of message: +The optional ```` keyword determines the type of message: :: diff --git a/Help/command/option.rst b/Help/command/option.rst index 244ed07ba..91cd0a778 100644 --- a/Help/command/option.rst +++ b/Help/command/option.rst @@ -8,8 +8,8 @@ Provides an option that the user can optionally select. option( "help string describing option" [initial value]) -Provide an option for the user to select as ON or OFF. If no initial -value is provided, OFF is used. +Provide an option for the user to select as ``ON`` or ``OFF``. If no +initial value is provided, ``OFF`` is used. If you have options that depend on the values of other options, see -the module help for CMakeDependentOption. +the module help for :module:`CMakeDependentOption`. diff --git a/Help/command/qt_wrap_cpp.rst b/Help/command/qt_wrap_cpp.rst index 81bbc0647..3843bf5e9 100644 --- a/Help/command/qt_wrap_cpp.rst +++ b/Help/command/qt_wrap_cpp.rst @@ -9,4 +9,4 @@ Create Qt Wrappers. SourceLists ...) Produce moc files for all the .h files listed in the SourceLists. The -moc files will be added to the library using the DestName source list. +moc files will be added to the library using the ``DestName`` source list. diff --git a/Help/command/qt_wrap_ui.rst b/Help/command/qt_wrap_ui.rst index 4e033a8b9..f731ed9a8 100644 --- a/Help/command/qt_wrap_ui.rst +++ b/Help/command/qt_wrap_ui.rst @@ -9,6 +9,6 @@ Create Qt user interfaces Wrappers. SourcesDestName SourceLists ...) Produce .h and .cxx files for all the .ui files listed in the -SourceLists. The .h files will be added to the library using the -HeadersDestNamesource list. The .cxx files will be added to the -library using the SourcesDestNamesource list. +``SourceLists``. The .h files will be added to the library using the +``HeadersDestNamesource`` list. The .cxx files will be added to the +library using the ``SourcesDestNamesource`` list. diff --git a/Help/command/remove.rst b/Help/command/remove.rst index ddf0e9a2d..462827796 100644 --- a/Help/command/remove.rst +++ b/Help/command/remove.rst @@ -1,12 +1,12 @@ remove ------ -Deprecated. Use the list(REMOVE_ITEM ) command instead. +Deprecated. Use the :command:`list(REMOVE_ITEM)` command instead. :: remove(VAR VALUE VALUE ...) -Removes VALUE from the variable VAR. This is typically used to remove -entries from a vector (e.g. semicolon separated list). VALUE is -expanded. +Removes ``VALUE`` from the variable ``VAR``. This is typically used to +remove entries from a vector (e.g. semicolon separated list). ``VALUE`` +is expanded. diff --git a/Help/command/remove_definitions.rst b/Help/command/remove_definitions.rst index 566da6e6b..ea189181c 100644 --- a/Help/command/remove_definitions.rst +++ b/Help/command/remove_definitions.rst @@ -1,11 +1,11 @@ remove_definitions ------------------ -Removes -D define flags added by add_definitions. +Removes -D define flags added by :command:`add_definitions`. :: remove_definitions(-DFOO -DBAR ...) -Removes flags (added by add_definitions) from the compiler command -line for sources in the current directory and below. +Removes flags (added by :command:`add_definitions`) from the compiler +command line for sources in the current directory and below. diff --git a/Help/command/return.rst b/Help/command/return.rst index 899470c69..e49fb3c8d 100644 --- a/Help/command/return.rst +++ b/Help/command/return.rst @@ -8,11 +8,11 @@ Return from a file, directory or function. return() Returns from a file, directory or function. When this command is -encountered in an included file (via include() or find_package()), it -causes processing of the current file to stop and control is returned -to the including file. If it is encountered in a file which is not -included by another file, e.g. a CMakeLists.txt, control is returned -to the parent directory if there is one. If return is called in a -function, control is returned to the caller of the function. Note -that a macro is not a function and does not handle return like a +encountered in an included file (via :command:`include` or +:command:`find_package`), it causes processing of the current file to stop +and control is returned to the including file. If it is encountered in a +file which is not included by another file, e.g. a ``CMakeLists.txt``, +control is returned to the parent directory if there is one. If return is +called in a function, control is returned to the caller of the function. +Note that a macro is not a function and does not handle return like a function does. diff --git a/Help/command/separate_arguments.rst b/Help/command/separate_arguments.rst index a876595ee..0e3e5a5f2 100644 --- a/Help/command/separate_arguments.rst +++ b/Help/command/separate_arguments.rst @@ -8,15 +8,15 @@ Parse space-separated arguments into a semicolon-separated list. separate_arguments( _COMMAND "") Parses a unix- or windows-style command-line string "" and -stores a semicolon-separated list of the arguments in . The +stores a semicolon-separated list of the arguments in ````. The entire command line must be given in one "" argument. -The UNIX_COMMAND mode separates arguments by unquoted whitespace. It +The ``UNIX_COMMAND`` mode separates arguments by unquoted whitespace. It recognizes both single-quote and double-quote pairs. A backslash escapes the next literal character (\" is "); there are no special escapes (\n is just n). -The WINDOWS_COMMAND mode parses a windows command-line using the same +The ``WINDOWS_COMMAND`` mode parses a windows command-line using the same syntax the runtime library uses to construct argv at startup. It separates arguments by whitespace that is not double-quoted. Backslashes are literal unless they precede double-quotes. See the @@ -26,6 +26,6 @@ MSDN article "Parsing C Command-Line Arguments" for details. separate_arguments(VARIABLE) -Convert the value of VARIABLE to a semi-colon separated list. All +Convert the value of ``VARIABLE`` to a semi-colon separated list. All spaces are replaced with ';'. This helps with generating command lines. diff --git a/Help/command/set_target_properties.rst b/Help/command/set_target_properties.rst index f65ee2494..2accfb0a6 100644 --- a/Help/command/set_target_properties.rst +++ b/Help/command/set_target_properties.rst @@ -12,93 +12,98 @@ Targets can have properties that affect how they are built. Set properties on a target. The syntax for the command is to list all the files you want to change, and then provide the values you want to set next. You can use any prop value pair you want and extract it -later with the GET_TARGET_PROPERTY command. +later with the :command:`get_target_property` command. Properties that affect the name of a target's output file are as -follows. The PREFIX and SUFFIX properties override the default target -name prefix (such as "lib") and suffix (such as ".so"). IMPORT_PREFIX -and IMPORT_SUFFIX are the equivalent properties for the import library -corresponding to a DLL (for SHARED library targets). OUTPUT_NAME sets -the real name of a target when it is built and can be used to help -create two targets of the same name even though CMake requires unique -logical target names. There is also a _OUTPUT_NAME that can -set the output name on a per-configuration basis. _POSTFIX -sets a postfix for the real name of the target when it is built under -the configuration named by (in upper-case, such as -"DEBUG_POSTFIX"). The value of this property is initialized when the -target is created to the value of the variable CMAKE__POSTFIX +follows. The :prop_tgt:`PREFIX` and :prop_tgt:`SUFFIX` properties +override the default target name prefix (such as "lib") and suffix +(such as ".so"). :prop_tgt:`IMPORT_PREFIX` and +:prop_tgt:`IMPORT_SUFFIX` are the equivalent properties for the import +library corresponding to a DLL (for SHARED library targets). +:prop_tgt:`OUTPUT_NAME` sets the real name of a target when it is built +and can be used to help create two targets of the same name even though +CMake requires unique logical target names. There is also a +:prop_tgt:`_OUTPUT_NAME` that can set the output name on a +per-configuration basis. :prop_tgt:`_POSTFIX` sets a postfix for +the real name of the target when it is built under the configuration named +by ```` (in upper-case, such as "DEBUG_POSTFIX"). The value of this +property is initialized when the target is created to the value of the +variable :variable:`CMAKE__POSTFIX` (except for executable targets because earlier CMake versions which did not use this variable for executables). -The LINK_FLAGS property can be used to add extra flags to the link -step of a target. LINK_FLAGS_ will add to the configuration -, for example, DEBUG, RELEASE, MINSIZEREL, RELWITHDEBINFO. -DEFINE_SYMBOL sets the name of the preprocessor symbol defined when -compiling sources in a shared library. If not set here then it is set -to target_EXPORTS by default (with some substitutions if the target is -not a valid C identifier). This is useful for headers to know whether -they are being included from inside their library or outside to -properly setup dllexport/dllimport decorations. The COMPILE_FLAGS -property sets additional compiler flags used to build sources within -the target. It may also be used to pass additional preprocessor -definitions. +The :prop_tgt:`LINK_FLAGS` property can be used to add extra flags to the +link step of a target. :prop_tgt:`LINK_FLAGS_` will add to the +configuration ````, for example, ``DEBUG``, ``RELEASE``, +``MINSIZEREL``,``RELWITHDEBINFO``. :prop_tgt:`DEFINE_SYMBOL` sets the name +of the preprocessor symbol defined when compiling sources in a shared +library. If not set here then it is set to target_EXPORTS by default +(with some substitutions if the target is not a valid C identifier). This +is useful for headers to know whether they are being included from inside +their library or outside to properly setup dllexport/dllimport +decorations. The :prop_tgt:`COMPILE_FLAGS` property sets additional +compiler flags used to build sources within the target. It may also be +used to pass additional preprocessor definitions. -The LINKER_LANGUAGE property is used to change the tool used to link -an executable or shared library. The default is set the language to -match the files in the library. CXX and C are common values for this +The :prop_tgt:`LINKER_LANGUAGE` property is used to change the tool used +to link an executable or shared library. The default is set the language to +match the files in the library. ``CXX`` and ``C`` are common values for this property. -For shared libraries VERSION and SOVERSION can be used to specify the -build version and API version respectively. When building or -installing appropriate symlinks are created if the platform supports -symlinks and the linker supports so-names. If only one of both is +For shared libraries :prop_tgt:`VERSION` and :prop_tgt:`SOVERSION` can be +used to specify the build version and API version respectively. When +building or installing appropriate symlinks are created if the platform +supports symlinks and the linker supports so-names. If only one of both is specified the missing is assumed to have the same version number. For -executables VERSION can be used to specify the build version. When -building or installing appropriate symlinks are created if the -platform supports symlinks. For shared libraries and executables on -Windows the VERSION attribute is parsed to extract a "major.minor" -version number. These numbers are used as the image version of the -binary. +executables :prop_tgt:`VERSION` can be used to specify the build +version. When building or installing appropriate symlinks are created if +the platform supports symlinks. For shared libraries and executables on +Windows the :prop_tgt:`VERSION` attribute is parsed to extract a +"major.minor" version number. These numbers are used as the image +version of the binary. -There are a few properties used to specify RPATH rules. INSTALL_RPATH -is a semicolon-separated list specifying the rpath to use in installed -targets (for platforms that support it). INSTALL_RPATH_USE_LINK_PATH -is a boolean that if set to true will append directories in the linker -search path and outside the project to the INSTALL_RPATH. -SKIP_BUILD_RPATH is a boolean specifying whether to skip automatic -generation of an rpath allowing the target to run from the build tree. -BUILD_WITH_INSTALL_RPATH is a boolean specifying whether to link the -target in the build tree with the INSTALL_RPATH. This takes -precedence over SKIP_BUILD_RPATH and avoids the need for relinking -before installation. INSTALL_NAME_DIR is a string specifying the +There are a few properties used to specify RPATH rules. +:prop_tgt:`INSTALL_RPATH` is a semicolon-separated list specifying the +rpath to use in installed targets (for platforms that support it). +:prop_tgt:`INSTALL_RPATH_USE_LINK_PATH` is a boolean that if set to true +will append directories in the linker search path and outside the project +to the :prop_tgt:`INSTALL_RPATH`. :prop_tgt:`SKIP_BUILD_RPATH` is a boolean +specifying whether to skip automatic generation of an rpath allowing the +target to run from the build tree. :prop_tgt:`BUILD_WITH_INSTALL_RPATH` is +a boolean specifying whether to link the target in the build tree with the +:prop_tgt:`INSTALL_RPATH`. This takes precedence over +:prop_tgt:`SKIP_BUILD_RPATH` and avoids the need for relinking before +installation. :prop_tgt:`INSTALL_NAME_DIR` is a string specifying the directory portion of the "install_name" field of shared libraries on Mac OSX to use in the installed targets. When the target is created -the values of the variables CMAKE_INSTALL_RPATH, -CMAKE_INSTALL_RPATH_USE_LINK_PATH, CMAKE_SKIP_BUILD_RPATH, -CMAKE_BUILD_WITH_INSTALL_RPATH, and CMAKE_INSTALL_NAME_DIR are used to -initialize these properties. +the values of the variables :variable:`CMAKE_INSTALL_RPATH`, +:variable:`CMAKE_INSTALL_RPATH_USE_LINK_PATH`, +:variable:`CMAKE_SKIP_BUILD_RPATH`, +:variable:`CMAKE_BUILD_WITH_INSTALL_RPATH`, and +:variable:`CMAKE_INSTALL_NAME_DIR` are used to initialize these properties. -PROJECT_LABEL can be used to change the name of the target in an IDE -like visual studio. VS_KEYWORD can be set to change the visual studio -keyword, for example Qt integration works better if this is set to -Qt4VSv1.0. +:prop_tgt:`PROJECT_LABEL` can be used to change the name of the target in +an IDE like visual studio. :prop_tgt:`VS_KEYWORD` can be set to change +the visual studio keyword, for example Qt integration works better if this +is set to ``Qt4VSv1.0``. -VS_SCC_PROJECTNAME, VS_SCC_LOCALPATH, VS_SCC_PROVIDER and -VS_SCC_AUXPATH can be set to add support for source control bindings -in a Visual Studio project file. +:prop_tgt:`VS_SCC_PROJECTNAME`, :prop_tgt:`VS_SCC_LOCALPATH`, +:prop_tgt:`VS_SCC_PROVIDER` and :prop_tgt:`VS_SCC_AUXPATH` can be set to +add support for source control bindings in a Visual Studio project file. -VS_GLOBAL_ can be set to add a Visual Studio +:prop_tgt:`VS_GLOBAL_` can be set to add a Visual Studio project-specific global variable. Qt integration works better if -VS_GLOBAL_QtVersion is set to the Qt version FindQt4.cmake found. For -example, "4.7.3" +``VS_GLOBAL_QtVersion`` is set to the Qt version :module:`FindQt4` +found. For example, "4.7.3" -The PRE_INSTALL_SCRIPT and POST_INSTALL_SCRIPT properties are the old -way to specify CMake scripts to run before and after installing a -target. They are used only when the old INSTALL_TARGETS command is -used to install the target. Use the INSTALL command instead. +The :prop_tgt:`PRE_INSTALL_SCRIPT` and :prop_tgt:`POST_INSTALL_SCRIPT` +properties are the old way to specify CMake scripts to run before and +after installing a target. They are used only when the old +:command:`install_targets` command is used to install the target. Use the +:command:`install` command instead. -The EXCLUDE_FROM_DEFAULT_BUILD property is used by the visual studio -generators. If it is set to 1 the target will not be part of the +The :prop_tgt:`EXCLUDE_FROM_DEFAULT_BUILD` property is used by the visual +studio generators. If it is set to 1 the target will not be part of the default build when you select "Build Solution". This can also be set on a per-configuration basis using -EXCLUDE_FROM_DEFAULT_BUILD_. +:prop_tgt:`EXCLUDE_FROM_DEFAULT_BUILD_`. diff --git a/Help/command/string.rst b/Help/command/string.rst index 351385bf1..34c1b6179 100644 --- a/Help/command/string.rst +++ b/Help/command/string.rst @@ -39,41 +39,41 @@ String operations. string(UUID NAMESPACE NAME TYPE [UPPER]) -REGEX MATCH will match the regular expression once and store the match +``REGEX MATCH`` will match the regular expression once and store the match in the output variable. -REGEX MATCHALL will match the regular expression as many times as +``REGEX MATCHALL`` will match the regular expression as many times as possible and store the matches in the output variable as a list. -REGEX REPLACE will match the regular expression as many times as +``REGEX REPLACE`` will match the regular expression as many times as possible and substitute the replacement expression for the match in the output. The replace expression may refer to paren-delimited subexpressions of the match using \1, \2, ..., \9. Note that two backslashes (\\1) are required in CMake code to get a backslash through argument parsing. -REPLACE will replace all occurrences of match_string in the input with -replace_string and store the result in the output. +``REPLACE`` will replace all occurrences of ``match_string`` in the input +with ``replace_string`` and store the result in the output. -CONCAT will concatenate all the input arguments together and store +``CONCAT`` will concatenate all the input arguments together and store the result in the named output variable. -MD5, SHA1, SHA224, SHA256, SHA384, and SHA512 will compute a -cryptographic hash of the input string. +``MD5``, ``SHA1``, ``SHA224``, ``SHA256``, ``SHA384``, and ``SHA512`` will +compute a cryptographic hash of the input string. -COMPARE EQUAL/NOTEQUAL/LESS/GREATER will compare the strings and store -true or false in the output variable. +``COMPARE EQUAL``/``COMPARE NOTEQUAL``/``COMPARE LESS/GREATER`` will +compare the strings and store true or false in the output variable. -ASCII will convert all numbers into corresponding ASCII characters. +``ASCII`` will convert all numbers into corresponding ASCII characters. -CONFIGURE will transform a string like CONFIGURE_FILE transforms a -file. +``CONFIGURE`` will transform a string like :command:`configure_file` +transforms a file. -TOUPPER/TOLOWER will convert string to upper/lower characters. +``TOUPPER``/``TOLOWER`` will convert string to upper/lower characters. -LENGTH will return a given string's length. +``LENGTH`` will return a given string's length. -SUBSTRING will return a substring of a given string. If length is -1 +``SUBSTRING`` will return a substring of a given string. If length is -1 the remainder of the string starting at begin will be returned. If string is shorter than length then end of string is used instead. @@ -81,17 +81,17 @@ If string is shorter than length then end of string is used instead. CMake 3.1 and below reported an error if length pointed past the end of string. -STRIP will return a substring of a given string with leading and +``STRIP`` will return a substring of a given string with leading and trailing spaces removed. -RANDOM will return a random string of given length consisting of +``RANDOM`` will return a random string of given length consisting of characters from the given alphabet. Default length is 5 characters and default alphabet is all numbers and upper and lower case letters. -If an integer RANDOM_SEED is given, its value will be used to seed the +If an integer ``RANDOM_SEED`` is given, its value will be used to seed the random number generator. -FIND will return the position where the given substring was found in -the supplied string. If the REVERSE flag was used, the command will +``FIND`` will return the position where the given substring was found in +the supplied string. If the ``REVERSE`` flag was used, the command will search for the position of the last occurrence of the specified substring. @@ -118,21 +118,21 @@ The following characters have special meaning in regular expressions: by all regular expression-related commands, including e.g. if( MATCHES ), in the variables CMAKE_MATCH_(0..9). -``*``, ``+`` and ``?`` have higher precedence than concatenation. | has lower -precedence than concatenation. This means that the regular expression -"^ab+d$" matches "abbd" but not "ababd", and the regular expression -"^(ab|cd)$" matches "ab" but not "abd". +``*``, ``+`` and ``?`` have higher precedence than concatenation. ``|`` +has lower precedence than concatenation. This means that the regular +expression "^ab+d$" matches "abbd" but not "ababd", and the regular +expression "^(ab|cd)$" matches "ab" but not "abd". -TIMESTAMP will write a string representation of the current date +``TIMESTAMP`` will write a string representation of the current date and/or time to the output variable. Should the command be unable to obtain a timestamp the output variable will be set to the empty string "". -The optional UTC flag requests the current date/time representation to +The optional ``UTC`` flag requests the current date/time representation to be in Coordinated Universal Time (UTC) rather than local time. -The optional may contain the following format +The optional ```` may contain the following format specifiers: :: @@ -153,23 +153,23 @@ specifiers: Unknown format specifiers will be ignored and copied to the output as-is. -If no explicit is given it will default to: +If no explicit ```` is given it will default to: :: %Y-%m-%dT%H:%M:%S for local time. %Y-%m-%dT%H:%M:%SZ for UTC. -MAKE_C_IDENTIFIER will write a string which can be used as an +``MAKE_C_IDENTIFIER`` will write a string which can be used as an identifier in C. ``GENEX_STRIP`` will strip any :manual:`generator expressions ` from the ``input string`` and store the result in the ``output variable``. -UUID creates a univerally unique identifier (aka GUID) as per RFC4122 -based on the hash of the combined values of -(which itself has to be a valid UUID) and . +``UUID`` creates a univerally unique identifier (aka GUID) as per RFC4122 +based on the hash of the combined values of ```` +(which itself has to be a valid UUID) and ````. The hash algorithm can be either ``MD5`` (Version 3 UUID) or ``SHA1`` (Version 5 UUID). A UUID has the format ``xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`` diff --git a/Help/command/subdirs.rst b/Help/command/subdirs.rst index dee49f8e0..43b87d4d7 100644 --- a/Help/command/subdirs.rst +++ b/Help/command/subdirs.rst @@ -1,7 +1,7 @@ subdirs ------- -Deprecated. Use the add_subdirectory() command instead. +Deprecated. Use the :command:`add_subdirectory` command instead. Add a list of subdirectories to the build. @@ -10,12 +10,12 @@ Add a list of subdirectories to the build. subdirs(dir1 dir2 ...[EXCLUDE_FROM_ALL exclude_dir1 exclude_dir2 ...] [PREORDER] ) -Add a list of subdirectories to the build. The add_subdirectory -command should be used instead of subdirs although subdirs will still +Add a list of subdirectories to the build. The :command:`add_subdirectory` +command should be used instead of ``subdirs`` although ``subdirs`` will still work. This will cause any CMakeLists.txt files in the sub directories -to be processed by CMake. Any directories after the PREORDER flag are -traversed first by makefile builds, the PREORDER flag has no effect on -IDE projects. Any directories after the EXCLUDE_FROM_ALL marker will +to be processed by CMake. Any directories after the ``PREORDER`` flag are +traversed first by makefile builds, the ``PREORDER`` flag has no effect on +IDE projects. Any directories after the ``EXCLUDE_FROM_ALL`` marker will not be included in the top level makefile or project file. This is useful for having CMake create makefiles or projects for a set of examples in a project. You would want CMake to generate makefiles or diff --git a/Help/command/unset.rst b/Help/command/unset.rst index d8f0dcdb2..a1fc95cc6 100644 --- a/Help/command/unset.rst +++ b/Help/command/unset.rst @@ -8,14 +8,14 @@ Unset a variable, cache variable, or environment variable. unset( [CACHE | PARENT_SCOPE]) Removes the specified variable causing it to become undefined. If -CACHE is present then the variable is removed from the cache instead +``CACHE`` is present then the variable is removed from the cache instead of the current scope. -If PARENT_SCOPE is present then the variable is removed from the scope -above the current scope. See the same option in the set() command for -further details. +If ``PARENT_SCOPE`` is present then the variable is removed from the scope +above the current scope. See the same option in the :command:`set` command +for further details. - can be an environment variable such as: +```` can be an environment variable such as: :: diff --git a/Help/command/utility_source.rst b/Help/command/utility_source.rst index 5122e520a..ee34492c3 100644 --- a/Help/command/utility_source.rst +++ b/Help/command/utility_source.rst @@ -12,11 +12,11 @@ Specify the source tree of a third-party utility. When a third-party utility's source is included in the distribution, this command specifies its location and name. The cache entry will -not be set unless the path_to_source and all listed files exist. It +not be set unless the ``path_to_source`` and all listed files exist. It is assumed that the source tree of the utility will have been built before it is needed. -When cross compiling CMake will print a warning if a utility_source() +When cross compiling CMake will print a warning if a ``utility_source()`` command is executed, because in many cases it is used to build an executable which is executed later on. This doesn't work when cross compiling, since the executable can run only on their target platform. diff --git a/Help/command/variable_requires.rst b/Help/command/variable_requires.rst index 831dd0023..9cf9f3ffd 100644 --- a/Help/command/variable_requires.rst +++ b/Help/command/variable_requires.rst @@ -3,7 +3,7 @@ variable_requires Disallowed. See CMake Policy :policy:`CMP0035`. -Use the if() command instead. +Use the :command:`if` command instead. Assert satisfaction of an option's required variables. @@ -13,10 +13,10 @@ Assert satisfaction of an option's required variables. REQUIRED_VARIABLE1 REQUIRED_VARIABLE2 ...) -The first argument (TEST_VARIABLE) is the name of the variable to be +The first argument (``TEST_VARIABLE``) is the name of the variable to be tested, if that variable is false nothing else is done. If -TEST_VARIABLE is true, then the next argument (RESULT_VARIABLE) is a -variable that is set to true if all the required variables are set. +``TEST_VARIABLE`` is true, then the next argument (``RESULT_VARIABLE``) +is a variable that is set to true if all the required variables are set. The rest of the arguments are variables that must be true or not set to NOTFOUND to avoid an error. If any are not true, an error is reported. diff --git a/Help/command/while.rst b/Help/command/while.rst index 72c055de1..7509da309 100644 --- a/Help/command/while.rst +++ b/Help/command/while.rst @@ -11,7 +11,7 @@ Evaluate a group of commands while a condition is true ... endwhile(condition) -All commands between while and the matching endwhile are recorded -without being invoked. Once the endwhile is evaluated, the recorded -list of commands is invoked as long as the condition is true. The -condition is evaluated using the same logic as the if command. +All commands between while and the matching :command:`endwhile` are recorded +without being invoked. Once the :command:`endwhile` is evaluated, the +recorded list of commands is invoked as long as the condition is true. The +condition is evaluated using the same logic as the :command:`if` command. diff --git a/Help/command/write_file.rst b/Help/command/write_file.rst index 015514bb3..40e755763 100644 --- a/Help/command/write_file.rst +++ b/Help/command/write_file.rst @@ -1,20 +1,20 @@ write_file ---------- -Deprecated. Use the file(WRITE ) command instead. +Deprecated. Use the :command:`file(WRITE)` command instead. :: write_file(filename "message to write"... [APPEND]) The first argument is the file name, the rest of the arguments are -messages to write. If the argument APPEND is specified, then the +messages to write. If the argument ``APPEND`` is specified, then the message will be appended. -NOTE 1: file(WRITE ... and file(APPEND ... do exactly the same as -this one but add some more functionality. +NOTE 1: :command:`file(WRITE)` and :command:`file(APPEND)` do exactly +the same as this one but add some more functionality. -NOTE 2: When using write_file the produced file cannot be used as an +NOTE 2: When using ``write_file`` the produced file cannot be used as an input to CMake (CONFIGURE_FILE, source file ...) because it will lead -to an infinite loop. Use configure_file if you want to generate input -files to CMake. +to an infinite loop. Use :command:`configure_file` if you want to +generate input files to CMake. From 1594edba9ead291eaf3a9b4e63ba41edc43d4f99 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 8 Jun 2015 11:28:35 -0400 Subject: [PATCH 0099/1048] Utilities/Release: Update to more recent Qt 4.8 on OS X Update to a version newer than 4.8.0 to get the fix for this issue: https://bugreports.qt.io/browse/QTBUG-23704 https://codereview.qt-project.org/13576 http://code.qt.io/cgit/qt/qt.git/commit/?id=e88dbaa7fc We hit it in the cmake-gui command-line install help dialog. --- Utilities/Release/dashmacmini5_release.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Utilities/Release/dashmacmini5_release.cmake b/Utilities/Release/dashmacmini5_release.cmake index bc95982df..b407554f8 100644 --- a/Utilities/Release/dashmacmini5_release.cmake +++ b/Utilities/Release/dashmacmini5_release.cmake @@ -20,7 +20,7 @@ CMAKE_SKIP_BOOTSTRAP_TEST:STRING=TRUE CPACK_SYSTEM_NAME:STRING=Darwin-x86_64 BUILD_QtDialog:BOOL=TRUE CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL:BOOL=TRUE -QT_QMAKE_EXECUTABLE:FILEPATH=/Users/kitware/Support/qt-4.8.0/install/bin/qmake +QT_QMAKE_EXECUTABLE:FILEPATH=/Users/kitware/Support/qt-4.8.6/install/bin/qmake ") get_filename_component(path "${CMAKE_CURRENT_LIST_FILE}" PATH) include(${path}/release_cmake.cmake) From 2848f93d1aa8420fa57351385aefe8042b675540 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Tue, 9 Jun 2015 00:01:04 -0400 Subject: [PATCH 0100/1048] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index c9aec510b..67be07389 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 3) -set(CMake_VERSION_PATCH 20150608) +set(CMake_VERSION_PATCH 20150609) #set(CMake_VERSION_RC 1) From 801b799f9d5f1d904c4605d19b798ed489be925d Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 9 Jun 2015 10:21:07 -0400 Subject: [PATCH 0101/1048] FindBISON: Improve documentation formatting --- Modules/FindBISON.cmake | 78 +++++++++++++++++++++++------------------ 1 file changed, 44 insertions(+), 34 deletions(-) diff --git a/Modules/FindBISON.cmake b/Modules/FindBISON.cmake index ec3ee78e8..4002cc608 100644 --- a/Modules/FindBISON.cmake +++ b/Modules/FindBISON.cmake @@ -2,60 +2,70 @@ # FindBISON # --------- # -# Find bison executable and provides macros to generate custom build rules +# Find ``bison`` executable and provide a macro to generate custom build rules. # # The module defines the following variables: # -# :: +# ``BISON_EXECUTABLE`` +# path to the ``bison`` program # -# BISON_EXECUTABLE - path to the bison program -# BISON_VERSION - version of bison -# BISON_FOUND - true if the program was found +# ``BISON_VERSION`` +# version of ``bison`` # +# ``BISON_FOUND`` +# true if the program was found # +# The minimum required version of ``bison`` can be specified using the +# standard CMake syntax, e.g. ``find_package(BISON 2.1.3)``. # -# The minimum required version of bison can be specified using the -# standard CMake syntax, e.g. find_package(BISON 2.1.3) +# If ``bison`` is found, the module defines the macro:: # -# If bison is found, the module defines the macros: +# BISON_TARGET( +# [COMPILE_FLAGS ] +# [VERBOSE ] +# ) # -# :: -# -# BISON_TARGET( [VERBOSE ] -# [COMPILE_FLAGS ]) -# -# which will create a custom rule to generate a parser. is -# the path to a yacc file. is the name of the source file +# which will create a custom rule to generate a parser. ```` is +# the path to a yacc file. ```` is the name of the source file # generated by bison. A header file is also be generated, and contains -# the token list. If COMPILE_FLAGS option is specified, the next -# parameter is added in the bison command line. if VERBOSE option is -# specified, is created and contains verbose descriptions of the -# grammar and parser. The macro defines a set of variables: +# the token list. # -# :: +# The options are: # -# BISON_${Name}_DEFINED - true is the macro ran successfully -# BISON_${Name}_INPUT - The input source file, an alias for -# BISON_${Name}_OUTPUT_SOURCE - The source file generated by bison -# BISON_${Name}_OUTPUT_HEADER - The header file generated by bison -# BISON_${Name}_OUTPUTS - The sources files generated by bison -# BISON_${Name}_COMPILE_FLAGS - Options used in the bison command line +# ``COMPILE_FLAGS `` +# Specify flags to be added to the ``bison`` command line. # +# ``VERBOSE `` +# Tell ``bison`` to write verbose descriptions of the grammar and +# parser to the given ````. # +# The macro defines the following variables: # -# :: +# ``BISON__DEFINED`` +# true is the macro ran successfully # -# ==================================================================== -# Example: +# ``BISON__INPUT`` +# The input source file, an alias for # +# ``BISON__OUTPUT_SOURCE`` +# The source file generated by bison # +# ``BISON__OUTPUT_HEADER`` +# The header file generated by bison # -# :: +# ``BISON__OUTPUTS`` +# The sources files generated by bison # -# find_package(BISON) -# BISON_TARGET(MyParser parser.y ${CMAKE_CURRENT_BINARY_DIR}/parser.cpp) -# add_executable(Foo main.cpp ${BISON_MyParser_OUTPUTS}) -# ==================================================================== +# ``BISON__COMPILE_FLAGS`` +# Options used in the ``bison`` command line +# +# Example usage: +# +# .. code-block:: cmake +# +# find_package(BISON) +# BISON_TARGET(MyParser parser.y ${CMAKE_CURRENT_BINARY_DIR}/parser.cpp) +# add_executable(Foo main.cpp ${BISON_MyParser_OUTPUTS}) #============================================================================= # Copyright 2009 Kitware, Inc. From 29985ad8948af74d8b6ad4e58428f65434e68f0c Mon Sep 17 00:00:00 2001 From: Eon Jeong Date: Mon, 8 Jun 2015 23:35:49 +0900 Subject: [PATCH 0102/1048] FindBISON: Use BISON_TARGET macro argument names internally The macro argument names are much clearer than ${ARGV#} references. --- Modules/FindBISON.cmake | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Modules/FindBISON.cmake b/Modules/FindBISON.cmake index 4002cc608..e1cad81e2 100644 --- a/Modules/FindBISON.cmake +++ b/Modules/FindBISON.cmake @@ -171,23 +171,23 @@ if(BISON_EXECUTABLE) # Header's name generated by bison (see option -d) list(APPEND BISON_TARGET_cmdopt "-d") - string(REGEX REPLACE "^(.*)(\\.[^.]*)$" "\\2" _fileext "${ARGV2}") + string(REGEX REPLACE "^(.*)(\\.[^.]*)$" "\\2" _fileext "${BisonOutput}") string(REPLACE "c" "h" _fileext ${_fileext}) string(REGEX REPLACE "^(.*)(\\.[^.]*)$" "\\1${_fileext}" - BISON_${Name}_OUTPUT_HEADER "${ARGV2}") + BISON_${Name}_OUTPUT_HEADER "${BisonOutput}") list(APPEND BISON_TARGET_outputs "${BISON_${Name}_OUTPUT_HEADER}") add_custom_command(OUTPUT ${BISON_TARGET_outputs} ${BISON_TARGET_extraoutputs} COMMAND ${BISON_EXECUTABLE} - ARGS ${BISON_TARGET_cmdopt} -o ${ARGV2} ${ARGV1} - DEPENDS ${ARGV1} + ARGS ${BISON_TARGET_cmdopt} -o ${BisonOutput} ${BisonInput} + DEPENDS ${BisonInput} COMMENT "[BISON][${Name}] Building parser with bison ${BISON_VERSION}" WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) # define target variables set(BISON_${Name}_DEFINED TRUE) - set(BISON_${Name}_INPUT ${ARGV1}) + set(BISON_${Name}_INPUT ${BisonInput}) set(BISON_${Name}_OUTPUTS ${BISON_TARGET_outputs}) set(BISON_${Name}_COMPILE_FLAGS ${BISON_TARGET_cmdopt}) set(BISON_${Name}_OUTPUT_SOURCE "${BisonOutput}") From eb859263aeffc79d73d046dbf9f5656e4c9739ef Mon Sep 17 00:00:00 2001 From: Eon Jeong Date: Mon, 8 Jun 2015 23:35:49 +0900 Subject: [PATCH 0103/1048] FindBISON: Use CMAKE_PARSE_ARGUMENTS to parse arguments --- Modules/FindBISON.cmake | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/Modules/FindBISON.cmake b/Modules/FindBISON.cmake index e1cad81e2..30d7c4f19 100644 --- a/Modules/FindBISON.cmake +++ b/Modules/FindBISON.cmake @@ -84,6 +84,8 @@ find_program(BISON_EXECUTABLE NAMES bison win_bison DOC "path to the bison executable") mark_as_advanced(BISON_EXECUTABLE) +include(CMakeParseArguments) + if(BISON_EXECUTABLE) # the bison commands should be executed with the C locale, otherwise # the message (which are parsed) may be translated @@ -146,27 +148,30 @@ if(BISON_EXECUTABLE) set(BISON_TARGET_output_header "") set(BISON_TARGET_cmdopt "") set(BISON_TARGET_outputs "${BisonOutput}") - if(NOT ${ARGC} EQUAL 3 AND NOT ${ARGC} EQUAL 5 AND NOT ${ARGC} EQUAL 7) + + # Parsing parameters + set(BISON_TARGET_PARAM_OPTIONS) + set(BISON_TARGET_PARAM_ONE_VALUE_KEYWORDS + VERBOSE + COMPILE_FLAGS + ) + set(BISON_TARGET_PARAM_MULTI_VALUE_KEYWORDS) + cmake_parse_arguments( + BISON_TARGET_ARG + "${BISON_TARGET_PARAM_OPTIONS}" + "${BISON_TARGET_PARAM_ONE_VALUE_KEYWORDS}" + "${BISON_TARGET_PARAM_MULTI_VALUE_KEYWORDS}" + ${ARGN} + ) + + if(NOT "${BISON_TARGET_ARG_UNPARSED_ARGUMENTS}" STREQUAL "") message(SEND_ERROR "Usage") else() - # Parsing parameters - if(${ARGC} GREATER 5 OR ${ARGC} EQUAL 5) - if("${ARGV3}" STREQUAL "VERBOSE") - BISON_TARGET_option_verbose(${Name} ${BisonOutput} "${ARGV4}") - endif() - if("${ARGV3}" STREQUAL "COMPILE_FLAGS") - BISON_TARGET_option_extraopts("${ARGV4}") - endif() + if(NOT "${BISON_TARGET_ARG_VERBOSE}" STREQUAL "") + BISON_TARGET_option_verbose(${Name} ${BisonOutput} "${BISON_TARGET_ARG_VERBOSE}") endif() - - if(${ARGC} EQUAL 7) - if("${ARGV5}" STREQUAL "VERBOSE") - BISON_TARGET_option_verbose(${Name} ${BisonOutput} "${ARGV6}") - endif() - - if("${ARGV5}" STREQUAL "COMPILE_FLAGS") - BISON_TARGET_option_extraopts("${ARGV6}") - endif() + if(NOT "${BISON_TARGET_ARG_COMPILE_FLAGS}" STREQUAL "") + BISON_TARGET_option_extraopts("${BISON_TARGET_ARG_COMPILE_FLAGS}") endif() # Header's name generated by bison (see option -d) From 12e534c2b8ad0009aba746ee6e4b47423c52f3e3 Mon Sep 17 00:00:00 2001 From: Eon Jeong Date: Tue, 9 Jun 2015 09:59:15 +0900 Subject: [PATCH 0104/1048] FindBISON: Add DEFINES_FILE option to pass --defines=FILE --- Modules/FindBISON.cmake | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/Modules/FindBISON.cmake b/Modules/FindBISON.cmake index 30d7c4f19..7d81276c8 100644 --- a/Modules/FindBISON.cmake +++ b/Modules/FindBISON.cmake @@ -22,6 +22,7 @@ # # BISON_TARGET( # [COMPILE_FLAGS ] +# [DEFINES_FILE ] # [VERBOSE ] # ) # @@ -35,6 +36,9 @@ # ``COMPILE_FLAGS `` # Specify flags to be added to the ``bison`` command line. # +# ``DEFINES_FILE `` +# Specify a non-default header ```` to be generated by ``bison``. +# # ``VERBOSE `` # Tell ``bison`` to write verbose descriptions of the grammar and # parser to the given ````. @@ -64,7 +68,8 @@ # .. code-block:: cmake # # find_package(BISON) -# BISON_TARGET(MyParser parser.y ${CMAKE_CURRENT_BINARY_DIR}/parser.cpp) +# BISON_TARGET(MyParser parser.y ${CMAKE_CURRENT_BINARY_DIR}/parser.cpp +# DEFINES_FILE ${CMAKE_CURRENT_BINARY_DIR}/parser.h) # add_executable(Foo main.cpp ${BISON_MyParser_OUTPUTS}) #============================================================================= @@ -140,6 +145,12 @@ if(BISON_EXECUTABLE) list(APPEND BISON_TARGET_cmdopt ${BISON_TARGET_extraopts}) endmacro() + # internal macro + macro(BISON_TARGET_option_defines Header) + set(BISON_TARGET_output_header "${Header}") + list(APPEND BISON_TARGET_cmdopt --defines=${BISON_TARGET_output_header}) + endmacro() + #============================================================ # BISON_TARGET (public macro) #============================================================ @@ -154,6 +165,7 @@ if(BISON_EXECUTABLE) set(BISON_TARGET_PARAM_ONE_VALUE_KEYWORDS VERBOSE COMPILE_FLAGS + DEFINES_FILE ) set(BISON_TARGET_PARAM_MULTI_VALUE_KEYWORDS) cmake_parse_arguments( @@ -173,14 +185,19 @@ if(BISON_EXECUTABLE) if(NOT "${BISON_TARGET_ARG_COMPILE_FLAGS}" STREQUAL "") BISON_TARGET_option_extraopts("${BISON_TARGET_ARG_COMPILE_FLAGS}") endif() + if(NOT "${BISON_TARGET_ARG_DEFINES_FILE}" STREQUAL "") + BISON_TARGET_option_defines("${BISON_TARGET_ARG_DEFINES_FILE}") + endif() - # Header's name generated by bison (see option -d) - list(APPEND BISON_TARGET_cmdopt "-d") - string(REGEX REPLACE "^(.*)(\\.[^.]*)$" "\\2" _fileext "${BisonOutput}") - string(REPLACE "c" "h" _fileext ${_fileext}) - string(REGEX REPLACE "^(.*)(\\.[^.]*)$" "\\1${_fileext}" - BISON_${Name}_OUTPUT_HEADER "${BisonOutput}") - list(APPEND BISON_TARGET_outputs "${BISON_${Name}_OUTPUT_HEADER}") + if("${BISON_TARGET_output_header}" STREQUAL "") + # Header's name generated by bison (see option -d) + list(APPEND BISON_TARGET_cmdopt "-d") + string(REGEX REPLACE "^(.*)(\\.[^.]*)$" "\\2" _fileext "${BisonOutput}") + string(REPLACE "c" "h" _fileext ${_fileext}) + string(REGEX REPLACE "^(.*)(\\.[^.]*)$" "\\1${_fileext}" + BISON_TARGET_output_header "${BisonOutput}") + endif() + list(APPEND BISON_TARGET_outputs "${BISON_TARGET_output_header}") add_custom_command(OUTPUT ${BISON_TARGET_outputs} ${BISON_TARGET_extraoutputs} @@ -196,6 +213,7 @@ if(BISON_EXECUTABLE) set(BISON_${Name}_OUTPUTS ${BISON_TARGET_outputs}) set(BISON_${Name}_COMPILE_FLAGS ${BISON_TARGET_cmdopt}) set(BISON_${Name}_OUTPUT_SOURCE "${BisonOutput}") + set(BISON_${Name}_OUTPUT_HEADER "${BISON_TARGET_output_header}") endif() endmacro() From 821a711b6ff59fd1fa0c0cbaa43178cee1718078 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 9 Jun 2015 22:23:56 +0200 Subject: [PATCH 0105/1048] project(): Remove unused variable. --- Source/cmProjectCommand.cxx | 1 - 1 file changed, 1 deletion(-) diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx index 176cb0d71..90bc1115e 100644 --- a/Source/cmProjectCommand.cxx +++ b/Source/cmProjectCommand.cxx @@ -233,7 +233,6 @@ bool cmProjectCommand const char* include = this->Makefile->GetDefinition(extraInclude); if(include) { - std::string fullFilePath; bool readit = this->Makefile->ReadDependentFile(include); if(!readit && !cmSystemTools::GetFatalErrorOccured()) From 22d09ecf33f3d07925003995b76b7e8aa788c04f Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 9 Jun 2015 22:27:35 +0200 Subject: [PATCH 0106/1048] cmLocalGenerator: Remove ConfigureFinalPass. Call the cmMakefile implementation directly. This is a configure-time construct. --- Source/cmGlobalGenerator.cxx | 2 +- Source/cmLocalGenerator.cxx | 5 ----- Source/cmLocalGenerator.h | 5 ----- 3 files changed, 1 insertion(+), 11 deletions(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index bd949bb42..9b02cbb06 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1540,7 +1540,7 @@ void cmGlobalGenerator::CheckLocalGenerators() cmState* state = this->GetCMakeInstance()->GetState(); for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i) { - this->LocalGenerators[i]->ConfigureFinalPass(); + this->LocalGenerators[i]->GetMakefile()->ConfigureFinalPass(); cmTargets &targets = this->LocalGenerators[i]->GetMakefile()->GetTargets(); for (cmTargets::iterator l = targets.begin(); diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 5ed53d04c..98accf9cf 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -113,11 +113,6 @@ void cmLocalGenerator::ComputeObjectMaxPath() this->ObjectMaxPathViolations.clear(); } -void cmLocalGenerator::ConfigureFinalPass() -{ - this->Makefile->ConfigureFinalPass(); -} - void cmLocalGenerator::TraceDependencies() { std::vector configs; diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index efdd48712..42df2b846 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -54,11 +54,6 @@ public: virtual void AddHelperCommands() {} - /** - * Perform any final calculations prior to generation - */ - void ConfigureFinalPass(); - /** * Generate the install rules files in this directory. */ From a3a8177eddfdfc89fae9331ca794abbc67f5d543 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 9 Jun 2015 23:55:56 +0200 Subject: [PATCH 0107/1048] cmFileCommand: Fix implementation of CMP0009. --- Source/cmFileCommand.cxx | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 469846815..7440357c7 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -906,13 +906,13 @@ bool cmFileCommand::HandleGlobCommand(std::vector const& args, { switch(status) { + case cmPolicies::REQUIRED_IF_USED: + case cmPolicies::REQUIRED_ALWAYS: case cmPolicies::NEW: g.RecurseThroughSymlinksOff(); break; case cmPolicies::OLD: case cmPolicies::WARN: - case cmPolicies::REQUIRED_IF_USED: - case cmPolicies::REQUIRED_ALWAYS: g.RecurseThroughSymlinksOn(); break; } @@ -1044,6 +1044,8 @@ bool cmFileCommand::HandleGlobCommand(std::vector const& args, { switch (status) { + case cmPolicies::REQUIRED_IF_USED: + case cmPolicies::REQUIRED_ALWAYS: case cmPolicies::NEW: // Correct behavior, yay! break; @@ -1059,12 +1061,6 @@ bool cmFileCommand::HandleGlobCommand(std::vector const& args, cmPolicies::GetPolicyWarning(cmPolicies::CMP0009)); } break; - case cmPolicies::REQUIRED_IF_USED: - case cmPolicies::REQUIRED_ALWAYS: - this->SetError("policy CMP0009 error"); - this->Makefile->IssueMessage(cmake::FATAL_ERROR, - cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0009)); - return false; } } From c9ee5de4af1ef11f946196052fbb5b6c536fb27f Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Wed, 10 Jun 2015 00:01:06 -0400 Subject: [PATCH 0108/1048] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 67be07389..5298a869b 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 3) -set(CMake_VERSION_PATCH 20150609) +set(CMake_VERSION_PATCH 20150610) #set(CMake_VERSION_RC 1) From 07ee7bac74260942121552bed94a18101b6e7002 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Thu, 11 Jun 2015 00:01:03 -0400 Subject: [PATCH 0109/1048] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 5298a869b..13420da6a 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 3) -set(CMake_VERSION_PATCH 20150610) +set(CMake_VERSION_PATCH 20150611) #set(CMake_VERSION_RC 1) From b6667729cb40dec8aff28464152dfa1b7c92decc Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 11 Jun 2015 09:44:05 -0400 Subject: [PATCH 0110/1048] Tests: Simplify CTest.UpdateGIT QUIET mode test Parameterize the dashboard script generation to configure custom content. Also move state cleanup from previous test back to its block. --- Tests/CTestUpdateCommon.cmake | 2 +- Tests/CTestUpdateGIT.cmake.in | 15 +++------------ 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/Tests/CTestUpdateCommon.cmake b/Tests/CTestUpdateCommon.cmake index 77b33989a..0bb2d30d7 100644 --- a/Tests/CTestUpdateCommon.cmake +++ b/Tests/CTestUpdateCommon.cmake @@ -193,7 +193,7 @@ set(CTEST_BINARY_DIRECTORY \${CTEST_DASHBOARD_ROOT}/${bin_dir}) ${custom_text} # Start a dashboard and run the update step ctest_start(Experimental) -ctest_update(SOURCE \${CTEST_SOURCE_DIRECTORY}) +ctest_update(SOURCE \${CTEST_SOURCE_DIRECTORY} ${ctest_update_args}) ") endfunction() diff --git a/Tests/CTestUpdateGIT.cmake.in b/Tests/CTestUpdateGIT.cmake.in index 5987a3005..3734e2b86 100644 --- a/Tests/CTestUpdateGIT.cmake.in +++ b/Tests/CTestUpdateGIT.cmake.in @@ -334,31 +334,22 @@ set(CTEST_UPDATE_VERSION_ONLY TRUE) # Run the dashboard script with CTest. set(NO_UPDATE 1) run_dashboard_script(dash-binary-no-update) +unset(NO_UPDATE) rewind_source(dash-source) #----------------------------------------------------------------------------- # Test ctest_update(QUIET) -set(NO_UPDATE 0) message("Running CTest Dashboard Script (update quietly)...") +set(ctest_update_args QUIET) create_dashboard_script(dash-binary-quiet "# git command configuration set(CTEST_GIT_COMMAND \"${GIT}\") set(CTEST_GIT_UPDATE_OPTIONS) set(CTEST_GIT_UPDATE_CUSTOM \${CTEST_GIT_COMMAND} pull origin master) ") - -# We need to modify the created dashboard script to include our "QUIET" -# option. -set(filename "${TOP}/dash-binary-quiet.cmake") -file(READ "${filename}" contents) -string(REPLACE - [=[ctest_update(SOURCE ${CTEST_SOURCE_DIRECTORY})]=] - [=[ctest_update(SOURCE ${CTEST_SOURCE_DIRECTORY} QUIET)]=] - contents - "${contents}") -file(WRITE "${filename}" "${contents}") +unset(ctest_update_args) # Run the dashboard script with CTest. run_dashboard_script(dash-binary-quiet) From bcf258032fe79c75965722f25ec5f76ff472a19c Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 11 Jun 2015 09:51:08 -0400 Subject: [PATCH 0111/1048] Tests: Teach CTest.Update* tests to check ctest_update return code --- Tests/CTestUpdateCommon.cmake | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Tests/CTestUpdateCommon.cmake b/Tests/CTestUpdateCommon.cmake index 0bb2d30d7..df1a713c5 100644 --- a/Tests/CTestUpdateCommon.cmake +++ b/Tests/CTestUpdateCommon.cmake @@ -182,6 +182,14 @@ endfunction() #----------------------------------------------------------------------------- # Function to write the dashboard test script. function(create_dashboard_script bin_dir custom_text) + if (NOT ctest_update_check) + set(ctest_update_check [[ +if(ret LESS 0) + message(FATAL_ERROR "ctest_update failed with ${ret}") +endif() +]]) + endif() + # Write the dashboard script. file(WRITE ${TOP}/${bin_dir}.cmake "# CTest Dashboard Script @@ -193,8 +201,8 @@ set(CTEST_BINARY_DIRECTORY \${CTEST_DASHBOARD_ROOT}/${bin_dir}) ${custom_text} # Start a dashboard and run the update step ctest_start(Experimental) -ctest_update(SOURCE \${CTEST_SOURCE_DIRECTORY} ${ctest_update_args}) -") +ctest_update(SOURCE \${CTEST_SOURCE_DIRECTORY} RETURN_VALUE ret ${ctest_update_args}) +${ctest_update_check}") endfunction() #----------------------------------------------------------------------------- From 493388ce48cb4188068c6f0379bb2afa60c0a41a Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 11 Jun 2015 09:00:01 -0400 Subject: [PATCH 0112/1048] ctest_update: Fix RETURN_VALUE on VCS tool failure (#15610) Make RETURN_VALUE report -1 if the update command failed as the documentation claims. Also avoid reporting a ctest script-level failure if the update command fails because we still correctly administered the update step. --- Source/CTest/cmCTestUpdateHandler.cxx | 4 ++-- Tests/CTestUpdateCVS.cmake.in | 19 +++++++++++++++++++ Tests/CTestUpdateCommon.cmake | 20 ++++++++++++++++++++ Tests/CTestUpdateGIT.cmake.in | 20 ++++++++++++++++++++ Tests/CTestUpdateHG.cmake.in | 19 +++++++++++++++++++ Tests/CTestUpdateSVN.cmake.in | 19 +++++++++++++++++++ 6 files changed, 99 insertions(+), 2 deletions(-) diff --git a/Source/CTest/cmCTestUpdateHandler.cxx b/Source/CTest/cmCTestUpdateHandler.cxx index 8494d28c3..963e50173 100644 --- a/Source/CTest/cmCTestUpdateHandler.cxx +++ b/Source/CTest/cmCTestUpdateHandler.cxx @@ -283,13 +283,13 @@ int cmCTestUpdateHandler::ProcessHandler() { xml.Content("Update command failed:\n"); xml.Content(vc->GetUpdateCommandLine()); - cmCTestLog(this->CTest, ERROR_MESSAGE, " Update command failed: " + cmCTestLog(this->CTest, HANDLER_OUTPUT, " Update command failed: " << vc->GetUpdateCommandLine() << "\n"); } xml.EndElement(); // UpdateReturnStatus xml.EndElement(); // Update xml.EndDocument(); - return numUpdated; + return updated? numUpdated : -1; } //---------------------------------------------------------------------- diff --git a/Tests/CTestUpdateCVS.cmake.in b/Tests/CTestUpdateCVS.cmake.in index 1699c3f1f..277b3a603 100644 --- a/Tests/CTestUpdateCVS.cmake.in +++ b/Tests/CTestUpdateCVS.cmake.in @@ -170,3 +170,22 @@ set(CTEST_CHECKOUT_COMMAND # Run the dashboard script with CTest. run_dashboard_script(dash-binary) + +#----------------------------------------------------------------------------- +# Test ctest_update(RETURN_VALUE) on failure +message("Running CTest Dashboard Script (fail to update)...") + +set(ctest_update_check [[ +if(NOT ret LESS 0) + message(FATAL_ERROR "ctest_update incorrectly succeeded with ${ret}") +endif() +]]) +create_dashboard_script(dash-binary-fail + "set(CTEST_CVS_COMMAND \"update-command-does-not-exist\") +") +unset(ctest_update_check) + +# Run the dashboard script with CTest. +set(FAIL_UPDATE 1) +run_dashboard_script(dash-binary-fail) +unset(FAIL_UPDATE) diff --git a/Tests/CTestUpdateCommon.cmake b/Tests/CTestUpdateCommon.cmake index df1a713c5..458e42743 100644 --- a/Tests/CTestUpdateCommon.cmake +++ b/Tests/CTestUpdateCommon.cmake @@ -258,6 +258,24 @@ function(check_no_update bin_dir) endif() endfunction() +#----------------------------------------------------------------------------- +# Function to find the Update.xml file and make sure +# it only has the UpdateReturnStatus failure message and no updates. +function(check_fail_update bin_dir) + set(PATTERN ${TOP}/${bin_dir}/Testing/*/Update.xml) + file(GLOB UPDATE_XML_FILE RELATIVE ${TOP} ${PATTERN}) + string(REGEX REPLACE "//Update.xml$" "/Update.xml" + UPDATE_XML_FILE "${UPDATE_XML_FILE}") + message(" found ${UPDATE_XML_FILE}") + file(STRINGS ${TOP}/${UPDATE_XML_FILE} UPDATE_XML_STATUS + REGEX "^\t[^<\n]+" + ) + if(UPDATE_XML_STATUS MATCHES "Update command failed") + message(" correctly found 'Update command failed'") + else() + message(FATAL_ERROR " missing 'Update command failed'") + endif() +endfunction() #----------------------------------------------------------------------------- # Function to run the dashboard through a script @@ -271,6 +289,8 @@ function(run_dashboard_script bin_dir) list(APPEND UPDATE_MAYBE Updated{subdir} Updated{CTestConfig.cmake}) if(NO_UPDATE) check_no_update(${bin_dir}) + elseif(FAIL_UPDATE) + check_fail_update(${bin_dir}) else() check_updates(${bin_dir} Updated{foo.txt} diff --git a/Tests/CTestUpdateGIT.cmake.in b/Tests/CTestUpdateGIT.cmake.in index 3734e2b86..6488a1f2f 100644 --- a/Tests/CTestUpdateGIT.cmake.in +++ b/Tests/CTestUpdateGIT.cmake.in @@ -358,3 +358,23 @@ run_dashboard_script(dash-binary-quiet) if("${OUTPUT}" MATCHES "Updating the repository") message(FATAL_ERROR "Found 'Updating the repository' in quiet output") endif() + +#----------------------------------------------------------------------------- +# Test ctest_update(RETURN_VALUE) on failure +message("Running CTest Dashboard Script (fail to update)...") + +set(ctest_update_check [[ + +if(NOT ret LESS 0) + message(FATAL_ERROR "ctest_update incorrectly succeeded with ${ret}") +endif() +]]) +create_dashboard_script(dash-binary-fail + "set(CTEST_GIT_COMMAND \"update-command-does-not-exist\") +") +unset(ctest_update_check) + +# Run the dashboard script with CTest. +set(FAIL_UPDATE 1) +run_dashboard_script(dash-binary-fail) +unset(FAIL_UPDATE) diff --git a/Tests/CTestUpdateHG.cmake.in b/Tests/CTestUpdateHG.cmake.in index c5440f954..c76bf9192 100644 --- a/Tests/CTestUpdateHG.cmake.in +++ b/Tests/CTestUpdateHG.cmake.in @@ -164,3 +164,22 @@ execute_process( # Run the dashboard script with CTest. run_dashboard_script(dash-binary) + +#----------------------------------------------------------------------------- +# Test ctest_update(RETURN_VALUE) on failure +message("Running CTest Dashboard Script (fail to update)...") + +set(ctest_update_check [[ +if(NOT ret LESS 0) + message(FATAL_ERROR "ctest_update incorrectly succeeded with ${ret}") +endif() +]]) +create_dashboard_script(dash-binary-fail + "set(CTEST_HG_COMMAND \"update-command-does-not-exist\") +") +unset(ctest_update_check) + +# Run the dashboard script with CTest. +set(FAIL_UPDATE 1) +run_dashboard_script(dash-binary-fail) +unset(FAIL_UPDATE) diff --git a/Tests/CTestUpdateSVN.cmake.in b/Tests/CTestUpdateSVN.cmake.in index b5728fd67..b757a441d 100644 --- a/Tests/CTestUpdateSVN.cmake.in +++ b/Tests/CTestUpdateSVN.cmake.in @@ -147,3 +147,22 @@ set(CTEST_CHECKOUT_COMMAND # Run the dashboard script with CTest. run_dashboard_script(dash-binary) + +#----------------------------------------------------------------------------- +# Test ctest_update(RETURN_VALUE) on failure +message("Running CTest Dashboard Script (fail to update)...") + +set(ctest_update_check [[ +if(NOT ret LESS 0) + message(FATAL_ERROR "ctest_update incorrectly succeeded with ${ret}") +endif() +]]) +create_dashboard_script(dash-binary-fail + "set(CTEST_SVN_COMMAND \"update-command-does-not-exist\") +") +unset(ctest_update_check) + +# Run the dashboard script with CTest. +set(FAIL_UPDATE 1) +run_dashboard_script(dash-binary-fail) +unset(FAIL_UPDATE) From 6863c0d52cecfc980ba512ddc891878071ff86b0 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 11 Jun 2015 11:32:09 -0400 Subject: [PATCH 0113/1048] Help: Add notes for topic 'FindBISON-DEFINES_FILE' --- Help/release/dev/FindBISON-DEFINES_FILE.rst | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 Help/release/dev/FindBISON-DEFINES_FILE.rst diff --git a/Help/release/dev/FindBISON-DEFINES_FILE.rst b/Help/release/dev/FindBISON-DEFINES_FILE.rst new file mode 100644 index 000000000..815d56090 --- /dev/null +++ b/Help/release/dev/FindBISON-DEFINES_FILE.rst @@ -0,0 +1,6 @@ +FindBISON-DEFINES_FILE +---------------------- + +* The :module:`FindBISON` module ``BISON_TARGET`` macro learned a + new ``DEFINES_FILE`` option to specify a custom output header + to be generated. From 7195ec92b2f34ef16ff1382fb00f527a3609f3bf Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 11 Jun 2015 15:40:24 -0400 Subject: [PATCH 0114/1048] Tests: Extend RunCMake.CommandLine to cover --build with no arg --- Tests/RunCMake/CommandLine/RunCMakeTest.cmake | 2 ++ Tests/RunCMake/CommandLine/build-no-dir-result.txt | 1 + Tests/RunCMake/CommandLine/build-no-dir-stderr.txt | 1 + 3 files changed, 4 insertions(+) create mode 100644 Tests/RunCMake/CommandLine/build-no-dir-result.txt create mode 100644 Tests/RunCMake/CommandLine/build-no-dir-stderr.txt diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index 69beed932..416b94e7d 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -22,6 +22,8 @@ run_cmake_command(G_bad-arg ${CMAKE_COMMAND} -G NoSuchGenerator) run_cmake_command(P_no-arg ${CMAKE_COMMAND} -P) run_cmake_command(P_no-file ${CMAKE_COMMAND} -P nosuchscriptfile.cmake) +run_cmake_command(build-no-dir + ${CMAKE_COMMAND} --build) run_cmake_command(build-no-cache ${CMAKE_COMMAND} --build ${RunCMake_SOURCE_DIR}) run_cmake_command(build-no-generator diff --git a/Tests/RunCMake/CommandLine/build-no-dir-result.txt b/Tests/RunCMake/CommandLine/build-no-dir-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/CommandLine/build-no-dir-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/build-no-dir-stderr.txt b/Tests/RunCMake/CommandLine/build-no-dir-stderr.txt new file mode 100644 index 000000000..8d518f609 --- /dev/null +++ b/Tests/RunCMake/CommandLine/build-no-dir-stderr.txt @@ -0,0 +1 @@ +^Usage: cmake --build \[options\] \[-- \[native-options\]\] From 90ad087ab9075cc9648df0623502da0caa44e971 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 11 Jun 2015 15:01:12 -0400 Subject: [PATCH 0115/1048] cmake: Fix --build for VS generators (#15609) The VS >= 10 generators need to parse the .sln file from the build directory to locate targets in subdirectories. This occurs after we change the working directory to the build tree. If a relative directory other than "." was given then we would change to it and also refer to the .sln file location with it. Fix this by converting the build tree to a full path always. This will also give a more informative error message when the directory does not exist. --- Source/cmakemain.cxx | 2 +- Tests/RunCMake/CommandLine/BuildDir.cmake | 1 + .../RunCMake/CommandLine/BuildDir/CMakeLists.txt | 5 +++++ Tests/RunCMake/CommandLine/RunCMakeTest.cmake | 15 +++++++++++++++ .../RunCMake/CommandLine/build-bad-dir-result.txt | 1 + .../RunCMake/CommandLine/build-bad-dir-stderr.txt | 2 ++ 6 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 Tests/RunCMake/CommandLine/BuildDir.cmake create mode 100644 Tests/RunCMake/CommandLine/BuildDir/CMakeLists.txt create mode 100644 Tests/RunCMake/CommandLine/build-bad-dir-result.txt create mode 100644 Tests/RunCMake/CommandLine/build-bad-dir-stderr.txt diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index cc3073251..c94ffec06 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -420,7 +420,7 @@ static int do_build(int ac, char const* const* av) switch (doing) { case DoingDir: - dir = av[i]; + dir = cmSystemTools::CollapseFullPath(av[i]); doing = DoingNone; break; case DoingTarget: diff --git a/Tests/RunCMake/CommandLine/BuildDir.cmake b/Tests/RunCMake/CommandLine/BuildDir.cmake new file mode 100644 index 000000000..30030a783 --- /dev/null +++ b/Tests/RunCMake/CommandLine/BuildDir.cmake @@ -0,0 +1 @@ +add_subdirectory(BuildDir) diff --git a/Tests/RunCMake/CommandLine/BuildDir/CMakeLists.txt b/Tests/RunCMake/CommandLine/BuildDir/CMakeLists.txt new file mode 100644 index 000000000..20df108ef --- /dev/null +++ b/Tests/RunCMake/CommandLine/BuildDir/CMakeLists.txt @@ -0,0 +1,5 @@ +add_custom_command( + OUTPUT output.txt + COMMAND ${CMAKE_COMMAND} -E echo CustomCommand > output.txt + ) +add_custom_target(CustomTarget ALL DEPENDS output.txt) diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index 416b94e7d..84d4cc904 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -28,9 +28,24 @@ run_cmake_command(build-no-cache ${CMAKE_COMMAND} --build ${RunCMake_SOURCE_DIR}) run_cmake_command(build-no-generator ${CMAKE_COMMAND} --build ${RunCMake_SOURCE_DIR}/cache-no-generator) +run_cmake_command(build-bad-dir + ${CMAKE_COMMAND} --build dir-does-not-exist) run_cmake_command(build-bad-generator ${CMAKE_COMMAND} --build ${RunCMake_SOURCE_DIR}/cache-bad-generator) +function(run_BuildDir) + # Use a single build tree for a few tests without cleaning. + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/BuildDir-build) + set(RunCMake_TEST_NO_CLEAN 1) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + + run_cmake(BuildDir) + run_cmake_command(BuildDir--build ${CMAKE_COMMAND} -E chdir .. + ${CMAKE_COMMAND} --build BuildDir-build --target CustomTarget) +endfunction() +run_BuildDir() + if(RunCMake_GENERATOR STREQUAL "Ninja") # Use a single build tree for a few tests without cleaning. set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Build-build) diff --git a/Tests/RunCMake/CommandLine/build-bad-dir-result.txt b/Tests/RunCMake/CommandLine/build-bad-dir-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/CommandLine/build-bad-dir-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/build-bad-dir-stderr.txt b/Tests/RunCMake/CommandLine/build-bad-dir-stderr.txt new file mode 100644 index 000000000..d3f3d9ce0 --- /dev/null +++ b/Tests/RunCMake/CommandLine/build-bad-dir-stderr.txt @@ -0,0 +1,2 @@ +^Error: [^ +]+/Tests/RunCMake/CommandLine/build-bad-dir-build/dir-does-not-exist is not a directory$ From 03e22481886c6ea97440f54ef84df84969e5969f Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Fri, 12 Jun 2015 00:01:04 -0400 Subject: [PATCH 0116/1048] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 13420da6a..ae1665666 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 3) -set(CMake_VERSION_PATCH 20150611) +set(CMake_VERSION_PATCH 20150612) #set(CMake_VERSION_RC 1) From 98133d3d4db5fe4cf5dbb0cd16235e19b753b55e Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sat, 13 Jun 2015 00:01:05 -0400 Subject: [PATCH 0117/1048] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index ae1665666..65b5f1fce 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 3) -set(CMake_VERSION_PATCH 20150612) +set(CMake_VERSION_PATCH 20150613) #set(CMake_VERSION_RC 1) From bc1211fa7d5c8262b075e010667aed41f5205a75 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 13 Jun 2015 08:38:19 +0200 Subject: [PATCH 0118/1048] cmLocalUnixMakefileGenerator3: Remove unused variable. --- Source/cmLocalUnixMakefileGenerator3.cxx | 1 - 1 file changed, 1 deletion(-) diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index f1fd806f9..5c9768aca 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -1840,7 +1840,6 @@ void cmLocalUnixMakefileGenerator3 std::vector commands; // Write the all rule. - std::string dir; std::string recursiveTarget = this->Makefile->GetCurrentBinaryDirectory(); recursiveTarget += "/all"; From 0efe4944e1ae18b9204209b3ddf5811905e22357 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 13 Jun 2015 08:38:27 +0200 Subject: [PATCH 0119/1048] cmGlobalGenerator: Add ComputeHomeRelativeOutputPath method. Fix generation of tgt/fast build targets. Commit 363caa2f (cmLocalGenerator: De-virtualize Configure()., 2015-05-30) moved the computation of HomeRelativeOutputPath from Configure-time to Generate-time, because it is only used at Generate-time. However, that commit caused the member for one local generator to be computed immediately before generating with that local generator, whereas previously the members of all local generators were computed before generating any of them. The HomeRelativeOutputPath is used by the GetRelativeTargetDirectory method, which is called by the cmGlobalUnixMakefileGenerator3::WriteConvenienceRules method. That method is called by the cmLocalUnixMakefileGenerator3::WriteLocalMakefile method when generating for the top-most (ie, the first) local generator. At that point, the HomeRelativeOutputPath is not yet computed. Fix that by computing the member just before generating anything. This will eventually be done in the cmLocalUnixMakefileGenerator3 constructor instead, but further refactoring is needed to make that possible. --- Source/cmGlobalGenerator.cxx | 5 ++++ Source/cmLocalGenerator.h | 2 ++ Source/cmLocalUnixMakefileGenerator3.cxx | 29 +++++++++++++----------- Source/cmLocalUnixMakefileGenerator3.h | 2 ++ 4 files changed, 25 insertions(+), 13 deletions(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 9b02cbb06..a46211395 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1273,6 +1273,11 @@ void cmGlobalGenerator::Generate() // it builds by default. this->FillLocalGeneratorToTargetMap(); + for (i = 0; i < this->LocalGenerators.size(); ++i) + { + this->LocalGenerators[i]->ComputeHomeRelativeOutputPath(); + } + // Generate project files for (i = 0; i < this->LocalGenerators.size(); ++i) { diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 42df2b846..6a8c5aa5f 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -47,6 +47,8 @@ public: */ virtual void Generate() {} + virtual void ComputeHomeRelativeOutputPath() {} + /** * Calls TraceVSDependencies() on all targets of this generator. */ diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 5c9768aca..e292ba788 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -100,19 +100,6 @@ cmLocalUnixMakefileGenerator3::~cmLocalUnixMakefileGenerator3() //---------------------------------------------------------------------------- void cmLocalUnixMakefileGenerator3::Generate() { - // Compute the path to use when referencing the current output - // directory from the top output directory. - this->HomeRelativeOutputPath = - this->Convert(this->Makefile->GetCurrentBinaryDirectory(), HOME_OUTPUT); - if(this->HomeRelativeOutputPath == ".") - { - this->HomeRelativeOutputPath = ""; - } - if(!this->HomeRelativeOutputPath.empty()) - { - this->HomeRelativeOutputPath += "/"; - } - // Store the configuration name that will be generated. if(const char* config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE")) { @@ -164,6 +151,22 @@ void cmLocalUnixMakefileGenerator3::Generate() this->WriteDirectoryInformationFile(); } +void cmLocalUnixMakefileGenerator3::ComputeHomeRelativeOutputPath() +{ + // Compute the path to use when referencing the current output + // directory from the top output directory. + this->HomeRelativeOutputPath = + this->Convert(this->Makefile->GetCurrentBinaryDirectory(), HOME_OUTPUT); + if(this->HomeRelativeOutputPath == ".") + { + this->HomeRelativeOutputPath = ""; + } + if(!this->HomeRelativeOutputPath.empty()) + { + this->HomeRelativeOutputPath += "/"; + } +} + //---------------------------------------------------------------------------- void cmLocalUnixMakefileGenerator3::ComputeObjectFilenames( std::map& mapping, diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index dcb301629..4e4d146a9 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -39,6 +39,8 @@ public: cmState::Snapshot snapshot); virtual ~cmLocalUnixMakefileGenerator3(); + virtual void ComputeHomeRelativeOutputPath(); + /** * Generate the makefile for this directory. */ From 081f6d917253046158ec43916073023d7fa181b4 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sun, 14 Jun 2015 00:01:04 -0400 Subject: [PATCH 0120/1048] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 65b5f1fce..2376de035 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 3) -set(CMake_VERSION_PATCH 20150613) +set(CMake_VERSION_PATCH 20150614) #set(CMake_VERSION_RC 1) From 9cbb9ed4c946b957df1a99910d5b60cdb269bb89 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Mon, 15 Jun 2015 00:01:03 -0400 Subject: [PATCH 0121/1048] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 2376de035..0f15ab156 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 3) -set(CMake_VERSION_PATCH 20150614) +set(CMake_VERSION_PATCH 20150615) #set(CMake_VERSION_RC 1) From 698f75971bee336133d21260db069bb139bd3d76 Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Thu, 4 Jun 2015 15:56:56 -0400 Subject: [PATCH 0122/1048] Add options to launch the compiler through tools like ccache or distcc Create a _COMPILER_LAUNCHER target property (initialized by a CMAKE__COMPILER_LAUNCHER variable) to specify a compiler launcher tool. This will supersede the CMAKE__COMPILER_ARG1 approach to using such tools. The old approach set CMAKE__COMPILER to the launcher tool while the new approach leaves this variable set to the actual compiler. Implement this property for Makefile and Ninja generators. It cannot be implemented for VS or Xcode generators as the IDE build tools offer no such hooks. --- Help/manual/cmake-properties.7.rst | 1 + Help/manual/cmake-variables.7.rst | 1 + Help/prop_tgt/LANG_COMPILER_LAUNCHER.rst | 13 +++++++++++ Help/release/dev/compiler-launcher.rst | 8 +++++++ .../variable/CMAKE_LANG_COMPILER_LAUNCHER.rst | 6 +++++ Source/cmMakefileTargetGenerator.cxx | 19 +++++++++++++++ Source/cmNinjaTargetGenerator.cxx | 20 ++++++++++++++++ Source/cmTarget.cxx | 2 ++ Tests/RunCMake/CMakeLists.txt | 1 + .../CompilerLauncher/C-Build-stdout.txt | 1 + .../C-launch-Build-stdout.txt | 1 + .../RunCMake/CompilerLauncher/C-launch.cmake | 3 +++ Tests/RunCMake/CompilerLauncher/C.cmake | 4 ++++ .../RunCMake/CompilerLauncher/CMakeLists.txt | 3 +++ .../CompilerLauncher/CXX-Build-stdout.txt | 1 + .../CXX-launch-Build-stdout.txt | 1 + .../CompilerLauncher/CXX-launch.cmake | 3 +++ Tests/RunCMake/CompilerLauncher/CXX.cmake | 4 ++++ .../CompilerLauncher/RunCMakeTest.cmake | 23 +++++++++++++++++++ Tests/RunCMake/CompilerLauncher/main.c | 3 +++ Tests/RunCMake/CompilerLauncher/main.cxx | 1 + 21 files changed, 119 insertions(+) create mode 100644 Help/prop_tgt/LANG_COMPILER_LAUNCHER.rst create mode 100644 Help/release/dev/compiler-launcher.rst create mode 100644 Help/variable/CMAKE_LANG_COMPILER_LAUNCHER.rst create mode 100644 Tests/RunCMake/CompilerLauncher/C-Build-stdout.txt create mode 100644 Tests/RunCMake/CompilerLauncher/C-launch-Build-stdout.txt create mode 100644 Tests/RunCMake/CompilerLauncher/C-launch.cmake create mode 100644 Tests/RunCMake/CompilerLauncher/C.cmake create mode 100644 Tests/RunCMake/CompilerLauncher/CMakeLists.txt create mode 100644 Tests/RunCMake/CompilerLauncher/CXX-Build-stdout.txt create mode 100644 Tests/RunCMake/CompilerLauncher/CXX-launch-Build-stdout.txt create mode 100644 Tests/RunCMake/CompilerLauncher/CXX-launch.cmake create mode 100644 Tests/RunCMake/CompilerLauncher/CXX.cmake create mode 100644 Tests/RunCMake/CompilerLauncher/RunCMakeTest.cmake create mode 100644 Tests/RunCMake/CompilerLauncher/main.c create mode 100644 Tests/RunCMake/CompilerLauncher/main.cxx diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index 615254e6a..9a60a103c 100644 --- a/Help/manual/cmake-properties.7.rst +++ b/Help/manual/cmake-properties.7.rst @@ -177,6 +177,7 @@ Properties on Targets /prop_tgt/JOB_POOL_COMPILE /prop_tgt/JOB_POOL_LINK /prop_tgt/LABELS + /prop_tgt/LANG_COMPILER_LAUNCHER /prop_tgt/LANG_INCLUDE_WHAT_YOU_USE /prop_tgt/LANG_VISIBILITY_PRESET /prop_tgt/LIBRARY_OUTPUT_DIRECTORY_CONFIG diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index bd02f8b8b..2b920069b 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -235,6 +235,7 @@ Variables that Control the Build /variable/CMAKE_INSTALL_NAME_DIR /variable/CMAKE_INSTALL_RPATH /variable/CMAKE_INSTALL_RPATH_USE_LINK_PATH + /variable/CMAKE_LANG_COMPILER_LAUNCHER /variable/CMAKE_LANG_INCLUDE_WHAT_YOU_USE /variable/CMAKE_LANG_VISIBILITY_PRESET /variable/CMAKE_LIBRARY_OUTPUT_DIRECTORY diff --git a/Help/prop_tgt/LANG_COMPILER_LAUNCHER.rst b/Help/prop_tgt/LANG_COMPILER_LAUNCHER.rst new file mode 100644 index 000000000..0fe0b31e5 --- /dev/null +++ b/Help/prop_tgt/LANG_COMPILER_LAUNCHER.rst @@ -0,0 +1,13 @@ +_COMPILER_LAUNCHER +------------------------ + +This property is implemented only when ```` is ``C`` or ``CXX``. + +Specify a :ref:`;-list ` containing a command line +for a compiler launching tool. The :ref:`Makefile Generators` and the +:generator:`Ninja` generator will run this tool and pass the compiler and +its arguments to the tool. Some example tools are distcc and ccache. + +This property is initialized by the value of +the :variable:`CMAKE__COMPILER_LAUNCHER` variable if it is set +when a target is created. diff --git a/Help/release/dev/compiler-launcher.rst b/Help/release/dev/compiler-launcher.rst new file mode 100644 index 000000000..3ba692da4 --- /dev/null +++ b/Help/release/dev/compiler-launcher.rst @@ -0,0 +1,8 @@ +compiler-launcher +----------------- + +* The :ref:`Makefile Generators` and the :generator:`Ninja` generator + learned to add compiler launcher tools like distcc and ccache along with the + compiler for ``C`` and ``CXX`` languages. See the + :variable:`CMAKE__COMPILER_LAUNCHER` variable and + :prop_tgt:`_COMPILER_LAUNCHER` target property for details. diff --git a/Help/variable/CMAKE_LANG_COMPILER_LAUNCHER.rst b/Help/variable/CMAKE_LANG_COMPILER_LAUNCHER.rst new file mode 100644 index 000000000..7961f609e --- /dev/null +++ b/Help/variable/CMAKE_LANG_COMPILER_LAUNCHER.rst @@ -0,0 +1,6 @@ +CMAKE__COMPILER_LAUNCHER +------------------------------ + +Default value for :prop_tgt:`_COMPILER_LAUNCHER` target property. +This variable is used to initialize the property on each target as it is +created. This is done only when ```` is ``C`` or ``CXX``. diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 7b88bc7b2..481f4fee6 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -775,6 +775,25 @@ cmMakefileTargetGenerator } } + // Maybe insert a compiler launcher like ccache or distcc + if (!compileCommands.empty() && (lang == "C" || lang == "CXX")) + { + std::string const clauncher_prop = lang + "_COMPILER_LAUNCHER"; + const char *clauncher = this->Target->GetProperty(clauncher_prop); + if (clauncher && *clauncher) + { + std::vector launcher_cmd; + cmSystemTools::ExpandListArgument(clauncher, launcher_cmd, true); + for (std::vector::iterator i = launcher_cmd.begin(), + e = launcher_cmd.end(); i != e; ++i) + { + *i = this->LocalGenerator->EscapeForShell(*i); + } + std::string const& run_launcher = cmJoin(launcher_cmd, " ") + " "; + compileCommands.front().insert(0, run_launcher); + } + } + // Expand placeholders in the commands. for(std::vector::iterator i = compileCommands.begin(); i != compileCommands.end(); ++i) diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 879d6b79e..bb75e09d2 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -22,6 +22,7 @@ #include "cmComputeLinkInformation.h" #include "cmSourceFile.h" #include "cmCustomCommandGenerator.h" +#include "cmAlgorithms.h" #include @@ -475,6 +476,25 @@ cmNinjaTargetGenerator } } + // Maybe insert a compiler launcher like ccache or distcc + if (!compileCmds.empty() && (lang == "C" || lang == "CXX")) + { + std::string const clauncher_prop = lang + "_COMPILER_LAUNCHER"; + const char *clauncher = this->Target->GetProperty(clauncher_prop); + if (clauncher && *clauncher) + { + std::vector launcher_cmd; + cmSystemTools::ExpandListArgument(clauncher, launcher_cmd, true); + for (std::vector::iterator i = launcher_cmd.begin(), + e = launcher_cmd.end(); i != e; ++i) + { + *i = this->LocalGenerator->EscapeForShell(*i); + } + std::string const& run_launcher = cmJoin(launcher_cmd, " ") + " "; + compileCmds.front().insert(0, run_launcher); + } + } + if (!compileCmds.empty()) { compileCmds.front().insert(0, cldeps); diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 70005b4fa..e20f0af8e 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -333,10 +333,12 @@ void cmTarget::SetMakefile(cmMakefile* mf) this->SetPropertyDefault("MACOSX_BUNDLE", 0); this->SetPropertyDefault("MACOSX_RPATH", 0); this->SetPropertyDefault("NO_SYSTEM_FROM_IMPORTED", 0); + this->SetPropertyDefault("C_COMPILER_LAUNCHER", 0); this->SetPropertyDefault("C_INCLUDE_WHAT_YOU_USE", 0); this->SetPropertyDefault("C_STANDARD", 0); this->SetPropertyDefault("C_STANDARD_REQUIRED", 0); this->SetPropertyDefault("C_EXTENSIONS", 0); + this->SetPropertyDefault("CXX_COMPILER_LAUNCHER", 0); this->SetPropertyDefault("CXX_INCLUDE_WHAT_YOU_USE", 0); this->SetPropertyDefault("CXX_STANDARD", 0); this->SetPropertyDefault("CXX_STANDARD_REQUIRED", 0); diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 592b5e406..2a4108fdf 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -232,4 +232,5 @@ endif() if("${CMAKE_GENERATOR}" MATCHES "Make|Ninja") add_executable(pseudo_iwyu pseudo_iwyu.c) add_RunCMake_test(IncludeWhatYouUse -DPSEUDO_IWYU=$) + add_RunCMake_test(CompilerLauncher) endif() diff --git a/Tests/RunCMake/CompilerLauncher/C-Build-stdout.txt b/Tests/RunCMake/CompilerLauncher/C-Build-stdout.txt new file mode 100644 index 000000000..3313e31f6 --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/C-Build-stdout.txt @@ -0,0 +1 @@ +.*-E env USED_LAUNCHER=1.* diff --git a/Tests/RunCMake/CompilerLauncher/C-launch-Build-stdout.txt b/Tests/RunCMake/CompilerLauncher/C-launch-Build-stdout.txt new file mode 100644 index 000000000..3313e31f6 --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/C-launch-Build-stdout.txt @@ -0,0 +1 @@ +.*-E env USED_LAUNCHER=1.* diff --git a/Tests/RunCMake/CompilerLauncher/C-launch.cmake b/Tests/RunCMake/CompilerLauncher/C-launch.cmake new file mode 100644 index 000000000..e66ca203e --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/C-launch.cmake @@ -0,0 +1,3 @@ +set(CTEST_USE_LAUNCHERS 1) +include(CTestUseLaunchers) +include(C.cmake) diff --git a/Tests/RunCMake/CompilerLauncher/C.cmake b/Tests/RunCMake/CompilerLauncher/C.cmake new file mode 100644 index 000000000..67bf7c4ac --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/C.cmake @@ -0,0 +1,4 @@ +enable_language(C) +set(CMAKE_C_COMPILER_LAUNCHER "${CMAKE_COMMAND};-E;env;USED_LAUNCHER=1") +set(CMAKE_VERBOSE_MAKEFILE TRUE) +add_executable(main main.c) diff --git a/Tests/RunCMake/CompilerLauncher/CMakeLists.txt b/Tests/RunCMake/CompilerLauncher/CMakeLists.txt new file mode 100644 index 000000000..18dfd2686 --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.2) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CompilerLauncher/CXX-Build-stdout.txt b/Tests/RunCMake/CompilerLauncher/CXX-Build-stdout.txt new file mode 100644 index 000000000..3313e31f6 --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/CXX-Build-stdout.txt @@ -0,0 +1 @@ +.*-E env USED_LAUNCHER=1.* diff --git a/Tests/RunCMake/CompilerLauncher/CXX-launch-Build-stdout.txt b/Tests/RunCMake/CompilerLauncher/CXX-launch-Build-stdout.txt new file mode 100644 index 000000000..3313e31f6 --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/CXX-launch-Build-stdout.txt @@ -0,0 +1 @@ +.*-E env USED_LAUNCHER=1.* diff --git a/Tests/RunCMake/CompilerLauncher/CXX-launch.cmake b/Tests/RunCMake/CompilerLauncher/CXX-launch.cmake new file mode 100644 index 000000000..3002c9d68 --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/CXX-launch.cmake @@ -0,0 +1,3 @@ +set(CTEST_USE_LAUNCHERS 1) +include(CTestUseLaunchers) +include(CXX.cmake) diff --git a/Tests/RunCMake/CompilerLauncher/CXX.cmake b/Tests/RunCMake/CompilerLauncher/CXX.cmake new file mode 100644 index 000000000..cdd347804 --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/CXX.cmake @@ -0,0 +1,4 @@ +enable_language(CXX) +set(CMAKE_CXX_COMPILER_LAUNCHER "${CMAKE_COMMAND};-E;env;USED_LAUNCHER=1") +set(CMAKE_VERBOSE_MAKEFILE TRUE) +add_executable(main main.cxx) diff --git a/Tests/RunCMake/CompilerLauncher/RunCMakeTest.cmake b/Tests/RunCMake/CompilerLauncher/RunCMakeTest.cmake new file mode 100644 index 000000000..5884d5c4d --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/RunCMakeTest.cmake @@ -0,0 +1,23 @@ +include(RunCMake) + +function(run_compiler_launcher lang) + # Use a single build tree for tests without cleaning. + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${lang}-build) + set(RunCMake_TEST_NO_CLEAN 1) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + run_cmake(${lang}) + + set(RunCMake_TEST_OUTPUT_MERGE 1) + if("${RunCMake_GENERATOR}" STREQUAL "Ninja") + set(verbose_args -- -v) + endif() + run_cmake_command(${lang}-Build ${CMAKE_COMMAND} --build . ${verbose_args}) +endfunction() + +run_compiler_launcher(C) +run_compiler_launcher(CXX) +if (NOT RunCMake_GENERATOR STREQUAL "Watcom WMake") + run_compiler_launcher(C-launch) + run_compiler_launcher(CXX-launch) +endif() diff --git a/Tests/RunCMake/CompilerLauncher/main.c b/Tests/RunCMake/CompilerLauncher/main.c new file mode 100644 index 000000000..03b2213bb --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/main.c @@ -0,0 +1,3 @@ +int main(void) { + return 0; +} diff --git a/Tests/RunCMake/CompilerLauncher/main.cxx b/Tests/RunCMake/CompilerLauncher/main.cxx new file mode 100644 index 000000000..76e819701 --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/main.cxx @@ -0,0 +1 @@ +int main() { return 0; } From b405f01daaeaeda98d448e2f0d71ea685757a5bd Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Fri, 12 Jun 2015 14:16:09 -0400 Subject: [PATCH 0123/1048] FindCUDA: Resolve a host compiler symlink only if it is Apple cc -> clang Otherwise using a "cc -> ccache" or similar symlink as the compiler causes FindCUDA to select ccache as the host compiler. Update the logic added by commit v3.1.0-rc1~354^2 (FindCUDA: Fix OSX Clang & no C language enabled, 2014-06-12) to apply only in the specific case it is needed. --- Modules/FindCUDA.cmake | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake index e8e1fb13d..f4b078310 100644 --- a/Modules/FindCUDA.cmake +++ b/Modules/FindCUDA.cmake @@ -468,17 +468,31 @@ set(CUDA_NVCC_FLAGS "" CACHE STRING "Semi-colon delimit multiple arguments.") if(CMAKE_GENERATOR MATCHES "Visual Studio") set(CUDA_HOST_COMPILER "$(VCInstallDir)bin" CACHE FILEPATH "Host side compiler used by NVCC") else() - # Using cc which is symlink to clang may let NVCC think it is GCC and issue - # unhandled -dumpspecs option to clang. Also in case neither - # CMAKE_C_COMPILER is defined (project does not use C language) nor - # CUDA_HOST_COMPILER is specified manually we should skip -ccbin and let - # nvcc use its own default C compiler. - if(DEFINED CMAKE_C_COMPILER AND NOT DEFINED CUDA_HOST_COMPILER) - get_filename_component(c_compiler_realpath "${CMAKE_C_COMPILER}" REALPATH) + if(APPLE + AND "${CMAKE_C_COMPILER_ID}" MATCHES "Clang" + AND "${CMAKE_C_COMPILER}" MATCHES "/cc$") + # Using cc which is symlink to clang may let NVCC think it is GCC and issue + # unhandled -dumpspecs option to clang. Also in case neither + # CMAKE_C_COMPILER is defined (project does not use C language) nor + # CUDA_HOST_COMPILER is specified manually we should skip -ccbin and let + # nvcc use its own default C compiler. + # Only care about this on APPLE with clang to avoid + # following symlinks to things like ccache + if(DEFINED CMAKE_C_COMPILER AND NOT DEFINED CUDA_HOST_COMPILER) + get_filename_component(c_compiler_realpath "${CMAKE_C_COMPILER}" REALPATH) + # if the real path does not end up being clang then + # go back to using CMAKE_C_COMPILER + if(NOT "${c_compiler_realpath}" MATCHES "/clang$") + set(c_compiler_realpath "${CMAKE_C_COMPILER}") + endif() + else() + set(c_compiler_realpath "") + endif() + set(CUDA_HOST_COMPILER "${c_compiler_realpath}" CACHE FILEPATH "Host side compiler used by NVCC") else() - set(c_compiler_realpath "") + set(CUDA_HOST_COMPILER "${CMAKE_C_COMPILER}" + CACHE FILEPATH "Host side compiler used by NVCC") endif() - set(CUDA_HOST_COMPILER "${c_compiler_realpath}" CACHE FILEPATH "Host side compiler used by NVCC") endif() # Propagate the host flags to the host compiler via -Xcompiler From 83af11d4112443ed732cd240eb0bfdfd27048825 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 15 Jun 2015 09:56:52 -0400 Subject: [PATCH 0124/1048] Fix preprocessor checks WIN32 => _WIN32 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The latter is predefined by Windows toolchains and is more reliable. Reported-by: Michael Stürmer --- Source/cmExecProgramCommand.cxx | 6 +++--- Source/cmFileCommand.cxx | 6 +++--- Source/cmQtAutoGenerators.cxx | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Source/cmExecProgramCommand.cxx b/Source/cmExecProgramCommand.cxx index e021d0bb4..41785c2b0 100644 --- a/Source/cmExecProgramCommand.cxx +++ b/Source/cmExecProgramCommand.cxx @@ -156,7 +156,7 @@ bool cmExecProgramCommand::RunCommand(const char* command, verbose = false; } -#if defined(WIN32) && !defined(__CYGWIN__) +#if defined(_WIN32) && !defined(__CYGWIN__) // if the command does not start with a quote, then // try to find the program, and if the program can not be // found use system to run the command as it must be a built in @@ -219,7 +219,7 @@ bool cmExecProgramCommand::RunCommand(const char* command, return false; } -#if defined(WIN32) && !defined(__CYGWIN__) +#if defined(_WIN32) && !defined(__CYGWIN__) if(dir) { cmsysProcess_SetWorkingDirectory(cp, dir); @@ -305,7 +305,7 @@ bool cmExecProgramCommand::RunCommand(const char* command, } if(!msg.empty()) { -#if defined(WIN32) && !defined(__CYGWIN__) +#if defined(_WIN32) && !defined(__CYGWIN__) // Old Windows process execution printed this info. msg += "\n\nfor command: "; msg += command; diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 7440357c7..f740020b2 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -66,7 +66,7 @@ static mode_t mode_setuid = S_ISUID; static mode_t mode_setgid = S_ISGID; #endif -#if defined(WIN32) && defined(CMAKE_ENCODING_UTF8) +#if defined(_WIN32) && defined(CMAKE_ENCODING_UTF8) // libcurl doesn't support file:// urls for unicode filenames on Windows. // Convert string from UTF-8 to ACP if this is a file:// URL. static std::string fix_file_url_windows(const std::string& url) @@ -3156,7 +3156,7 @@ cmFileCommand::HandleDownloadCommand(std::vector const& args) return false; } -#if defined(WIN32) && defined(CMAKE_ENCODING_UTF8) +#if defined(_WIN32) && defined(CMAKE_ENCODING_UTF8) url = fix_file_url_windows(url); #endif @@ -3411,7 +3411,7 @@ cmFileCommand::HandleUploadCommand(std::vector const& args) unsigned long file_size = cmsys::SystemTools::FileLength(filename); -#if defined(WIN32) && defined(CMAKE_ENCODING_UTF8) +#if defined(_WIN32) && defined(CMAKE_ENCODING_UTF8) url = fix_file_url_windows(url); #endif diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index ef32c75f7..f472ed8ee 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -609,7 +609,7 @@ void cmQtAutoGenerators::SetupAutoGenerateTarget(cmTarget const* target) // Ensure we have write permission in case .in was read-only. mode_t perm = 0; -#if defined(WIN32) && !defined(__CYGWIN__) +#if defined(_WIN32) && !defined(__CYGWIN__) mode_t mode_write = S_IWRITE; #else mode_t mode_write = S_IWUSR; From 6d1cef1aed6d86c0651aecb9cd0fd384db6de90c Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 15 Jun 2015 12:37:44 -0400 Subject: [PATCH 0125/1048] Utilities/Release: Update to openssl-1.0.2c Update the prebuilt binary build configurations for machines where we build our own OpenSSL library to use a newer version. --- Utilities/Release/linux64_release.cmake | 6 +++--- Utilities/Release/magrathea_release.cmake | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Utilities/Release/linux64_release.cmake b/Utilities/Release/linux64_release.cmake index 513f42f3d..265e0d7f7 100644 --- a/Utilities/Release/linux64_release.cmake +++ b/Utilities/Release/linux64_release.cmake @@ -11,9 +11,9 @@ CURSES_LIBRARY:FILEPATH=/home/kitware/ncurses-5.9/lib/libncurses.a CURSES_INCLUDE_PATH:PATH=/home/kitware/ncurses-5.9/include FORM_LIBRARY:FILEPATH=/home/kitware/ncurses-5.9/lib/libform.a CMAKE_USE_OPENSSL:BOOL=ON -OPENSSL_CRYPTO_LIBRARY:FILEPATH=/home/kitware/openssl-1.0.1j/lib/libcrypto.a -OPENSSL_INCLUDE_DIR:PATH=/home/kitware/openssl-1.0.1j/include -OPENSSL_SSL_LIBRARY:FILEPATH=/home/kitware/openssl-1.0.1j/lib/libssl.a +OPENSSL_CRYPTO_LIBRARY:FILEPATH=/home/kitware/openssl-1.0.2c/lib/libcrypto.a +OPENSSL_INCLUDE_DIR:PATH=/home/kitware/openssl-1.0.2c/include +OPENSSL_SSL_LIBRARY:FILEPATH=/home/kitware/openssl-1.0.2c/lib/libssl.a CPACK_SYSTEM_NAME:STRING=Linux-x86_64 BUILD_QtDialog:BOOL:=TRUE CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL:BOOL=TRUE diff --git a/Utilities/Release/magrathea_release.cmake b/Utilities/Release/magrathea_release.cmake index 1bf75dd0a..79fa319e3 100644 --- a/Utilities/Release/magrathea_release.cmake +++ b/Utilities/Release/magrathea_release.cmake @@ -11,9 +11,9 @@ CURSES_LIBRARY:FILEPATH=/usr/i686-gcc-332s/lib/libncurses.a CURSES_INCLUDE_PATH:PATH=/usr/i686-gcc-332s/include/ncurses FORM_LIBRARY:FILEPATH=/usr/i686-gcc-332s/lib/libform.a CMAKE_USE_OPENSSL:BOOL=ON -OPENSSL_CRYPTO_LIBRARY:FILEPATH=/home/kitware/openssl-1.0.1g-install/lib/libcrypto.a -OPENSSL_INCLUDE_DIR:PATH=/home/kitware/openssl-1.0.1g-install/include -OPENSSL_SSL_LIBRARY:FILEPATH=/home/kitware/openssl-1.0.1g-install/lib/libssl.a +OPENSSL_CRYPTO_LIBRARY:FILEPATH=/home/kitware/openssl-1.0.2c/lib/libcrypto.a +OPENSSL_INCLUDE_DIR:PATH=/home/kitware/openssl-1.0.2c/include +OPENSSL_SSL_LIBRARY:FILEPATH=/home/kitware/openssl-1.0.2c/lib/libssl.a CPACK_SYSTEM_NAME:STRING=Linux-i386 BUILD_QtDialog:BOOL:=TRUE CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL:BOOL=TRUE From e726fc025a3543c0be8a4eb217b0a80f9c16051c Mon Sep 17 00:00:00 2001 From: Domen Vrankar Date: Fri, 5 Jun 2015 21:03:26 +0200 Subject: [PATCH 0126/1048] Tests: Add RunCMake tests for CPack{Deb,RPM} Add script structure for easier addition of new CPack related tests. --- Tests/RunCMake/CMakeLists.txt | 35 +++++++ Tests/RunCMake/CPack/CMakeLists.txt | 12 +++ Tests/RunCMake/CPack/CPackTestHelpers.cmake | 76 ++++++++++++++ Tests/RunCMake/CPack/DEB/Helpers.cmake | 10 ++ .../CPack/DEB/MINIMAL-ExpectedFiles.cmake | 5 + .../CPack/DEB/MINIMAL-specifics.cmake | 1 + .../RunCMake/CPack/DEB/Prerequirements.cmake | 8 ++ Tests/RunCMake/CPack/MINIMAL.cmake | 3 + Tests/RunCMake/CPack/PreTestError.cmake | 7 ++ Tests/RunCMake/CPack/README.txt | 99 +++++++++++++++++++ Tests/RunCMake/CPack/RPM/Helpers.cmake | 10 ++ .../CPack/RPM/MINIMAL-ExpectedFiles.cmake | 5 + Tests/RunCMake/CPack/RPM/MINIMAL-stderr.txt | 1 + .../RunCMake/CPack/RPM/Prerequirements.cmake | 16 +++ Tests/RunCMake/CPack/RunCMakeTest.cmake | 7 ++ Tests/RunCMake/CPack/VerifyResult.cmake | 91 +++++++++++++++++ 16 files changed, 386 insertions(+) create mode 100644 Tests/RunCMake/CPack/CMakeLists.txt create mode 100644 Tests/RunCMake/CPack/CPackTestHelpers.cmake create mode 100644 Tests/RunCMake/CPack/DEB/Helpers.cmake create mode 100644 Tests/RunCMake/CPack/DEB/MINIMAL-ExpectedFiles.cmake create mode 100644 Tests/RunCMake/CPack/DEB/MINIMAL-specifics.cmake create mode 100644 Tests/RunCMake/CPack/DEB/Prerequirements.cmake create mode 100644 Tests/RunCMake/CPack/MINIMAL.cmake create mode 100644 Tests/RunCMake/CPack/PreTestError.cmake create mode 100644 Tests/RunCMake/CPack/README.txt create mode 100644 Tests/RunCMake/CPack/RPM/Helpers.cmake create mode 100644 Tests/RunCMake/CPack/RPM/MINIMAL-ExpectedFiles.cmake create mode 100644 Tests/RunCMake/CPack/RPM/MINIMAL-stderr.txt create mode 100644 Tests/RunCMake/CPack/RPM/Prerequirements.cmake create mode 100644 Tests/RunCMake/CPack/RunCMakeTest.cmake create mode 100644 Tests/RunCMake/CPack/VerifyResult.cmake diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 592b5e406..f4abed2a7 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -26,6 +26,39 @@ macro(add_RunCMake_test test) ) endmacro() +function(add_RunCMake_test_group test types) + # create directory for common content + set(TEST_CONFIG_DIR "${CMAKE_CURRENT_BINARY_DIR}/${test}/conf") + file(REMOVE_RECURSE "${TEST_CONFIG_DIR}") + file(MAKE_DIRECTORY "${TEST_CONFIG_DIR}") + + foreach(type IN LISTS types) + # generate prerequirements config file in cmake as ctest doesn't have as + # much system information so it is easier to set programs and environment + # values here + unset(${test}_${type}_FOUND_PREREQUIREMENTS) + include("${CMAKE_CURRENT_SOURCE_DIR}/${test}/${type}/Prerequirements.cmake") + get_test_prerequirements("${test}_${type}_FOUND_PREREQUIREMENTS" + "${TEST_CONFIG_DIR}/${type}_config.cmake") + + # only add the test if prerequirements are met + if(${test}_${type}_FOUND_PREREQUIREMENTS) + add_test(NAME RunCMake.${test}_${type} COMMAND ${CMAKE_CMAKE_COMMAND} + -DTEST_TYPE=${type} + -DCMAKE_MODULE_PATH=${CMAKE_CURRENT_SOURCE_DIR} + -DRunCMake_GENERATOR=${CMAKE_GENERATOR} + -DRunCMake_GENERATOR_PLATFORM=${CMAKE_GENERATOR_PLATFORM} + -DRunCMake_GENERATOR_TOOLSET=${CMAKE_GENERATOR_TOOLSET} + -DRunCMake_MAKE_PROGRAM=${CMake_TEST_EXPLICIT_MAKE_PROGRAM} + -DRunCMake_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}/${test} + -DRunCMake_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR}/${type}/${test} + -Dconfig_file=${TEST_CONFIG_DIR}/${type}_config.cmake + -P "${CMAKE_CURRENT_SOURCE_DIR}/${test}/RunCMakeTest.cmake" + ) + endif() + endforeach() +endfunction() + if(XCODE_VERSION AND "${XCODE_VERSION}" VERSION_LESS 3) set(GeneratorToolset_ARGS -DXCODE_BELOW_3=1) endif() @@ -233,3 +266,5 @@ if("${CMAKE_GENERATOR}" MATCHES "Make|Ninja") add_executable(pseudo_iwyu pseudo_iwyu.c) add_RunCMake_test(IncludeWhatYouUse -DPSEUDO_IWYU=$) endif() + +add_RunCMake_test_group(CPack "DEB;RPM") diff --git a/Tests/RunCMake/CPack/CMakeLists.txt b/Tests/RunCMake/CPack/CMakeLists.txt new file mode 100644 index 000000000..7905706b5 --- /dev/null +++ b/Tests/RunCMake/CPack/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 3.1 FATAL_ERROR) + +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) + +# include test generator specifics +if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${GENERATOR_TYPE}/${RunCMake_TEST}-specifics.cmake") + include("${GENERATOR_TYPE}/${RunCMake_TEST}-specifics.cmake") +endif() + +set(CPACK_GENERATOR "${GENERATOR_TYPE}") +include(CPack) diff --git a/Tests/RunCMake/CPack/CPackTestHelpers.cmake b/Tests/RunCMake/CPack/CPackTestHelpers.cmake new file mode 100644 index 000000000..7ea2a24b3 --- /dev/null +++ b/Tests/RunCMake/CPack/CPackTestHelpers.cmake @@ -0,0 +1,76 @@ +cmake_policy(SET CMP0057 NEW) + +function(run_cpack_test TEST_NAME types build) + if(TEST_TYPE IN_LIST types) + set(RunCMake_TEST_NO_CLEAN TRUE) + set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/${TEST_NAME}-build") + + # TODO this should be executed only once per ctest run (not per generator) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + + # execute cmake + execute_process( + COMMAND "${CMAKE_COMMAND}" -DRunCMake_TEST=${TEST_NAME} + -DGENERATOR_TYPE=${TEST_TYPE} "${RunCMake_SOURCE_DIR}" + WORKING_DIRECTORY "${RunCMake_TEST_BINARY_DIR}" + RESULT_VARIABLE res + OUTPUT_FILE "${RunCMake_TEST_BINARY_DIR}/test_output.txt" + ERROR_FILE "${RunCMake_TEST_BINARY_DIR}/test_error.txt" + ) + + if(res) + run_cmake_command( + ${TEST_TYPE}/${TEST_NAME} + "${CMAKE_COMMAND}" + -DRunCMake_TEST_STEP=configure + -Dreturn_code=${res} + "-Dbin_dir=${RunCMake_TEST_BINARY_DIR}" + -P "${RunCMake_SOURCE_DIR}/PreTestError.cmake" + ) + return() + endif() + + # execute optional build step + if(build) + execute_process( + COMMAND "${CMAKE_COMMAND}" --build "${RunCMake_TEST_BINARY_DIR}" + RESULT_VARIABLE res + OUTPUT_FILE "${RunCMake_TEST_BINARY_DIR}/test_output.txt" + ERROR_FILE "${RunCMake_TEST_BINARY_DIR}/test_error.txt" + ) + endif() + + if(res) + run_cmake_command( + ${TEST_TYPE}/${TEST_NAME} + "${CMAKE_COMMAND}" + -DRunCMake_TEST_STEP=build + -Dreturn_code=${res} + "-Dbin_dir=${RunCMake_TEST_BINARY_DIR}" + -P "${RunCMake_SOURCE_DIR}/PreTestError.cmake" + ) + return() + endif() + + # execute cpack + execute_process( + COMMAND "${CMAKE_CPACK_COMMAND}" + WORKING_DIRECTORY "${RunCMake_TEST_BINARY_DIR}" + OUTPUT_FILE "${RunCMake_TEST_BINARY_DIR}/test_output.txt" + ERROR_FILE "${RunCMake_TEST_BINARY_DIR}/test_error.txt" + ) + + # verify result + run_cmake_command( + ${TEST_TYPE}/${TEST_NAME} + "${CMAKE_COMMAND}" + -DRunCMake_TEST=${TEST_NAME} + -DGENERATOR_TYPE=${TEST_TYPE} + "-Dsrc_dir=${RunCMake_SOURCE_DIR}" + "-Dbin_dir=${RunCMake_TEST_BINARY_DIR}" + "-Dconfig_file=${config_file}" + -P "${RunCMake_SOURCE_DIR}/VerifyResult.cmake" + ) + endif() +endfunction() diff --git a/Tests/RunCMake/CPack/DEB/Helpers.cmake b/Tests/RunCMake/CPack/DEB/Helpers.cmake new file mode 100644 index 000000000..4ed3fbdae --- /dev/null +++ b/Tests/RunCMake/CPack/DEB/Helpers.cmake @@ -0,0 +1,10 @@ +set(ALL_FILES_GLOB "*.deb") + +function(getPackageContent FILE RESULT_VAR) + execute_process(COMMAND ${DPKG_EXECUTABLE} -c ${FILE} + OUTPUT_VARIABLE package_content_ + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + + set(${RESULT_VAR} "${package_content_}" PARENT_SCOPE) +endfunction() diff --git a/Tests/RunCMake/CPack/DEB/MINIMAL-ExpectedFiles.cmake b/Tests/RunCMake/CPack/DEB/MINIMAL-ExpectedFiles.cmake new file mode 100644 index 000000000..9e4aa7c1d --- /dev/null +++ b/Tests/RunCMake/CPack/DEB/MINIMAL-ExpectedFiles.cmake @@ -0,0 +1,5 @@ +set(whitespaces_ "[\t\n\r ]*") + +set(EXPECTED_FILES_COUNT "1") +set(EXPECTED_FILE_1 "minimal*.deb") +set(EXPECTED_FILE_CONTENT_1 "^.*/usr/${whitespaces_}.*/usr/foo/${whitespaces_}.*/usr/foo/CMakeLists.txt$") diff --git a/Tests/RunCMake/CPack/DEB/MINIMAL-specifics.cmake b/Tests/RunCMake/CPack/DEB/MINIMAL-specifics.cmake new file mode 100644 index 000000000..8821ab9be --- /dev/null +++ b/Tests/RunCMake/CPack/DEB/MINIMAL-specifics.cmake @@ -0,0 +1 @@ +set(CPACK_PACKAGE_CONTACT "someone") diff --git a/Tests/RunCMake/CPack/DEB/Prerequirements.cmake b/Tests/RunCMake/CPack/DEB/Prerequirements.cmake new file mode 100644 index 000000000..197b99d5d --- /dev/null +++ b/Tests/RunCMake/CPack/DEB/Prerequirements.cmake @@ -0,0 +1,8 @@ +function(get_test_prerequirements found_var config_file) + find_program(DPKG_EXECUTABLE dpkg) + + if(DPKG_EXECUTABLE) + file(WRITE "${config_file}" "set(DPKG_EXECUTABLE \"${DPKG_EXECUTABLE}\")") + set(${found_var} true PARENT_SCOPE) + endif() +endfunction() diff --git a/Tests/RunCMake/CPack/MINIMAL.cmake b/Tests/RunCMake/CPack/MINIMAL.cmake new file mode 100644 index 000000000..f29ad2a98 --- /dev/null +++ b/Tests/RunCMake/CPack/MINIMAL.cmake @@ -0,0 +1,3 @@ +install(FILES CMakeLists.txt DESTINATION foo COMPONENT test) + +set(CPACK_PACKAGE_NAME "minimal") diff --git a/Tests/RunCMake/CPack/PreTestError.cmake b/Tests/RunCMake/CPack/PreTestError.cmake new file mode 100644 index 000000000..f88f2e8dc --- /dev/null +++ b/Tests/RunCMake/CPack/PreTestError.cmake @@ -0,0 +1,7 @@ +file(READ "${bin_dir}/test_output.txt" output) +file(READ "${bin_dir}/test_error.txt" error) + +message(FATAL_ERROR "Error in pre-test phase '${RunCMake_TEST_STEP}'!\n" + "Return code: '${return_code}'\n" + "Info output: '${output}'\n" + "Error output: '${error}'") diff --git a/Tests/RunCMake/CPack/README.txt b/Tests/RunCMake/CPack/README.txt new file mode 100644 index 000000000..365c73792 --- /dev/null +++ b/Tests/RunCMake/CPack/README.txt @@ -0,0 +1,99 @@ +RunCMake.CPack is a test module that is intended for testing of package +generators that can be validated from command line. + +------------- +Adding a test +------------- + +CPack test root directory: 'Tests/RunCMake/CPack'. + +All phases are executed separately for each generator that is bound to a test. +Tests for each generator are subtests of test 'RunCMake.CPack_'. + +Each test must also be added to 'RunCMakeTest.cmake' script located in CPack +test root directory. +Line that adds a test is: +run_cpack_test( "") + + may be one generator e.g. "RPM" or multiple e.g. "RPM;DEB" and +will be run for all listed generators. + +Test consists of +- CMake execution phase +- CPack execution phase +- verification of generated files + +CMake execution phase: +---------------------- + +To add a new CPack test we first create a .cmake script that contains +CMake commands that should be used as a preparation script for generation of +different types of packages. This script is placed into CPack test root +directory even if it will be used for only one of the generators. + +If test will be used for multiple generators but some of them require some +generator speciffic commands then those commands should be added to a separate +file that should be located in '/-specifics.cmake' +in CPack test root directory. + +CPack execution phase: +---------------------- + +Only exececutes CPack for content that was generated during CMake execution +phase. + +Verification of generated files: +-------------------------------- + +Verification of generated files consists of two phases +- mandatory verification phase +- optional verification phase + +Mandatory verification phase checks that expected files were generated and +contain expected files. +Mandatory verification phase also checks that no other unexpected package files +were generated (this is executed even if EXPECTED_FILES_COUNT contains 0 in +order to verify that no files were generated). +CMake script '/-ExpectedFiles.cmake' is required by +this step and must contain +- EXPECTED_FILES_COUNT variable that contains the number of expected files that + will be generated (0 or more) +- EXPECTED_FILE_ that contains globing expression + that uniquely defines expected file name (will be used to find expected file) + and should be present once for each expected file +- EXPECTED_FILE_CONTENT_ that contains regular + expression of files that should be present in generated file and should be + present once for each expected file + +Optional verification phase is generator specific and is optionaly executed. +This phase is executed if '/-VerifyResult.cmake' +script exists. +In case that the script doesn't exist VerifyResult.cmake script automatically +prints out standard output and standard error from CPack execution phase that +is compared with '/-stdout.txt' regular expression +and '/-stderr.txt' regular expresson respectively. + +---------------------- +Adding a new generator +---------------------- + +To add a new generator we must +- add new generator directory (e.g. RPM for RPM generator) to CPack test root + directory that contains 'Helpers.cmake' script. In this script a function + named 'getPackageContent' must exist. This function should list files that + are contained in a package. Function should accept two parameters + + FILE variable that will contain path to file for which the content should be + listed + + RESULT_VAR that will tell the function which variable in parent scope should + contain the result (list of files inside package file) +- add 'Prerequirements.cmake' script to generator directory. In this script a + function named 'get_test_prerequirements' must exist. This function should + set a variable in parent scope (name of the variable is the first parameter) + that tells if prerequirements for test execution are met (certain programs, + OS specifics, ...) and create a config file (name of the variable which + contains file name and path is provided with the second parameter) that + should contain 'set' commands for variables that will later be used in tests + (e.g. location of dpkg program for DEB packages) +- add tests the same way as described above +- add generator to 'add_RunCMake_test_group' function call that is located in + RunCMake CMakeLists.txt file diff --git a/Tests/RunCMake/CPack/RPM/Helpers.cmake b/Tests/RunCMake/CPack/RPM/Helpers.cmake new file mode 100644 index 000000000..98cdad845 --- /dev/null +++ b/Tests/RunCMake/CPack/RPM/Helpers.cmake @@ -0,0 +1,10 @@ +set(ALL_FILES_GLOB "*.rpm") + +function(getPackageContent FILE RESULT_VAR) + execute_process(COMMAND ${RPM_EXECUTABLE} -pql ${FILE} + OUTPUT_VARIABLE package_content_ + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + + set(${RESULT_VAR} "${package_content_}" PARENT_SCOPE) +endfunction() diff --git a/Tests/RunCMake/CPack/RPM/MINIMAL-ExpectedFiles.cmake b/Tests/RunCMake/CPack/RPM/MINIMAL-ExpectedFiles.cmake new file mode 100644 index 000000000..800b78ee0 --- /dev/null +++ b/Tests/RunCMake/CPack/RPM/MINIMAL-ExpectedFiles.cmake @@ -0,0 +1,5 @@ +set(whitespaces_ "[\t\n\r ]*") + +set(EXPECTED_FILES_COUNT "1") +set(EXPECTED_FILE_1 "minimal*.rpm") +set(EXPECTED_FILE_CONTENT_1 "^/usr/foo${whitespaces_}/usr/foo/CMakeLists.txt$") diff --git a/Tests/RunCMake/CPack/RPM/MINIMAL-stderr.txt b/Tests/RunCMake/CPack/RPM/MINIMAL-stderr.txt new file mode 100644 index 000000000..7c5fb461c --- /dev/null +++ b/Tests/RunCMake/CPack/RPM/MINIMAL-stderr.txt @@ -0,0 +1 @@ +^CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/MINIMAL-build/_CPack_Packages/.*/RPM/SPECS/minimal.spec$ diff --git a/Tests/RunCMake/CPack/RPM/Prerequirements.cmake b/Tests/RunCMake/CPack/RPM/Prerequirements.cmake new file mode 100644 index 000000000..3416205bc --- /dev/null +++ b/Tests/RunCMake/CPack/RPM/Prerequirements.cmake @@ -0,0 +1,16 @@ +function(get_test_prerequirements found_var config_file) + if(CMAKE_CURRENT_BINARY_DIR MATCHES " ") + # rpmbuild can't handle spaces in path + return() + endif() + + find_program(RPM_EXECUTABLE rpm) + find_program(RPMBUILD_EXECUTABLE rpmbuild) + + if(RPM_EXECUTABLE AND RPMBUILD_EXECUTABLE) + file(WRITE "${config_file}" "set(RPM_EXECUTABLE \"${RPM_EXECUTABLE}\")") + file(APPEND "${config_file}" + "\nset(RPMBUILD_EXECUTABLE \"${RPMBUILD_EXECUTABLE}\")") + set(${found_var} true PARENT_SCOPE) + endif() +endfunction() diff --git a/Tests/RunCMake/CPack/RunCMakeTest.cmake b/Tests/RunCMake/CPack/RunCMakeTest.cmake new file mode 100644 index 000000000..426734e53 --- /dev/null +++ b/Tests/RunCMake/CPack/RunCMakeTest.cmake @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.1 FATAL_ERROR) + +include(RunCMake) +include("${RunCMake_SOURCE_DIR}/CPackTestHelpers.cmake") + +# args: TEST_NAME "GENERATORS" RUN_CMAKE_BUILD_STEP +run_cpack_test(MINIMAL "RPM;DEB" false) diff --git a/Tests/RunCMake/CPack/VerifyResult.cmake b/Tests/RunCMake/CPack/VerifyResult.cmake new file mode 100644 index 000000000..809011b5b --- /dev/null +++ b/Tests/RunCMake/CPack/VerifyResult.cmake @@ -0,0 +1,91 @@ +cmake_minimum_required(VERSION 3.1 FATAL_ERROR) + +include("${config_file}") +include("${src_dir}/${GENERATOR_TYPE}/Helpers.cmake") + +file(READ "${bin_dir}/test_output.txt" output) +file(READ "${bin_dir}/test_error.txt" error) +file(READ "${config_file}" config_file_content) + +set(output_error_message + "\nCPack output: '${output}'\nCPack error: '${error}';\nconfig file: '${config_file_content}'") + +# check that expected generated files exist and contain expected content +include("${src_dir}/${GENERATOR_TYPE}/${RunCMake_TEST}-ExpectedFiles.cmake") + +if(NOT EXPECTED_FILES_COUNT EQUAL 0) + foreach(file_no_ RANGE 1 ${EXPECTED_FILES_COUNT}) + file(GLOB foundFile_ RELATIVE "${bin_dir}" "${EXPECTED_FILE_${file_no_}}") + set(foundFiles_ "${foundFiles_};${foundFile_}") + list(LENGTH foundFile_ foundFilesCount_) + + if(foundFilesCount_ EQUAL 1) + unset(PACKAGE_CONTENT) + getPackageContent("${bin_dir}/${foundFile_}" "PACKAGE_CONTENT") + + string(REGEX MATCH "${EXPECTED_FILE_CONTENT_${file_no_}}" + expected_content_list "${PACKAGE_CONTENT}") + + if(NOT expected_content_list) + message(FATAL_ERROR + "Unexpected file content for file No. '${file_no_}'!" + " Content: '${PACKAGE_CONTENT}'" + "${output_error_message}") + endif() + else() + message(FATAL_ERROR + "Found more than one file for file No. '${file_no_}'!" + " Found files count '${foundFilesCount_}'." + " Files: '${foundFile_}'" + "${output_error_message}") + endif() + endforeach() + + # check that there were no extra files generated + foreach(all_files_glob_ IN LISTS ALL_FILES_GLOB) + file(GLOB foundAll_ RELATIVE "${bin_dir}" "${all_files_glob_}") + set(allFoundFiles_ "${allFoundFiles_};${foundAll_}") + endforeach() + + list(LENGTH foundFiles_ foundFilesCount_) + list(LENGTH allFoundFiles_ allFoundFilesCount_) + + if(NOT foundFilesCount_ EQUAL allFoundFilesCount_) + message(FATAL_ERROR + "Found more files than expected! Found files: '${allFoundFiles_}'" + "${output_error_message}") + endif() + + # sanity check that we didn't accidentaly list wrong files with our regular + # expressions + foreach(expected_ IN LISTS allFoundFiles_) + list(FIND foundFiles_ "${expected_}" found_) + + if(found_ EQUAL -1) + message(FATAL_ERROR + "Expected files don't match found files! Found files:" + " '${allFoundFiles_}'" + "${output_error_message}") + endif() + endforeach() +else() + # there should be no generated files present + foreach(missing_file_glob_ IN LISTS ALL_FILES_GLOB) + file(GLOB checkMissingFiles_ RELATIVE "${bin_dir}" "${missing_file_glob_}") + + if(checkMissingFiles_) + message(FATAL_ERROR "Unexpected files found: '${checkMissingFiles_}'" + "${output_error_message}") + endif() + endforeach() +endif() + +# handle additional result verifications +if(EXISTS "${src_dir}/${GENERATOR_TYPE}/${RunCMake_TEST}-VerifyResult.cmake") + include("${src_dir}/${GENERATOR_TYPE}/${RunCMake_TEST}-VerifyResult.cmake") +else() + # by default only print out output and error so that they can be compared by + # regex + message(STATUS "${output}") + message("${error}") +endif() From 5f61ed991b3b6b9f61edc97a10b257d3343c7302 Mon Sep 17 00:00:00 2001 From: Domen Vrankar Date: Fri, 5 Jun 2015 21:12:08 +0200 Subject: [PATCH 0127/1048] Tests: Move RunCMake.CPackRPM case into RunCMake.CPack_RPM test Move PARTIALLY_RELOCATABLE_WARNING test to the new common CPack test script structure to have all tests in one place as well as additional benefit of having some more checks done during test execution. --- Tests/RunCMake/CMakeLists.txt | 4 ---- .../PARTIALLY_RELOCATABLE_WARNING.cmake} | 0 ...ALLY_RELOCATABLE_WARNING-ExpectedFiles.cmake | 5 +++++ .../PARTIALLY_RELOCATABLE_WARNING-stderr.txt} | 0 Tests/RunCMake/CPack/RunCMakeTest.cmake | 1 + Tests/RunCMake/CPackRPM/CMakeLists.txt | 7 ------- Tests/RunCMake/CPackRPM/RunCMakeTest.cmake | 17 ----------------- 7 files changed, 6 insertions(+), 28 deletions(-) rename Tests/RunCMake/{CPackRPM/CPackRPM_PARTIALLY_RELOCATABLE_WARNING.cmake => CPack/PARTIALLY_RELOCATABLE_WARNING.cmake} (100%) create mode 100644 Tests/RunCMake/CPack/RPM/PARTIALLY_RELOCATABLE_WARNING-ExpectedFiles.cmake rename Tests/RunCMake/{CPackRPM/CPackRPM_PARTIALLY_RELOCATABLE_WARNING-stderr.txt => CPack/RPM/PARTIALLY_RELOCATABLE_WARNING-stderr.txt} (100%) delete mode 100644 Tests/RunCMake/CPackRPM/CMakeLists.txt delete mode 100644 Tests/RunCMake/CPackRPM/RunCMakeTest.cmake diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index f4abed2a7..74bbf3814 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -239,10 +239,6 @@ add_RunCMake_test(IfacePaths_INCLUDE_DIRECTORIES TEST_DIR IfacePaths) set(IfacePaths_SOURCES_ARGS -DTEST_PROP=SOURCES) add_RunCMake_test(IfacePaths_SOURCES TEST_DIR IfacePaths) -if(RPMBUILD_EXECUTABLE) - add_RunCMake_test(CPackRPM) -endif() - add_RunCMake_test(COMPILE_LANGUAGE-genex) # Matlab module related tests diff --git a/Tests/RunCMake/CPackRPM/CPackRPM_PARTIALLY_RELOCATABLE_WARNING.cmake b/Tests/RunCMake/CPack/PARTIALLY_RELOCATABLE_WARNING.cmake similarity index 100% rename from Tests/RunCMake/CPackRPM/CPackRPM_PARTIALLY_RELOCATABLE_WARNING.cmake rename to Tests/RunCMake/CPack/PARTIALLY_RELOCATABLE_WARNING.cmake diff --git a/Tests/RunCMake/CPack/RPM/PARTIALLY_RELOCATABLE_WARNING-ExpectedFiles.cmake b/Tests/RunCMake/CPack/RPM/PARTIALLY_RELOCATABLE_WARNING-ExpectedFiles.cmake new file mode 100644 index 000000000..4e01f7b41 --- /dev/null +++ b/Tests/RunCMake/CPack/RPM/PARTIALLY_RELOCATABLE_WARNING-ExpectedFiles.cmake @@ -0,0 +1,5 @@ +set(whitespaces_ "[\t\n\r ]*") + +set(EXPECTED_FILES_COUNT "1") +set(EXPECTED_FILE_1 "PARTIALLY_RELOCATABLE_WARNING-0.1.1-*.rpm") +set(EXPECTED_FILE_CONTENT_1 "^/not_relocatable${whitespaces_}/not_relocatable/CMakeLists.txt${whitespaces_}/opt$") diff --git a/Tests/RunCMake/CPackRPM/CPackRPM_PARTIALLY_RELOCATABLE_WARNING-stderr.txt b/Tests/RunCMake/CPack/RPM/PARTIALLY_RELOCATABLE_WARNING-stderr.txt similarity index 100% rename from Tests/RunCMake/CPackRPM/CPackRPM_PARTIALLY_RELOCATABLE_WARNING-stderr.txt rename to Tests/RunCMake/CPack/RPM/PARTIALLY_RELOCATABLE_WARNING-stderr.txt diff --git a/Tests/RunCMake/CPack/RunCMakeTest.cmake b/Tests/RunCMake/CPack/RunCMakeTest.cmake index 426734e53..308b8ccb3 100644 --- a/Tests/RunCMake/CPack/RunCMakeTest.cmake +++ b/Tests/RunCMake/CPack/RunCMakeTest.cmake @@ -5,3 +5,4 @@ include("${RunCMake_SOURCE_DIR}/CPackTestHelpers.cmake") # args: TEST_NAME "GENERATORS" RUN_CMAKE_BUILD_STEP run_cpack_test(MINIMAL "RPM;DEB" false) +run_cpack_test(PARTIALLY_RELOCATABLE_WARNING "RPM" false) diff --git a/Tests/RunCMake/CPackRPM/CMakeLists.txt b/Tests/RunCMake/CPackRPM/CMakeLists.txt deleted file mode 100644 index b7d170ba0..000000000 --- a/Tests/RunCMake/CPackRPM/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1 FATAL_ERROR) - -project(${RunCMake_TEST} NONE) -include(${RunCMake_TEST}.cmake) - -set(CPACK_GENERATOR "RPM") -include(CPack) diff --git a/Tests/RunCMake/CPackRPM/RunCMakeTest.cmake b/Tests/RunCMake/CPackRPM/RunCMakeTest.cmake deleted file mode 100644 index 1935e32cd..000000000 --- a/Tests/RunCMake/CPackRPM/RunCMakeTest.cmake +++ /dev/null @@ -1,17 +0,0 @@ -include(RunCMake) - -function(run_cpack_rpm_test TEST_NAME) - set(RunCMake_TEST_NO_CLEAN TRUE) - set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/${TEST_NAME}-build") - file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") - file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") - execute_process( - COMMAND "${CMAKE_COMMAND}" -D RunCMake_TEST=${TEST_NAME} "${RunCMake_SOURCE_DIR}" - WORKING_DIRECTORY "${RunCMake_TEST_BINARY_DIR}" - OUTPUT_QUIET - ERROR_QUIET - ) - run_cmake_command(${TEST_NAME} ${CMAKE_CPACK_COMMAND}) -endfunction() - -run_cpack_rpm_test(CPackRPM_PARTIALLY_RELOCATABLE_WARNING) From 157396b131c3d7f5c7324972afaf3e185ee726b5 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Tue, 16 Jun 2015 00:01:05 -0400 Subject: [PATCH 0128/1048] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 0f15ab156..495551bdd 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 3) -set(CMake_VERSION_PATCH 20150615) +set(CMake_VERSION_PATCH 20150616) #set(CMake_VERSION_RC 1) From da4cddd787500b9da71e7c7877de9a17c6a7d1fc Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Mon, 15 Jun 2015 09:50:46 -0400 Subject: [PATCH 0129/1048] KWSys 2015-06-15 (d217407c) Extract upstream KWSys using the following shell commands. $ git archive --prefix=upstream-kwsys/ d217407c | tar x $ git shortlog --no-merges --abbrev=8 --format='%h %s' 8533a79b..d217407c Brad King (1): d217407c SystemTools: Fix preprocessor check WIN32 => _WIN32 --- SystemTools.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SystemTools.cxx b/SystemTools.cxx index c834e34d1..fed1c9c38 100644 --- a/SystemTools.cxx +++ b/SystemTools.cxx @@ -4408,7 +4408,7 @@ bool SystemTools::FileIsFullPath(const char* in_name, size_t len) bool SystemTools::GetShortPath(const kwsys_stl::string& path, kwsys_stl::string& shortPath) { -#if defined(WIN32) && !defined(__CYGWIN__) +#if defined(_WIN32) && !defined(__CYGWIN__) const int size = int(path.size()) +1; // size of return char *tempPath = new char[size]; // create a buffer DWORD ret; From 15c6a4c9199e245a31d1e4cf45bd35f279bbc44d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20St=C3=BCrmer?= Date: Tue, 16 Jun 2015 13:17:55 +0200 Subject: [PATCH 0130/1048] Utilities/Doxygen: Support tools installed in paths with spaces Quote paths to tools in generation script. --- Utilities/Doxygen/doc_makeall.sh.in | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/Utilities/Doxygen/doc_makeall.sh.in b/Utilities/Doxygen/doc_makeall.sh.in index ed7b521e4..fceafdd69 100755 --- a/Utilities/Doxygen/doc_makeall.sh.in +++ b/Utilities/Doxygen/doc_makeall.sh.in @@ -130,7 +130,7 @@ export RESULTING_HTML_TARZ_ARCHIVE_FILE="$DOXTEMP/$PROJECT_NAME-html.tar.gz" if test "x@VTK_SOURCE_DIR@" != "x" ; then if test "x$PERL_PROG" != "xNOTFOUND" ; then - $PERL_PROG "$PATH_TO_VTK_DOX_SCRIPTS/doc_contributors.pl" \ + "$PERL_PROG" "$PATH_TO_VTK_DOX_SCRIPTS/doc_contributors.pl" \ --authors "$SOURCE_DIR/Utilities/Doxygen/authors.txt" \ --cachedir "$DOXTEMP/cache" \ --class_group '^(cm[A-Z0-9][A-Za-z0-9]+)\.(?:c|cpp|cxx|h|fl)$' \ @@ -158,7 +158,7 @@ if test "x@VTK_SOURCE_DIR@" != "x" ; then fi if test "x$GNUPLOT_PROG" != "xNOTFOUND" ; then - $GNUPLOT_PROG "$DOXTEMP/contrib/history.plt" + "$GNUPLOT_PROG" "$DOXTEMP/contrib/history.plt" fi fi @@ -168,7 +168,7 @@ fi if test "x$DOXYGEN_PROG" != "xNOTFOUND" ; then if test "x$RM_PROG" != "xNOTFOUND" ; then - $RM_PROG -fr "$OUTPUT_DIRECTORY" + "$RM_PROG" -fr "$OUTPUT_DIRECTORY" fi "$DOXYGEN_PROG" "$DOXYFILE" @@ -182,7 +182,7 @@ fi if test "x@VTK_SOURCE_DIR@" != "x" ; then if test "x$PERL_PROG" != "xNOTFOUND" ; then - $PERL_PROG "$PATH_TO_VTK_DOX_SCRIPTS/doc_rmpath.pl" \ + "$PERL_PROG" "$PATH_TO_VTK_DOX_SCRIPTS/doc_rmpath.pl" \ --verbose \ --to "$INTERMEDIATE_DOX_DIR" \ --html "$OUTPUT_DIRECTORY/html" @@ -198,7 +198,7 @@ if test "x$COMPILE_HTML_HELP" == "xON" ; then if test "x$HHC_PROG" != "xNOTFOUND" ; then "$HHC_PROG" index.hhp if test "x$MV_PROG" != "xNOTFOUND" ; then - $MV_PROG -f index.chm "$RESULTING_HTML_HELP_FILE" + "$MV_PROG" -f index.chm "$RESULTING_HTML_HELP_FILE" fi fi fi @@ -212,15 +212,15 @@ if test "x$CREATE_HTML_TARZ_ARCHIVE" == "xON" ; then cd "$OUTPUT_DIRECTORY" if test "x$TAR_PROG" != "xNOTFOUND" ; then if test "x$RM_PROG" != "xNOTFOUND" ; then - $RM_PROG -f html.tar + "$RM_PROG" -f html.tar fi - $TAR_PROG -cf html.tar html + "$TAR_PROG" -cf html.tar html if test "x$GZIP_PROG" != "xNOTFOUND" ; then if test "x$RM_PROG" != "xNOTFOUND" ; then - $RM_PROG -f html.tar.gz + "$RM_PROG" -f html.tar.gz fi - $GZIP_PROG html.tar - $MV_PROG -f html.tar.gz "$RESULTING_HTML_TARZ_ARCHIVE_FILE" + "$GZIP_PROG" html.tar + "$MV_PROG" -f html.tar.gz "$RESULTING_HTML_TARZ_ARCHIVE_FILE" fi fi fi @@ -230,18 +230,18 @@ fi # Clean-up. if test "x$RM_PROG" != "xNOTFOUND" ; then - $RM_PROG -fr "$INTERMEDIATE_DOX_DIR" + "$RM_PROG" -fr "$INTERMEDIATE_DOX_DIR" if test "x$DOWNLOAD_VTK_TAGFILE" == "xON" ; then if test "x$VTK_TAGFILE" != "x" ; then - $RM_PROG -f "$VTK_TAGFILE_DEST_DIR/$VTK_TAGFILE" + "$RM_PROG" -f "$VTK_TAGFILE_DEST_DIR/$VTK_TAGFILE" fi fi if test "x$COMPILE_HTML_HELP" == "xON" ; then if test "x$RESULTING_HTML_HELP_FILE" != "x" ; then if test "x$ALLOW_ERASE_OUTPUT_DIRECTORY" == "xON" ; then - $RM_PROG -fr "$OUTPUT_DIRECTORY" + "$RM_PROG" -fr "$OUTPUT_DIRECTORY" fi fi fi From 1199ebf1c53f7f591e412617afdaaf4ccd5bc0ff Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 16 Jun 2015 10:30:59 -0400 Subject: [PATCH 0131/1048] GNUInstallDirs: Improve documentation formatting Also consolidate the description of each variable. --- Modules/GNUInstallDirs.cmake | 61 +++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 28 deletions(-) diff --git a/Modules/GNUInstallDirs.cmake b/Modules/GNUInstallDirs.cmake index c61e7e9a1..82258d1db 100644 --- a/Modules/GNUInstallDirs.cmake +++ b/Modules/GNUInstallDirs.cmake @@ -4,57 +4,62 @@ # # Define GNU standard installation directories # -# Provides install directory variables as defined for GNU software: +# Provides install directory variables as defined by the +# `GNU Coding Standards`_. # -# http://www.gnu.org/prep/standards/html_node/Directory-Variables.html +# .. _`GNU Coding Standards`: https://www.gnu.org/prep/standards/html_node/Directory-Variables.html # # Inclusion of this module defines the following variables: # # ``CMAKE_INSTALL_`` -# destination for files of a given type -# ``CMAKE_INSTALL_FULL_`` -# corresponding absolute path # -# where is one of: +# Destination for files of a given type. This value may be passed to +# the ``DESTINATION`` options of :command:`install` commands for the +# corresponding file type. +# +# ``CMAKE_INSTALL_FULL_`` +# +# The absolute path generated from the corresponding ``CMAKE_INSTALL_`` +# value. If the value is not already an absolute path, an absolute path +# is constructed typically by prepending the value of the +# :variable:`CMAKE_INSTALL_PREFIX` variable. +# +# where ```` is one of: # # ``BINDIR`` -# user executables (bin) +# user executables (``bin``) # ``SBINDIR`` -# system admin executables (sbin) +# system admin executables (``sbin``) # ``LIBEXECDIR`` -# program executables (libexec) +# program executables (``libexec``) # ``SYSCONFDIR`` -# read-only single-machine data (etc) +# read-only single-machine data (``etc``) # ``SHAREDSTATEDIR`` -# modifiable architecture-independent data (com) +# modifiable architecture-independent data (``com``) # ``LOCALSTATEDIR`` -# modifiable single-machine data (var) +# modifiable single-machine data (``var``) # ``LIBDIR`` -# object code libraries (lib or lib64 or lib/ on Debian) +# object code libraries (``lib`` or ``lib64`` +# or ``lib/`` on Debian) # ``INCLUDEDIR`` -# C header files (include) +# C header files (``include``) # ``OLDINCLUDEDIR`` -# C header files for non-gcc (/usr/include) +# C header files for non-gcc (``/usr/include``) # ``DATAROOTDIR`` -# read-only architecture-independent data root (share) +# read-only architecture-independent data root (``share``) # ``DATADIR`` -# read-only architecture-independent data (DATAROOTDIR) +# read-only architecture-independent data (``DATAROOTDIR``) # ``INFODIR`` -# info documentation (DATAROOTDIR/info) +# info documentation (``DATAROOTDIR/info``) # ``LOCALEDIR`` -# locale-dependent data (DATAROOTDIR/locale) +# locale-dependent data (``DATAROOTDIR/locale``) # ``MANDIR`` -# man documentation (DATAROOTDIR/man) +# man documentation (``DATAROOTDIR/man``) # ``DOCDIR`` -# documentation root (DATAROOTDIR/doc/PROJECT_NAME) +# documentation root (``DATAROOTDIR/doc/PROJECT_NAME``) # -# Each CMAKE_INSTALL_ value may be passed to the DESTINATION -# options of install() commands for the corresponding file type. If the -# includer does not define a value the above-shown default will be used -# and the value will appear in the cache for editing by the user. Each -# CMAKE_INSTALL_FULL_ value contains an absolute path constructed -# from the corresponding destination by prepending (if necessary) the -# value of CMAKE_INSTALL_PREFIX. +# If the includer does not define a value the above-shown default will be +# used and the value will appear in the cache for editing by the user. #============================================================================= # Copyright 2011 Nikita Krupen'ko From f43defaec4e8610e90886a831dcc0a15fdeea1cb Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 16 Jun 2015 13:55:42 -0400 Subject: [PATCH 0132/1048] GNU: Drop -rdynamic flag from Fortran The GNU Fortran compiler does not document support for this flag as the GNU C and C++ compilers do. --- Modules/Platform/Linux-GNU-Fortran.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/Modules/Platform/Linux-GNU-Fortran.cmake b/Modules/Platform/Linux-GNU-Fortran.cmake index 68e95404b..85e12265a 100644 --- a/Modules/Platform/Linux-GNU-Fortran.cmake +++ b/Modules/Platform/Linux-GNU-Fortran.cmake @@ -1,2 +1,3 @@ include(Platform/Linux-GNU) __linux_compiler_gnu(Fortran) +set(CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS "") From ee5c40a5f8e7dbbea7b0576c184003a7f86646ba Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Wed, 17 Jun 2015 00:01:04 -0400 Subject: [PATCH 0133/1048] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 495551bdd..c0f56d202 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 3) -set(CMake_VERSION_PATCH 20150616) +set(CMake_VERSION_PATCH 20150617) #set(CMake_VERSION_RC 1) From f17e89c00406d243370f03c8df28efb8e128bbad Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Thu, 18 Jun 2015 00:01:04 -0400 Subject: [PATCH 0134/1048] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index c0f56d202..267e49a1c 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 3) -set(CMake_VERSION_PATCH 20150617) +set(CMake_VERSION_PATCH 20150618) #set(CMake_VERSION_RC 1) From 5f30f1754ac9a701cbd311bab86250dd237d86fd Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 16 Jun 2015 14:59:51 -0400 Subject: [PATCH 0135/1048] GNUInstallDirs: Add test cases Add a RunCMake.GNUInstallDirs test with cases covering various install prefixes. Hard-code the architecture information. Tolerate all platform-specific LIBDIR values. Currently the root prefix is not handled well, but verify the current behavior in the test anyway. This can be addressed with a future change. Inspired-by: Alex Turbov --- Tests/RunCMake/CMakeLists.txt | 1 + Tests/RunCMake/GNUInstallDirs/CMakeLists.txt | 3 ++ Tests/RunCMake/GNUInstallDirs/Common.cmake | 28 +++++++++++++++++++ Tests/RunCMake/GNUInstallDirs/Opt-stderr.txt | 28 +++++++++++++++++++ Tests/RunCMake/GNUInstallDirs/Opt.cmake | 2 ++ Tests/RunCMake/GNUInstallDirs/Root-stderr.txt | 28 +++++++++++++++++++ Tests/RunCMake/GNUInstallDirs/Root.cmake | 2 ++ .../GNUInstallDirs/RunCMakeTest.cmake | 6 ++++ Tests/RunCMake/GNUInstallDirs/Usr-stderr.txt | 28 +++++++++++++++++++ Tests/RunCMake/GNUInstallDirs/Usr.cmake | 2 ++ .../GNUInstallDirs/UsrLocal-stderr.txt | 28 +++++++++++++++++++ Tests/RunCMake/GNUInstallDirs/UsrLocal.cmake | 2 ++ 12 files changed, 158 insertions(+) create mode 100644 Tests/RunCMake/GNUInstallDirs/CMakeLists.txt create mode 100644 Tests/RunCMake/GNUInstallDirs/Common.cmake create mode 100644 Tests/RunCMake/GNUInstallDirs/Opt-stderr.txt create mode 100644 Tests/RunCMake/GNUInstallDirs/Opt.cmake create mode 100644 Tests/RunCMake/GNUInstallDirs/Root-stderr.txt create mode 100644 Tests/RunCMake/GNUInstallDirs/Root.cmake create mode 100644 Tests/RunCMake/GNUInstallDirs/RunCMakeTest.cmake create mode 100644 Tests/RunCMake/GNUInstallDirs/Usr-stderr.txt create mode 100644 Tests/RunCMake/GNUInstallDirs/Usr.cmake create mode 100644 Tests/RunCMake/GNUInstallDirs/UsrLocal-stderr.txt create mode 100644 Tests/RunCMake/GNUInstallDirs/UsrLocal.cmake diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 592b5e406..1501792ab 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -95,6 +95,7 @@ add_RunCMake_test(FPHSA) add_RunCMake_test(GeneratorExpression) add_RunCMake_test(GeneratorPlatform) add_RunCMake_test(GeneratorToolset) +add_RunCMake_test(GNUInstallDirs) add_RunCMake_test(TargetPropertyGeneratorExpressions) add_RunCMake_test(Languages) add_RunCMake_test(ObjectLibrary) diff --git a/Tests/RunCMake/GNUInstallDirs/CMakeLists.txt b/Tests/RunCMake/GNUInstallDirs/CMakeLists.txt new file mode 100644 index 000000000..74b3ff8de --- /dev/null +++ b/Tests/RunCMake/GNUInstallDirs/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.3) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/GNUInstallDirs/Common.cmake b/Tests/RunCMake/GNUInstallDirs/Common.cmake new file mode 100644 index 000000000..eff2d54b3 --- /dev/null +++ b/Tests/RunCMake/GNUInstallDirs/Common.cmake @@ -0,0 +1,28 @@ +set(CMAKE_SIZEOF_VOID_P 8) +set(CMAKE_LIBRARY_ARCHITECTURE "arch") +if(CMAKE_SYSTEM_NAME STREQUAL "OpenBSD") + set(CMAKE_SYSTEM_NAME "OpenBSD-Fake") +endif() +include(GNUInstallDirs) +set(dirs + BINDIR + DATADIR + DATAROOTDIR + DOCDIR + INCLUDEDIR + INFODIR + LIBDIR + LIBEXECDIR + LOCALEDIR + LOCALSTATEDIR + MANDIR + SBINDIR + SHAREDSTATEDIR + SYSCONFDIR + ) +foreach(dir ${dirs}) + message("CMAKE_INSTALL_${dir}='${CMAKE_INSTALL_${dir}}'") +endforeach() +foreach(dir ${dirs}) + message("CMAKE_INSTALL_FULL_${dir}='${CMAKE_INSTALL_FULL_${dir}}'") +endforeach() diff --git a/Tests/RunCMake/GNUInstallDirs/Opt-stderr.txt b/Tests/RunCMake/GNUInstallDirs/Opt-stderr.txt new file mode 100644 index 000000000..f24a10354 --- /dev/null +++ b/Tests/RunCMake/GNUInstallDirs/Opt-stderr.txt @@ -0,0 +1,28 @@ +^CMAKE_INSTALL_BINDIR='bin' +CMAKE_INSTALL_DATADIR='share' +CMAKE_INSTALL_DATAROOTDIR='share' +CMAKE_INSTALL_DOCDIR='share/doc/Opt' +CMAKE_INSTALL_INCLUDEDIR='include' +CMAKE_INSTALL_INFODIR='share/info' +CMAKE_INSTALL_LIBDIR='(lib|lib64)' +CMAKE_INSTALL_LIBEXECDIR='libexec' +CMAKE_INSTALL_LOCALEDIR='share/locale' +CMAKE_INSTALL_LOCALSTATEDIR='var' +CMAKE_INSTALL_MANDIR='share/man' +CMAKE_INSTALL_SBINDIR='sbin' +CMAKE_INSTALL_SHAREDSTATEDIR='com' +CMAKE_INSTALL_SYSCONFDIR='etc' +CMAKE_INSTALL_FULL_BINDIR='/opt/Opt/bin' +CMAKE_INSTALL_FULL_DATADIR='/opt/Opt/share' +CMAKE_INSTALL_FULL_DATAROOTDIR='/opt/Opt/share' +CMAKE_INSTALL_FULL_DOCDIR='/opt/Opt/share/doc/Opt' +CMAKE_INSTALL_FULL_INCLUDEDIR='/opt/Opt/include' +CMAKE_INSTALL_FULL_INFODIR='/opt/Opt/share/info' +CMAKE_INSTALL_FULL_LIBDIR='/opt/Opt/(lib|lib64)' +CMAKE_INSTALL_FULL_LIBEXECDIR='/opt/Opt/libexec' +CMAKE_INSTALL_FULL_LOCALEDIR='/opt/Opt/share/locale' +CMAKE_INSTALL_FULL_LOCALSTATEDIR='/opt/Opt/var' +CMAKE_INSTALL_FULL_MANDIR='/opt/Opt/share/man' +CMAKE_INSTALL_FULL_SBINDIR='/opt/Opt/sbin' +CMAKE_INSTALL_FULL_SHAREDSTATEDIR='/opt/Opt/com' +CMAKE_INSTALL_FULL_SYSCONFDIR='/opt/Opt/etc'$ diff --git a/Tests/RunCMake/GNUInstallDirs/Opt.cmake b/Tests/RunCMake/GNUInstallDirs/Opt.cmake new file mode 100644 index 000000000..49eab0e4e --- /dev/null +++ b/Tests/RunCMake/GNUInstallDirs/Opt.cmake @@ -0,0 +1,2 @@ +set(CMAKE_INSTALL_PREFIX "/opt/${PROJECT_NAME}") +include(Common.cmake) diff --git a/Tests/RunCMake/GNUInstallDirs/Root-stderr.txt b/Tests/RunCMake/GNUInstallDirs/Root-stderr.txt new file mode 100644 index 000000000..95ca1e5b9 --- /dev/null +++ b/Tests/RunCMake/GNUInstallDirs/Root-stderr.txt @@ -0,0 +1,28 @@ +^CMAKE_INSTALL_BINDIR='bin' +CMAKE_INSTALL_DATADIR='share' +CMAKE_INSTALL_DATAROOTDIR='share' +CMAKE_INSTALL_DOCDIR='share/doc/Root' +CMAKE_INSTALL_INCLUDEDIR='include' +CMAKE_INSTALL_INFODIR='share/info' +CMAKE_INSTALL_LIBDIR='(lib|lib64)' +CMAKE_INSTALL_LIBEXECDIR='libexec' +CMAKE_INSTALL_LOCALEDIR='share/locale' +CMAKE_INSTALL_LOCALSTATEDIR='var' +CMAKE_INSTALL_MANDIR='share/man' +CMAKE_INSTALL_SBINDIR='sbin' +CMAKE_INSTALL_SHAREDSTATEDIR='com' +CMAKE_INSTALL_SYSCONFDIR='etc' +CMAKE_INSTALL_FULL_BINDIR='//bin' +CMAKE_INSTALL_FULL_DATADIR='//share' +CMAKE_INSTALL_FULL_DATAROOTDIR='//share' +CMAKE_INSTALL_FULL_DOCDIR='//share/doc/Root' +CMAKE_INSTALL_FULL_INCLUDEDIR='//include' +CMAKE_INSTALL_FULL_INFODIR='//share/info' +CMAKE_INSTALL_FULL_LIBDIR='//(lib|lib64)' +CMAKE_INSTALL_FULL_LIBEXECDIR='//libexec' +CMAKE_INSTALL_FULL_LOCALEDIR='//share/locale' +CMAKE_INSTALL_FULL_LOCALSTATEDIR='//var' +CMAKE_INSTALL_FULL_MANDIR='//share/man' +CMAKE_INSTALL_FULL_SBINDIR='//sbin' +CMAKE_INSTALL_FULL_SHAREDSTATEDIR='//com' +CMAKE_INSTALL_FULL_SYSCONFDIR='//etc'$ diff --git a/Tests/RunCMake/GNUInstallDirs/Root.cmake b/Tests/RunCMake/GNUInstallDirs/Root.cmake new file mode 100644 index 000000000..f8cc6411b --- /dev/null +++ b/Tests/RunCMake/GNUInstallDirs/Root.cmake @@ -0,0 +1,2 @@ +set(CMAKE_INSTALL_PREFIX "/") +include(Common.cmake) diff --git a/Tests/RunCMake/GNUInstallDirs/RunCMakeTest.cmake b/Tests/RunCMake/GNUInstallDirs/RunCMakeTest.cmake new file mode 100644 index 000000000..f88569a04 --- /dev/null +++ b/Tests/RunCMake/GNUInstallDirs/RunCMakeTest.cmake @@ -0,0 +1,6 @@ +include(RunCMake) + +run_cmake(Opt) +run_cmake(Root) +run_cmake(Usr) +run_cmake(UsrLocal) diff --git a/Tests/RunCMake/GNUInstallDirs/Usr-stderr.txt b/Tests/RunCMake/GNUInstallDirs/Usr-stderr.txt new file mode 100644 index 000000000..d857720f2 --- /dev/null +++ b/Tests/RunCMake/GNUInstallDirs/Usr-stderr.txt @@ -0,0 +1,28 @@ +^CMAKE_INSTALL_BINDIR='bin' +CMAKE_INSTALL_DATADIR='share' +CMAKE_INSTALL_DATAROOTDIR='share' +CMAKE_INSTALL_DOCDIR='share/doc/Usr' +CMAKE_INSTALL_INCLUDEDIR='include' +CMAKE_INSTALL_INFODIR='share/info' +CMAKE_INSTALL_LIBDIR='(lib|lib64|lib/arch)' +CMAKE_INSTALL_LIBEXECDIR='libexec' +CMAKE_INSTALL_LOCALEDIR='share/locale' +CMAKE_INSTALL_LOCALSTATEDIR='var' +CMAKE_INSTALL_MANDIR='share/man' +CMAKE_INSTALL_SBINDIR='sbin' +CMAKE_INSTALL_SHAREDSTATEDIR='com' +CMAKE_INSTALL_SYSCONFDIR='etc' +CMAKE_INSTALL_FULL_BINDIR='/usr/bin' +CMAKE_INSTALL_FULL_DATADIR='/usr/share' +CMAKE_INSTALL_FULL_DATAROOTDIR='/usr/share' +CMAKE_INSTALL_FULL_DOCDIR='/usr/share/doc/Usr' +CMAKE_INSTALL_FULL_INCLUDEDIR='/usr/include' +CMAKE_INSTALL_FULL_INFODIR='/usr/share/info' +CMAKE_INSTALL_FULL_LIBDIR='/usr/(lib|lib64|lib/arch)' +CMAKE_INSTALL_FULL_LIBEXECDIR='/usr/libexec' +CMAKE_INSTALL_FULL_LOCALEDIR='/usr/share/locale' +CMAKE_INSTALL_FULL_LOCALSTATEDIR='/usr/var' +CMAKE_INSTALL_FULL_MANDIR='/usr/share/man' +CMAKE_INSTALL_FULL_SBINDIR='/usr/sbin' +CMAKE_INSTALL_FULL_SHAREDSTATEDIR='/usr/com' +CMAKE_INSTALL_FULL_SYSCONFDIR='/usr/etc'$ diff --git a/Tests/RunCMake/GNUInstallDirs/Usr.cmake b/Tests/RunCMake/GNUInstallDirs/Usr.cmake new file mode 100644 index 000000000..62b728804 --- /dev/null +++ b/Tests/RunCMake/GNUInstallDirs/Usr.cmake @@ -0,0 +1,2 @@ +set(CMAKE_INSTALL_PREFIX "/usr") +include(Common.cmake) diff --git a/Tests/RunCMake/GNUInstallDirs/UsrLocal-stderr.txt b/Tests/RunCMake/GNUInstallDirs/UsrLocal-stderr.txt new file mode 100644 index 000000000..8dcf25b6e --- /dev/null +++ b/Tests/RunCMake/GNUInstallDirs/UsrLocal-stderr.txt @@ -0,0 +1,28 @@ +^CMAKE_INSTALL_BINDIR='bin' +CMAKE_INSTALL_DATADIR='share' +CMAKE_INSTALL_DATAROOTDIR='share' +CMAKE_INSTALL_DOCDIR='share/doc/UsrLocal' +CMAKE_INSTALL_INCLUDEDIR='include' +CMAKE_INSTALL_INFODIR='share/info' +CMAKE_INSTALL_LIBDIR='(lib|lib64)' +CMAKE_INSTALL_LIBEXECDIR='libexec' +CMAKE_INSTALL_LOCALEDIR='share/locale' +CMAKE_INSTALL_LOCALSTATEDIR='var' +CMAKE_INSTALL_MANDIR='share/man' +CMAKE_INSTALL_SBINDIR='sbin' +CMAKE_INSTALL_SHAREDSTATEDIR='com' +CMAKE_INSTALL_SYSCONFDIR='etc' +CMAKE_INSTALL_FULL_BINDIR='/usr/local/bin' +CMAKE_INSTALL_FULL_DATADIR='/usr/local/share' +CMAKE_INSTALL_FULL_DATAROOTDIR='/usr/local/share' +CMAKE_INSTALL_FULL_DOCDIR='/usr/local/share/doc/UsrLocal' +CMAKE_INSTALL_FULL_INCLUDEDIR='/usr/local/include' +CMAKE_INSTALL_FULL_INFODIR='/usr/local/share/info' +CMAKE_INSTALL_FULL_LIBDIR='/usr/local/(lib|lib64)' +CMAKE_INSTALL_FULL_LIBEXECDIR='/usr/local/libexec' +CMAKE_INSTALL_FULL_LOCALEDIR='/usr/local/share/locale' +CMAKE_INSTALL_FULL_LOCALSTATEDIR='/usr/local/var' +CMAKE_INSTALL_FULL_MANDIR='/usr/local/share/man' +CMAKE_INSTALL_FULL_SBINDIR='/usr/local/sbin' +CMAKE_INSTALL_FULL_SHAREDSTATEDIR='/usr/local/com' +CMAKE_INSTALL_FULL_SYSCONFDIR='/usr/local/etc'$ diff --git a/Tests/RunCMake/GNUInstallDirs/UsrLocal.cmake b/Tests/RunCMake/GNUInstallDirs/UsrLocal.cmake new file mode 100644 index 000000000..59d933185 --- /dev/null +++ b/Tests/RunCMake/GNUInstallDirs/UsrLocal.cmake @@ -0,0 +1,2 @@ +set(CMAKE_INSTALL_PREFIX "/usr/local") +include(Common.cmake) From c8bd37ec685c02736618af83ac894e96fc1e6ab8 Mon Sep 17 00:00:00 2001 From: Alex Turbov Date: Tue, 16 Jun 2015 01:16:57 +0700 Subject: [PATCH 0136/1048] GNUInstallDirs: Add special cases for certain prefixes Teach the module to handle SYSCONFDIR and LOCALSTATEDIR properly if CMAKE_INSTALL_PREFIX is set to `/` or `/usr` -- i.e. as expected by GNU Coding Standard (i.e. set SYSCONFDIR to `/etc` and `LOCALSTATEDIR` to `/var`). Also if CMAKE_INSTALL_PREFIX is set to /opt/pkg, `SYSCONFDIR` must be set to `/etc/opt/pkg` and `LOCALSTATEDIR` to `/var/opt/pkg` according to FHS. --- Modules/GNUInstallDirs.cmake | 73 ++++++++++++++++++- Tests/RunCMake/GNUInstallDirs/Opt-stderr.txt | 4 +- Tests/RunCMake/GNUInstallDirs/Root-stderr.txt | 52 ++++++------- Tests/RunCMake/GNUInstallDirs/Usr-stderr.txt | 4 +- 4 files changed, 100 insertions(+), 33 deletions(-) diff --git a/Modules/GNUInstallDirs.cmake b/Modules/GNUInstallDirs.cmake index 82258d1db..b42084eda 100644 --- a/Modules/GNUInstallDirs.cmake +++ b/Modules/GNUInstallDirs.cmake @@ -9,6 +9,9 @@ # # .. _`GNU Coding Standards`: https://www.gnu.org/prep/standards/html_node/Directory-Variables.html # +# Result Variables +# ^^^^^^^^^^^^^^^^ +# # Inclusion of this module defines the following variables: # # ``CMAKE_INSTALL_`` @@ -22,7 +25,8 @@ # The absolute path generated from the corresponding ``CMAKE_INSTALL_`` # value. If the value is not already an absolute path, an absolute path # is constructed typically by prepending the value of the -# :variable:`CMAKE_INSTALL_PREFIX` variable. +# :variable:`CMAKE_INSTALL_PREFIX` variable. However, there are some +# `special cases`_ as documented below. # # where ```` is one of: # @@ -60,8 +64,44 @@ # # If the includer does not define a value the above-shown default will be # used and the value will appear in the cache for editing by the user. +# +# Special Cases +# ^^^^^^^^^^^^^ +# +# The following values of :variable:`CMAKE_INSTALL_PREFIX` are special: +# +# ``/`` +# +# For ```` other than the ``SYSCONFDIR`` and ``LOCALSTATEDIR``, +# the value of ``CMAKE_INSTALL_`` is prefixed with ``usr/`` if +# it is not user-specified as an absolute path. For example, the +# ``INCLUDEDIR`` value ``include`` becomes ``usr/include``. +# This is required by the `GNU Coding Standards`_, which state: +# +# When building the complete GNU system, the prefix will be empty +# and ``/usr`` will be a symbolic link to ``/``. +# +# ``/usr`` +# +# For ```` equal to ``SYSCONFDIR`` or ``LOCALSTATEDIR``, the +# ``CMAKE_INSTALL_FULL_`` is computed by prepending just ``/`` +# to the value of ``CMAKE_INSTALL_`` if it is not user-specified +# as an absolute path. For example, the ``SYSCONFDIR`` value ``etc`` +# becomes ``/etc``. This is required by the `GNU Coding Standards`_. +# +# ``/opt/...`` +# +# For ```` equal to ``SYSCONFDIR`` or ``LOCALSTATEDIR``, the +# ``CMAKE_INSTALL_FULL_`` is computed by *appending* the prefix +# to the value of ``CMAKE_INSTALL_`` if it is not user-specified +# as an absolute path. For example, the ``SYSCONFDIR`` value ``etc`` +# becomes ``/etc/opt/...``. This is defined by the +# `Filesystem Hierarchy Standard`_. +# +# .. _`Filesystem Hierarchy Standard`: https://refspecs.linuxfoundation.org/FHS_3.0/fhs/index.html #============================================================================= +# Copyright 2015 Alex Turbov # Copyright 2011 Nikita Krupen'ko # Copyright 2011 Kitware, Inc. # @@ -279,8 +319,35 @@ foreach(dir MANDIR DOCDIR ) - if(NOT IS_ABSOLUTE ${CMAKE_INSTALL_${dir}}) - set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_${dir}}") + if(NOT IS_ABSOLUTE "${CMAKE_INSTALL_${dir}}") + # Handle special cases: + # - CMAKE_INSTALL_PREFIX == / + # - CMAKE_INSTALL_PREFIX == /usr + # - CMAKE_INSTALL_PREFIX == /opt/... + if("${CMAKE_INSTALL_PREFIX}" STREQUAL "/") + if("${dir}" STREQUAL "SYSCONFDIR" OR "${dir}" STREQUAL "LOCALSTATEDIR") + set(CMAKE_INSTALL_FULL_${dir} "/${CMAKE_INSTALL_${dir}}") + else() + if (NOT "${CMAKE_INSTALL_${dir}}" MATCHES "^usr/") + set(CMAKE_INSTALL_${dir} "usr/${CMAKE_INSTALL_${dir}}") + endif() + set(CMAKE_INSTALL_FULL_${dir} "/${CMAKE_INSTALL_${dir}}") + endif() + elseif("${CMAKE_INSTALL_PREFIX}" MATCHES "^/usr/?$") + if("${dir}" STREQUAL "SYSCONFDIR" OR "${dir}" STREQUAL "LOCALSTATEDIR") + set(CMAKE_INSTALL_FULL_${dir} "/${CMAKE_INSTALL_${dir}}") + else() + set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_${dir}}") + endif() + elseif("${CMAKE_INSTALL_PREFIX}" MATCHES "^/opt/.*") + if("${dir}" STREQUAL "SYSCONFDIR" OR "${dir}" STREQUAL "LOCALSTATEDIR") + set(CMAKE_INSTALL_FULL_${dir} "/${CMAKE_INSTALL_${dir}}${CMAKE_INSTALL_PREFIX}") + else() + set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_${dir}}") + endif() + else() + set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_${dir}}") + endif() else() set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_${dir}}") endif() diff --git a/Tests/RunCMake/GNUInstallDirs/Opt-stderr.txt b/Tests/RunCMake/GNUInstallDirs/Opt-stderr.txt index f24a10354..aee8552c8 100644 --- a/Tests/RunCMake/GNUInstallDirs/Opt-stderr.txt +++ b/Tests/RunCMake/GNUInstallDirs/Opt-stderr.txt @@ -21,8 +21,8 @@ CMAKE_INSTALL_FULL_INFODIR='/opt/Opt/share/info' CMAKE_INSTALL_FULL_LIBDIR='/opt/Opt/(lib|lib64)' CMAKE_INSTALL_FULL_LIBEXECDIR='/opt/Opt/libexec' CMAKE_INSTALL_FULL_LOCALEDIR='/opt/Opt/share/locale' -CMAKE_INSTALL_FULL_LOCALSTATEDIR='/opt/Opt/var' +CMAKE_INSTALL_FULL_LOCALSTATEDIR='/var/opt/Opt' CMAKE_INSTALL_FULL_MANDIR='/opt/Opt/share/man' CMAKE_INSTALL_FULL_SBINDIR='/opt/Opt/sbin' CMAKE_INSTALL_FULL_SHAREDSTATEDIR='/opt/Opt/com' -CMAKE_INSTALL_FULL_SYSCONFDIR='/opt/Opt/etc'$ +CMAKE_INSTALL_FULL_SYSCONFDIR='/etc/opt/Opt'$ diff --git a/Tests/RunCMake/GNUInstallDirs/Root-stderr.txt b/Tests/RunCMake/GNUInstallDirs/Root-stderr.txt index 95ca1e5b9..a95400e86 100644 --- a/Tests/RunCMake/GNUInstallDirs/Root-stderr.txt +++ b/Tests/RunCMake/GNUInstallDirs/Root-stderr.txt @@ -1,28 +1,28 @@ -^CMAKE_INSTALL_BINDIR='bin' -CMAKE_INSTALL_DATADIR='share' -CMAKE_INSTALL_DATAROOTDIR='share' -CMAKE_INSTALL_DOCDIR='share/doc/Root' -CMAKE_INSTALL_INCLUDEDIR='include' -CMAKE_INSTALL_INFODIR='share/info' -CMAKE_INSTALL_LIBDIR='(lib|lib64)' -CMAKE_INSTALL_LIBEXECDIR='libexec' -CMAKE_INSTALL_LOCALEDIR='share/locale' +^CMAKE_INSTALL_BINDIR='usr/bin' +CMAKE_INSTALL_DATADIR='usr/share' +CMAKE_INSTALL_DATAROOTDIR='usr/share' +CMAKE_INSTALL_DOCDIR='usr/share/doc/Root' +CMAKE_INSTALL_INCLUDEDIR='usr/include' +CMAKE_INSTALL_INFODIR='usr/share/info' +CMAKE_INSTALL_LIBDIR='usr/(lib|lib64)' +CMAKE_INSTALL_LIBEXECDIR='usr/libexec' +CMAKE_INSTALL_LOCALEDIR='usr/share/locale' CMAKE_INSTALL_LOCALSTATEDIR='var' -CMAKE_INSTALL_MANDIR='share/man' -CMAKE_INSTALL_SBINDIR='sbin' -CMAKE_INSTALL_SHAREDSTATEDIR='com' +CMAKE_INSTALL_MANDIR='usr/share/man' +CMAKE_INSTALL_SBINDIR='usr/sbin' +CMAKE_INSTALL_SHAREDSTATEDIR='usr/com' CMAKE_INSTALL_SYSCONFDIR='etc' -CMAKE_INSTALL_FULL_BINDIR='//bin' -CMAKE_INSTALL_FULL_DATADIR='//share' -CMAKE_INSTALL_FULL_DATAROOTDIR='//share' -CMAKE_INSTALL_FULL_DOCDIR='//share/doc/Root' -CMAKE_INSTALL_FULL_INCLUDEDIR='//include' -CMAKE_INSTALL_FULL_INFODIR='//share/info' -CMAKE_INSTALL_FULL_LIBDIR='//(lib|lib64)' -CMAKE_INSTALL_FULL_LIBEXECDIR='//libexec' -CMAKE_INSTALL_FULL_LOCALEDIR='//share/locale' -CMAKE_INSTALL_FULL_LOCALSTATEDIR='//var' -CMAKE_INSTALL_FULL_MANDIR='//share/man' -CMAKE_INSTALL_FULL_SBINDIR='//sbin' -CMAKE_INSTALL_FULL_SHAREDSTATEDIR='//com' -CMAKE_INSTALL_FULL_SYSCONFDIR='//etc'$ +CMAKE_INSTALL_FULL_BINDIR='/usr/bin' +CMAKE_INSTALL_FULL_DATADIR='/usr/share' +CMAKE_INSTALL_FULL_DATAROOTDIR='/usr/share' +CMAKE_INSTALL_FULL_DOCDIR='/usr/share/doc/Root' +CMAKE_INSTALL_FULL_INCLUDEDIR='/usr/include' +CMAKE_INSTALL_FULL_INFODIR='/usr/share/info' +CMAKE_INSTALL_FULL_LIBDIR='/usr/(lib|lib64)' +CMAKE_INSTALL_FULL_LIBEXECDIR='/usr/libexec' +CMAKE_INSTALL_FULL_LOCALEDIR='/usr/share/locale' +CMAKE_INSTALL_FULL_LOCALSTATEDIR='/var' +CMAKE_INSTALL_FULL_MANDIR='/usr/share/man' +CMAKE_INSTALL_FULL_SBINDIR='/usr/sbin' +CMAKE_INSTALL_FULL_SHAREDSTATEDIR='/usr/com' +CMAKE_INSTALL_FULL_SYSCONFDIR='/etc'$ diff --git a/Tests/RunCMake/GNUInstallDirs/Usr-stderr.txt b/Tests/RunCMake/GNUInstallDirs/Usr-stderr.txt index d857720f2..e10c4c595 100644 --- a/Tests/RunCMake/GNUInstallDirs/Usr-stderr.txt +++ b/Tests/RunCMake/GNUInstallDirs/Usr-stderr.txt @@ -21,8 +21,8 @@ CMAKE_INSTALL_FULL_INFODIR='/usr/share/info' CMAKE_INSTALL_FULL_LIBDIR='/usr/(lib|lib64|lib/arch)' CMAKE_INSTALL_FULL_LIBEXECDIR='/usr/libexec' CMAKE_INSTALL_FULL_LOCALEDIR='/usr/share/locale' -CMAKE_INSTALL_FULL_LOCALSTATEDIR='/usr/var' +CMAKE_INSTALL_FULL_LOCALSTATEDIR='/var' CMAKE_INSTALL_FULL_MANDIR='/usr/share/man' CMAKE_INSTALL_FULL_SBINDIR='/usr/sbin' CMAKE_INSTALL_FULL_SHAREDSTATEDIR='/usr/com' -CMAKE_INSTALL_FULL_SYSCONFDIR='/usr/etc'$ +CMAKE_INSTALL_FULL_SYSCONFDIR='/etc'$ From 8bcec4d22993614e746fdbae54ba66862a85dfe1 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 16 Jun 2015 15:41:33 -0400 Subject: [PATCH 0137/1048] Help: Add notes for topic 'GNUInstallDirs-special-prefixes' --- Help/release/dev/GNUInstallDirs-special-prefixes.rst | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 Help/release/dev/GNUInstallDirs-special-prefixes.rst diff --git a/Help/release/dev/GNUInstallDirs-special-prefixes.rst b/Help/release/dev/GNUInstallDirs-special-prefixes.rst new file mode 100644 index 000000000..83c1352f8 --- /dev/null +++ b/Help/release/dev/GNUInstallDirs-special-prefixes.rst @@ -0,0 +1,9 @@ +GNUInstallDirs-special-prefixes +------------------------------- + +* The :module:`GNUInstallDirs` module learned special default values + for certain installation prefixes according to the `GNU Coding + Standards`_ and the `Filesystem Hierarchy Standard`_. + +.. _`GNU Coding Standards`: https://www.gnu.org/prep/standards/html_node/Directory-Variables.html +.. _`Filesystem Hierarchy Standard`: https://refspecs.linuxfoundation.org/FHS_3.0/fhs/index.html From c65a060e1b19a463312f9003bc4d7793db9630e5 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 18 Jun 2015 10:57:46 -0400 Subject: [PATCH 0138/1048] CMakeDetermineCompilerId: Optionally try some flags before no flags Teach CMAKE_DETERMINE_COMPILER_ID to optionally try detecting the compiler id using some given flags before trying to detect it with no special flags. This will be useful for Fortran detection to distinguish some compilers that use the preprocessors of others but have no macro of their own by getting verbose output. --- Modules/CMakeDetermineCCompiler.cmake | 1 + Modules/CMakeDetermineCXXCompiler.cmake | 1 + Modules/CMakeDetermineCompilerId.cmake | 4 +++- Modules/CMakeDetermineFortranCompiler.cmake | 1 + 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Modules/CMakeDetermineCCompiler.cmake b/Modules/CMakeDetermineCCompiler.cmake index 937aa8c3e..40d4ce6c3 100644 --- a/Modules/CMakeDetermineCCompiler.cmake +++ b/Modules/CMakeDetermineCCompiler.cmake @@ -80,6 +80,7 @@ else() # Each entry in this list is a set of extra flags to try # adding to the compile line to see if it helps produce # a valid identification file. + set(CMAKE_C_COMPILER_ID_TEST_FLAGS_FIRST) set(CMAKE_C_COMPILER_ID_TEST_FLAGS # Try compiling to an object file only. "-c" diff --git a/Modules/CMakeDetermineCXXCompiler.cmake b/Modules/CMakeDetermineCXXCompiler.cmake index 893c454cc..a673525a8 100644 --- a/Modules/CMakeDetermineCXXCompiler.cmake +++ b/Modules/CMakeDetermineCXXCompiler.cmake @@ -78,6 +78,7 @@ else() # Each entry in this list is a set of extra flags to try # adding to the compile line to see if it helps produce # a valid identification file. + set(CMAKE_CXX_COMPILER_ID_TEST_FLAGS_FIRST) set(CMAKE_CXX_COMPILER_ID_TEST_FLAGS # Try compiling to an object file only. "-c" diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index 403ac089a..7ddf33fcf 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -34,7 +34,9 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src) # Try building with no extra flags and then try each set # of helper flags. Stop when the compiler is identified. - foreach(flags "" ${CMAKE_${lang}_COMPILER_ID_TEST_FLAGS}) + foreach(flags ${CMAKE_${lang}_COMPILER_ID_TEST_FLAGS_FIRST} + "" + ${CMAKE_${lang}_COMPILER_ID_TEST_FLAGS}) if(NOT CMAKE_${lang}_COMPILER_ID) CMAKE_DETERMINE_COMPILER_ID_BUILD("${lang}" "${flags}" "${src}") foreach(file ${COMPILER_${lang}_PRODUCED_FILES}) diff --git a/Modules/CMakeDetermineFortranCompiler.cmake b/Modules/CMakeDetermineFortranCompiler.cmake index 3a27127e2..ca68900a5 100644 --- a/Modules/CMakeDetermineFortranCompiler.cmake +++ b/Modules/CMakeDetermineFortranCompiler.cmake @@ -98,6 +98,7 @@ else() # Each entry in this list is a set of extra flags to try # adding to the compile line to see if it helps produce # a valid identification executable. + set(CMAKE_Fortran_COMPILER_ID_TEST_FLAGS_FIRST) set(CMAKE_Fortran_COMPILER_ID_TEST_FLAGS # Try compiling to an object file only. "-c" From 5f0dad75a9dd9bb9e7b2f917806588563c3ed39e Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 18 Jun 2015 11:24:54 -0400 Subject: [PATCH 0139/1048] CMakeDetermineCompilerId: Refactor id build/check loop logic Callers of CMAKE_DETERMINE_COMPILER_ID initialize the CMAKE_${lang}_COMPILER_ID to unset so we can check it at the end of each loop iteration instead of the beginning. This approach allows us to break out of the loop as soon as we succeed. It will also allow checks to be added in more places within the loop later. --- Modules/CMakeDetermineCompilerId.cmake | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index 7ddf33fcf..3c715e91e 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -37,11 +37,12 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src) foreach(flags ${CMAKE_${lang}_COMPILER_ID_TEST_FLAGS_FIRST} "" ${CMAKE_${lang}_COMPILER_ID_TEST_FLAGS}) - if(NOT CMAKE_${lang}_COMPILER_ID) - CMAKE_DETERMINE_COMPILER_ID_BUILD("${lang}" "${flags}" "${src}") - foreach(file ${COMPILER_${lang}_PRODUCED_FILES}) - CMAKE_DETERMINE_COMPILER_ID_CHECK("${lang}" "${CMAKE_${lang}_COMPILER_ID_DIR}/${file}" "${src}") - endforeach() + CMAKE_DETERMINE_COMPILER_ID_BUILD("${lang}" "${flags}" "${src}") + foreach(file ${COMPILER_${lang}_PRODUCED_FILES}) + CMAKE_DETERMINE_COMPILER_ID_CHECK("${lang}" "${CMAKE_${lang}_COMPILER_ID_DIR}/${file}" "${src}") + endforeach() + if(CMAKE_${lang}_COMPILER_ID) + break() endif() endforeach() From 0d204c1c1dabba2dc87957e9ce6bcd32aab70dae Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 18 Jun 2015 11:28:36 -0400 Subject: [PATCH 0140/1048] CMakeDetermineCompilerId: Try matching compiler output to detect id Some compilers can only be distinguished by their compilation output rather than preprocessor symbols or special flags. Add infrastructure to determine the compiler id by matching output. --- Modules/CMakeDetermineCompilerId.cmake | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index 3c715e91e..68f219451 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -38,6 +38,10 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src) "" ${CMAKE_${lang}_COMPILER_ID_TEST_FLAGS}) CMAKE_DETERMINE_COMPILER_ID_BUILD("${lang}" "${flags}" "${src}") + CMAKE_DETERMINE_COMPILER_ID_MATCH_VENDOR("${lang}" "${COMPILER_${lang}_PRODUCED_OUTPUT}") + if(CMAKE_${lang}_COMPILER_ID) + break() + endif() foreach(file ${COMPILER_${lang}_PRODUCED_FILES}) CMAKE_DETERMINE_COMPILER_ID_CHECK("${lang}" "${CMAKE_${lang}_COMPILER_ID_DIR}/${file}" "${src}") endforeach() @@ -358,6 +362,7 @@ ${CMAKE_${lang}_COMPILER_ID_OUTPUT} # No output files should be inspected. set(COMPILER_${lang}_PRODUCED_FILES) + set(COMPILER_${lang}_PRODUCED_OUTPUT) else() # Compilation succeeded. file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log @@ -398,10 +403,24 @@ ${CMAKE_${lang}_COMPILER_ID_OUTPUT} "${src}\" did not produce an executable in \"" "${CMAKE_${lang}_COMPILER_ID_DIR}\".\n\n") endif() + + set(COMPILER_${lang}_PRODUCED_OUTPUT "${CMAKE_${lang}_COMPILER_ID_OUTPUT}") endif() # Return the files produced by the compilation. set(COMPILER_${lang}_PRODUCED_FILES "${COMPILER_${lang}_PRODUCED_FILES}" PARENT_SCOPE) + set(COMPILER_${lang}_PRODUCED_OUTPUT "${COMPILER_${lang}_PRODUCED_OUTPUT}" PARENT_SCOPE) +endfunction() + +#----------------------------------------------------------------------------- +# Function to extract the compiler id from compiler output. +function(CMAKE_DETERMINE_COMPILER_ID_MATCH_VENDOR lang output) + foreach(vendor ${CMAKE_${lang}_COMPILER_ID_MATCH_VENDORS}) + if(output MATCHES "${CMAKE_${lang}_COMPILER_ID_MATCH_VENDOR_REGEX_${vendor}}") + set(CMAKE_${lang}_COMPILER_ID "${vendor}") + endif() + endforeach() + set(CMAKE_${lang}_COMPILER_ID "${CMAKE_${lang}_COMPILER_ID}" PARENT_SCOPE) endfunction() #----------------------------------------------------------------------------- From 7cd539b163a58f8b594e2318bdc7e7d7b1ba6577 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 18 Jun 2015 11:33:45 -0400 Subject: [PATCH 0141/1048] Add support for Concurrent Fortran 77 Compiler The Concurrent Fortran compiler (ccur.com) is available on Linux and can be used much like the GNU Fortran compiler. Currently it has no preprocessor symbols to identify it so we need to detect it by matching compiler output. Suggested-by: Anthony Ette --- Help/variable/CMAKE_LANG_COMPILER_ID.rst | 1 + Modules/CMakeDetermineFortranCompiler.cmake | 9 ++++++++- Modules/Compiler/CCur-Fortran.cmake | 1 + Modules/Platform/Linux-CCur-Fortran.cmake | 1 + 4 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 Modules/Compiler/CCur-Fortran.cmake create mode 100644 Modules/Platform/Linux-CCur-Fortran.cmake diff --git a/Help/variable/CMAKE_LANG_COMPILER_ID.rst b/Help/variable/CMAKE_LANG_COMPILER_ID.rst index f554f4ec4..1c3b134d0 100644 --- a/Help/variable/CMAKE_LANG_COMPILER_ID.rst +++ b/Help/variable/CMAKE_LANG_COMPILER_ID.rst @@ -11,6 +11,7 @@ include: Absoft = Absoft Fortran (absoft.com) ADSP = Analog VisualDSP++ (analog.com) AppleClang = Apple Clang (apple.com) + CCur = Concurrent Fortran (ccur.com) Clang = LLVM Clang (clang.llvm.org) Cray = Cray Compiler (cray.com) Embarcadero, Borland = Embarcadero (embarcadero.com) diff --git a/Modules/CMakeDetermineFortranCompiler.cmake b/Modules/CMakeDetermineFortranCompiler.cmake index ca68900a5..52ec25a13 100644 --- a/Modules/CMakeDetermineFortranCompiler.cmake +++ b/Modules/CMakeDetermineFortranCompiler.cmake @@ -98,7 +98,10 @@ else() # Each entry in this list is a set of extra flags to try # adding to the compile line to see if it helps produce # a valid identification executable. - set(CMAKE_Fortran_COMPILER_ID_TEST_FLAGS_FIRST) + set(CMAKE_Fortran_COMPILER_ID_TEST_FLAGS_FIRST + # Get verbose output to help distinguish compilers. + "-v" + ) set(CMAKE_Fortran_COMPILER_ID_TEST_FLAGS # Try compiling to an object file only. "-c" @@ -112,6 +115,10 @@ endif() if(NOT CMAKE_Fortran_COMPILER_ID_RUN) set(CMAKE_Fortran_COMPILER_ID_RUN 1) + # Table of per-vendor compiler output regular expressions. + list(APPEND CMAKE_Fortran_COMPILER_ID_MATCH_VENDORS CCur) + set(CMAKE_Fortran_COMPILER_ID_MATCH_VENDOR_REGEX_CCur "Concurrent Fortran [0-9]+ Compiler") + # Table of per-vendor compiler id flags with expected output. list(APPEND CMAKE_Fortran_COMPILER_ID_VENDORS Compaq) set(CMAKE_Fortran_COMPILER_ID_VENDOR_FLAGS_Compaq "-what") diff --git a/Modules/Compiler/CCur-Fortran.cmake b/Modules/Compiler/CCur-Fortran.cmake new file mode 100644 index 000000000..6ec06ae11 --- /dev/null +++ b/Modules/Compiler/CCur-Fortran.cmake @@ -0,0 +1 @@ +include(Compiler/GNU-Fortran) diff --git a/Modules/Platform/Linux-CCur-Fortran.cmake b/Modules/Platform/Linux-CCur-Fortran.cmake new file mode 100644 index 000000000..ceecc2f69 --- /dev/null +++ b/Modules/Platform/Linux-CCur-Fortran.cmake @@ -0,0 +1 @@ +include(Platform/Linux-GNU-Fortran) From 54676a0e4cf30d9f026a0f6521f7171a75f85803 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 18 Jun 2015 16:16:50 -0400 Subject: [PATCH 0142/1048] Help: Add notes for topic 'ConcurrentFortran-compiler-id' --- Help/release/dev/ConcurrentFortran-compiler-id.rst | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 Help/release/dev/ConcurrentFortran-compiler-id.rst diff --git a/Help/release/dev/ConcurrentFortran-compiler-id.rst b/Help/release/dev/ConcurrentFortran-compiler-id.rst new file mode 100644 index 000000000..71e79aa7e --- /dev/null +++ b/Help/release/dev/ConcurrentFortran-compiler-id.rst @@ -0,0 +1,5 @@ +ConcurrentFortran-compiler-id +----------------------------- + +* The `Concurrent Fortran 77 `__ compiler is now supported. + Its :variable:`compiler id _COMPILER_ID>` is ``CCur``. From 078b60f05c9750b79e0efb322fafeddd8450f6c0 Mon Sep 17 00:00:00 2001 From: James Johnston Date: Thu, 18 Jun 2015 17:17:38 +0000 Subject: [PATCH 0143/1048] Embarcadero: Run at most one linker invocation at a time (#15620) At least some versions (e.g. C++ Builder 5) of the bcc32 linker are known to write temporary files with a constant name to the current directory (e.g. "turboc.$ln"). (This can be verified by using Process Monitor to watch the file writes that bcc32 / ilink32 / implib make). This causes problems with some generators that keep a constant current directory and run concurrent linkers. For example, the Ninja generator, by default, always has the current directory set to the top of the build tree - resulting in conflicts between the linkers that are simultaneously trying to write to "turboc.$ln". Symptoms include direct errors regarding the "turboc.$ln" file, or later build steps failing due to corrupted output from previous links that happened to link "successfully." This is not a problem for the Borland Makefiles generator which does not run jobs in parallel. For the Ninja generator, work around this problem by using a link job pool of size 1. --- Modules/Platform/Windows-Embarcadero.cmake | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Modules/Platform/Windows-Embarcadero.cmake b/Modules/Platform/Windows-Embarcadero.cmake index 26b3c0cab..58ef3ca58 100644 --- a/Modules/Platform/Windows-Embarcadero.cmake +++ b/Modules/Platform/Windows-Embarcadero.cmake @@ -74,6 +74,12 @@ set (CMAKE_MODULE_LINKER_FLAGS_INIT ${CMAKE_SHARED_LINKER_FLAGS_INIT}) set (CMAKE_MODULE_LINKER_FLAGS_DEBUG_INIT ${CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT}) set (CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT}) +# The Borland link tool does not support multiple concurrent +# invocations within a single working directory. +if(NOT DEFINED CMAKE_JOB_POOL_LINK) + set(CMAKE_JOB_POOL_LINK BCC32LinkPool) + set_property(GLOBAL APPEND PROPERTY JOB_POOLS BCC32LinkPool=1) +endif() macro(__embarcadero_language lang) set(CMAKE_${lang}_COMPILE_OPTIONS_DLL "${_tD}") # Note: This variable is a ';' separated list From 66a2675e2bd4e32c32ff8e4147c3c679734c4445 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Fri, 19 Jun 2015 00:01:07 -0400 Subject: [PATCH 0144/1048] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 267e49a1c..f11eb8084 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 3) -set(CMake_VERSION_PATCH 20150618) +set(CMake_VERSION_PATCH 20150619) #set(CMake_VERSION_RC 1) From 0e346427a254024b8eafe52956e8f4ba05d856ed Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 19 Jun 2015 09:38:04 -0400 Subject: [PATCH 0145/1048] QtAutogen: Always run autogen step even when rcc is enabled (#15608) In commit v3.2.0-rc1~480^2 (QtAutogen: Regenerate qrc files if their input changes, 2014-09-17) the "cmake -E cmake_autogen" rule was switched from always running to running as a custom command with dependencies if rcc is enabled. This is not correct because automoc always needs to re-run. Switch back to always running the command. --- Source/cmQtAutoGenerators.cxx | 22 +--------------- Tests/QtAutogen/CMakeLists.txt | 23 +++++++++++++++++ Tests/QtAutogen/automoc_rerun/CMakeLists.txt | 27 ++++++++++++++++++++ Tests/QtAutogen/automoc_rerun/input.txt | 1 + Tests/QtAutogen/automoc_rerun/res1.qrc | 5 ++++ Tests/QtAutogen/automoc_rerun/test1.cpp | 5 ++++ Tests/QtAutogen/automoc_rerun/test1.h.in1 | 8 ++++++ Tests/QtAutogen/automoc_rerun/test1.h.in2 | 7 +++++ 8 files changed, 77 insertions(+), 21 deletions(-) create mode 100644 Tests/QtAutogen/automoc_rerun/CMakeLists.txt create mode 100644 Tests/QtAutogen/automoc_rerun/input.txt create mode 100644 Tests/QtAutogen/automoc_rerun/res1.qrc create mode 100644 Tests/QtAutogen/automoc_rerun/test1.cpp create mode 100644 Tests/QtAutogen/automoc_rerun/test1.h.in1 create mode 100644 Tests/QtAutogen/automoc_rerun/test1.h.in2 diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index f472ed8ee..d2f6e3640 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -466,31 +466,11 @@ bool cmQtAutoGenerators::InitializeAutogenTarget(cmTarget* target) else #endif { - cmTarget* autogenTarget = 0; - if (!rcc_output.empty() && !isNinja) - { - std::vector no_byproducts; - makefile->AddCustomCommandToOutput(rcc_output, no_byproducts, - depends, "", - commandLines, 0, - workingDirectory.c_str(), - false, false); - - cmCustomCommandLines no_commands; - autogenTarget = makefile->AddUtilityCommand( - autogenTargetName, true, - workingDirectory.c_str(), rcc_output, - no_commands, false, autogenComment.c_str()); - - } - else - { - autogenTarget = makefile->AddUtilityCommand( + cmTarget* autogenTarget = makefile->AddUtilityCommand( autogenTargetName, true, workingDirectory.c_str(), /*byproducts=*/rcc_output, depends, commandLines, false, autogenComment.c_str()); - } // Set target folder const char* autogenFolder = makefile->GetState() diff --git a/Tests/QtAutogen/CMakeLists.txt b/Tests/QtAutogen/CMakeLists.txt index 60b44fd96..1dfa648fb 100644 --- a/Tests/QtAutogen/CMakeLists.txt +++ b/Tests/QtAutogen/CMakeLists.txt @@ -167,3 +167,26 @@ file(TIMESTAMP "${qrc_file1}" file1_step1 "${timeformat}") if (NOT file1_step1 GREATER file1_before) message(SEND_ERROR "file1 (${qrc_file1}) should have changed in the first step!") endif() + +#----------------------------------------------------------------------------- +try_compile(MOC_RERUN + "${CMAKE_CURRENT_BINARY_DIR}/automoc_rerun" + "${CMAKE_CURRENT_SOURCE_DIR}/automoc_rerun" + automoc_rerun + CMAKE_FLAGS "-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}" "-DQT_TEST_VERSION=${QT_TEST_VERSION}" + "-DCMAKE_PREFIX_PATH=${Qt_PREFIX_DIR}" + OUTPUT_VARIABLE output +) +if (NOT MOC_RERUN) + message(SEND_ERROR "Initial build of automoc_rerun failed. Output: ${output}") +endif() + +configure_file(automoc_rerun/test1.h.in2 automoc_rerun/test1.h COPYONLY) + +execute_process(COMMAND "${CMAKE_COMMAND}" --build . + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/automoc_rerun" + RESULT_VARIABLE automoc_rerun_result + ) +if (automoc_rerun_result) + message(SEND_ERROR "Second build of automoc_rerun failed.") +endif() diff --git a/Tests/QtAutogen/automoc_rerun/CMakeLists.txt b/Tests/QtAutogen/automoc_rerun/CMakeLists.txt new file mode 100644 index 000000000..17bc332a4 --- /dev/null +++ b/Tests/QtAutogen/automoc_rerun/CMakeLists.txt @@ -0,0 +1,27 @@ +cmake_minimum_required(VERSION 3.1) +project(automoc_rerun CXX) + +if (QT_TEST_VERSION STREQUAL 4) + find_package(Qt4 REQUIRED) + set(QT_CORE_TARGET Qt4::QtCore) +else() + if (NOT QT_TEST_VERSION STREQUAL 5) + message(SEND_ERROR "Invalid Qt version specified.") + endif() + + find_package(Qt5Core REQUIRED) + set(QT_CORE_TARGET Qt5::Core) +endif() + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) + +configure_file(test1.h.in1 test1.h COPYONLY) + +add_executable(test1 + ${CMAKE_CURRENT_BINARY_DIR}/test1.h + test1.cpp + res1.qrc + ) +target_include_directories(test1 PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) +target_link_libraries(test1 ${QT_CORE_TARGET}) diff --git a/Tests/QtAutogen/automoc_rerun/input.txt b/Tests/QtAutogen/automoc_rerun/input.txt new file mode 100644 index 000000000..da627624b --- /dev/null +++ b/Tests/QtAutogen/automoc_rerun/input.txt @@ -0,0 +1 @@ +Res1 input. diff --git a/Tests/QtAutogen/automoc_rerun/res1.qrc b/Tests/QtAutogen/automoc_rerun/res1.qrc new file mode 100644 index 000000000..fb804b5ec --- /dev/null +++ b/Tests/QtAutogen/automoc_rerun/res1.qrc @@ -0,0 +1,5 @@ + + + input.txt + + diff --git a/Tests/QtAutogen/automoc_rerun/test1.cpp b/Tests/QtAutogen/automoc_rerun/test1.cpp new file mode 100644 index 000000000..4316a91cb --- /dev/null +++ b/Tests/QtAutogen/automoc_rerun/test1.cpp @@ -0,0 +1,5 @@ +#include "test1.h" +int main() +{ + return 0; +} diff --git a/Tests/QtAutogen/automoc_rerun/test1.h.in1 b/Tests/QtAutogen/automoc_rerun/test1.h.in1 new file mode 100644 index 000000000..fee2c096b --- /dev/null +++ b/Tests/QtAutogen/automoc_rerun/test1.h.in1 @@ -0,0 +1,8 @@ +#include +class test1 : public QObject +{ + Q_OBJECT + public slots: + void onTst1() {} + void onTst2() {} +}; diff --git a/Tests/QtAutogen/automoc_rerun/test1.h.in2 b/Tests/QtAutogen/automoc_rerun/test1.h.in2 new file mode 100644 index 000000000..6531d10d5 --- /dev/null +++ b/Tests/QtAutogen/automoc_rerun/test1.h.in2 @@ -0,0 +1,7 @@ +#include +class test1 : public QObject +{ + Q_OBJECT + public slots: + void onTst1() {} +}; From 4fa99b9922cf811b6f3cb2fac17d9b58a33c0d6e Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sat, 20 Jun 2015 00:01:04 -0400 Subject: [PATCH 0146/1048] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index f11eb8084..7cd14a239 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 3) -set(CMake_VERSION_PATCH 20150619) +set(CMake_VERSION_PATCH 20150620) #set(CMake_VERSION_RC 1) From 155ef535974ab9e78e98da00b63f31bd5c848bd0 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sun, 21 Jun 2015 00:01:03 -0400 Subject: [PATCH 0147/1048] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 7cd14a239..9d6817251 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 3) -set(CMake_VERSION_PATCH 20150620) +set(CMake_VERSION_PATCH 20150621) #set(CMake_VERSION_RC 1) From 6af9fa1294e86d61b01034e0c9f12375d69f3120 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 21 Jun 2015 14:50:50 +0200 Subject: [PATCH 0148/1048] Tests: Don't hang when running Qt5Autogen built with GCC 5 (#15570). Since Qt 5.4.2, it is necessary to compile against Qt 5 with -fPIC and not -fPIE when using GCC 5. Not doing so results in a hanging test in this case, so use the PIC flag directly instead. --- Tests/QtAutogen/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Tests/QtAutogen/CMakeLists.txt b/Tests/QtAutogen/CMakeLists.txt index 60b44fd96..54ee8f5ab 100644 --- a/Tests/QtAutogen/CMakeLists.txt +++ b/Tests/QtAutogen/CMakeLists.txt @@ -34,8 +34,8 @@ else() include_directories(${Qt5Widgets_INCLUDE_DIRS}) set(QT_LIBRARIES Qt5::Widgets) - if(Qt5_POSITION_INDEPENDENT_CODE) - set(CMAKE_POSITION_INDEPENDENT_CODE ON) + if(Qt5_POSITION_INDEPENDENT_CODE AND CMAKE_CXX_COMPILE_OPTIONS_PIC) + add_definitions(${CMAKE_CXX_COMPILE_OPTIONS_PIC}) endif() macro(qtx_wrap_cpp) From ac10fc0958c94e17d89a686d1addae0ac18dc648 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 21 Jun 2015 19:30:23 +0200 Subject: [PATCH 0149/1048] cmMakefile: Move listfile parsing responsibility. --- Source/cmMakefile.cxx | 21 +++++++++++---------- Source/cmMakefile.h | 6 +++--- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 63dbe27fc..56fe02835 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -576,8 +576,14 @@ bool cmMakefile::ReadListFile(const char* listfile, this->ListFileStack.push_back(filenametoread); - bool res = this->ReadListFileInternal(filenametoread.c_str(), - noPolicyScope, requireProjectCommand); + cmListFile cacheFile; + bool res = cacheFile.ParseFile(filenametoread.c_str(), + requireProjectCommand, this); + if (res) + { + this->ReadListFileInternal(cacheFile, filenametoread.c_str(), + noPolicyScope); + } this->AddDefinition("CMAKE_PARENT_LIST_FILE", currentParentFile.c_str()); this->AddDefinition("CMAKE_CURRENT_LIST_FILE", currentFile.c_str()); @@ -595,15 +601,10 @@ bool cmMakefile::ReadListFile(const char* listfile, return res; } -bool cmMakefile::ReadListFileInternal(const char* filenametoread, - bool noPolicyScope, - bool requireProjectCommand) +bool cmMakefile::ReadListFileInternal(cmListFile const& cacheFile, + const char* filenametoread, + bool noPolicyScope) { - cmListFile cacheFile; - if( !cacheFile.ParseFile(filenametoread, requireProjectCommand, this) ) - { - return false; - } // add this list file to the list of dependencies this->ListFiles.push_back( filenametoread); diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 86bde0ca7..0c41268bb 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -918,9 +918,9 @@ private: bool noPolicyScope, bool requireProjectCommand); - bool ReadListFileInternal(const char* filenametoread, - bool noPolicyScope, - bool requireProjectCommand); + bool ReadListFileInternal(cmListFile const& cacheFile, + const char* filenametoread, + bool noPolicyScope); bool ParseDefineFlag(std::string const& definition, bool remove); From fe38bb2c29ab4273cfefb1b343b80388bea2893e Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 21 Jun 2015 19:33:54 +0200 Subject: [PATCH 0150/1048] cmMakefile: Change return type of ReadListFileInternal. --- Source/cmMakefile.cxx | 4 +--- Source/cmMakefile.h | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 56fe02835..9a1f7ef4b 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -601,7 +601,7 @@ bool cmMakefile::ReadListFile(const char* listfile, return res; } -bool cmMakefile::ReadListFileInternal(cmListFile const& cacheFile, +void cmMakefile::ReadListFileInternal(cmListFile const& cacheFile, const char* filenametoread, bool noPolicyScope) { @@ -633,8 +633,6 @@ bool cmMakefile::ReadListFileInternal(cmListFile const& cacheFile, } } } - - return true; } //---------------------------------------------------------------------------- diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 0c41268bb..5927be1e7 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -918,7 +918,7 @@ private: bool noPolicyScope, bool requireProjectCommand); - bool ReadListFileInternal(cmListFile const& cacheFile, + void ReadListFileInternal(cmListFile const& cacheFile, const char* filenametoread, bool noPolicyScope); From a6e661b848fc180b03e7d72739c9a4a077a97e3f Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 21 Jun 2015 19:38:02 +0200 Subject: [PATCH 0151/1048] cmMakefile: Rename variables. --- Source/cmMakefile.cxx | 14 +++++++------- Source/cmMakefile.h | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 9a1f7ef4b..08c5a0b1f 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -576,12 +576,12 @@ bool cmMakefile::ReadListFile(const char* listfile, this->ListFileStack.push_back(filenametoread); - cmListFile cacheFile; - bool res = cacheFile.ParseFile(filenametoread.c_str(), - requireProjectCommand, this); + cmListFile listFile; + bool res = listFile.ParseFile(filenametoread.c_str(), + requireProjectCommand, this); if (res) { - this->ReadListFileInternal(cacheFile, filenametoread.c_str(), + this->ReadListFileInternal(listFile, filenametoread.c_str(), noPolicyScope); } @@ -601,7 +601,7 @@ bool cmMakefile::ReadListFile(const char* listfile, return res; } -void cmMakefile::ReadListFileInternal(cmListFile const& cacheFile, +void cmMakefile::ReadListFileInternal(cmListFile const& listFile, const char* filenametoread, bool noPolicyScope) { @@ -614,11 +614,11 @@ void cmMakefile::ReadListFileInternal(cmListFile const& cacheFile, IncludeScope incScope(this, filenametoread, noPolicyScope); // Run the parsed commands. - const size_t numberFunctions = cacheFile.Functions.size(); + const size_t numberFunctions = listFile.Functions.size(); for(size_t i =0; i < numberFunctions; ++i) { cmExecutionStatus status; - this->ExecuteCommand(cacheFile.Functions[i],status); + this->ExecuteCommand(listFile.Functions[i],status); if(cmSystemTools::GetFatalErrorOccured()) { // Exit early due to error. diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 5927be1e7..b80a1eea8 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -918,7 +918,7 @@ private: bool noPolicyScope, bool requireProjectCommand); - void ReadListFileInternal(cmListFile const& cacheFile, + void ReadListFileInternal(cmListFile const& listFile, const char* filenametoread, bool noPolicyScope); From fff3c6cd1c49ba1aa8a256e26294db65710c9d18 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 21 Jun 2015 19:42:21 +0200 Subject: [PATCH 0152/1048] cmMakefile: Move a container population. --- Source/cmMakefile.cxx | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 08c5a0b1f..3c3236225 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -581,6 +581,9 @@ bool cmMakefile::ReadListFile(const char* listfile, requireProjectCommand, this); if (res) { + // add this list file to the list of dependencies + this->ListFiles.push_back(filenametoread); + this->ReadListFileInternal(listFile, filenametoread.c_str(), noPolicyScope); } @@ -605,11 +608,7 @@ void cmMakefile::ReadListFileInternal(cmListFile const& listFile, const char* filenametoread, bool noPolicyScope) { - // add this list file to the list of dependencies - this->ListFiles.push_back( filenametoread); - // Enforce balanced blocks (if/endif, function/endfunction, etc.). - { LexicalPushPop lexScope(this); IncludeScope incScope(this, filenametoread, noPolicyScope); @@ -632,7 +631,6 @@ void cmMakefile::ReadListFileInternal(cmListFile const& listFile, break; } } - } } //---------------------------------------------------------------------------- From d5aaa2b96f7d93aaa8e11e8d5e9cf0c2b1739290 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 21 Jun 2015 19:43:07 +0200 Subject: [PATCH 0153/1048] cmMakefile: Move check for unused variables. --- Source/cmMakefile.cxx | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 3c3236225..6b3c7df2e 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -586,6 +586,8 @@ bool cmMakefile::ReadListFile(const char* listfile, this->ReadListFileInternal(listFile, filenametoread.c_str(), noPolicyScope); + + this->CheckForUnusedVariables(); } this->AddDefinition("CMAKE_PARENT_LIST_FILE", currentParentFile.c_str()); @@ -596,11 +598,6 @@ bool cmMakefile::ReadListFile(const char* listfile, this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_FILE"); this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_DIR"); - if (res) - { - this->CheckForUnusedVariables(); - } - return res; } From 5e24ff17a22b780947e98eabc1d25320104f7b21 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 21 Jun 2015 19:43:55 +0200 Subject: [PATCH 0154/1048] cmMakefile: Split file handling from execution. --- Source/cmMakefile.cxx | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 6b3c7df2e..e3a2e4c3e 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -561,6 +561,17 @@ bool cmMakefile::ReadListFile(const char* listfile, cmSystemTools::CollapseFullPath(listfile, this->GetCurrentSourceDirectory()); + this->ListFileStack.push_back(filenametoread); + + cmListFile listFile; + bool res = listFile.ParseFile(filenametoread.c_str(), + requireProjectCommand, this); + if (res) + { + // add this list file to the list of dependencies + this->ListFiles.push_back(filenametoread); + } + std::string currentParentFile = this->GetSafeDefinition("CMAKE_PARENT_LIST_FILE"); std::string currentFile @@ -574,16 +585,8 @@ bool cmMakefile::ReadListFile(const char* listfile, this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_FILE"); this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_DIR"); - this->ListFileStack.push_back(filenametoread); - - cmListFile listFile; - bool res = listFile.ParseFile(filenametoread.c_str(), - requireProjectCommand, this); if (res) { - // add this list file to the list of dependencies - this->ListFiles.push_back(filenametoread); - this->ReadListFileInternal(listFile, filenametoread.c_str(), noPolicyScope); From 384a0dba63b166d94a199b12f104e53496a3302a Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 21 Jun 2015 19:44:37 +0200 Subject: [PATCH 0155/1048] cmMakefile: Simplify condition handling. --- Source/cmMakefile.cxx | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index e3a2e4c3e..93a6c0863 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -564,14 +564,15 @@ bool cmMakefile::ReadListFile(const char* listfile, this->ListFileStack.push_back(filenametoread); cmListFile listFile; - bool res = listFile.ParseFile(filenametoread.c_str(), - requireProjectCommand, this); - if (res) + if (!listFile.ParseFile(filenametoread.c_str(), + requireProjectCommand, this)) { - // add this list file to the list of dependencies - this->ListFiles.push_back(filenametoread); + return false; } + // add this list file to the list of dependencies + this->ListFiles.push_back(filenametoread); + std::string currentParentFile = this->GetSafeDefinition("CMAKE_PARENT_LIST_FILE"); std::string currentFile @@ -585,13 +586,8 @@ bool cmMakefile::ReadListFile(const char* listfile, this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_FILE"); this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_DIR"); - if (res) - { - this->ReadListFileInternal(listFile, filenametoread.c_str(), - noPolicyScope); - - this->CheckForUnusedVariables(); - } + this->ReadListFileInternal(listFile, filenametoread.c_str(), noPolicyScope); + this->CheckForUnusedVariables(); this->AddDefinition("CMAKE_PARENT_LIST_FILE", currentParentFile.c_str()); this->AddDefinition("CMAKE_CURRENT_LIST_FILE", currentFile.c_str()); @@ -601,7 +597,7 @@ bool cmMakefile::ReadListFile(const char* listfile, this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_FILE"); this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_DIR"); - return res; + return true; } void cmMakefile::ReadListFileInternal(cmListFile const& listFile, From 9166b49d70746dcd36e6e891c78734b559e0fccf Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 21 Jun 2015 19:45:20 +0200 Subject: [PATCH 0156/1048] cmMakefile: Change order of raii scopes. --- Source/cmMakefile.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 93a6c0863..15a37105e 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -605,8 +605,8 @@ void cmMakefile::ReadListFileInternal(cmListFile const& listFile, bool noPolicyScope) { // Enforce balanced blocks (if/endif, function/endfunction, etc.). - LexicalPushPop lexScope(this); IncludeScope incScope(this, filenametoread, noPolicyScope); + LexicalPushPop lexScope(this); // Run the parsed commands. const size_t numberFunctions = listFile.Functions.size(); From 27f229b9707f3a87c3ed0d469b5b2d08c80076c5 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 21 Jun 2015 19:46:03 +0200 Subject: [PATCH 0157/1048] cmMakefile: Move include scope out of ReadListFileInternal. Simplify the ReadListFileInternal API. --- Source/cmMakefile.cxx | 13 +++++++------ Source/cmMakefile.h | 4 +--- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 15a37105e..836667c28 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -586,7 +586,12 @@ bool cmMakefile::ReadListFile(const char* listfile, this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_FILE"); this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_DIR"); - this->ReadListFileInternal(listFile, filenametoread.c_str(), noPolicyScope); + IncludeScope incScope(this, filenametoread.c_str(), noPolicyScope); + this->ReadListFileInternal(listFile); + if(cmSystemTools::GetFatalErrorOccured()) + { + incScope.Quiet(); + } this->CheckForUnusedVariables(); this->AddDefinition("CMAKE_PARENT_LIST_FILE", currentParentFile.c_str()); @@ -600,12 +605,9 @@ bool cmMakefile::ReadListFile(const char* listfile, return true; } -void cmMakefile::ReadListFileInternal(cmListFile const& listFile, - const char* filenametoread, - bool noPolicyScope) +void cmMakefile::ReadListFileInternal(cmListFile const& listFile) { // Enforce balanced blocks (if/endif, function/endfunction, etc.). - IncludeScope incScope(this, filenametoread, noPolicyScope); LexicalPushPop lexScope(this); // Run the parsed commands. @@ -618,7 +620,6 @@ void cmMakefile::ReadListFileInternal(cmListFile const& listFile, { // Exit early due to error. lexScope.Quiet(); - incScope.Quiet(); break; } if(status.GetReturnInvoked()) diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index b80a1eea8..2db7c93f9 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -918,9 +918,7 @@ private: bool noPolicyScope, bool requireProjectCommand); - void ReadListFileInternal(cmListFile const& listFile, - const char* filenametoread, - bool noPolicyScope); + void ReadListFileInternal(cmListFile const& listFile); bool ParseDefineFlag(std::string const& definition, bool remove); From b7166afa6d385c4f0a0610f43ea00c8e5613a003 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 21 Jun 2015 19:50:18 +0200 Subject: [PATCH 0158/1048] cmMakefile: Remove File from IncludeScope. Get it from the Makefile instead. --- Source/cmMakefile.cxx | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 836667c28..0142e6d01 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -409,12 +409,11 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff, class cmMakefile::IncludeScope { public: - IncludeScope(cmMakefile* mf, const char* fname, bool noPolicyScope); + IncludeScope(cmMakefile* mf, bool noPolicyScope); ~IncludeScope(); void Quiet() { this->ReportError = false; } private: cmMakefile* Makefile; - const char* File; bool NoPolicyScope; bool CheckCMP0011; bool ReportError; @@ -422,9 +421,9 @@ private: }; //---------------------------------------------------------------------------- -cmMakefile::IncludeScope::IncludeScope(cmMakefile* mf, const char* fname, +cmMakefile::IncludeScope::IncludeScope(cmMakefile* mf, bool noPolicyScope): - Makefile(mf), File(fname), NoPolicyScope(noPolicyScope), + Makefile(mf), NoPolicyScope(noPolicyScope), CheckCMP0011(false), ReportError(true) { if(!this->NoPolicyScope) @@ -501,7 +500,8 @@ void cmMakefile::IncludeScope::EnforceCMP0011() { std::ostringstream w; w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0011) << "\n" - << "The included script\n " << this->File << "\n" + << "The included script\n " + << this->Makefile->ListFileStack.back() << "\n" << "affects policy settings. " << "CMake is implying the NO_POLICY_SCOPE option for compatibility, " << "so the effects are applied to the including context."; @@ -513,7 +513,8 @@ void cmMakefile::IncludeScope::EnforceCMP0011() { std::ostringstream e; e << cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0011) << "\n" - << "The included script\n " << this->File << "\n" + << "The included script\n " + << this->Makefile->ListFileStack.back() << "\n" << "affects policy settings, so it requires this policy to be set."; this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); } @@ -586,7 +587,7 @@ bool cmMakefile::ReadListFile(const char* listfile, this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_FILE"); this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_DIR"); - IncludeScope incScope(this, filenametoread.c_str(), noPolicyScope); + IncludeScope incScope(this, noPolicyScope); this->ReadListFileInternal(listFile); if(cmSystemTools::GetFatalErrorOccured()) { From e53072d638c2cca3258ffccbec75bb5c70d34a3f Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 21 Jun 2015 19:51:04 +0200 Subject: [PATCH 0159/1048] cmMakefile: Move IncludeScope instance. --- Source/cmMakefile.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 0142e6d01..6fee95caa 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -558,6 +558,8 @@ bool cmMakefile::ReadListFile(const char* listfile, bool noPolicyScope, bool requireProjectCommand) { + IncludeScope incScope(this, noPolicyScope); + std::string filenametoread = cmSystemTools::CollapseFullPath(listfile, this->GetCurrentSourceDirectory()); @@ -587,7 +589,6 @@ bool cmMakefile::ReadListFile(const char* listfile, this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_FILE"); this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_DIR"); - IncludeScope incScope(this, noPolicyScope); this->ReadListFileInternal(listFile); if(cmSystemTools::GetFatalErrorOccured()) { From 826b6e68184759cda496f0073a8f59b2155cfdaf Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 21 Jun 2015 19:51:46 +0200 Subject: [PATCH 0160/1048] cmMakefile: Move IncludeScope to ReadDependentFile. Add replacement simple push/pop in the other two callers of ReadListFile. --- Source/cmMakefile.cxx | 25 +++++++++++++++---------- Source/cmMakefile.h | 1 - 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 6fee95caa..87d6e3c5a 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -532,8 +532,10 @@ bool cmMakefile::ProcessBuildsystemFile(const char* listfile) { this->AddDefinition("CMAKE_PARENT_LIST_FILE", listfile); std::string curSrc = this->GetCurrentSourceDirectory(); - bool result = this->ReadListFile(listfile, true, + this->PushPolicyBarrier(); + bool result = this->ReadListFile(listfile, curSrc == this->GetHomeDirectory()); + this->PopPolicyBarrier(!cmSystemTools::GetFatalErrorOccured()); this->EnforceDirectoryLevelRules(); return result; } @@ -542,24 +544,31 @@ bool cmMakefile::ReadDependentFile(const char* listfile, bool noPolicyScope) { this->AddDefinition("CMAKE_PARENT_LIST_FILE", this->GetDefinition("CMAKE_CURRENT_LIST_FILE")); - bool result = this->ReadListFile(listfile, noPolicyScope, false); + bool result = false; + { + IncludeScope incScope(this, noPolicyScope); + result = this->ReadListFile(listfile, false); + if(cmSystemTools::GetFatalErrorOccured()) + { + incScope.Quiet(); + } + } this->ListFileStack.pop_back(); return result; } bool cmMakefile::ReadListFile(const char* listfile) { - bool result = this->ReadListFile(listfile, true, false); + this->PushPolicyBarrier(); + bool result = this->ReadListFile(listfile, false); + this->PopPolicyBarrier(!cmSystemTools::GetFatalErrorOccured()); this->ListFileStack.pop_back(); return result; } bool cmMakefile::ReadListFile(const char* listfile, - bool noPolicyScope, bool requireProjectCommand) { - IncludeScope incScope(this, noPolicyScope); - std::string filenametoread = cmSystemTools::CollapseFullPath(listfile, this->GetCurrentSourceDirectory()); @@ -590,10 +599,6 @@ bool cmMakefile::ReadListFile(const char* listfile, this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_DIR"); this->ReadListFileInternal(listFile); - if(cmSystemTools::GetFatalErrorOccured()) - { - incScope.Quiet(); - } this->CheckForUnusedVariables(); this->AddDefinition("CMAKE_PARENT_LIST_FILE", currentParentFile.c_str()); diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 2db7c93f9..9896d5b44 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -915,7 +915,6 @@ private: cmState::Snapshot StateSnapshot; bool ReadListFile(const char* listfile, - bool noPolicyScope, bool requireProjectCommand); void ReadListFileInternal(cmListFile const& listFile); From 254be613b803816a918c12d7d7eca40a7c9f7c09 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 21 Jun 2015 19:56:31 +0200 Subject: [PATCH 0161/1048] cmMakefile: Move resource management into the IncludeScope. --- Source/cmMakefile.cxx | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 87d6e3c5a..b02cfc81d 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -486,6 +486,7 @@ cmMakefile::IncludeScope::~IncludeScope() this->EnforceCMP0011(); } } + this->Makefile->ListFileStack.pop_back(); } //---------------------------------------------------------------------------- @@ -544,16 +545,12 @@ bool cmMakefile::ReadDependentFile(const char* listfile, bool noPolicyScope) { this->AddDefinition("CMAKE_PARENT_LIST_FILE", this->GetDefinition("CMAKE_CURRENT_LIST_FILE")); - bool result = false; - { IncludeScope incScope(this, noPolicyScope); - result = this->ReadListFile(listfile, false); + bool result = this->ReadListFile(listfile, false); if(cmSystemTools::GetFatalErrorOccured()) { incScope.Quiet(); } - } - this->ListFileStack.pop_back(); return result; } From ad47e6e5bc4822dc5bc9d82ae1d7590aee4ece95 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 21 Jun 2015 19:57:15 +0200 Subject: [PATCH 0162/1048] cmMakefile: Inline ReadListFileInternal into caller. --- Source/cmMakefile.cxx | 27 +++++++++++---------------- Source/cmMakefile.h | 2 -- 2 files changed, 11 insertions(+), 18 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index b02cfc81d..c4400d1b3 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -595,22 +595,6 @@ bool cmMakefile::ReadListFile(const char* listfile, this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_FILE"); this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_DIR"); - this->ReadListFileInternal(listFile); - this->CheckForUnusedVariables(); - - this->AddDefinition("CMAKE_PARENT_LIST_FILE", currentParentFile.c_str()); - this->AddDefinition("CMAKE_CURRENT_LIST_FILE", currentFile.c_str()); - this->AddDefinition("CMAKE_CURRENT_LIST_DIR", - cmSystemTools::GetFilenamePath(currentFile).c_str()); - this->MarkVariableAsUsed("CMAKE_PARENT_LIST_FILE"); - this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_FILE"); - this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_DIR"); - - return true; -} - -void cmMakefile::ReadListFileInternal(cmListFile const& listFile) -{ // Enforce balanced blocks (if/endif, function/endfunction, etc.). LexicalPushPop lexScope(this); @@ -632,6 +616,17 @@ void cmMakefile::ReadListFileInternal(cmListFile const& listFile) break; } } + this->CheckForUnusedVariables(); + + this->AddDefinition("CMAKE_PARENT_LIST_FILE", currentParentFile.c_str()); + this->AddDefinition("CMAKE_CURRENT_LIST_FILE", currentFile.c_str()); + this->AddDefinition("CMAKE_CURRENT_LIST_DIR", + cmSystemTools::GetFilenamePath(currentFile).c_str()); + this->MarkVariableAsUsed("CMAKE_PARENT_LIST_FILE"); + this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_FILE"); + this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_DIR"); + + return true; } //---------------------------------------------------------------------------- diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 9896d5b44..8ea6e1377 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -917,8 +917,6 @@ private: bool ReadListFile(const char* listfile, bool requireProjectCommand); - void ReadListFileInternal(cmListFile const& listFile); - bool ParseDefineFlag(std::string const& definition, bool remove); bool EnforceUniqueDir(const std::string& srcPath, From a1858136c28326212d15cfd0a4412281f46b9cb0 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 21 Jun 2015 20:02:16 +0200 Subject: [PATCH 0163/1048] cmMakefile: Rename parameter. --- Source/cmMakefile.cxx | 18 +++++++++--------- Source/cmMakefile.h | 8 ++++---- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index c4400d1b3..62d4c6677 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -529,24 +529,24 @@ void cmMakefile::IncludeScope::EnforceCMP0011() } } -bool cmMakefile::ProcessBuildsystemFile(const char* listfile) +bool cmMakefile::ProcessBuildsystemFile(const char* filename) { - this->AddDefinition("CMAKE_PARENT_LIST_FILE", listfile); + this->AddDefinition("CMAKE_PARENT_LIST_FILE", filename); std::string curSrc = this->GetCurrentSourceDirectory(); this->PushPolicyBarrier(); - bool result = this->ReadListFile(listfile, + bool result = this->ReadListFile(filename, curSrc == this->GetHomeDirectory()); this->PopPolicyBarrier(!cmSystemTools::GetFatalErrorOccured()); this->EnforceDirectoryLevelRules(); return result; } -bool cmMakefile::ReadDependentFile(const char* listfile, bool noPolicyScope) +bool cmMakefile::ReadDependentFile(const char* filename, bool noPolicyScope) { this->AddDefinition("CMAKE_PARENT_LIST_FILE", this->GetDefinition("CMAKE_CURRENT_LIST_FILE")); IncludeScope incScope(this, noPolicyScope); - bool result = this->ReadListFile(listfile, false); + bool result = this->ReadListFile(filename, false); if(cmSystemTools::GetFatalErrorOccured()) { incScope.Quiet(); @@ -554,20 +554,20 @@ bool cmMakefile::ReadDependentFile(const char* listfile, bool noPolicyScope) return result; } -bool cmMakefile::ReadListFile(const char* listfile) +bool cmMakefile::ReadListFile(const char* filename) { this->PushPolicyBarrier(); - bool result = this->ReadListFile(listfile, false); + bool result = this->ReadListFile(filename, false); this->PopPolicyBarrier(!cmSystemTools::GetFatalErrorOccured()); this->ListFileStack.pop_back(); return result; } -bool cmMakefile::ReadListFile(const char* listfile, +bool cmMakefile::ReadListFile(const char* filename, bool requireProjectCommand) { std::string filenametoread = - cmSystemTools::CollapseFullPath(listfile, + cmSystemTools::CollapseFullPath(filename, this->GetCurrentSourceDirectory()); this->ListFileStack.push_back(filenametoread); diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 8ea6e1377..24b4bd038 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -79,11 +79,11 @@ public: */ ~cmMakefile(); - bool ReadListFile(const char* listfile); + bool ReadListFile(const char* filename); - bool ReadDependentFile(const char* listfile, bool noPolicyScope = true); + bool ReadDependentFile(const char* filename, bool noPolicyScope = true); - bool ProcessBuildsystemFile(const char* listfile); + bool ProcessBuildsystemFile(const char* filename); /** * Add a function blocker to this makefile @@ -914,7 +914,7 @@ private: cmState::Snapshot StateSnapshot; - bool ReadListFile(const char* listfile, + bool ReadListFile(const char* filename, bool requireProjectCommand); bool ParseDefineFlag(std::string const& definition, bool remove); From 3404f8a081a03441c6747de50f2155ae28115c07 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 21 Jun 2015 20:07:40 +0200 Subject: [PATCH 0164/1048] cmMakefile: Move ListFile parsing responsibility out of internal method. --- Source/cmMakefile.cxx | 92 ++++++++++++++++++++++++++----------------- Source/cmMakefile.h | 4 +- 2 files changed, 58 insertions(+), 38 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 62d4c6677..32767a3b2 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -533,39 +533,6 @@ bool cmMakefile::ProcessBuildsystemFile(const char* filename) { this->AddDefinition("CMAKE_PARENT_LIST_FILE", filename); std::string curSrc = this->GetCurrentSourceDirectory(); - this->PushPolicyBarrier(); - bool result = this->ReadListFile(filename, - curSrc == this->GetHomeDirectory()); - this->PopPolicyBarrier(!cmSystemTools::GetFatalErrorOccured()); - this->EnforceDirectoryLevelRules(); - return result; -} - -bool cmMakefile::ReadDependentFile(const char* filename, bool noPolicyScope) -{ - this->AddDefinition("CMAKE_PARENT_LIST_FILE", - this->GetDefinition("CMAKE_CURRENT_LIST_FILE")); - IncludeScope incScope(this, noPolicyScope); - bool result = this->ReadListFile(filename, false); - if(cmSystemTools::GetFatalErrorOccured()) - { - incScope.Quiet(); - } - return result; -} - -bool cmMakefile::ReadListFile(const char* filename) -{ - this->PushPolicyBarrier(); - bool result = this->ReadListFile(filename, false); - this->PopPolicyBarrier(!cmSystemTools::GetFatalErrorOccured()); - this->ListFileStack.pop_back(); - return result; -} - -bool cmMakefile::ReadListFile(const char* filename, - bool requireProjectCommand) -{ std::string filenametoread = cmSystemTools::CollapseFullPath(filename, this->GetCurrentSourceDirectory()); @@ -574,11 +541,66 @@ bool cmMakefile::ReadListFile(const char* filename, cmListFile listFile; if (!listFile.ParseFile(filenametoread.c_str(), - requireProjectCommand, this)) + curSrc == this->GetHomeDirectory(), this)) { return false; } + this->PushPolicyBarrier(); + this->ReadListFile(listFile, filenametoread); + this->PopPolicyBarrier(!cmSystemTools::GetFatalErrorOccured()); + this->EnforceDirectoryLevelRules(); + return true; +} + +bool cmMakefile::ReadDependentFile(const char* filename, bool noPolicyScope) +{ + this->AddDefinition("CMAKE_PARENT_LIST_FILE", + this->GetDefinition("CMAKE_CURRENT_LIST_FILE")); + std::string filenametoread = + cmSystemTools::CollapseFullPath(filename, + this->GetCurrentSourceDirectory()); + + this->ListFileStack.push_back(filenametoread); + + cmListFile listFile; + if (!listFile.ParseFile(filenametoread.c_str(), false, this)) + { + return false; + } + IncludeScope incScope(this, noPolicyScope); + this->ReadListFile(listFile, filenametoread); + if(cmSystemTools::GetFatalErrorOccured()) + { + incScope.Quiet(); + } + return true; +} + +bool cmMakefile::ReadListFile(const char* filename) +{ + std::string filenametoread = + cmSystemTools::CollapseFullPath(filename, + this->GetCurrentSourceDirectory()); + + this->ListFileStack.push_back(filenametoread); + + cmListFile listFile; + if (!listFile.ParseFile(filenametoread.c_str(), false, this)) + { + return false; + } + + this->PushPolicyBarrier(); + this->ReadListFile(listFile, filenametoread); + this->PopPolicyBarrier(!cmSystemTools::GetFatalErrorOccured()); + this->ListFileStack.pop_back(); + return true; +} + +void cmMakefile::ReadListFile(cmListFile const& listFile, + std::string const& filenametoread) +{ // add this list file to the list of dependencies this->ListFiles.push_back(filenametoread); @@ -625,8 +647,6 @@ bool cmMakefile::ReadListFile(const char* filename, this->MarkVariableAsUsed("CMAKE_PARENT_LIST_FILE"); this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_FILE"); this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_DIR"); - - return true; } //---------------------------------------------------------------------------- diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 24b4bd038..271cfd682 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -914,8 +914,8 @@ private: cmState::Snapshot StateSnapshot; - bool ReadListFile(const char* filename, - bool requireProjectCommand); + void ReadListFile(cmListFile const& listFile, + const std::string& filenametoread); bool ParseDefineFlag(std::string const& definition, bool remove); From c10ab014344e693a65d7cfbfb9b4e0f8a8b155f9 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 21 Jun 2015 20:08:30 +0200 Subject: [PATCH 0165/1048] cmMakefile: Move IncludeScope. --- Source/cmMakefile.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 32767a3b2..744e84889 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -561,14 +561,15 @@ bool cmMakefile::ReadDependentFile(const char* filename, bool noPolicyScope) cmSystemTools::CollapseFullPath(filename, this->GetCurrentSourceDirectory()); + IncludeScope incScope(this, noPolicyScope); this->ListFileStack.push_back(filenametoread); cmListFile listFile; if (!listFile.ParseFile(filenametoread.c_str(), false, this)) { + incScope.Quiet(); return false; } - IncludeScope incScope(this, noPolicyScope); this->ReadListFile(listFile, filenametoread); if(cmSystemTools::GetFatalErrorOccured()) { From 5c837686287eb22e73af76d2ab7f32d5bf8cb9ec Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 21 Jun 2015 20:09:13 +0200 Subject: [PATCH 0166/1048] cmMakefile: Make the IncludeScope more responsible. It is now responsible for all resource management when including a file. --- Source/cmMakefile.cxx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 744e84889..dee290ce5 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -409,7 +409,8 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff, class cmMakefile::IncludeScope { public: - IncludeScope(cmMakefile* mf, bool noPolicyScope); + IncludeScope(cmMakefile* mf, std::string const& filenametoread, + bool noPolicyScope); ~IncludeScope(); void Quiet() { this->ReportError = false; } private: @@ -422,6 +423,7 @@ private: //---------------------------------------------------------------------------- cmMakefile::IncludeScope::IncludeScope(cmMakefile* mf, + std::string const& filenametoread, bool noPolicyScope): Makefile(mf), NoPolicyScope(noPolicyScope), CheckCMP0011(false), ReportError(true) @@ -457,6 +459,7 @@ cmMakefile::IncludeScope::IncludeScope(cmMakefile* mf, // The included file cannot pop our policy scope. this->Makefile->PushPolicyBarrier(); + this->Makefile->ListFileStack.push_back(filenametoread); } //---------------------------------------------------------------------------- @@ -561,8 +564,7 @@ bool cmMakefile::ReadDependentFile(const char* filename, bool noPolicyScope) cmSystemTools::CollapseFullPath(filename, this->GetCurrentSourceDirectory()); - IncludeScope incScope(this, noPolicyScope); - this->ListFileStack.push_back(filenametoread); + IncludeScope incScope(this, filenametoread, noPolicyScope); cmListFile listFile; if (!listFile.ParseFile(filenametoread.c_str(), false, this)) From 81eb2c58a17f7e34cda79897ea7dec24bf798dd2 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 21 Jun 2015 20:10:02 +0200 Subject: [PATCH 0167/1048] cmMakefile: Simplify filename handling. This method has only one caller. --- Source/cmMakefile.cxx | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index dee290ce5..7faf67a9a 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -536,21 +536,17 @@ bool cmMakefile::ProcessBuildsystemFile(const char* filename) { this->AddDefinition("CMAKE_PARENT_LIST_FILE", filename); std::string curSrc = this->GetCurrentSourceDirectory(); - std::string filenametoread = - cmSystemTools::CollapseFullPath(filename, - this->GetCurrentSourceDirectory()); - this->ListFileStack.push_back(filenametoread); + this->ListFileStack.push_back(filename); cmListFile listFile; - if (!listFile.ParseFile(filenametoread.c_str(), - curSrc == this->GetHomeDirectory(), this)) + if (!listFile.ParseFile(filename, curSrc == this->GetHomeDirectory(), this)) { return false; } this->PushPolicyBarrier(); - this->ReadListFile(listFile, filenametoread); + this->ReadListFile(listFile, filename); this->PopPolicyBarrier(!cmSystemTools::GetFatalErrorOccured()); this->EnforceDirectoryLevelRules(); return true; From ccf7760f0035e2e0458ba59e29ab302a2d07c388 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 14 Jun 2015 20:27:37 +0200 Subject: [PATCH 0168/1048] cmOutputConverter: Constify API. --- Source/cmOutputConverter.cxx | 18 +++++++++--------- Source/cmOutputConverter.h | 18 +++++++++--------- Source/cmState.cxx | 4 ++-- Source/cmState.h | 6 ++++-- 4 files changed, 24 insertions(+), 22 deletions(-) diff --git a/Source/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx index db73a3438..b0a30a1ca 100644 --- a/Source/cmOutputConverter.cxx +++ b/Source/cmOutputConverter.cxx @@ -27,7 +27,7 @@ cmOutputConverter::cmOutputConverter(cmState::Snapshot snapshot) std::string cmOutputConverter::ConvertToOutputForExistingCommon(const std::string& remote, std::string const& result, - OutputFormat format) + OutputFormat format) const { // If this is a windows shell, the result has a space, and the path // already exists, we can use a short-path to reference it without a @@ -50,7 +50,7 @@ cmOutputConverter::ConvertToOutputForExistingCommon(const std::string& remote, std::string cmOutputConverter::ConvertToOutputForExisting(const std::string& remote, RelativeRoot local, - OutputFormat format) + OutputFormat format) const { static_cast(local); @@ -65,7 +65,7 @@ cmOutputConverter::ConvertToOutputForExisting(const std::string& remote, std::string cmOutputConverter::ConvertToOutputForExisting(RelativeRoot remote, const std::string& local, - OutputFormat format) + OutputFormat format) const { // Perform standard conversion. std::string result = this->Convert(remote, local, format, true); @@ -76,7 +76,7 @@ cmOutputConverter::ConvertToOutputForExisting(RelativeRoot remote, } //---------------------------------------------------------------------------- -const char* cmOutputConverter::GetRelativeRootPath(RelativeRoot relroot) +const char* cmOutputConverter::GetRelativeRootPath(RelativeRoot relroot) const { switch (relroot) { @@ -91,7 +91,7 @@ const char* cmOutputConverter::GetRelativeRootPath(RelativeRoot relroot) std::string cmOutputConverter::Convert(const std::string& source, RelativeRoot relative, - OutputFormat output) + OutputFormat output) const { // Convert the path to a relative path. std::string result = source; @@ -125,7 +125,7 @@ std::string cmOutputConverter::Convert(const std::string& source, //---------------------------------------------------------------------------- std::string cmOutputConverter::ConvertToOutputFormat(const std::string& source, - OutputFormat output) + OutputFormat output) const { std::string result = source; // Convert it to an output path. @@ -163,7 +163,7 @@ std::string cmOutputConverter::ConvertToOutputFormat(const std::string& source, std::string cmOutputConverter::Convert(RelativeRoot remote, const std::string& local, OutputFormat output, - bool optional) + bool optional) const { const char* remotePath = this->GetRelativeRootPath(remote); @@ -192,7 +192,7 @@ static bool cmOutputConverterNotAbove(const char* a, const char* b) std::string cmOutputConverter::ConvertToRelativePath(const std::vector& local, const std::string& in_remote, - bool force) + bool force) const { // The path should never be quoted. assert(in_remote[0] != '\"'); @@ -318,7 +318,7 @@ static bool cmOutputConverterIsShellOperator(const std::string& str) std::string cmOutputConverter::EscapeForShell(const std::string& str, bool makeVars, bool forEcho, - bool useWatcomQuote) + bool useWatcomQuote) const { // Do not escape shell operators. if(cmOutputConverterIsShellOperator(str)) diff --git a/Source/cmOutputConverter.h b/Source/cmOutputConverter.h index 1d3f8c75f..482a64b1c 100644 --- a/Source/cmOutputConverter.h +++ b/Source/cmOutputConverter.h @@ -39,35 +39,35 @@ public: enum RelativeRoot { NONE, FULL, HOME, START, HOME_OUTPUT, START_OUTPUT }; enum OutputFormat { UNCHANGED, MAKERULE, SHELL, WATCOMQUOTE, RESPONSE }; std::string ConvertToOutputFormat(const std::string& source, - OutputFormat output); + OutputFormat output) const; std::string Convert(const std::string& remote, RelativeRoot local, - OutputFormat output = UNCHANGED); + OutputFormat output = UNCHANGED) const; std::string Convert(RelativeRoot remote, const std::string& local, OutputFormat output = UNCHANGED, - bool optional = false); + bool optional = false) const; /** * Get path for the specified relative root. */ - const char* GetRelativeRootPath(RelativeRoot relroot); + const char* GetRelativeRootPath(RelativeRoot relroot) const; ///! for existing files convert to output path and short path if spaces std::string ConvertToOutputForExisting(const std::string& remote, RelativeRoot local = START_OUTPUT, - OutputFormat format = SHELL); + OutputFormat format = SHELL) const; /** For existing path identified by RelativeRoot convert to output path and short path if spaces. */ std::string ConvertToOutputForExisting(RelativeRoot remote, const std::string& local = "", - OutputFormat format = SHELL); + OutputFormat format = SHELL) const; void SetLinkScriptShell(bool linkScriptShell); std::string EscapeForShell(const std::string& str, bool makeVars = false, bool forEcho = false, - bool useWatcomQuote = false); + bool useWatcomQuote = false) const; static std::string EscapeForCMake(const std::string& str); @@ -88,14 +88,14 @@ public: */ std::string ConvertToRelativePath(const std::vector& local, const std::string& in_remote, - bool force = false); + bool force = false) const; private: cmState* GetState() const; std::string ConvertToOutputForExistingCommon(const std::string& remote, std::string const& result, - OutputFormat format); + OutputFormat format) const; private: cmState::Snapshot StateSnapshot; diff --git a/Source/cmState.cxx b/Source/cmState.cxx index a13c13f14..f0c7e6dab 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -741,14 +741,14 @@ void cmState::Snapshot::SetCurrentBinaryDirectory(std::string const& dir) } std::vector const& -cmState::Snapshot::GetCurrentSourceDirectoryComponents() +cmState::Snapshot::GetCurrentSourceDirectoryComponents() const { return this->Position->BuildSystemDirectory ->CurrentSourceDirectoryComponents; } std::vector const& -cmState::Snapshot::GetCurrentBinaryDirectoryComponents() +cmState::Snapshot::GetCurrentBinaryDirectoryComponents() const { return this->Position->BuildSystemDirectory ->CurrentBinaryDirectoryComponents; diff --git a/Source/cmState.h b/Source/cmState.h index 353a6c60a..070a08b58 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -43,8 +43,10 @@ public: const char* GetCurrentBinaryDirectory() const; void SetCurrentBinaryDirectory(std::string const& dir); - std::vector const& GetCurrentSourceDirectoryComponents(); - std::vector const& GetCurrentBinaryDirectoryComponents(); + std::vector const& + GetCurrentSourceDirectoryComponents() const; + std::vector const& + GetCurrentBinaryDirectoryComponents() const; const char* GetRelativePathTopSource() const; const char* GetRelativePathTopBinary() const; From cfae7fa4082e73d4282be98fa99a07c18dd53d24 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 21 Jun 2015 20:16:37 +0200 Subject: [PATCH 0169/1048] cmMakefile: Use cmOutputConverter instead of cmLocalGenerator. --- Source/cmMakefile.cxx | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 63dbe27fc..03380623b 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -264,8 +264,8 @@ void cmMakefile::IssueMessage(cmake::MessageType t, if(!this->GetCMakeInstance()->GetIsInTryCompile()) { - lfc.FilePath = this->LocalGenerator->Convert(lfc.FilePath, - cmLocalGenerator::HOME); + cmOutputConverter converter(this->StateSnapshot); + lfc.FilePath = converter.Convert(lfc.FilePath, cmOutputConverter::HOME); } lfc.Line = 0; this->GetCMakeInstance()->IssueMessage(t, text, lfc); @@ -1963,8 +1963,8 @@ void cmMakefile::LogUnused(const char* reason, lfc.FilePath = path; lfc.Line = 0; } - lfc.FilePath = this->LocalGenerator->Convert(lfc.FilePath, - cmLocalGenerator::HOME); + cmOutputConverter converter(this->StateSnapshot); + lfc.FilePath = converter.Convert(lfc.FilePath, cmOutputConverter::HOME); if (this->CheckSystemVars || cmSystemTools::IsSubDirectory(path, @@ -2861,8 +2861,9 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringNew( { std::ostringstream msg; cmListFileContext lfc; - lfc.FilePath = this->LocalGenerator - ->Convert(filename, cmLocalGenerator::HOME); + cmOutputConverter converter(this->StateSnapshot); + lfc.FilePath = + converter.Convert(filename, cmOutputConverter::HOME); lfc.Line = line; msg << "uninitialized variable \'" << lookup << "\'"; this->GetCMakeInstance()->IssueMessage(cmake::AUTHOR_WARNING, From eb05dcd6c9b587eeb8738d9f08459d94733708f6 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 13 Jun 2015 19:32:46 +0200 Subject: [PATCH 0170/1048] cmLocalGenerator: Add IssueMessage method. For use at generate-time instead of the cmMakefile method of the same name. --- Source/cmGeneratorTarget.cxx | 3 ++- Source/cmLocalGenerator.cxx | 30 +++++++++++++++++++++++------- Source/cmLocalGenerator.h | 4 ++++ 3 files changed, 29 insertions(+), 8 deletions(-) diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 67d0d5433..2f68ab031 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -705,7 +705,8 @@ cmTargetTraceDependencies e << "Evaluation output file\n \"" << sf->GetFullPath() << "\"\ndepends on the sources of a target it is used in. This " "is a dependency loop and is not allowed."; - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); + this->GeneratorTarget + ->LocalGenerator->IssueMessage(cmake::FATAL_ERROR, e.str()); return; } if(emitted.insert(sf).second && this->SourcesQueued.insert(sf).second) diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 98accf9cf..a42d5a755 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -73,6 +73,22 @@ bool cmLocalGenerator::IsRootMakefile() const return !this->StateSnapshot.GetBuildsystemDirectoryParent().IsValid(); } +void cmLocalGenerator::IssueMessage(cmake::MessageType t, + std::string const& text) const +{ + cmListFileContext lfc; + lfc.FilePath = this->StateSnapshot.GetCurrentSourceDirectory(); + lfc.FilePath += "/CMakeLists.txt"; + + if(!this->GlobalGenerator->GetCMakeInstance()->GetIsInTryCompile()) + { + cmOutputConverter converter(this->StateSnapshot); + lfc.FilePath = converter.Convert(lfc.FilePath, cmLocalGenerator::HOME); + } + lfc.Line = 0; + this->GlobalGenerator->GetCMakeInstance()->IssueMessage(t, text, lfc); +} + //---------------------------------------------------------------------------- void cmLocalGenerator::ComputeObjectMaxPath() { @@ -98,7 +114,7 @@ void cmLocalGenerator::ComputeObjectMaxPath() w << "CMAKE_OBJECT_PATH_MAX is set to " << pmax << ", which is less than the minimum of 128. " << "The value will be ignored."; - this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w.str()); + this->IssueMessage(cmake::AUTHOR_WARNING, w.str()); } } else @@ -107,7 +123,7 @@ void cmLocalGenerator::ComputeObjectMaxPath() w << "CMAKE_OBJECT_PATH_MAX is set to \"" << plen << "\", which fails to parse as a positive integer. " << "The value will be ignored."; - this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w.str()); + this->IssueMessage(cmake::AUTHOR_WARNING, w.str()); } } this->ObjectMaxPathViolations.clear(); @@ -1317,7 +1333,7 @@ void cmLocalGenerator::AddCompileOptions( "higher \"" << it->first << "_STANDARD\" \"" << standard << "\". " "This is not permitted. The COMPILE_FEATURES may not both depend on " "and be depended on by the link implementation." << std::endl; - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); + this->IssueMessage(cmake::FATAL_ERROR, e.str()); return; } } @@ -2041,7 +2057,7 @@ AddCompilerRequirementFlag(std::string &flags, cmTarget const* target, "dialect \"" << lang << standardProp << "\" " << (ext ? "(with compiler extensions)" : "") << ", but CMake " "does not know the compile flags to use to enable it."; - this->GetMakefile()->IssueMessage(cmake::FATAL_ERROR, e.str()); + this->IssueMessage(cmake::FATAL_ERROR, e.str()); } else { @@ -2085,7 +2101,7 @@ AddCompilerRequirementFlag(std::string &flags, cmTarget const* target, std::string e = "CMAKE_" + lang + "_STANDARD_DEFAULT is set to invalid value '" + std::string(defaultStd) + "'"; - this->Makefile->IssueMessage(cmake::INTERNAL_ERROR, e); + this->IssueMessage(cmake::INTERNAL_ERROR, e); return; } @@ -2301,7 +2317,7 @@ bool cmLocalGenerator::GetShouldUseOldFlags(bool shared, << flagsVar << " was removed.\n" << cmPolicies::GetPolicyWarning(cmPolicies::CMP0018); - this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, e.str()); + this->IssueMessage(cmake::AUTHOR_WARNING, e.str()); // fall through to OLD behaviour } case cmPolicies::OLD: @@ -2813,7 +2829,7 @@ cmLocalGenerator << " " << ssin << "\n" << "cannot be safely placed under this directory. " << "The build may not work correctly."; - this->Makefile->IssueMessage(cmake::WARNING, m.str()); + this->IssueMessage(cmake::WARNING, m.str()); } } #else diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 6a8c5aa5f..4452eef65 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -14,6 +14,7 @@ #include "cmStandardIncludes.h" #include "cmState.h" +#include "cmake.h" #include "cmOutputConverter.h" class cmMakefile; @@ -304,6 +305,9 @@ public: bool IsMinGWMake() const; bool IsNMake() const; + void IssueMessage(cmake::MessageType t, std::string const& text) const; + + void ComputeObjectMaxPath(); protected: ///! put all the libraries for a target on into the given stream From 217c243db04a21763848ac048edf153cd93bd883 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 14 Jun 2015 01:08:34 +0200 Subject: [PATCH 0171/1048] cmake: Update the current snapshot when Resetting. This will matter when definitions are stored in the cmState. --- Source/cmState.cxx | 6 ++++-- Source/cmState.h | 2 +- Source/cmake.cxx | 3 ++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Source/cmState.cxx b/Source/cmState.cxx index f0c7e6dab..58500cc10 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -219,13 +219,13 @@ void cmState::RemoveCacheEntryProperty(std::string const& key, ->GetCacheIterator(key.c_str()).SetProperty(propertyName, (void*)0); } -void cmState::Reset() +cmState::Snapshot cmState::Reset() { this->GlobalProperties.clear(); this->PropertyDefinitions.clear(); this->BuildsystemDirectory.Truncate(); - this->SnapshotData.Truncate(); + PositionType pos = this->SnapshotData.Truncate(); this->DefineProperty ("RULE_LAUNCH_COMPILE", cmProperty::DIRECTORY, @@ -246,6 +246,8 @@ void cmState::Reset() this->DefineProperty ("RULE_LAUNCH_CUSTOM", cmProperty::TARGET, "", "", true); + + return Snapshot(this, pos); } void cmState::DefineProperty(const std::string& name, diff --git a/Source/cmState.h b/Source/cmState.h index 070a08b58..9c7574f7b 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -105,7 +105,7 @@ public: void RemoveCacheEntryProperty(std::string const& key, std::string const& propertyName); - void Reset(); + Snapshot Reset(); // Define a property void DefineProperty(const std::string& name, cmProperty::ScopeType scope, const char *ShortDescription, diff --git a/Source/cmake.cxx b/Source/cmake.cxx index eeb6575c0..e51b260cd 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -186,7 +186,7 @@ cmake::~cmake() void cmake::CleanupCommandsAndMacros() { - this->State->Reset(); + this->CurrentSnapshot = this->State->Reset(); this->State->RemoveUserDefinedCommands(); } @@ -370,6 +370,7 @@ void cmake::ReadListFile(const std::vector& args, // read in the list file to fill the cache if(path) { + this->CurrentSnapshot = this->State->Reset(); std::string homeDir = this->GetHomeDirectory(); std::string homeOutputDir = this->GetHomeOutputDirectory(); this->SetHomeDirectory(cmSystemTools::GetCurrentWorkingDirectory()); From f971ab04cfdcb73e1ac2b182caf302172aebe6a8 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 23 May 2015 21:28:30 +0200 Subject: [PATCH 0172/1048] cmMacroCommand: Store the FilePath when creating the prototype. Instead of setting it each time the macro is invoked. --- Source/cmMacroCommand.cxx | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx index 028ab6223..7793dc40f 100644 --- a/Source/cmMacroCommand.cxx +++ b/Source/cmMacroCommand.cxx @@ -122,10 +122,6 @@ bool cmMacroHelperCommand::InvokeInitialPass sprintf(argvName,"${ARGV%i}",j); argVs.push_back(argvName); } - if(!this->Functions.empty()) - { - this->FilePath = this->Functions[0].FilePath; - } // Invoke all the functions that were collected in the block. cmListFileFunction newLFF; // for each function @@ -225,6 +221,7 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf, cmMacroHelperCommand *f = new cmMacroHelperCommand(); f->Args = this->Args; f->Functions = this->Functions; + f->FilePath = this->GetStartingContext().FilePath; mf.RecordPolicies(f->Policies); std::string newName = "_" + this->Args[0]; mf.GetState()->RenameCommand(this->Args[0], newName); From 569f4785371399628dd401e2522dccc54c73e34e Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 23 May 2015 22:21:08 +0200 Subject: [PATCH 0173/1048] cmFunctionCommand: Store the FilePath when creating the prototype. --- Source/cmFunctionCommand.cxx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx index dc6d2d270..848cfd1a2 100644 --- a/Source/cmFunctionCommand.cxx +++ b/Source/cmFunctionCommand.cxx @@ -43,6 +43,7 @@ public: newC->Args = this->Args; newC->Functions = this->Functions; newC->Policies = this->Policies; + newC->FilePath = this->FilePath; return newC; } @@ -71,6 +72,7 @@ public: std::vector Args; std::vector Functions; cmPolicies::PolicyMap Policies; + std::string FilePath; }; bool cmFunctionHelperCommand::InvokeInitialPass @@ -171,6 +173,7 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf, cmFunctionHelperCommand *f = new cmFunctionHelperCommand(); f->Args = this->Args; f->Functions = this->Functions; + f->FilePath = this->GetStartingContext().FilePath; mf.RecordPolicies(f->Policies); // Set the FilePath on the arguments to match the function since it is From 076760a63c665dd2269c74d415e323f55969f544 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 23 May 2015 20:32:05 +0200 Subject: [PATCH 0174/1048] cmMakefile: Add filename context to ExpandArguments. The cmListFileArgument currently stores a FilePath for use in this method. The filename is the same as the CMAKE_CURRENT_LIST_FILE, except if executing a macro or function defined in another file. Set the context filename when expanding the arguments of macros and functions using the filename recorded when defining the prototype. --- Source/cmFunctionCommand.cxx | 3 ++- Source/cmMacroCommand.cxx | 3 ++- Source/cmMakefile.cxx | 29 +++++++++++++++++++++++------ Source/cmMakefile.h | 8 ++++++-- 4 files changed, 33 insertions(+), 10 deletions(-) diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx index 848cfd1a2..662f77d32 100644 --- a/Source/cmFunctionCommand.cxx +++ b/Source/cmFunctionCommand.cxx @@ -215,7 +215,8 @@ ShouldRemove(const cmListFileFunction& lff, cmMakefile &mf) if(!cmSystemTools::Strucmp(lff.Name.c_str(),"endfunction")) { std::vector expandedArguments; - mf.ExpandArguments(lff.Arguments, expandedArguments); + mf.ExpandArguments(lff.Arguments, expandedArguments, + this->GetStartingContext().FilePath.c_str()); // if the endfunction has arguments then make sure // they match the ones in the opening function command if ((expandedArguments.empty() || diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx index 7793dc40f..c3e67d747 100644 --- a/Source/cmMacroCommand.cxx +++ b/Source/cmMacroCommand.cxx @@ -251,7 +251,8 @@ ShouldRemove(const cmListFileFunction& lff, cmMakefile &mf) if(!cmSystemTools::Strucmp(lff.Name.c_str(),"endmacro")) { std::vector expandedArguments; - mf.ExpandArguments(lff.Arguments, expandedArguments); + mf.ExpandArguments(lff.Arguments, expandedArguments, + this->GetStartingContext().FilePath.c_str()); // if the endmacro has arguments make sure they // match the arguments of the macro if ((expandedArguments.empty() || diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 63dbe27fc..72aa74cb3 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -3313,11 +3313,25 @@ bool cmMakefile::IsLoopBlock() const return !this->LoopBlockCounter.empty() && this->LoopBlockCounter.top() > 0; } +std::string cmMakefile::GetExecutionFilePath() const +{ + if (this->CallStack.empty()) + { + return std::string(); + } + return this->CallStack.back().Context->FilePath; +} + //---------------------------------------------------------------------------- bool cmMakefile::ExpandArguments( std::vector const& inArgs, - std::vector& outArgs) const + std::vector& outArgs, const char* filename) const { + std::string efp = this->GetExecutionFilePath(); + if (!filename) + { + filename = efp.c_str(); + } std::vector::const_iterator i; std::string value; outArgs.reserve(inArgs.size()); @@ -3332,8 +3346,7 @@ bool cmMakefile::ExpandArguments( // Expand the variables in the argument. value = i->Value; this->ExpandVariablesInString(value, false, false, false, - i->FilePath, i->Line, - false, false); + filename, i->Line, false, false); // If the argument is quoted, it should be one argument. // Otherwise, it may be a list of arguments. @@ -3352,8 +3365,13 @@ bool cmMakefile::ExpandArguments( //---------------------------------------------------------------------------- bool cmMakefile::ExpandArguments( std::vector const& inArgs, - std::vector& outArgs) const + std::vector& outArgs, const char* filename) const { + std::string efp = this->GetExecutionFilePath(); + if (!filename) + { + filename = efp.c_str(); + } std::vector::const_iterator i; std::string value; outArgs.reserve(inArgs.size()); @@ -3368,8 +3386,7 @@ bool cmMakefile::ExpandArguments( // Expand the variables in the argument. value = i->Value; this->ExpandVariablesInString(value, false, false, false, - i->FilePath, i->Line, - false, false); + filename, i->Line, false, false); // If the argument is quoted, it should be one argument. // Otherwise, it may be a list of arguments. diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 86bde0ca7..8930b6dff 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -662,10 +662,12 @@ public: * variable replacement and list expansion. */ bool ExpandArguments(std::vector const& inArgs, - std::vector& outArgs) const; + std::vector& outArgs, + const char* filename = 0) const; bool ExpandArguments(std::vector const& inArgs, - std::vector& outArgs) const; + std::vector& outArgs, + const char* filename = 0) const; /** * Get the instance @@ -840,6 +842,8 @@ public: const char* GetDefineFlagsCMP0059() const; + std::string GetExecutionFilePath() const; + protected: // add link libraries and directories to the target void AddGlobalLinkInformation(const std::string& name, cmTarget& target); From a863c59f70a7556c010990a362e4d13792670148 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 13 Jun 2015 19:18:28 +0200 Subject: [PATCH 0175/1048] cmMakefile: Use GetExecutionFileStack method. --- Source/cmMakefile.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 72aa74cb3..a1b1a94f1 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -308,7 +308,7 @@ cmListFileContext cmMakefile::GetExecutionContext() const void cmMakefile::PrintCommandTrace(const cmListFileFunction& lff) const { std::ostringstream msg; - msg << lff.FilePath << "(" << lff.Line << "): "; + msg << this->GetExecutionFilePath() << "(" << lff.Line << "): "; msg << lff.Name << "("; for(std::vector::const_iterator i = lff.Arguments.begin(); i != lff.Arguments.end(); ++i) From 782657db48e0d5f0d33a19ad51678d36ddfa7ad5 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 23 May 2015 23:43:37 +0200 Subject: [PATCH 0176/1048] cmListFileArgument: Remove FilePath member. It is now unused. --- Source/cmCPluginAPI.cxx | 3 +-- Source/cmFunctionCommand.cxx | 11 ----------- Source/cmListFileCache.cxx | 5 ++--- Source/cmListFileCache.h | 12 +++++------- Source/cmMacroCommand.cxx | 5 ----- Source/cmVariableWatchCommand.cxx | 12 ++++++------ 6 files changed, 14 insertions(+), 34 deletions(-) diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx index 0d24ed5ed..591a2cd81 100644 --- a/Source/cmCPluginAPI.cxx +++ b/Source/cmCPluginAPI.cxx @@ -426,8 +426,7 @@ int CCONV cmExecuteCommand(void *arg, const char *name, { // Assume all arguments are quoted. lff.Arguments.push_back( - cmListFileArgument(args[i], cmListFileArgument::Quoted, - "[CMake-Plugin]", 0)); + cmListFileArgument(args[i], cmListFileArgument::Quoted, 0)); } cmExecutionStatus status; return mf->ExecuteCommand(lff,status); diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx index 662f77d32..b3576c35d 100644 --- a/Source/cmFunctionCommand.cxx +++ b/Source/cmFunctionCommand.cxx @@ -176,17 +176,6 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf, f->FilePath = this->GetStartingContext().FilePath; mf.RecordPolicies(f->Policies); - // Set the FilePath on the arguments to match the function since it is - // not stored and the original values may be freed - for (unsigned int i = 0; i < f->Functions.size(); ++i) - { - for (unsigned int j = 0; j < f->Functions[i].Arguments.size(); ++j) - { - f->Functions[i].Arguments[j].FilePath = - f->Functions[i].FilePath.c_str(); - } - } - std::string newName = "_" + this->Args[0]; mf.GetState()->RenameCommand(this->Args[0], newName); mf.GetState()->AddCommand(f); diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx index ca583145a..006ca4c1f 100644 --- a/Source/cmListFileCache.cxx +++ b/Source/cmListFileCache.cxx @@ -234,8 +234,7 @@ bool cmListFile::ParseFile(const char* filename, { cmListFileFunction project; project.Name = "PROJECT"; - cmListFileArgument prj("Project", cmListFileArgument::Unquoted, - filename, 0); + cmListFileArgument prj("Project", cmListFileArgument::Unquoted, 0); project.Arguments.push_back(prj); this->Functions.insert(this->Functions.begin(),project); } @@ -375,7 +374,7 @@ bool cmListFileParser::ParseFunction(const char* name, long line) bool cmListFileParser::AddArgument(cmListFileLexer_Token* token, cmListFileArgument::Delimiter delim) { - cmListFileArgument a(token->text, delim, this->FileName, token->line); + cmListFileArgument a(token->text, delim, token->line); this->Function.Arguments.push_back(a); if(this->Separation == SeparationOkay) { diff --git a/Source/cmListFileCache.h b/Source/cmListFileCache.h index 4002d94b0..f5859ec63 100644 --- a/Source/cmListFileCache.h +++ b/Source/cmListFileCache.h @@ -33,12 +33,11 @@ struct cmListFileArgument Quoted, Bracket }; - cmListFileArgument(): Value(), Delim(Unquoted), FilePath(0), Line(0) {} - cmListFileArgument(const cmListFileArgument& r): - Value(r.Value), Delim(r.Delim), FilePath(r.FilePath), Line(r.Line) {} - cmListFileArgument(const std::string& v, Delimiter d, const char* file, - long line): Value(v), Delim(d), - FilePath(file), Line(line) {} + cmListFileArgument(): Value(), Delim(Unquoted), Line(0) {} + cmListFileArgument(const cmListFileArgument& r) + : Value(r.Value), Delim(r.Delim), Line(r.Line) {} + cmListFileArgument(const std::string& v, Delimiter d, long line) + : Value(v), Delim(d), Line(line) {} bool operator == (const cmListFileArgument& r) const { return (this->Value == r.Value) && (this->Delim == r.Delim); @@ -49,7 +48,6 @@ struct cmListFileArgument } std::string Value; Delimiter Delim; - const char* FilePath; long Line; }; diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx index c3e67d747..0b945b217 100644 --- a/Source/cmMacroCommand.cxx +++ b/Source/cmMacroCommand.cxx @@ -139,10 +139,6 @@ bool cmMacroHelperCommand::InvokeInitialPass this->Functions[c].Arguments.begin(); k != this->Functions[c].Arguments.end(); ++k) { - // Set the FilePath on the arguments to match the function since it is - // not stored and the original values may be freed - k->FilePath = this->FilePath.c_str(); - cmListFileArgument arg; arg.Value = k->Value; if(k->Delim != cmListFileArgument::Bracket) @@ -173,7 +169,6 @@ bool cmMacroHelperCommand::InvokeInitialPass } } arg.Delim = k->Delim; - arg.FilePath = k->FilePath; arg.Line = k->Line; newLFF.Arguments.push_back(arg); } diff --git a/Source/cmVariableWatchCommand.cxx b/Source/cmVariableWatchCommand.cxx index 09cef5e5d..6521c04c2 100644 --- a/Source/cmVariableWatchCommand.cxx +++ b/Source/cmVariableWatchCommand.cxx @@ -49,21 +49,21 @@ static void cmVariableWatchCommandVariableAccessed( newLFF.Arguments.clear(); newLFF.Arguments.push_back( cmListFileArgument(variable, cmListFileArgument::Quoted, - "unknown", 9999)); + 9999)); newLFF.Arguments.push_back( cmListFileArgument(accessString, cmListFileArgument::Quoted, - "unknown", 9999)); + 9999)); newLFF.Arguments.push_back( cmListFileArgument(newValue?newValue:"", cmListFileArgument::Quoted, - "unknown", 9999)); + 9999)); newLFF.Arguments.push_back( cmListFileArgument(currentListFile, cmListFileArgument::Quoted, - "unknown", 9999)); + 9999)); newLFF.Arguments.push_back( cmListFileArgument(stack, cmListFileArgument::Quoted, - "unknown", 9999)); + 9999)); newLFF.Name = data->Command; - newLFF.FilePath = "Some weird path"; + newLFF.FilePath = "unknown"; newLFF.Line = 9999; cmExecutionStatus status; if(!makefile->ExecuteCommand(newLFF,status)) From 8bfaadfa394c9b462259ea13df6b2df7c4544ab4 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 6 Jun 2015 14:07:15 +0200 Subject: [PATCH 0177/1048] cmMakefile: Move IsRoot API from cmLocalGenerator. --- Source/cmGlobalUnixMakefileGenerator3.cxx | 4 ++-- Source/cmLocalGenerator.cxx | 5 ----- Source/cmLocalGenerator.h | 3 --- Source/cmLocalNinjaGenerator.cxx | 4 ++-- Source/cmMakefile.cxx | 5 +++++ Source/cmMakefile.h | 3 +++ Source/cmProjectCommand.cxx | 2 +- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 4fe52dde7..0f61225f5 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -529,7 +529,7 @@ cmGlobalUnixMakefileGenerator3 cmLocalUnixMakefileGenerator3* lg) { // Only subdirectories need these rules. - if(lg->IsRootMakefile()) + if(lg->GetMakefile()->IsRootMakefile()) { return; } @@ -1034,7 +1034,7 @@ void cmGlobalUnixMakefileGenerator3::WriteHelpRule static_cast(this->LocalGenerators[i]); // for the passed in makefile or if this is the top Makefile wripte out // the targets - if (lg2 == lg || lg->IsRootMakefile()) + if (lg2 == lg || lg->GetMakefile()->IsRootMakefile()) { // for each target Generate the rule files for each target. cmTargets& targets = lg2->GetMakefile()->GetTargets(); diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index a42d5a755..119cba9d8 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -68,11 +68,6 @@ cmLocalGenerator::~cmLocalGenerator() delete this->Makefile; } -bool cmLocalGenerator::IsRootMakefile() const -{ - return !this->StateSnapshot.GetBuildsystemDirectoryParent().IsValid(); -} - void cmLocalGenerator::IssueMessage(cmake::MessageType t, std::string const& text) const { diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 4452eef65..a3f95886e 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -40,9 +40,6 @@ public: cmState::Snapshot snapshot); virtual ~cmLocalGenerator(); - /// @return whether we are processing the top CMakeLists.txt file. - bool IsRootMakefile() const; - /** * Generate the makefile for this directory. */ diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index 427ae106c..4db36fc5b 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -58,7 +58,7 @@ void cmLocalNinjaGenerator::Generate() #endif // We do that only once for the top CMakeLists.txt file. - if(this->IsRootMakefile()) + if(this->Makefile->IsRootMakefile()) { this->WriteBuildFileTop(); @@ -298,7 +298,7 @@ void cmLocalNinjaGenerator::WriteProcessedMakefile(std::ostream& os) << "# Write statements declared in CMakeLists.txt:" << std::endl << "# " << this->Makefile->GetDefinition("CMAKE_CURRENT_LIST_FILE") << std::endl; - if(this->IsRootMakefile()) + if(this->Makefile->IsRootMakefile()) os << "# Which is the root file." << std::endl; cmGlobalNinjaGenerator::WriteDivider(os); os << std::endl; diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 03380623b..cf7897e4b 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1608,6 +1608,11 @@ void cmMakefile::PopMacroScope(bool reportError) this->PopFunctionBlockerBarrier(reportError); } +bool cmMakefile::IsRootMakefile() const +{ + return !this->StateSnapshot.GetBuildsystemDirectoryParent().IsValid(); +} + //---------------------------------------------------------------------------- class cmMakefileCurrent { diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 86bde0ca7..44bd8c61c 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -90,6 +90,9 @@ public: */ void AddFunctionBlocker(cmFunctionBlocker* fb); + /// @return whether we are processing the top CMakeLists.txt file. + bool IsRootMakefile() const; + /** * Remove the function blocker whose scope ends with the given command. * This returns ownership of the function blocker object. diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx index 90bc1115e..46d7e0113 100644 --- a/Source/cmProjectCommand.cxx +++ b/Source/cmProjectCommand.cxx @@ -53,7 +53,7 @@ bool cmProjectCommand // CMAKE_PROJECT_NAME will match PROJECT_NAME, and cmake --build // will work. if(!this->Makefile->GetDefinition("CMAKE_PROJECT_NAME") - || (this->Makefile->GetLocalGenerator()->IsRootMakefile())) + || (this->Makefile->IsRootMakefile())) { this->Makefile->AddDefinition("CMAKE_PROJECT_NAME", args[0].c_str()); this->Makefile->AddCacheDefinition From 080489b8a92253bedbb67cc7958351350f4b2341 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 6 Jun 2015 14:39:27 +0200 Subject: [PATCH 0178/1048] cmMakefile: Use member directly instead of through method. This function will not be around much longer anyway. --- Source/cmMakefile.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index cf7897e4b..64d863861 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -105,7 +105,7 @@ public: ++it; if(it == this->VarStack.rend()) { - cmLocalGenerator* plg = mf->GetLocalGenerator()->GetParent(); + cmLocalGenerator* plg = mf->LocalGenerator->GetParent(); if(!plg) { return false; From 61c0113c13fe4a65c394e56cc0354db0b80d9c4c Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 6 Jun 2015 13:06:47 +0200 Subject: [PATCH 0179/1048] cmLocalUnixMakefileGenerator3: Remove unused method. --- Source/cmLocalUnixMakefileGenerator3.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index 4e4d146a9..b097c95ed 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -149,9 +149,6 @@ public: void AddImplicitDepends(cmTarget const& tgt, const std::string& lang, const char* obj, const char* src); - void AppendGlobalTargetDepends(std::vector& depends, - cmTarget& target); - // write the target rules for the local Makefile into the stream void WriteLocalAllRules(std::ostream& ruleFileStream); From b3e2e332eb9c2a7d73ec872664cee896248c6c38 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 6 Jun 2015 14:59:22 +0200 Subject: [PATCH 0180/1048] QtAutogen: Get the global generator from the Makefile. --- Source/cmQtAutoGenerators.cxx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index f472ed8ee..53fea8379 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -368,8 +368,7 @@ bool cmQtAutoGenerators::InitializeAutogenTarget(cmTarget* target) #if defined(_WIN32) && !defined(__CYGWIN__) bool usePRE_BUILD = false; - cmLocalGenerator* localGen = makefile->GetLocalGenerator(); - cmGlobalGenerator* gg = localGen->GetGlobalGenerator(); + cmGlobalGenerator* gg = makefile->GetGlobalGenerator(); if(gg->GetName().find("Visual Studio") != std::string::npos) { cmGlobalVisualStudioGenerator* vsgg = From 820986edfff97779bb0c84fd9da3b284921c8ae4 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 6 Jun 2015 12:57:19 +0200 Subject: [PATCH 0181/1048] cmLocalGenerator: Constify GetIncludeDirectories method. --- Source/cmLocalGenerator.cxx | 2 +- Source/cmLocalGenerator.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 119cba9d8..6f98ee2a0 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1341,7 +1341,7 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector& dirs, const std::string& lang, const std::string& config, bool stripImplicitInclDirs - ) + ) const { // Need to decide whether to automatically include the source and // binary directories at the beginning of the include path. diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index a3f95886e..98f4d3a22 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -183,7 +183,7 @@ public: cmGeneratorTarget* target, const std::string& lang = "C", const std::string& config = "", - bool stripImplicitInclDirs = true); + bool stripImplicitInclDirs = true) const; void AddCompileOptions(std::string& flags, cmTarget* target, const std::string& lang, const std::string& config); void AddCompileDefinitions(std::set& defines, From f4144af90598fb4ae55ecd260d0b64be9d822673 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Mon, 22 Jun 2015 00:01:04 -0400 Subject: [PATCH 0182/1048] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 9d6817251..1532fd008 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 3) -set(CMake_VERSION_PATCH 20150621) +set(CMake_VERSION_PATCH 20150622) #set(CMake_VERSION_RC 1) From 2e9333a1d0979c4d6ecfe8fd16382ea6526dec9c Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 6 Jun 2015 13:00:51 +0200 Subject: [PATCH 0183/1048] C::B: Get the Makefile from the LocalGenerator, not vice-versa. The Makefile is a configure-time concept, and the LocalGenerator is a generate time concept. The LocalGenerator should not be available from the Makefile. --- Source/cmExtraCodeBlocksGenerator.cxx | 24 +++++++++++++----------- Source/cmExtraCodeBlocksGenerator.h | 5 +++-- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx index e374387de..a31e83242 100644 --- a/Source/cmExtraCodeBlocksGenerator.cxx +++ b/Source/cmExtraCodeBlocksGenerator.cxx @@ -313,7 +313,7 @@ void cmExtraCodeBlocksGenerator " "<\n"; - this->AppendTarget(fout, "all", 0, make.c_str(), mf, compiler.c_str()); + this->AppendTarget(fout, "all", 0, make.c_str(), lgs[0], compiler.c_str()); // add all executable and library targets and some of the GLOBAL // and UTILITY targets @@ -335,7 +335,7 @@ void cmExtraCodeBlocksGenerator makefile->GetHomeOutputDirectory())==0) { this->AppendTarget(fout, ti->first, 0, - make.c_str(), makefile, compiler.c_str()); + make.c_str(), *lg, compiler.c_str()); } } break; @@ -351,7 +351,7 @@ void cmExtraCodeBlocksGenerator } this->AppendTarget(fout, ti->first, 0, - make.c_str(), makefile, compiler.c_str()); + make.c_str(), *lg, compiler.c_str()); break; case cmTarget::EXECUTABLE: case cmTarget::STATIC_LIBRARY: @@ -360,11 +360,11 @@ void cmExtraCodeBlocksGenerator case cmTarget::OBJECT_LIBRARY: { this->AppendTarget(fout, ti->first, &ti->second, - make.c_str(), makefile, compiler.c_str()); + make.c_str(), *lg, compiler.c_str()); std::string fastTarget = ti->first; fastTarget += "/fast"; this->AppendTarget(fout, fastTarget, &ti->second, - make.c_str(), makefile, compiler.c_str()); + make.c_str(), *lg, compiler.c_str()); } break; default: @@ -519,14 +519,16 @@ void cmExtraCodeBlocksGenerator // Write a dummy file for OBJECT libraries, so C::B can reference some file std::string cmExtraCodeBlocksGenerator::CreateDummyTargetFile( - cmMakefile* mf, cmTarget* target) const + cmLocalGenerator* lg, + cmTarget* target) const { + cmMakefile *mf = lg->GetMakefile(); // this file doesn't seem to be used by C::B in custom makefile mode, // but we generate a unique file for each OBJECT library so in case // C::B uses it in some way, the targets don't interfere with each other. std::string filename = mf->GetCurrentBinaryDirectory(); filename += "/"; - filename += mf->GetLocalGenerator()->GetTargetDirectory(*target); + filename += lg->GetTargetDirectory(*target); filename += "/"; filename += target->GetName(); filename += ".objlib"; @@ -547,9 +549,10 @@ void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout, const std::string& targetName, cmTarget* target, const char* make, - const cmMakefile* makefile, + const cmLocalGenerator* lg, const char* compiler) { + cmMakefile const* makefile = lg->GetMakefile(); std::string makefileName = makefile->GetCurrentBinaryDirectory(); makefileName += "/Makefile"; @@ -583,7 +586,7 @@ void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout, std::string location; if ( target->GetType()==cmTarget::OBJECT_LIBRARY) { - location = this->CreateDummyTargetFile(const_cast(makefile), + location = this->CreateDummyTargetFile(const_cast(lg), target); } else @@ -618,8 +621,7 @@ void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout, std::set uniqIncludeDirs; std::vector includes; - target->GetMakefile()->GetLocalGenerator()-> - GetIncludeDirectories(includes, gtgt, "C", buildType); + lg->GetIncludeDirectories(includes, gtgt, "C", buildType); uniqIncludeDirs.insert(includes.begin(), includes.end()); diff --git a/Source/cmExtraCodeBlocksGenerator.h b/Source/cmExtraCodeBlocksGenerator.h index 97da1b862..e5ede9aca 100644 --- a/Source/cmExtraCodeBlocksGenerator.h +++ b/Source/cmExtraCodeBlocksGenerator.h @@ -48,7 +48,8 @@ private: void CreateNewProjectFile(const std::vector& lgs, const std::string& filename); - std::string CreateDummyTargetFile(cmMakefile* mf, cmTarget* target) const; + std::string CreateDummyTargetFile(cmLocalGenerator* lg, + cmTarget* target) const; std::string GetCBCompilerId(const cmMakefile* mf); int GetCBTargetType(cmTarget* target); @@ -58,7 +59,7 @@ private: const std::string& targetName, cmTarget* target, const char* make, - const cmMakefile* makefile, + const cmLocalGenerator* lg, const char* compiler); }; From b2b41b83ff594555f3b80c6c2fd12e10e1e97458 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 6 Jun 2015 12:59:25 +0200 Subject: [PATCH 0184/1048] cmGeneratorTarget: Add accessor for cmLocalGenerator. --- Source/cmGeneratorTarget.cxx | 5 +++++ Source/cmGeneratorTarget.h | 2 ++ 2 files changed, 7 insertions(+) diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 2f68ab031..482eefddc 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -228,6 +228,11 @@ cmGeneratorTarget::cmGeneratorTarget(cmTarget* t): Target(t), this->GlobalGenerator = this->Makefile->GetGlobalGenerator(); } +cmLocalGenerator* cmGeneratorTarget::GetLocalGenerator() const +{ + return this->LocalGenerator; +} + //---------------------------------------------------------------------------- int cmGeneratorTarget::GetType() const { diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index a8edcb8cb..645b79284 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -26,6 +26,8 @@ class cmGeneratorTarget public: cmGeneratorTarget(cmTarget*); + cmLocalGenerator* GetLocalGenerator() const; + int GetType() const; std::string GetName() const; const char *GetProperty(const std::string& prop) const; From dee197fe610b5fe50403da796539b63a74430bd3 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 6 Jun 2015 13:02:59 +0200 Subject: [PATCH 0185/1048] GHS: Use a cmGeneratorTarget in generator API. --- Source/cmGhsMultiTargetGenerator.cxx | 18 +++++++++--------- Source/cmGhsMultiTargetGenerator.h | 3 ++- Source/cmLocalGhsMultiGenerator.cxx | 2 +- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx index 01e2011c5..14efc3e66 100644 --- a/Source/cmGhsMultiTargetGenerator.cxx +++ b/Source/cmGhsMultiTargetGenerator.cxx @@ -21,23 +21,24 @@ std::string const cmGhsMultiTargetGenerator::DDOption("-dynamic"); -cmGhsMultiTargetGenerator::cmGhsMultiTargetGenerator(cmTarget *target) - : Target(target) +cmGhsMultiTargetGenerator::cmGhsMultiTargetGenerator(cmGeneratorTarget *target) + : Target(target->Target) + , GeneratorTarget(target) , LocalGenerator(static_cast( - target->GetMakefile()->GetLocalGenerator())) - , Makefile(target->GetMakefile()) - , TargetGroup(DetermineIfTargetGroup(target)) + target->GetLocalGenerator())) + , Makefile(target->Target->GetMakefile()) + , TargetGroup(DetermineIfTargetGroup(target->Target)) , DynamicDownload(false) { - this->RelBuildFilePath = this->GetRelBuildFilePath(target); + this->RelBuildFilePath = this->GetRelBuildFilePath(target->Target); this->RelOutputFileName = this->RelBuildFilePath + this->Target->GetName() + ".a"; this->RelBuildFileName = this->RelBuildFilePath; - this->RelBuildFileName += this->GetBuildFileName(target); + this->RelBuildFileName += this->GetBuildFileName(target->Target); - std::string absPathToRoot = this->GetAbsPathToRoot(target); + std::string absPathToRoot = this->GetAbsPathToRoot(target->Target); absPathToRoot = this->AddSlashIfNeededToPath(absPathToRoot); this->AbsBuildFilePath = absPathToRoot + this->RelBuildFilePath; this->AbsBuildFileName = absPathToRoot + this->RelBuildFileName; @@ -373,7 +374,6 @@ void cmGhsMultiTargetGenerator::WriteTargetLinkLibraries() cmTarget *tg(GetGlobalGenerator()->FindTarget(libName)); if (NULL != tg) { - cmGhsMultiTargetGenerator gmtg(tg); libName = tg->GetName() + ".a"; } *this->GetFolderBuildStreams() << " -l\"" << libName << "\"" diff --git a/Source/cmGhsMultiTargetGenerator.h b/Source/cmGhsMultiTargetGenerator.h index 8e81db870..c29a31ead 100644 --- a/Source/cmGhsMultiTargetGenerator.h +++ b/Source/cmGhsMultiTargetGenerator.h @@ -27,7 +27,7 @@ class cmCustomCommand; class cmGhsMultiTargetGenerator { public: - cmGhsMultiTargetGenerator(cmTarget *target); + cmGhsMultiTargetGenerator(cmGeneratorTarget* target); virtual ~cmGhsMultiTargetGenerator(); @@ -100,6 +100,7 @@ private: const std::string &language); cmTarget *Target; + cmGeneratorTarget* GeneratorTarget; cmLocalGhsMultiGenerator *LocalGenerator; cmMakefile *Makefile; std::string AbsBuildFilePath; diff --git a/Source/cmLocalGhsMultiGenerator.cxx b/Source/cmLocalGhsMultiGenerator.cxx index 870b9b98d..8e498ddee 100644 --- a/Source/cmLocalGhsMultiGenerator.cxx +++ b/Source/cmLocalGhsMultiGenerator.cxx @@ -37,7 +37,7 @@ void cmLocalGhsMultiGenerator::Generate() { continue; } - cmGhsMultiTargetGenerator tg(l->second->Target); + cmGhsMultiTargetGenerator tg(l->second); tg.Generate(); } } From 8ec60c675a3fb4294776b2d644974361b145c444 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 6 Jun 2015 13:12:24 +0200 Subject: [PATCH 0186/1048] cmGlobalGenerator: Create GeneratorTargets with a local generator. --- Source/cmGlobalGenerator.cxx | 5 +++-- Source/cmGlobalGenerator.h | 2 +- Source/cmake.cxx | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index a46211395..c4396c628 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1456,9 +1456,10 @@ void cmGlobalGenerator::FinalizeTargetCompileInfo() } //---------------------------------------------------------------------------- -void cmGlobalGenerator::CreateGeneratorTargets(cmMakefile *mf) +void cmGlobalGenerator::CreateGeneratorTargets(cmLocalGenerator *lg) { cmGeneratorTargetsType generatorTargets; + cmMakefile* mf = lg->GetMakefile(); cmTargets& targets = mf->GetTargets(); for(cmTargets::iterator ti = targets.begin(); ti != targets.end(); ++ti) @@ -1487,7 +1488,7 @@ void cmGlobalGenerator::CreateGeneratorTargets() // Construct per-target generator information. for(unsigned int i=0; i < this->LocalGenerators.size(); ++i) { - this->CreateGeneratorTargets(this->LocalGenerators[i]->GetMakefile()); + this->CreateGeneratorTargets(this->LocalGenerators[i]); } } diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index f02df90c1..d606cc939 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -483,7 +483,7 @@ private: // Per-target generator information. cmGeneratorTargetsType GeneratorTargets; friend class cmake; - void CreateGeneratorTargets(cmMakefile* mf); + void CreateGeneratorTargets(cmLocalGenerator* lg); void CreateGeneratorTargets(); void ClearGeneratorMembers(); diff --git a/Source/cmake.cxx b/Source/cmake.cxx index e51b260cd..05703990f 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -483,7 +483,7 @@ bool cmake::FindPackage(const std::vector& args) std::string linkPath; std::string flags; std::string linkFlags; - gg->CreateGeneratorTargets(mf); + gg->CreateGeneratorTargets(lg.get()); cmGeneratorTarget *gtgt = gg->GetGeneratorTarget(tgt); lg->GetTargetFlags(linkLibs, frameworkPath, linkPath, flags, linkFlags, gtgt, false); From a3b210fd6cb85cba76f867e93d94dd835fa3278a Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 6 Jun 2015 13:14:04 +0200 Subject: [PATCH 0187/1048] cmGeneratorTarget: Require a cmLocalGenerator to construct. --- Source/cmGeneratorTarget.cxx | 5 +++-- Source/cmGeneratorTarget.h | 2 +- Source/cmGlobalGenerator.cxx | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 482eefddc..449455306 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -220,11 +220,12 @@ struct TagVisitor }; //---------------------------------------------------------------------------- -cmGeneratorTarget::cmGeneratorTarget(cmTarget* t): Target(t), +cmGeneratorTarget::cmGeneratorTarget(cmTarget* t, cmLocalGenerator* lg) + : Target(t), SourceFileFlagsConstructed(false) { this->Makefile = this->Target->GetMakefile(); - this->LocalGenerator = this->Makefile->GetLocalGenerator(); + this->LocalGenerator = lg; this->GlobalGenerator = this->Makefile->GetGlobalGenerator(); } diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 645b79284..675ee9ffa 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -24,7 +24,7 @@ class cmTarget; class cmGeneratorTarget { public: - cmGeneratorTarget(cmTarget*); + cmGeneratorTarget(cmTarget*, cmLocalGenerator* lg); cmLocalGenerator* GetLocalGenerator() const; diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index c4396c628..14eaeac7a 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1465,7 +1465,7 @@ void cmGlobalGenerator::CreateGeneratorTargets(cmLocalGenerator *lg) ti != targets.end(); ++ti) { cmTarget* t = &ti->second; - cmGeneratorTarget* gt = new cmGeneratorTarget(t); + cmGeneratorTarget* gt = new cmGeneratorTarget(t, lg); this->ComputeTargetObjectDirectory(gt); this->GeneratorTargets[t] = gt; generatorTargets[t] = gt; @@ -1475,7 +1475,7 @@ void cmGlobalGenerator::CreateGeneratorTargets(cmLocalGenerator *lg) j = mf->GetOwnedImportedTargets().begin(); j != mf->GetOwnedImportedTargets().end(); ++j) { - cmGeneratorTarget* gt = new cmGeneratorTarget(*j); + cmGeneratorTarget* gt = new cmGeneratorTarget(*j, lg); this->GeneratorTargets[*j] = gt; generatorTargets[*j] = gt; } From bb88668addb3746f6f043533f0405914834a0421 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 6 Jun 2015 14:02:24 +0200 Subject: [PATCH 0188/1048] cmNinjaGenerator: Require cmGeneratorTarget. --- Source/cmNinjaNormalTargetGenerator.cxx | 2 +- Source/cmNinjaTargetGenerator.cxx | 11 +++++------ Source/cmNinjaTargetGenerator.h | 2 +- Source/cmNinjaUtilityTargetGenerator.cxx | 2 +- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index bbf03ffe4..2fe53bfff 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -32,7 +32,7 @@ cmNinjaNormalTargetGenerator:: cmNinjaNormalTargetGenerator(cmGeneratorTarget* target) - : cmNinjaTargetGenerator(target->Target) + : cmNinjaTargetGenerator(target) , TargetNameOut() , TargetNameSO() , TargetNameReal() diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 6e35cd434..b18f36896 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -57,19 +57,18 @@ cmNinjaTargetGenerator::New(cmGeneratorTarget* target) } } -cmNinjaTargetGenerator::cmNinjaTargetGenerator(cmTarget* target) +cmNinjaTargetGenerator::cmNinjaTargetGenerator(cmGeneratorTarget* target) : MacOSXContentGenerator(0), OSXBundleGenerator(0), MacContentFolders(), - Target(target), - Makefile(target->GetMakefile()), + Target(target->Target), + Makefile(target->Makefile), LocalGenerator( - static_cast(Makefile->GetLocalGenerator())), + static_cast(target->GetLocalGenerator())), Objects() { - this->GeneratorTarget = - this->GetGlobalGenerator()->GetGeneratorTarget(target); + this->GeneratorTarget = target; MacOSXContentGenerator = new MacOSXContentGeneratorType(this); } diff --git a/Source/cmNinjaTargetGenerator.h b/Source/cmNinjaTargetGenerator.h index 4e7d8b3a1..fc361b2bd 100644 --- a/Source/cmNinjaTargetGenerator.h +++ b/Source/cmNinjaTargetGenerator.h @@ -33,7 +33,7 @@ public: static cmNinjaTargetGenerator* New(cmGeneratorTarget* target); /// Build a NinjaTargetGenerator. - cmNinjaTargetGenerator(cmTarget* target); + cmNinjaTargetGenerator(cmGeneratorTarget* target); /// Destructor. virtual ~cmNinjaTargetGenerator(); diff --git a/Source/cmNinjaUtilityTargetGenerator.cxx b/Source/cmNinjaUtilityTargetGenerator.cxx index 42d6b46fd..c3bf01133 100644 --- a/Source/cmNinjaUtilityTargetGenerator.cxx +++ b/Source/cmNinjaUtilityTargetGenerator.cxx @@ -21,7 +21,7 @@ cmNinjaUtilityTargetGenerator::cmNinjaUtilityTargetGenerator( cmGeneratorTarget *target) - : cmNinjaTargetGenerator(target->Target) {} + : cmNinjaTargetGenerator(target) {} cmNinjaUtilityTargetGenerator::~cmNinjaUtilityTargetGenerator() {} From 5aa556be560b782d149b53bccc12dfc2be2bda0b Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 6 Jun 2015 14:57:26 +0200 Subject: [PATCH 0189/1048] cmMakefileTargetGenerator: Require cmGeneratorTarget. --- Source/cmMakefileExecutableTargetGenerator.cxx | 2 +- Source/cmMakefileLibraryTargetGenerator.cxx | 2 +- Source/cmMakefileTargetGenerator.cxx | 9 ++++----- Source/cmMakefileTargetGenerator.h | 2 +- Source/cmMakefileUtilityTargetGenerator.cxx | 2 +- 5 files changed, 8 insertions(+), 9 deletions(-) diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx index 37b297e0b..416063f10 100644 --- a/Source/cmMakefileExecutableTargetGenerator.cxx +++ b/Source/cmMakefileExecutableTargetGenerator.cxx @@ -22,7 +22,7 @@ //---------------------------------------------------------------------------- cmMakefileExecutableTargetGenerator ::cmMakefileExecutableTargetGenerator(cmGeneratorTarget* target): - cmMakefileTargetGenerator(target->Target) + cmMakefileTargetGenerator(target) { this->CustomCommandDriver = OnDepends; this->Target->GetExecutableNames( diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index 450f57351..660027c96 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -22,7 +22,7 @@ //---------------------------------------------------------------------------- cmMakefileLibraryTargetGenerator ::cmMakefileLibraryTargetGenerator(cmGeneratorTarget* target): - cmMakefileTargetGenerator(target->Target) + cmMakefileTargetGenerator(target) { this->CustomCommandDriver = OnDepends; if (this->Target->GetType() != cmTarget::INTERFACE_LIBRARY) diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 402dfc6fa..fa471c977 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -32,7 +32,7 @@ #include -cmMakefileTargetGenerator::cmMakefileTargetGenerator(cmTarget* target) +cmMakefileTargetGenerator::cmMakefileTargetGenerator(cmGeneratorTarget* target) : OSXBundleGenerator(0) , MacOSXContentGenerator(0) { @@ -41,16 +41,15 @@ cmMakefileTargetGenerator::cmMakefileTargetGenerator(cmTarget* target) this->FlagFileStream = 0; this->CustomCommandDriver = OnBuild; this->FortranModuleDirectoryComputed = false; - this->Target = target; + this->Target = target->Target; this->Makefile = this->Target->GetMakefile(); this->LocalGenerator = - static_cast( - this->Makefile->GetLocalGenerator()); + static_cast(target->GetLocalGenerator()); this->ConfigName = this->LocalGenerator->ConfigurationName.c_str(); this->GlobalGenerator = static_cast( this->LocalGenerator->GetGlobalGenerator()); - this->GeneratorTarget = this->GlobalGenerator->GetGeneratorTarget(target); + this->GeneratorTarget = target; cmake* cm = this->GlobalGenerator->GetCMakeInstance(); this->NoRuleMessages = false; if(const char* ruleStatus = cm->GetState() diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h index 2e1b05261..9182236ef 100644 --- a/Source/cmMakefileTargetGenerator.h +++ b/Source/cmMakefileTargetGenerator.h @@ -34,7 +34,7 @@ class cmMakefileTargetGenerator { public: // constructor to set the ivars - cmMakefileTargetGenerator(cmTarget* target); + cmMakefileTargetGenerator(cmGeneratorTarget* target); virtual ~cmMakefileTargetGenerator(); // construct using this factory call diff --git a/Source/cmMakefileUtilityTargetGenerator.cxx b/Source/cmMakefileUtilityTargetGenerator.cxx index 25d929cce..303ca639f 100644 --- a/Source/cmMakefileUtilityTargetGenerator.cxx +++ b/Source/cmMakefileUtilityTargetGenerator.cxx @@ -21,7 +21,7 @@ //---------------------------------------------------------------------------- cmMakefileUtilityTargetGenerator ::cmMakefileUtilityTargetGenerator(cmGeneratorTarget* target): - cmMakefileTargetGenerator(target->Target) + cmMakefileTargetGenerator(target) { this->CustomCommandDriver = OnUtility; this->OSXBundleGenerator = new cmOSXBundleGenerator(target, From e77142350de1dec03ca788e3d3e278b7b9358fb5 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 6 Jun 2015 14:59:06 +0200 Subject: [PATCH 0190/1048] Get the local generator from the GeneratorTarget. The Makefile should not know the LocalGenerator at all --- Source/cmMakefileTargetGenerator.cxx | 4 +++- Source/cmOSXBundleGenerator.cxx | 2 +- Source/cmQtAutoGenerators.cxx | 6 +++--- Source/cmVisualStudio10TargetGenerator.cxx | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index fa471c977..09fad5cdc 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -1173,8 +1173,10 @@ void cmMakefileTargetGenerator::WriteTargetDependRules() && linkee->GetType() != cmTarget::INTERFACE_LIBRARY && emitted.insert(linkee).second) { + cmGeneratorTarget* gt = + this->GlobalGenerator->GetGeneratorTarget(linkee); + cmLocalGenerator* lg = gt->GetLocalGenerator(); cmMakefile* mf = linkee->GetMakefile(); - cmLocalGenerator* lg = mf->GetLocalGenerator(); std::string di = mf->GetCurrentBinaryDirectory(); di += "/"; di += lg->GetTargetDirectory(*linkee); diff --git a/Source/cmOSXBundleGenerator.cxx b/Source/cmOSXBundleGenerator.cxx index a8eef8244..3bc0eb734 100644 --- a/Source/cmOSXBundleGenerator.cxx +++ b/Source/cmOSXBundleGenerator.cxx @@ -22,7 +22,7 @@ cmOSXBundleGenerator(cmGeneratorTarget* target, const std::string& configName) : GT(target) , Makefile(target->Target->GetMakefile()) - , LocalGenerator(Makefile->GetLocalGenerator()) + , LocalGenerator(target->GetLocalGenerator()) , ConfigName(configName) , MacContentFolders(0) { diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index 53fea8379..b03e45a5a 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -521,10 +521,10 @@ static void GetCompileDefinitionsAndDirectories(cmTarget const* target, std::string &defs) { cmMakefile* makefile = target->GetMakefile(); - cmLocalGenerator* localGen = makefile->GetLocalGenerator(); + cmGlobalGenerator* globalGen = makefile->GetGlobalGenerator(); std::vector includeDirs; - cmGeneratorTarget *gtgt = localGen->GetGlobalGenerator() - ->GetGeneratorTarget(target); + cmGeneratorTarget *gtgt = globalGen->GetGeneratorTarget(target); + cmLocalGenerator *localGen = gtgt->GetLocalGenerator(); // Get the include dirs for this target, without stripping the implicit // include dirs off, see http://public.kitware.com/Bug/view.php?id=13667 localGen->GetIncludeDirectories(includeDirs, gtgt, "CXX", config, false); diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 9b78df3b7..12a1e42c0 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -176,7 +176,7 @@ cmVisualStudio10TargetGenerator(cmTarget* target, this->Makefile->GetConfigurations(this->Configurations); this->LocalGenerator = (cmLocalVisualStudio7Generator*) - this->Makefile->GetLocalGenerator(); + this->GeneratorTarget->GetLocalGenerator(); this->Name = this->Target->GetName(); this->GUID = this->GlobalGenerator->GetGUID(this->Name.c_str()); this->Platform = gg->GetPlatformName(); From 6ccb534df3a131d87ea14082fea05484039fc524 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Tue, 23 Jun 2015 00:01:05 -0400 Subject: [PATCH 0191/1048] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 1532fd008..98e75c7e8 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 3) -set(CMake_VERSION_PATCH 20150622) +set(CMake_VERSION_PATCH 20150623) #set(CMake_VERSION_RC 1) From 9579be1043a5d0156006a483f2a4724627fcbf14 Mon Sep 17 00:00:00 2001 From: Roger Leigh Date: Tue, 23 Jun 2015 08:57:59 +0000 Subject: [PATCH 0192/1048] FindIce: Update for Ice version 3.6.0 --- Modules/FindIce.cmake | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Modules/FindIce.cmake b/Modules/FindIce.cmake index 8493d80e2..b48919b10 100644 --- a/Modules/FindIce.cmake +++ b/Modules/FindIce.cmake @@ -28,6 +28,7 @@ # Ice_SLICE2FREEZE_EXECUTABLE - path to slice2freeze executable # Ice_SLICE2HTML_EXECUTABLE - path to slice2html executable # Ice_SLICE2JAVA_EXECUTABLE - path to slice2java executable +# Ice_SLICE2JS_EXECUTABLE - path to slice2js executable # Ice_SLICE2PHP_EXECUTABLE - path to slice2php executable # Ice_SLICE2PY_EXECUTABLE - path to slice2py executable # Ice_SLICE2RB_EXECUTABLE - path to slice2rb executable @@ -94,6 +95,8 @@ function(_Ice_FIND) # Released versions of Ice, including generic short forms set(ice_versions 3 + 3.6 + 3.6.0 3.5 3.5.1 3.5.0 @@ -205,6 +208,7 @@ function(_Ice_FIND) slice2freeze slice2html slice2java + slice2js slice2php slice2py slice2rb) @@ -379,6 +383,7 @@ if(Ice_DEBUG) message(STATUS "slice2freeze executable: ${Ice_SLICE2FREEZE_EXECUTABLE}") message(STATUS "slice2html executable: ${Ice_SLICE2HTML_EXECUTABLE}") message(STATUS "slice2java executable: ${Ice_SLICE2JAVA_EXECUTABLE}") + message(STATUS "slice2js executable: ${Ice_SLICE2JS_EXECUTABLE}") message(STATUS "slice2php executable: ${Ice_SLICE2PHP_EXECUTABLE}") message(STATUS "slice2py executable: ${Ice_SLICE2PY_EXECUTABLE}") message(STATUS "slice2rb executable: ${Ice_SLICE2RB_EXECUTABLE}") From 69c5f134a6d681e7e66052ad40e8e74cebf64e61 Mon Sep 17 00:00:00 2001 From: Roger Leigh Date: Tue, 23 Jun 2015 09:27:59 +0000 Subject: [PATCH 0193/1048] FindIce: Find all Ice executables --- Modules/FindIce.cmake | 114 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 111 insertions(+), 3 deletions(-) diff --git a/Modules/FindIce.cmake b/Modules/FindIce.cmake index b48919b10..c88c1b849 100644 --- a/Modules/FindIce.cmake +++ b/Modules/FindIce.cmake @@ -20,7 +20,7 @@ # Ice_SLICE_DIRS - the directories containing the Ice slice interface # definitions # -# Ice programs are reported in:: +# Ice slice programs are reported in:: # # Ice_SLICE2CPP_EXECUTABLE - path to slice2cpp executable # Ice_SLICE2CS_EXECUTABLE - path to slice2cs executable @@ -33,6 +33,44 @@ # Ice_SLICE2PY_EXECUTABLE - path to slice2py executable # Ice_SLICE2RB_EXECUTABLE - path to slice2rb executable # +# Ice programs are reported in:: +# +# Ice_GLACIER2ROUTER_EXECUTABLE - path to glacier2router executable +# Ice_ICEBOX_EXECUTABLE - path to icebox executable +# Ice_ICEBOXADMIN_EXECUTABLE - path to iceboxadmin executable +# Ice_ICEBOXD_EXECUTABLE - path to iceboxd executable +# Ice_ICEBOXNET_EXECUTABLE - path to iceboxnet executable +# Ice_ICEGRIDADMIN_EXECUTABLE - path to icegridadmin executable +# Ice_ICEGRIDNODE_EXECUTABLE - path to icegridnode executable +# Ice_ICEGRIDNODED_EXECUTABLE - path to icegridnoded executable +# Ice_ICEGRIDREGISTRY_EXECUTABLE - path to icegridregistry executable +# Ice_ICEGRIDREGISTRYD_EXECUTABLE - path to icegridregistryd executable +# Ice_ICEPATCH2CALC_EXECUTABLE - path to icepatch2calc executable +# Ice_ICEPATCH2CLIENT_EXECUTABLE - path to icepatch2client executable +# Ice_ICEPATCH2SERVER_EXECUTABLE - path to icepatch2server executable +# Ice_ICESERVICEINSTALL_EXECUTABLE - path to iceserviceinstall executable +# Ice_ICESTORMADMIN_EXECUTABLE - path to icestormadmin executable +# Ice_ICESTORMMIGRATE_EXECUTABLE - path to icestormmigrate executable +# +# Ice db programs (Windows only; standard system versions on all other +# platforms) are reported in:: +# +# Ice_DB_ARCHIVE_EXECUTABLE - path to db_archive executable +# Ice_DB_CHECKPOINT_EXECUTABLE - path to db_checkpoint executable +# Ice_DB_DEADLOCK_EXECUTABLE - path to db_deadlock executable +# Ice_DB_DUMP_EXECUTABLE - path to db_dump executable +# Ice_DB_HOTBACKUP_EXECUTABLE - path to db_hotbackup executable +# Ice_DB_LOAD_EXECUTABLE - path to db_load executable +# Ice_DB_LOG_VERIFY_EXECUTABLE - path to db_log_verify executable +# Ice_DB_PRINTLOG_EXECUTABLE - path to db_printlog executable +# Ice_DB_RECOVER_EXECUTABLE - path to db_recover executable +# Ice_DB_STAT_EXECUTABLE - path to db_stat executable +# Ice_DB_TUNER_EXECUTABLE - path to db_tuner executable +# Ice_DB_UPGRADE_EXECUTABLE - path to db_upgrade executable +# Ice_DB_VERIFY_EXECUTABLE - path to db_verify executable +# Ice_DUMPDB_EXECUTABLE - path to dumpdb executable +# Ice_TRANSFORMDB_EXECUTABLE - path to transformdb executable +# # Ice component libraries are reported in:: # # Ice__FOUND - ON if component was found @@ -77,7 +115,7 @@ # Written by Roger Leigh #============================================================================= -# Copyright 2014 University of Dundee +# Copyright 2014-2015 University of Dundee # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -201,7 +239,42 @@ function(_Ice_FIND) endforeach() endif() + set(db_programs + db_archive + db_checkpoint + db_deadlock + db_dump + db_hotbackup + db_load + db_log_verify + db_printlog + db_recover + db_stat + db_tuner + db_upgrade + db_verify + dumpdb + transformdb) + set(ice_programs + glacier2router + icebox + iceboxadmin + iceboxd + iceboxnet + icegridadmin + icegridnode + icegridnoded + icegridregistry + icegridregistryd + icepatch2calc + icepatch2client + icepatch2server + iceserviceinstall + icestormadmin + icestormmigrate) + + set(slice_programs slice2cpp slice2cs slice2freezej @@ -214,7 +287,7 @@ function(_Ice_FIND) slice2rb) # Find all Ice programs - foreach(program ${ice_programs}) + foreach(program ${db_programs} ${ice_programs} ${slice_programs}) string(TOUPPER "${program}" program_upcase) set(cache_var "Ice_${program_upcase}_EXECUTABLE") set(program_var "Ice_${program_upcase}_EXECUTABLE") @@ -377,6 +450,7 @@ if(Ice_DEBUG) message(STATUS "Ice_INCLUDE_DIR directory: ${Ice_INCLUDE_DIR}") message(STATUS "Ice_SLICE_DIR directory: ${Ice_SLICE_DIR}") message(STATUS "Ice_LIBRARIES: ${Ice_LIBRARIES}") + message(STATUS "slice2cpp executable: ${Ice_SLICE2CPP_EXECUTABLE}") message(STATUS "slice2cs executable: ${Ice_SLICE2CS_EXECUTABLE}") message(STATUS "slice2freezej executable: ${Ice_SLICE2FREEZEJ_EXECUTABLE}") @@ -387,6 +461,40 @@ if(Ice_DEBUG) message(STATUS "slice2php executable: ${Ice_SLICE2PHP_EXECUTABLE}") message(STATUS "slice2py executable: ${Ice_SLICE2PY_EXECUTABLE}") message(STATUS "slice2rb executable: ${Ice_SLICE2RB_EXECUTABLE}") + message(STATUS "glacier2router executable: ${Ice_GLACIER2ROUTER_EXECUTABLE}") + + message(STATUS "icebox executable: ${Ice_ICEBOX_EXECUTABLE}") + message(STATUS "iceboxadmin executable: ${Ice_ICEBOXADMIN_EXECUTABLE}") + message(STATUS "iceboxd executable: ${Ice_ICEBOXD_EXECUTABLE}") + message(STATUS "iceboxnet executable: ${Ice_ICEBOXNET_EXECUTABLE}") + message(STATUS "icegridadmin executable: ${Ice_ICEGRIDADMIN_EXECUTABLE}") + message(STATUS "icegridnode executable: ${Ice_ICEGRIDNODE_EXECUTABLE}") + message(STATUS "icegridnoded executable: ${Ice_ICEGRIDNODED_EXECUTABLE}") + message(STATUS "icegridregistry executable: ${Ice_ICEGRIDREGISTRY_EXECUTABLE}") + message(STATUS "icegridregistryd executable: ${Ice_ICEGRIDREGISTRYD_EXECUTABLE}") + message(STATUS "icepatch2calc executable: ${Ice_ICEPATCH2CALC_EXECUTABLE}") + message(STATUS "icepatch2client executable: ${Ice_ICEPATCH2CLIENT_EXECUTABLE}") + message(STATUS "icepatch2server executable: ${Ice_ICEPATCH2SERVER_EXECUTABLE}") + message(STATUS "iceserviceinstall executable: ${Ice_ICESERVICEINSTALL_EXECUTABLE}") + message(STATUS "icestormadmin executable: ${Ice_ICESTORMADMIN_EXECUTABLE}") + message(STATUS "icestormmigrate executable: ${Ice_ICESTORMMIGRATE_EXECUTABLE}") + + message(STATUS "db_archive executable: ${Ice_DB_ARCHIVE_EXECUTABLE}") + message(STATUS "db_checkpoint executable: ${Ice_DB_CHECKPOINT_EXECUTABLE}") + message(STATUS "db_deadlock executable: ${Ice_DB_DEADLOCK_EXECUTABLE}") + message(STATUS "db_dump executable: ${Ice_DB_DUMP_EXECUTABLE}") + message(STATUS "db_hotbackup executable: ${Ice_DB_HOTBACKUP_EXECUTABLE}") + message(STATUS "db_load executable: ${Ice_DB_LOAD_EXECUTABLE}") + message(STATUS "db_log_verify executable: ${Ice_DB_LOG_VERIFY_EXECUTABLE}") + message(STATUS "db_printlog executable: ${Ice_DB_PRINTLOG_EXECUTABLE}") + message(STATUS "db_recover executable: ${Ice_DB_RECOVER_EXECUTABLE}") + message(STATUS "db_stat executable: ${Ice_DB_STAT_EXECUTABLE}") + message(STATUS "db_tuner executable: ${Ice_DB_TUNER_EXECUTABLE}") + message(STATUS "db_upgrade executable: ${Ice_DB_UPGRADE_EXECUTABLE}") + message(STATUS "db_verify executable: ${Ice_DB_VERIFY_EXECUTABLE}") + message(STATUS "dumpdb executable: ${Ice_DUMPDB_EXECUTABLE}") + message(STATUS "transformdb executable: ${Ice_TRANSFORMDB_EXECUTABLE}") + foreach(component ${Ice_FIND_COMPONENTS}) string(TOUPPER "${component}" component_upcase) set(component_lib "Ice_${component_upcase}_LIBRARIES") From b24b58bb7b100794846786521f1977f048ecf5b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jostein=20Kj=C3=B8nigsen?= Date: Tue, 23 Jun 2015 10:05:37 +0200 Subject: [PATCH 0194/1048] cmake-mode.el: Add support for prog-mode hooks (#15521) Since version 24, Emacs supports a generic mode called prog-mode. Like all other modes it has its own mode-hook, prog-mode-hook. For Emacs users it is common to provide all your generic programming-mode related customizations in this mode-hook. cmake-mode is definitely a programming-mode and should support calling this hook. There are two ways to make that happen: * Make your major-mode a derived-mode from prog-mode. * Manually calling the hook upon mode-activation. Implementing a derived mode may be the most proper thing to do, but that may require quite a few structural changes. For now just call the hook explicitly if it exists. This should cover much of what users need. --- Auxiliary/cmake-mode.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Auxiliary/cmake-mode.el b/Auxiliary/cmake-mode.el index 7458a660c..51663a8e1 100644 --- a/Auxiliary/cmake-mode.el +++ b/Auxiliary/cmake-mode.el @@ -259,7 +259,9 @@ the indentation. Otherwise it retains the same position on the line" (setq comment-start "#") ; Run user hooks. - (run-hooks 'cmake-mode-hook)) + (if (boundp 'prog-mode-hook) + (run-hooks 'prog-mode-hook 'cmake-mode-hook) + (run-hooks 'cmake-mode-hook))) ; Help mode starts here From 2bf22a4b908592e363fc9aa93b3d09fbb5387b4d Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 22 Jun 2015 10:49:36 -0400 Subject: [PATCH 0195/1048] QtAutogen: Add comment explaining why rcc cannot use PRE_BUILD --- Source/cmQtAutoGenerators.cxx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index d2f6e3640..d8f826cc7 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -440,6 +440,9 @@ bool cmQtAutoGenerators::InitializeAutogenTarget(cmTarget* target) this->ListQt4RccInputs(sf, depends); } #if defined(_WIN32) && !defined(__CYGWIN__) + // Cannot use PRE_BUILD because the resource files themselves + // may not be sources within the target so VS may not know the + // target needs to re-build at all. usePRE_BUILD = false; #endif } From 6b5e94baa20685780c56158d4f41bc784c9ce49f Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Wed, 24 Jun 2015 00:01:06 -0400 Subject: [PATCH 0196/1048] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 98e75c7e8..9fcdc8b92 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 3) -set(CMake_VERSION_PATCH 20150623) +set(CMake_VERSION_PATCH 20150624) #set(CMake_VERSION_RC 1) From 60eb396f104ff6c662029b16f8859288776afbe8 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 23 Jun 2015 10:54:23 -0400 Subject: [PATCH 0197/1048] Export: Escape exported property values when writing CMake language files When writing export files, correctly encode property values that contain characters special to the CMake language parser. We must ensure that they parse correctly when loaded on the consuming side. Reported-by: Dan Liew --- Source/cmExportFileGenerator.cxx | 24 ++++++++++++++++--- .../Export/Interface/CMakeLists.txt | 4 ++++ .../Import/Interface/CMakeLists.txt | 11 +++++++++ 3 files changed, 36 insertions(+), 3 deletions(-) diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index a51fb2a00..094ad4f76 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -23,11 +23,27 @@ #include "cmVersion.h" #include "cmComputeLinkInformation.h" #include "cmAlgorithms.h" +#include "cmOutputConverter.h" #include #include #include +//---------------------------------------------------------------------------- +static std::string cmExportFileGeneratorEscape(std::string const& str) +{ + // Escape a property value for writing into a .cmake file. + std::string result = cmOutputConverter::EscapeForCMake(str); + // Un-escape variable references generated by our own export code. + cmSystemTools::ReplaceString(result, + "\\${_IMPORT_PREFIX}", + "${_IMPORT_PREFIX}"); + cmSystemTools::ReplaceString(result, + "\\${CMAKE_IMPORT_LIBRARY_SUFFIX}", + "${CMAKE_IMPORT_LIBRARY_SUFFIX}"); + return result; +} + //---------------------------------------------------------------------------- cmExportFileGenerator::cmExportFileGenerator() { @@ -608,7 +624,8 @@ void cmExportFileGenerator::GenerateInterfaceProperties(cmTarget const* target, for(ImportPropertyMap::const_iterator pi = properties.begin(); pi != properties.end(); ++pi) { - os << " " << pi->first << " \"" << pi->second << "\"\n"; + os << " " << pi->first << " " + << cmExportFileGeneratorEscape(pi->second) << "\n"; } os << ")\n\n"; } @@ -1112,7 +1129,8 @@ cmExportFileGenerator for(ImportPropertyMap::const_iterator pi = properties.begin(); pi != properties.end(); ++pi) { - os << " " << pi->first << " \"" << pi->second << "\"\n"; + os << " " << pi->first << " " + << cmExportFileGeneratorEscape(pi->second) << "\n"; } os << " )\n" << "\n"; @@ -1223,7 +1241,7 @@ cmExportFileGenerator ImportPropertyMap::const_iterator pi = properties.find(*li); if (pi != properties.end()) { - os << "\"" << pi->second << "\" "; + os << cmExportFileGeneratorEscape(pi->second) << " "; } } diff --git a/Tests/ExportImport/Export/Interface/CMakeLists.txt b/Tests/ExportImport/Export/Interface/CMakeLists.txt index 00a53756d..fd55c423c 100644 --- a/Tests/ExportImport/Export/Interface/CMakeLists.txt +++ b/Tests/ExportImport/Export/Interface/CMakeLists.txt @@ -39,7 +39,11 @@ install(FILES DESTINATION src ) +add_library(cmakeonly INTERFACE) +set_property(TARGET cmakeonly PROPERTY INTERFACE_COMPILE_DEFINITIONS [[DEF="\"\$\B"]]) + install(TARGETS headeronly sharediface use_auto_type use_c_restrict source_target + cmakeonly EXPORT expInterface ) install(TARGETS sharedlib diff --git a/Tests/ExportImport/Import/Interface/CMakeLists.txt b/Tests/ExportImport/Import/Interface/CMakeLists.txt index 51d518e99..c850508e5 100644 --- a/Tests/ExportImport/Import/Interface/CMakeLists.txt +++ b/Tests/ExportImport/Import/Interface/CMakeLists.txt @@ -99,3 +99,14 @@ add_executable(interfacetest_exp interfacetest.cpp) target_link_libraries(interfacetest_exp exp::sharediface) do_try_compile(exp) + +foreach(ns exp bld) + get_property(defs TARGET ${ns}::cmakeonly PROPERTY INTERFACE_COMPILE_DEFINITIONS) + if(NOT defs STREQUAL [[DEF="\"\$\B"]]) + message(SEND_ERROR + "${ns}::cmakeonly property INTERFACE_COMPILE_DEFINITIONS is:\n" + " ${defs}\n" + "not\n" + " " [[DEF="\"\$\B"]] "\n") + endif() +endforeach() From 93904772d7382ca46f2e73be9222c556c1ca79f2 Mon Sep 17 00:00:00 2001 From: Zack Galbreath Date: Mon, 8 Jun 2015 10:50:25 -0400 Subject: [PATCH 0198/1048] Help: Fix typo in ctest_test documentation s/acorss/across/ --- Help/command/ctest_test.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Help/command/ctest_test.rst b/Help/command/ctest_test.rst index 8cbb9ec71..af422b644 100644 --- a/Help/command/ctest_test.rst +++ b/Help/command/ctest_test.rst @@ -41,7 +41,7 @@ The options are: Specify the end of a range of test numbers. ``STRIDE `` - Specify the stride by which to step acorss a range of test numbers. + Specify the stride by which to step across a range of test numbers. ``EXCLUDE `` Specify a regular expression matching test names to exclude. From 6de440e201052c8b84c712f6c42cca7210e23ef3 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Thu, 25 Jun 2015 00:01:04 -0400 Subject: [PATCH 0199/1048] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 9fcdc8b92..5eefed03a 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 3) -set(CMake_VERSION_PATCH 20150624) +set(CMake_VERSION_PATCH 20150625) #set(CMake_VERSION_RC 1) From 8306108fd6ed58833d5d33cf6425665457dcd902 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 25 Jun 2015 15:15:17 -0400 Subject: [PATCH 0200/1048] CMakeDetermineCompilerId: Simplify src reference in IDE projects When constructing the "id_src" value for substitution into VS or Xcode compiler id projects, the input "src" variable already contains the file name with no path so we do not need get_filename_component. We know this because CMAKE_DETERMINE_COMPILER_ID_WRITE already references "${src}" with this assumption. --- Modules/CMakeDetermineCompilerId.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index 68f219451..487429beb 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -217,7 +217,7 @@ Id flags: ${testflags} set(id_subsystem 1) endif() set(id_dir ${CMAKE_${lang}_COMPILER_ID_DIR}) - get_filename_component(id_src "${src}" NAME) + set(id_src "${src}") configure_file(${CMAKE_ROOT}/Modules/CompilerId/VS-${v}.${ext}.in ${id_dir}/CompilerId${lang}.${ext} @ONLY) if(CMAKE_VS_MSBUILD_COMMAND AND NOT lang STREQUAL "Fortran") @@ -256,7 +256,7 @@ Id flags: ${testflags} set(id_lang "${lang}") set(id_type ${CMAKE_${lang}_COMPILER_XCODE_TYPE}) set(id_dir ${CMAKE_${lang}_COMPILER_ID_DIR}) - get_filename_component(id_src "${src}" NAME) + set(id_src "${src}") if(CMAKE_XCODE_PLATFORM_TOOLSET) set(id_toolset "GCC_VERSION = ${CMAKE_XCODE_PLATFORM_TOOLSET};") else() From 086b19aeda24bab60f7e4cd17feb2e3a070878a9 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Fri, 26 Jun 2015 00:01:05 -0400 Subject: [PATCH 0201/1048] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 5eefed03a..951ba1ce9 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 3) -set(CMake_VERSION_PATCH 20150625) +set(CMake_VERSION_PATCH 20150626) #set(CMake_VERSION_RC 1) From 806609c7024dbf07a639a9d77074d4bc82ae1b8a Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 26 Jun 2015 09:38:35 -0400 Subject: [PATCH 0202/1048] VS: Add /machine: flag to Librarian tool (#11240) If a Windows resource (.rc) source file is included in a STATIC library, the VS "link" tool will process the compiled ".res" file and needs to know the target architecture. Without it, we may get a LNK4068 warning and possibly a LNK1112 error. Add /machine: to the default static library flags to give the link tool the information it needs. --- Modules/Platform/Windows-MSVC.cmake | 1 + Tests/VSResource/CMakeLists.txt | 3 +++ Tests/VSResource/lib.cpp | 1 + Tests/VSResource/lib.rc | 4 ++++ Tests/VSResource/main.cpp | 4 +++- 5 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 Tests/VSResource/lib.cpp create mode 100644 Tests/VSResource/lib.rc diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake index 13fe8bc9c..2537e3921 100644 --- a/Modules/Platform/Windows-MSVC.cmake +++ b/Modules/Platform/Windows-MSVC.cmake @@ -230,6 +230,7 @@ elseif(MSVC_Fortran_ARCHITECTURE_ID) set(_MACHINE_ARCH_FLAG "/machine:${MSVC_Fortran_ARCHITECTURE_ID}") endif() set(CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT} ${_MACHINE_ARCH_FLAG}") +set(CMAKE_STATIC_LINKER_FLAGS_INIT "${CMAKE_STATIC_LINKER_FLAGS_INIT} ${_MACHINE_ARCH_FLAG}") unset(_MACHINE_ARCH_FLAG) # add /debug and /INCREMENTAL:YES to DEBUG and RELWITHDEBINFO also add pdbtype diff --git a/Tests/VSResource/CMakeLists.txt b/Tests/VSResource/CMakeLists.txt index 17eb04136..3b9cfc396 100644 --- a/Tests/VSResource/CMakeLists.txt +++ b/Tests/VSResource/CMakeLists.txt @@ -46,7 +46,10 @@ else() include_directories(${CMAKE_CURRENT_BINARY_DIR}) endif() +add_library(ResourceLib STATIC lib.cpp lib.rc) + add_executable(VSResource main.cpp test.rc) +target_link_libraries(VSResource ResourceLib) set_property(TARGET VSResource PROPERTY VS_GLOBAL_CMakeTestVsGlobalVariable "test val") diff --git a/Tests/VSResource/lib.cpp b/Tests/VSResource/lib.cpp new file mode 100644 index 000000000..006e3e48a --- /dev/null +++ b/Tests/VSResource/lib.cpp @@ -0,0 +1 @@ +int lib() { return 0; } diff --git a/Tests/VSResource/lib.rc b/Tests/VSResource/lib.rc new file mode 100644 index 000000000..1ffade6ca --- /dev/null +++ b/Tests/VSResource/lib.rc @@ -0,0 +1,4 @@ +STRINGTABLE +BEGIN + 1234 "5" +END diff --git a/Tests/VSResource/main.cpp b/Tests/VSResource/main.cpp index 7ee0c74fa..ccf700c42 100644 --- a/Tests/VSResource/main.cpp +++ b/Tests/VSResource/main.cpp @@ -1,6 +1,8 @@ #include #include +extern int lib(); + struct x { const char *txt; @@ -76,5 +78,5 @@ int main(int argc, char** argv) } } - return ret; + return ret + lib(); } From b702415d3a14cc2c561e4327ca27d720bbec886a Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sat, 27 Jun 2015 00:01:05 -0400 Subject: [PATCH 0203/1048] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 951ba1ce9..bac2eaf3a 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 3) -set(CMake_VERSION_PATCH 20150626) +set(CMake_VERSION_PATCH 20150627) #set(CMake_VERSION_RC 1) From e5f991f62f30864ccc14d10f348e56a249c1562c Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sun, 28 Jun 2015 00:01:04 -0400 Subject: [PATCH 0204/1048] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index bac2eaf3a..4ede6a569 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 3) -set(CMake_VERSION_PATCH 20150627) +set(CMake_VERSION_PATCH 20150628) #set(CMake_VERSION_RC 1) From ebd5eeb6567b89697c57c4203a4c38b988c7bfaa Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Mon, 29 Jun 2015 00:01:04 -0400 Subject: [PATCH 0205/1048] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 4ede6a569..2570ca30e 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 3) -set(CMake_VERSION_PATCH 20150628) +set(CMake_VERSION_PATCH 20150629) #set(CMake_VERSION_RC 1) From 327490e698db7a74f6a8e8543e99c6c7c9333a8f Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 29 Jun 2015 14:51:14 -0400 Subject: [PATCH 0206/1048] enable_language: Allow CMakeDetermineCompiler module to fail early If the module reports a FATAL_ERROR, skip the rest of the steps to enable the language to avoid unnecessary following error messages. --- Source/cmGlobalGenerator.cxx | 4 ++++ Tests/RunCMake/Languages/DetermineFail-result.txt | 1 + Tests/RunCMake/Languages/DetermineFail-stderr.txt | 5 +++++ Tests/RunCMake/Languages/DetermineFail.cmake | 2 ++ .../Languages/Modules/CMakeDetermineFailCompiler.cmake | 1 + Tests/RunCMake/Languages/RunCMakeTest.cmake | 2 ++ 6 files changed, 15 insertions(+) create mode 100644 Tests/RunCMake/Languages/DetermineFail-result.txt create mode 100644 Tests/RunCMake/Languages/DetermineFail-stderr.txt create mode 100644 Tests/RunCMake/Languages/DetermineFail.cmake create mode 100644 Tests/RunCMake/Languages/Modules/CMakeDetermineFailCompiler.cmake diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 14eaeac7a..23ab93de8 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -564,6 +564,10 @@ cmGlobalGenerator::EnableLanguage(std::vectorconst& languages, cmSystemTools::Error("Could not find cmake module file: ", determineCompiler.c_str()); } + if (cmSystemTools::GetFatalErrorOccured()) + { + return; + } needTestLanguage[lang] = true; // Some generators like visual studio should not use the env variables // So the global generator can specify that in this variable diff --git a/Tests/RunCMake/Languages/DetermineFail-result.txt b/Tests/RunCMake/Languages/DetermineFail-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/Languages/DetermineFail-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Languages/DetermineFail-stderr.txt b/Tests/RunCMake/Languages/DetermineFail-stderr.txt new file mode 100644 index 000000000..3b4743e15 --- /dev/null +++ b/Tests/RunCMake/Languages/DetermineFail-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error at Modules/CMakeDetermineFailCompiler.cmake:[0-9]+ \(message\): + This language is not supported. +Call Stack \(most recent call first\): + DetermineFail.cmake:[0-9]+ \(enable_language\) + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/Languages/DetermineFail.cmake b/Tests/RunCMake/Languages/DetermineFail.cmake new file mode 100644 index 000000000..3c8d17d8f --- /dev/null +++ b/Tests/RunCMake/Languages/DetermineFail.cmake @@ -0,0 +1,2 @@ +list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/Modules) +enable_language(Fail) diff --git a/Tests/RunCMake/Languages/Modules/CMakeDetermineFailCompiler.cmake b/Tests/RunCMake/Languages/Modules/CMakeDetermineFailCompiler.cmake new file mode 100644 index 000000000..3b2d50a34 --- /dev/null +++ b/Tests/RunCMake/Languages/Modules/CMakeDetermineFailCompiler.cmake @@ -0,0 +1 @@ +message(FATAL_ERROR "This language is not supported.") diff --git a/Tests/RunCMake/Languages/RunCMakeTest.cmake b/Tests/RunCMake/Languages/RunCMakeTest.cmake index 6517a8105..732baae41 100644 --- a/Tests/RunCMake/Languages/RunCMakeTest.cmake +++ b/Tests/RunCMake/Languages/RunCMakeTest.cmake @@ -4,3 +4,5 @@ run_cmake(NoLangSHARED) run_cmake(LINK_LANGUAGE-genex) run_cmake(link-libraries-TARGET_FILE-genex) run_cmake(link-libraries-TARGET_FILE-genex-ok) + +run_cmake(DetermineFail) From 5ff47ea93d490616292aae88847b42d56200d9e7 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Tue, 30 Jun 2015 00:01:04 -0400 Subject: [PATCH 0207/1048] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 2570ca30e..fd8861011 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 3) -set(CMake_VERSION_PATCH 20150629) +set(CMake_VERSION_PATCH 20150630) #set(CMake_VERSION_RC 1) From 99d160385e22ab7bd8e712d5a58460940573cfcd Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 29 Jun 2015 11:19:15 -0400 Subject: [PATCH 0208/1048] CMakeDetermineCompilerId: Use per-language regex to match Xcode compiler tool Move the Ld invocation match expression from CMakeDetermineCompilerId into CMakeDetermine{C,CXX,Fortran}Compiler so that it can be specified on a per-language basis. --- Modules/CMakeDetermineCCompiler.cmake | 8 ++++++++ Modules/CMakeDetermineCXXCompiler.cmake | 8 ++++++++ Modules/CMakeDetermineCompilerId.cmake | 15 ++++++--------- Modules/CMakeDetermineFortranCompiler.cmake | 8 ++++++++ 4 files changed, 30 insertions(+), 9 deletions(-) diff --git a/Modules/CMakeDetermineCCompiler.cmake b/Modules/CMakeDetermineCCompiler.cmake index 40d4ce6c3..492c3eaae 100644 --- a/Modules/CMakeDetermineCCompiler.cmake +++ b/Modules/CMakeDetermineCCompiler.cmake @@ -105,6 +105,14 @@ if(NOT CMAKE_C_COMPILER_ID_RUN) set(CMAKE_C_COMPILER_ID_VENDOR_FLAGS_IAR ) set(CMAKE_C_COMPILER_ID_VENDOR_REGEX_IAR "IAR .+ Compiler") + # Match the link line from xcodebuild output of the form + # Ld ... + # ... + # /path/to/cc ...CompilerIdC/... + # to extract the compiler front-end for the language. + set(CMAKE_C_COMPILER_ID_TOOL_MATCH_REGEX "\nLd[^\n]*(\n[ \t]+[^\n]*)*\n[ \t]+([^ \t\r\n]+)[^\r\n]*-o[^\r\n]*CompilerIdC/(\\./)?(CompilerIdC.xctest/)?CompilerIdC[ \t\n\\\"]") + set(CMAKE_C_COMPILER_ID_TOOL_MATCH_INDEX 2) + include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerId.cmake) CMAKE_DETERMINE_COMPILER_ID(C CFLAGS CMakeCCompilerId.c) diff --git a/Modules/CMakeDetermineCXXCompiler.cmake b/Modules/CMakeDetermineCXXCompiler.cmake index a673525a8..203201558 100644 --- a/Modules/CMakeDetermineCXXCompiler.cmake +++ b/Modules/CMakeDetermineCXXCompiler.cmake @@ -100,6 +100,14 @@ if(NOT CMAKE_CXX_COMPILER_ID_RUN) set(CMAKE_CXX_COMPILER_ID_VENDOR_FLAGS_IAR ) set(CMAKE_CXX_COMPILER_ID_VENDOR_REGEX_IAR "IAR .+ Compiler") + # Match the link line from xcodebuild output of the form + # Ld ... + # ... + # /path/to/cc ...CompilerIdCXX/... + # to extract the compiler front-end for the language. + set(CMAKE_CXX_COMPILER_ID_TOOL_MATCH_REGEX "\nLd[^\n]*(\n[ \t]+[^\n]*)*\n[ \t]+([^ \t\r\n]+)[^\r\n]*-o[^\r\n]*CompilerIdCXX/(\\./)?(CompilerIdCXX.xctest/)?CompilerIdCXX[ \t\n\\\"]") + set(CMAKE_CXX_COMPILER_ID_TOOL_MATCH_INDEX 2) + include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerId.cmake) CMAKE_DETERMINE_COMPILER_ID(CXX CXXFLAGS CMakeCXXCompilerId.cpp) diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index 487429beb..c699315ec 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -304,15 +304,12 @@ Id flags: ${testflags} set(ENV{MACOSX_DEPLOYMENT_TARGET} "${_ENV_MACOSX_DEPLOYMENT_TARGET}") endif() - # Match the link line from xcodebuild output of the form - # Ld ... - # ... - # /path/to/cc ...CompilerId${lang}/... - # to extract the compiler front-end for the language. - if("${CMAKE_${lang}_COMPILER_ID_OUTPUT}" MATCHES "\nLd[^\n]*(\n[ \t]+[^\n]*)*\n[ \t]+([^ \t\r\n]+)[^\r\n]*-o[^\r\n]*CompilerId${lang}/(\\./)?(CompilerId${lang}.xctest/)?CompilerId${lang}[ \t\n\\\"]") - set(_comp "${CMAKE_MATCH_2}") - if(EXISTS "${_comp}") - set(CMAKE_${lang}_COMPILER_ID_TOOL "${_comp}" PARENT_SCOPE) + if(DEFINED CMAKE_${lang}_COMPILER_ID_TOOL_MATCH_REGEX) + if("${CMAKE_${lang}_COMPILER_ID_OUTPUT}" MATCHES "${CMAKE_${lang}_COMPILER_ID_TOOL_MATCH_REGEX}") + set(_comp "${CMAKE_MATCH_${CMAKE_${lang}_COMPILER_ID_TOOL_MATCH_INDEX}}") + if(EXISTS "${_comp}") + set(CMAKE_${lang}_COMPILER_ID_TOOL "${_comp}" PARENT_SCOPE) + endif() endif() endif() else() diff --git a/Modules/CMakeDetermineFortranCompiler.cmake b/Modules/CMakeDetermineFortranCompiler.cmake index 52ec25a13..911ffac94 100644 --- a/Modules/CMakeDetermineFortranCompiler.cmake +++ b/Modules/CMakeDetermineFortranCompiler.cmake @@ -127,6 +127,14 @@ if(NOT CMAKE_Fortran_COMPILER_ID_RUN) set(CMAKE_Fortran_COMPILER_ID_VENDOR_FLAGS_NAG "-V") set(CMAKE_Fortran_COMPILER_ID_VENDOR_REGEX_NAG "NAG Fortran Compiler") + # Match the link line from xcodebuild output of the form + # Ld ... + # ... + # /path/to/cc ...CompilerIdFortran/... + # to extract the compiler front-end for the language. + set(CMAKE_Fortran_COMPILER_ID_TOOL_MATCH_REGEX "\nLd[^\n]*(\n[ \t]+[^\n]*)*\n[ \t]+([^ \t\r\n]+)[^\r\n]*-o[^\r\n]*CompilerIdFortran/(\\./)?(CompilerIdFortran.xctest/)?CompilerIdFortran[ \t\n\\\"]") + set(CMAKE_Fortran_COMPILER_ID_TOOL_MATCH_INDEX 2) + set(_version_info "") foreach(m MAJOR MINOR PATCH TWEAK) set(_COMP "_${m}") From dffc307c81220ffc243abc3b87ecfd694bd4cd35 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 24 Jun 2015 09:53:37 -0400 Subject: [PATCH 0209/1048] Tests: Teach RunCMake infrastructure to optionally timeout Add a RunCMake_TEST_TIMEOUT option that tests can set to cause RunCMake to limit the time it waits for the child process to finish. --- Tests/RunCMake/RunCMake.cmake | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake index 70c0d6c37..46bc4945b 100644 --- a/Tests/RunCMake/RunCMake.cmake +++ b/Tests/RunCMake/RunCMake.cmake @@ -66,6 +66,11 @@ function(run_cmake test) else() set(actual_stderr_var actual_stderr) endif() + if(DEFINED RunCMake_TEST_TIMEOUT) + set(maybe_timeout TIMEOUT ${RunCMake_TEST_TIMEOUT}) + else() + set(maybe_timeout "") + endif() if(RunCMake_TEST_COMMAND) execute_process( COMMAND ${RunCMake_TEST_COMMAND} @@ -73,6 +78,7 @@ function(run_cmake test) OUTPUT_VARIABLE actual_stdout ERROR_VARIABLE ${actual_stderr_var} RESULT_VARIABLE actual_result + ${maybe_timeout} ) else() execute_process( @@ -87,6 +93,7 @@ function(run_cmake test) OUTPUT_VARIABLE actual_stdout ERROR_VARIABLE ${actual_stderr_var} RESULT_VARIABLE actual_result + ${maybe_timeout} ) endif() set(msg "") From 8bf5a80b9668a31b85aaac00d1682228bbbbac5e Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 24 Jun 2015 09:41:58 -0400 Subject: [PATCH 0210/1048] cmSystemTools: Add StringToULong helper Convert a string to an unsigned integer and reject any extra input. --- Source/cmSystemTools.cxx | 9 +++++++++ Source/cmSystemTools.h | 1 + 2 files changed, 10 insertions(+) diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index e2adabe5f..7230a64f9 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -2955,3 +2955,12 @@ bool cmSystemTools::StringToLong(const char* str, long* value) *value = strtol(str, &endp, 10); return (*endp == '\0') && (endp != str) && (errno == 0); } + +//---------------------------------------------------------------------------- +bool cmSystemTools::StringToULong(const char* str, unsigned long* value) +{ + errno = 0; + char *endp; + *value = strtoul(str, &endp, 10); + return (*endp == '\0') && (endp != str) && (errno == 0); +} diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index 6feb6c5bf..8ebb4e325 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -469,6 +469,7 @@ public: /** Convert string to long. Expected that the whole string is an integer */ static bool StringToLong(const char* str, long* value); + static bool StringToULong(const char* str, unsigned long* value); #ifdef _WIN32 struct WindowsFileRetry From 07c550caa20d4b1d6ebc08269d744ff6a45c0a6d Mon Sep 17 00:00:00 2001 From: Zack Galbreath Date: Mon, 1 Jun 2015 09:42:44 -0400 Subject: [PATCH 0211/1048] cmCTestMultiProcessHandler: Refactor RUN_SERIAL implementation The original implementation of the RUN_SERIAL test property worked by having such a test consume all available processors. Instead use an explicit flag to indicate that a serial test is running. This avoids artificially inflating the number of processors a test is expected to consume. --- Source/CTest/cmCTestMultiProcessHandler.cxx | 35 ++++++++++++++++++--- Source/CTest/cmCTestMultiProcessHandler.h | 1 + 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index bd090db97..28aec3d4c 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -44,6 +44,7 @@ cmCTestMultiProcessHandler::cmCTestMultiProcessHandler() this->RunningCount = 0; this->StopTimePassed = false; this->HasCycles = false; + this->SerialTestRunning = false; } cmCTestMultiProcessHandler::~cmCTestMultiProcessHandler() @@ -172,6 +173,11 @@ void cmCTestMultiProcessHandler::LockResources(int index) this->LockedResources.insert( this->Properties[index]->LockedResources.begin(), this->Properties[index]->LockedResources.end()); + + if (this->Properties[index]->RunSerial) + { + this->SerialTestRunning = true; + } } //--------------------------------------------------------- @@ -198,11 +204,9 @@ inline size_t cmCTestMultiProcessHandler::GetProcessorsUsed(int test) { size_t processors = static_cast(this->Properties[test]->Processors); - //If this is set to run serially, it must run alone. - //Also, if processors setting is set higher than the -j + //If processors setting is set higher than the -j //setting, we default to using all of the process slots. - if(this->Properties[test]->RunSerial - || processors > this->ParallelLevel) + if (processors > this->ParallelLevel) { processors = this->ParallelLevel; } @@ -248,9 +252,27 @@ void cmCTestMultiProcessHandler::StartNextTests() return; } + // Don't start any new tests if one with the RUN_SERIAL property + // is already running. + if (this->SerialTestRunning) + { + return; + } + TestList copy = this->SortedTests; for(TestList::iterator test = copy.begin(); test != copy.end(); ++test) { + // Take a nap if we're currently performing a RUN_SERIAL test. + if (this->SerialTestRunning) + { + break; + } + // We can only start a RUN_SERIAL test if no other tests are also running. + if (this->Properties[*test]->RunSerial && this->RunningCount > 0) + { + continue; + } + size_t processors = GetProcessorsUsed(*test); if(processors <= numToStart && this->StartTest(*test)) @@ -319,6 +341,11 @@ bool cmCTestMultiProcessHandler::CheckOutput() this->WriteCheckpoint(test); this->UnlockResources(test); this->RunningCount -= GetProcessorsUsed(test); + if (this->Properties[test]->RunSerial) + { + this->SerialTestRunning = false; + } + delete p; } return true; diff --git a/Source/CTest/cmCTestMultiProcessHandler.h b/Source/CTest/cmCTestMultiProcessHandler.h index 6440fbc19..243318f52 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.h +++ b/Source/CTest/cmCTestMultiProcessHandler.h @@ -121,6 +121,7 @@ protected: cmCTest* CTest; bool HasCycles; bool Quiet; + bool SerialTestRunning; }; #endif From f62d301b9257542f5460902c400af3f947f10a66 Mon Sep 17 00:00:00 2001 From: Betsy McPhail Date: Tue, 9 Jun 2015 08:50:44 -0400 Subject: [PATCH 0212/1048] ctest: Optionally avoid starting tests that may exceed a given CPU load Add a TestLoad setting to CTest that can be set via a new --test-load command-line option, CTEST_TEST_LOAD variable, or TEST_LOAD option to the ctest_test command. Teach cmCTestMultiProcessHandler to measure the CPU load and avoid starting tests that may take more than the spare load currently available. The expression + <= must be true to start a new test. Co-Author: Zack Galbreath --- Help/command/ctest_memcheck.rst | 1 + Help/command/ctest_test.rst | 8 ++ Help/manual/cmake-variables.7.rst | 1 + Help/manual/ctest.1.rst | 14 ++ Help/release/dev/ctest-test-load-option.rst | 9 ++ Help/variable/CTEST_TEST_LOAD.rst | 7 + Modules/DartConfiguration.tcl.in | 4 + Source/CTest/cmCTestGenericHandler.cxx | 2 + Source/CTest/cmCTestGenericHandler.h | 3 + Source/CTest/cmCTestMultiProcessHandler.cxx | 126 ++++++++++++++++-- Source/CTest/cmCTestMultiProcessHandler.h | 3 + Source/CTest/cmCTestTestCommand.cxx | 33 +++++ Source/CTest/cmCTestTestCommand.h | 1 + Source/CTest/cmCTestTestHandler.cxx | 8 ++ Source/cmCTest.cxx | 35 +++++ Source/cmCTest.h | 5 + Source/ctest.cxx | 1 + .../CTestCommandLine/RunCMakeTest.cmake | 33 +++++ .../test-load-fail-stderr.txt | 1 + .../test-load-fail-stdout.txt | 2 + .../test-load-invalid-stderr.txt | 1 + .../test-load-invalid-stdout.txt | 7 + .../test-load-pass-stderr.txt | 1 + .../test-load-pass-stdout.txt | 7 + .../ctest_test/CTestTestLoadFail-result.txt | 1 + .../ctest_test/CTestTestLoadFail-stderr.txt | 1 + .../ctest_test/CTestTestLoadFail-stdout.txt | 2 + .../CTestTestLoadInvalid-stderr.txt | 1 + .../CTestTestLoadInvalid-stdout.txt | 7 + .../ctest_test/CTestTestLoadPass-stdout.txt | 7 + Tests/RunCMake/ctest_test/RunCMakeTest.cmake | 41 ++++++ .../ctest_test/TestLoadFail-result.txt | 1 + .../ctest_test/TestLoadFail-stderr.txt | 1 + .../ctest_test/TestLoadFail-stdout.txt | 2 + .../ctest_test/TestLoadInvalid-stderr.txt | 1 + .../ctest_test/TestLoadInvalid-stdout.txt | 7 + .../ctest_test/TestLoadOrder-stderr.txt | 1 + .../ctest_test/TestLoadOrder-stdout.txt | 7 + .../ctest_test/TestLoadPass-stdout.txt | 7 + Tests/RunCMake/ctest_test/test.cmake.in | 1 + 40 files changed, 393 insertions(+), 8 deletions(-) create mode 100644 Help/release/dev/ctest-test-load-option.rst create mode 100644 Help/variable/CTEST_TEST_LOAD.rst create mode 100644 Tests/RunCMake/CTestCommandLine/test-load-fail-stderr.txt create mode 100644 Tests/RunCMake/CTestCommandLine/test-load-fail-stdout.txt create mode 100644 Tests/RunCMake/CTestCommandLine/test-load-invalid-stderr.txt create mode 100644 Tests/RunCMake/CTestCommandLine/test-load-invalid-stdout.txt create mode 100644 Tests/RunCMake/CTestCommandLine/test-load-pass-stderr.txt create mode 100644 Tests/RunCMake/CTestCommandLine/test-load-pass-stdout.txt create mode 100644 Tests/RunCMake/ctest_test/CTestTestLoadFail-result.txt create mode 100644 Tests/RunCMake/ctest_test/CTestTestLoadFail-stderr.txt create mode 100644 Tests/RunCMake/ctest_test/CTestTestLoadFail-stdout.txt create mode 100644 Tests/RunCMake/ctest_test/CTestTestLoadInvalid-stderr.txt create mode 100644 Tests/RunCMake/ctest_test/CTestTestLoadInvalid-stdout.txt create mode 100644 Tests/RunCMake/ctest_test/CTestTestLoadPass-stdout.txt create mode 100644 Tests/RunCMake/ctest_test/TestLoadFail-result.txt create mode 100644 Tests/RunCMake/ctest_test/TestLoadFail-stderr.txt create mode 100644 Tests/RunCMake/ctest_test/TestLoadFail-stdout.txt create mode 100644 Tests/RunCMake/ctest_test/TestLoadInvalid-stderr.txt create mode 100644 Tests/RunCMake/ctest_test/TestLoadInvalid-stdout.txt create mode 100644 Tests/RunCMake/ctest_test/TestLoadOrder-stderr.txt create mode 100644 Tests/RunCMake/ctest_test/TestLoadOrder-stdout.txt create mode 100644 Tests/RunCMake/ctest_test/TestLoadPass-stdout.txt diff --git a/Help/command/ctest_memcheck.rst b/Help/command/ctest_memcheck.rst index 2800511a4..29bdf7d0e 100644 --- a/Help/command/ctest_memcheck.rst +++ b/Help/command/ctest_memcheck.rst @@ -14,6 +14,7 @@ Perform the :ref:`CTest MemCheck Step` as a :ref:`Dashboard Client`. [EXCLUDE_LABEL ] [INCLUDE_LABEL ] [PARALLEL_LEVEL ] + [TEST_LOAD ] [SCHEDULE_RANDOM ] [STOP_TIME ] [RETURN_VALUE ] diff --git a/Help/command/ctest_test.rst b/Help/command/ctest_test.rst index af422b644..162db69a3 100644 --- a/Help/command/ctest_test.rst +++ b/Help/command/ctest_test.rst @@ -14,6 +14,7 @@ Perform the :ref:`CTest Test Step` as a :ref:`Dashboard Client`. [EXCLUDE_LABEL ] [INCLUDE_LABEL ] [PARALLEL_LEVEL ] + [TEST_LOAD ] [SCHEDULE_RANDOM ] [STOP_TIME ] [RETURN_VALUE ] @@ -61,6 +62,13 @@ The options are: Specify a positive number representing the number of tests to be run in parallel. +``TEST_LOAD `` + While running tests in parallel, try not to start tests when they + may cause the CPU load to pass above a given threshold. If not + specified the :variable:`CTEST_TEST_LOAD` variable will be checked, + and then the ``--test-load`` command-line argument to :manual:`ctest(1)`. + See also the ``TestLoad`` setting in the :ref:`CTest Test Step`. + ``SCHEDULE_RANDOM `` Launch tests in a random order. This may be useful for detecting implicit test dependencies. diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index 0e6222f25..adbc40bd6 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -386,6 +386,7 @@ Variables for CTest /variable/CTEST_SVN_COMMAND /variable/CTEST_SVN_OPTIONS /variable/CTEST_SVN_UPDATE_OPTIONS + /variable/CTEST_TEST_LOAD /variable/CTEST_TEST_TIMEOUT /variable/CTEST_TRIGGER_SITE /variable/CTEST_UPDATE_COMMAND diff --git a/Help/manual/ctest.1.rst b/Help/manual/ctest.1.rst index c91321b10..50c856a04 100644 --- a/Help/manual/ctest.1.rst +++ b/Help/manual/ctest.1.rst @@ -66,6 +66,13 @@ Options number of jobs. This option can also be set by setting the environment variable ``CTEST_PARALLEL_LEVEL``. +``--test-load `` + While running tests in parallel (e.g. with ``-j``), try not to start + tests when they may cause the CPU load to pass above a given threshold. + + When ``ctest`` is run as a `Dashboard Client`_ this sets the + ``TestLoad`` option of the `CTest Test Step`_. + ``-Q,--quiet`` Make ctest quiet. @@ -776,6 +783,13 @@ Arguments to the command may specify some of the step settings. Configuration settings include: +``TestLoad`` + While running tests in parallel (e.g. with ``-j``), try not to start + tests when they may cause the CPU load to pass above a given threshold. + + * `CTest Script`_ variable: :variable:`CTEST_TEST_LOAD` + * :module:`CTest` module variable: ``CTEST_TEST_LOAD`` + ``TimeOut`` The default timeout for each test if not specified by the :prop_test:`TIMEOUT` test property. diff --git a/Help/release/dev/ctest-test-load-option.rst b/Help/release/dev/ctest-test-load-option.rst new file mode 100644 index 000000000..069f49ae2 --- /dev/null +++ b/Help/release/dev/ctest-test-load-option.rst @@ -0,0 +1,9 @@ +ctest-test-load-option +---------------------- + +* CTest learned to optionally measure the CPU load during parallel + testing and avoid starting tests that may cause the load to exceed + a given threshold. See the :manual:`ctest(1)` command ``--test-load`` + option, the ``TestLoad`` setting of the :ref:`CTest Test Step`, + the :variable:`CTEST_TEST_LOAD` variable, and the ``TEST_LOAD`` + option of the :command:`ctest_test` command. diff --git a/Help/variable/CTEST_TEST_LOAD.rst b/Help/variable/CTEST_TEST_LOAD.rst new file mode 100644 index 000000000..80823fe4e --- /dev/null +++ b/Help/variable/CTEST_TEST_LOAD.rst @@ -0,0 +1,7 @@ +CTEST_TEST_LOAD +--------------- + +Specify the ``TestLoad`` setting in the :ref:`CTest Test Step` +of a :manual:`ctest(1)` dashboard client script. This sets the +default value for the ``TEST_LOAD`` option of the :command:`ctest_test` +command. diff --git a/Modules/DartConfiguration.tcl.in b/Modules/DartConfiguration.tcl.in index 37a0a408e..918b407bf 100644 --- a/Modules/DartConfiguration.tcl.in +++ b/Modules/DartConfiguration.tcl.in @@ -95,6 +95,10 @@ SlurmRunCommand: @SLURM_SRUN_COMMAND@ # Currently set to 25 minutes TimeOut: @DART_TESTING_TIMEOUT@ +# During parallel testing CTest will not start a new test if doing +# so would cause the system load to exceed this value. +TestLoad: @CTEST_TEST_LOAD@ + UseLaunchers: @CTEST_USE_LAUNCHERS@ CurlOptions: @CTEST_CURL_OPTIONS@ # warning, if you add new options here that have to do with submit, diff --git a/Source/CTest/cmCTestGenericHandler.cxx b/Source/CTest/cmCTestGenericHandler.cxx index 81eb0a808..ad79ba2b1 100644 --- a/Source/CTest/cmCTestGenericHandler.cxx +++ b/Source/CTest/cmCTestGenericHandler.cxx @@ -23,6 +23,7 @@ cmCTestGenericHandler::cmCTestGenericHandler() this->SubmitIndex = 0; this->AppendXML = false; this->Quiet = false; + this->TestLoad = 0; } //---------------------------------------------------------------------- @@ -70,6 +71,7 @@ void cmCTestGenericHandler::SetPersistentOption(const std::string& op, void cmCTestGenericHandler::Initialize() { this->AppendXML = false; + this->TestLoad = 0; this->Options.clear(); t_StringToString::iterator it; for ( it = this->PersistentOptions.begin(); diff --git a/Source/CTest/cmCTestGenericHandler.h b/Source/CTest/cmCTestGenericHandler.h index 8567dd7cd..4b7ae7901 100644 --- a/Source/CTest/cmCTestGenericHandler.h +++ b/Source/CTest/cmCTestGenericHandler.h @@ -89,6 +89,8 @@ public: void SetAppendXML(bool b) { this->AppendXML = b; } void SetQuiet(bool b) { this->Quiet = b; } bool GetQuiet() { return this->Quiet; } + void SetTestLoad(unsigned long load) { this->TestLoad = load; } + unsigned long GetTestLoad() const { return this->TestLoad; } protected: bool StartResultingXML(cmCTest::Part part, @@ -97,6 +99,7 @@ protected: bool AppendXML; bool Quiet; + unsigned long TestLoad; cmSystemTools::OutputOption HandlerVerbose; cmCTest *CTest; t_StringToString Options; diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index 28aec3d4c..483218658 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -13,12 +13,15 @@ #include "cmProcess.h" #include "cmStandardIncludes.h" #include "cmCTest.h" +#include "cmCTestScriptHandler.h" #include "cmSystemTools.h" #include #include #include #include +#include #include +#include class TestComparator { @@ -40,6 +43,7 @@ private: cmCTestMultiProcessHandler::cmCTestMultiProcessHandler() { this->ParallelLevel = 1; + this->TestLoad = 0; this->Completed = 0; this->RunningCount = 0; this->StopTimePassed = false; @@ -84,6 +88,11 @@ void cmCTestMultiProcessHandler::SetParallelLevel(size_t level) this->ParallelLevel = level < 1 ? 1 : level; } +void cmCTestMultiProcessHandler::SetTestLoad(unsigned long load) +{ + this->TestLoad = load; +} + //--------------------------------------------------------- void cmCTestMultiProcessHandler::RunTests() { @@ -213,6 +222,11 @@ inline size_t cmCTestMultiProcessHandler::GetProcessorsUsed(int test) return processors; } +std::string cmCTestMultiProcessHandler::GetName(int test) +{ + return this->Properties[test]->Name; +} + //--------------------------------------------------------- bool cmCTestMultiProcessHandler::StartTest(int test) { @@ -259,6 +273,46 @@ void cmCTestMultiProcessHandler::StartNextTests() return; } + bool allTestsFailedTestLoadCheck = false; + bool usedFakeLoadForTesting = false; + size_t minProcessorsRequired = this->ParallelLevel; + std::string testWithMinProcessors = ""; + + cmsys::SystemInformation info; + + unsigned long systemLoad = 0; + size_t spareLoad = 0; + if (this->TestLoad > 0) + { + // Activate possible wait. + allTestsFailedTestLoadCheck = true; + + // Check for a fake load average value used in testing. + if (const char* fake_load_value = + cmSystemTools::GetEnv("__CTEST_FAKE_LOAD_AVERAGE_FOR_TESTING")) + { + usedFakeLoadForTesting = true; + if (!cmSystemTools::StringToULong(fake_load_value, &systemLoad)) + { + cmSystemTools::Error("Failed to parse fake load value: ", + fake_load_value); + } + } + // If it's not set, look up the true load average. + else + { + systemLoad = static_cast(ceil(info.GetLoadAverage())); + } + spareLoad = (this->TestLoad > systemLoad ? + this->TestLoad - systemLoad : 0); + + // Don't start more tests than the spare load can support. + if (numToStart > spareLoad) + { + numToStart = spareLoad; + } + } + TestList copy = this->SortedTests; for(TestList::iterator test = copy.begin(); test != copy.end(); ++test) { @@ -274,18 +328,74 @@ void cmCTestMultiProcessHandler::StartNextTests() } size_t processors = GetProcessorsUsed(*test); - - if(processors <= numToStart && this->StartTest(*test)) + bool testLoadOk = true; + if (this->TestLoad > 0) { - if(this->StopTimePassed) - { - return; - } - numToStart -= processors; + if (processors <= spareLoad) + { + cmCTestLog(this->CTest, DEBUG, + "OK to run " << GetName(*test) << + ", it requires " << processors << + " procs & system load is: " << + systemLoad << std::endl); + allTestsFailedTestLoadCheck = false; + } + else + { + testLoadOk = false; + } + } + + if (processors <= minProcessorsRequired) + { + minProcessorsRequired = processors; + testWithMinProcessors = GetName(*test); + } + + if(testLoadOk && processors <= numToStart && this->StartTest(*test)) + { + if(this->StopTimePassed) + { + return; + } + + numToStart -= processors; } else if(numToStart == 0) { - return; + break; + } + } + + if (allTestsFailedTestLoadCheck) + { + cmCTestLog(this->CTest, HANDLER_OUTPUT, "***** WAITING, "); + if (this->SerialTestRunning) + { + cmCTestLog(this->CTest, HANDLER_OUTPUT, + "Waiting for RUN_SERIAL test to finish."); + } + else + { + cmCTestLog(this->CTest, HANDLER_OUTPUT, + "System Load: " << systemLoad << ", " + "Max Allowed Load: " << this->TestLoad << ", " + "Smallest test " << testWithMinProcessors << + " requires " << minProcessorsRequired); + } + cmCTestLog(this->CTest, HANDLER_OUTPUT, "*****" << std::endl); + + if (usedFakeLoadForTesting) + { + // Break out of the infinite loop of waiting for our fake load + // to come down. + this->StopTimePassed = true; + } + else + { + // Wait between 1 and 5 seconds before trying again. + cmCTestScriptHandler::SleepInSeconds( + cmSystemTools::RandomSeed() % 5 + 1); } } } diff --git a/Source/CTest/cmCTestMultiProcessHandler.h b/Source/CTest/cmCTestMultiProcessHandler.h index 243318f52..ed3e155a0 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.h +++ b/Source/CTest/cmCTestMultiProcessHandler.h @@ -37,6 +37,7 @@ public: void SetTests(TestMap& tests, PropertiesMap& properties); // Set the max number of tests that can be run at the same time. void SetParallelLevel(size_t); + void SetTestLoad(unsigned long load); virtual void RunTests(); void PrintTestList(); void PrintLabels(); @@ -93,6 +94,7 @@ protected: bool CheckCycles(); int FindMaxIndex(); inline size_t GetProcessorsUsed(int index); + std::string GetName(int index); void LockResources(int index); void UnlockResources(int index); @@ -116,6 +118,7 @@ protected: std::set LockedResources; std::vector* TestResults; size_t ParallelLevel; // max number of process that can be run at once + unsigned long TestLoad; std::set RunningTests; // current running tests cmCTestTestHandler * TestHandler; cmCTest* CTest; diff --git a/Source/CTest/cmCTestTestCommand.cxx b/Source/CTest/cmCTestTestCommand.cxx index 8b357acd3..b7d8318f4 100644 --- a/Source/CTest/cmCTestTestCommand.cxx +++ b/Source/CTest/cmCTestTestCommand.cxx @@ -26,6 +26,7 @@ cmCTestTestCommand::cmCTestTestCommand() this->Arguments[ctt_PARALLEL_LEVEL] = "PARALLEL_LEVEL"; this->Arguments[ctt_SCHEDULE_RANDOM] = "SCHEDULE_RANDOM"; this->Arguments[ctt_STOP_TIME] = "STOP_TIME"; + this->Arguments[ctt_TEST_LOAD] = "TEST_LOAD"; this->Arguments[ctt_LAST] = 0; this->Last = ctt_LAST; } @@ -103,6 +104,38 @@ cmCTestGenericHandler* cmCTestTestCommand::InitializeHandler() { this->CTest->SetStopTime(this->Values[ctt_STOP_TIME]); } + + // Test load is determined by: TEST_LOAD argument, + // or CTEST_TEST_LOAD script variable, or ctest --test-load + // command line argument... in that order. + unsigned long testLoad; + const char* ctestTestLoad + = this->Makefile->GetDefinition("CTEST_TEST_LOAD"); + if(this->Values[ctt_TEST_LOAD] && *this->Values[ctt_TEST_LOAD]) + { + if (!cmSystemTools::StringToULong(this->Values[ctt_TEST_LOAD], &testLoad)) + { + testLoad = 0; + cmCTestLog(this->CTest, WARNING, "Invalid value for 'TEST_LOAD' : " + << this->Values[ctt_TEST_LOAD] << std::endl); + } + } + else if(ctestTestLoad && *ctestTestLoad) + { + if (!cmSystemTools::StringToULong(ctestTestLoad, &testLoad)) + { + testLoad = 0; + cmCTestLog(this->CTest, WARNING, + "Invalid value for 'CTEST_TEST_LOAD' : " << + ctestTestLoad << std::endl); + } + } + else + { + testLoad = this->CTest->GetTestLoad(); + } + handler->SetTestLoad(testLoad); + handler->SetQuiet(this->Quiet); return handler; } diff --git a/Source/CTest/cmCTestTestCommand.h b/Source/CTest/cmCTestTestCommand.h index a1e5f368f..0dfca974d 100644 --- a/Source/CTest/cmCTestTestCommand.h +++ b/Source/CTest/cmCTestTestCommand.h @@ -60,6 +60,7 @@ protected: ctt_PARALLEL_LEVEL, ctt_SCHEDULE_RANDOM, ctt_STOP_TIME, + ctt_TEST_LOAD, ctt_LAST }; }; diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 70b7f5cb5..59576f4d9 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -1062,6 +1062,14 @@ void cmCTestTestHandler::ProcessDirectory(std::vector &passed, parallel->SetParallelLevel(this->CTest->GetParallelLevel()); parallel->SetTestHandler(this); parallel->SetQuiet(this->Quiet); + if(this->TestLoad > 0) + { + parallel->SetTestLoad(this->TestLoad); + } + else + { + parallel->SetTestLoad(this->CTest->GetTestLoad()); + } *this->LogFile << "Start testing: " << this->CTest->CurrentTime() << std::endl diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index e3b7a2bcb..5887ba8ed 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -294,6 +294,7 @@ cmCTest::cmCTest() this->LabelSummary = true; this->ParallelLevel = 1; this->ParallelLevelSetInCli = false; + this->TestLoad = 0; this->SubmitIndex = 0; this->Failover = false; this->BatchJobs = false; @@ -393,6 +394,11 @@ void cmCTest::SetParallelLevel(int level) this->ParallelLevel = level < 1 ? 1 : level; } +void cmCTest::SetTestLoad(unsigned long load) +{ + this->TestLoad = load; +} + //---------------------------------------------------------------------------- bool cmCTest::ShouldCompressTestOutput() { @@ -820,6 +826,20 @@ bool cmCTest::UpdateCTestConfiguration() cmSystemTools::ChangeDirectory(this->BinaryDir); } this->TimeOut = atoi(this->GetCTestConfiguration("TimeOut").c_str()); + std::string const& testLoad = this->GetCTestConfiguration("TestLoad"); + if (!testLoad.empty()) + { + unsigned long load; + if (cmSystemTools::StringToULong(testLoad.c_str(), &load)) + { + this->SetTestLoad(load); + } + else + { + cmCTestLog(this, WARNING, "Invalid value for 'Test Load' : " + << testLoad << std::endl); + } + } if ( this->ProduceXML ) { this->CompressXMLFiles = cmSystemTools::IsOn( @@ -2051,6 +2071,21 @@ bool cmCTest::HandleCommandLineArguments(size_t &i, } } + if(this->CheckArgument(arg, "--test-load") && i < args.size() - 1) + { + i++; + unsigned long load; + if (cmSystemTools::StringToULong(args[i].c_str(), &load)) + { + this->SetTestLoad(load); + } + else + { + cmCTestLog(this, WARNING, + "Invalid value for 'Test Load' : " << args[i] << std::endl); + } + } + if(this->CheckArgument(arg, "--no-compress-output")) { this->CompressTestOutput = false; diff --git a/Source/cmCTest.h b/Source/cmCTest.h index db3ea1063..47245ae00 100644 --- a/Source/cmCTest.h +++ b/Source/cmCTest.h @@ -161,6 +161,9 @@ public: int GetParallelLevel() { return this->ParallelLevel; } void SetParallelLevel(int); + unsigned long GetTestLoad() { return this->TestLoad; } + void SetTestLoad(unsigned long); + /** * Check if CTest file exists */ @@ -499,6 +502,8 @@ private: int ParallelLevel; bool ParallelLevelSetInCli; + unsigned long TestLoad; + int CompatibilityMode; // information for the --build-and-test options diff --git a/Source/ctest.cxx b/Source/ctest.cxx index e7847592d..afcbd613b 100644 --- a/Source/ctest.cxx +++ b/Source/ctest.cxx @@ -98,6 +98,7 @@ static const char * cmDocumentationOptions[][2] = {"--test-command", "The test to run with the --build-and-test option."}, {"--test-timeout", "The time limit in seconds, internal use only."}, + {"--test-load", "CPU load threshold for starting new parallel tests."}, {"--tomorrow-tag", "Nightly or experimental starts with next day tag."}, {"--ctest-config", "The configuration file used to initialize CTest state " "when submitting dashboards."}, diff --git a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake index a3ce1399c..aba1dafc2 100644 --- a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake @@ -1,4 +1,5 @@ include(RunCMake) +set(RunCMake_TEST_TIMEOUT 60) unset(ENV{CTEST_PARALLEL_LEVEL}) unset(ENV{CTEST_OUTPUT_ON_FAILURE}) @@ -52,3 +53,35 @@ add_test(MergeOutput \"${CMAKE_COMMAND}\" -P \"${RunCMake_SOURCE_DIR}/MergeOutpu run_cmake_command(MergeOutput ${CMAKE_CTEST_COMMAND} -V) endfunction() run_MergeOutput() + + +function(run_TestLoad name load) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/TestLoad) + set(RunCMake_TEST_NO_CLEAN 1) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + file(WRITE "${RunCMake_TEST_BINARY_DIR}/CTestTestfile.cmake" " + add_test(TestLoad1 \"${CMAKE_COMMAND}\" -E echo \"test of --test-load\") + add_test(TestLoad2 \"${CMAKE_COMMAND}\" -E echo \"test of --test-load\") +") + run_cmake_command(${name} ${CMAKE_CTEST_COMMAND} -j2 --test-load ${load} --test-timeout 5) +endfunction() + +# Tests for the --test-load feature of ctest +# +# Spoof a load average value to make these tests more reliable. +set(ENV{__CTEST_FAKE_LOAD_AVERAGE_FOR_TESTING} 5) + +# Verify that new tests are not started when the load average exceeds +# our threshold. +run_TestLoad(test-load-fail 2) + +# Verify that warning message is displayed but tests still start when +# an invalid argument is given. +run_TestLoad(test-load-invalid 'two') + +# Verify that new tests are started when the load average falls below +# our threshold. +run_TestLoad(test-load-pass 10) + +unset(ENV{__CTEST_FAKE_LOAD_AVERAGE_FOR_TESTING}) diff --git a/Tests/RunCMake/CTestCommandLine/test-load-fail-stderr.txt b/Tests/RunCMake/CTestCommandLine/test-load-fail-stderr.txt new file mode 100644 index 000000000..eafba1c69 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/test-load-fail-stderr.txt @@ -0,0 +1 @@ +No tests were found!!! diff --git a/Tests/RunCMake/CTestCommandLine/test-load-fail-stdout.txt b/Tests/RunCMake/CTestCommandLine/test-load-fail-stdout.txt new file mode 100644 index 000000000..153da09fb --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/test-load-fail-stdout.txt @@ -0,0 +1,2 @@ +^Test project .*/Tests/RunCMake/CTestCommandLine/TestLoad +\*\*\*\*\* WAITING, System Load: 5, Max Allowed Load: 2, Smallest test TestLoad[1-2] requires 1\*\*\*\*\* diff --git a/Tests/RunCMake/CTestCommandLine/test-load-invalid-stderr.txt b/Tests/RunCMake/CTestCommandLine/test-load-invalid-stderr.txt new file mode 100644 index 000000000..caab3b9b7 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/test-load-invalid-stderr.txt @@ -0,0 +1 @@ +Invalid value for 'Test Load' : 'two' diff --git a/Tests/RunCMake/CTestCommandLine/test-load-invalid-stdout.txt b/Tests/RunCMake/CTestCommandLine/test-load-invalid-stdout.txt new file mode 100644 index 000000000..7ee3daee1 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/test-load-invalid-stdout.txt @@ -0,0 +1,7 @@ +^Test project .*/Tests/RunCMake/CTestCommandLine/TestLoad + Start 1: TestLoad1 + Start 2: TestLoad2 +1/2 Test #[1-2]: TestLoad[1-2] ........................ Passed +[0-9.]+ sec +2/2 Test #[1-2]: TestLoad[1-2] ........................ Passed +[0-9.]+ sec ++ +100% tests passed, 0 tests failed out of 2 diff --git a/Tests/RunCMake/CTestCommandLine/test-load-pass-stderr.txt b/Tests/RunCMake/CTestCommandLine/test-load-pass-stderr.txt new file mode 100644 index 000000000..10f32932e --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/test-load-pass-stderr.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/CTestCommandLine/test-load-pass-stdout.txt b/Tests/RunCMake/CTestCommandLine/test-load-pass-stdout.txt new file mode 100644 index 000000000..7ee3daee1 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/test-load-pass-stdout.txt @@ -0,0 +1,7 @@ +^Test project .*/Tests/RunCMake/CTestCommandLine/TestLoad + Start 1: TestLoad1 + Start 2: TestLoad2 +1/2 Test #[1-2]: TestLoad[1-2] ........................ Passed +[0-9.]+ sec +2/2 Test #[1-2]: TestLoad[1-2] ........................ Passed +[0-9.]+ sec ++ +100% tests passed, 0 tests failed out of 2 diff --git a/Tests/RunCMake/ctest_test/CTestTestLoadFail-result.txt b/Tests/RunCMake/ctest_test/CTestTestLoadFail-result.txt new file mode 100644 index 000000000..b57e2deb7 --- /dev/null +++ b/Tests/RunCMake/ctest_test/CTestTestLoadFail-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/ctest_test/CTestTestLoadFail-stderr.txt b/Tests/RunCMake/ctest_test/CTestTestLoadFail-stderr.txt new file mode 100644 index 000000000..eafba1c69 --- /dev/null +++ b/Tests/RunCMake/ctest_test/CTestTestLoadFail-stderr.txt @@ -0,0 +1 @@ +No tests were found!!! diff --git a/Tests/RunCMake/ctest_test/CTestTestLoadFail-stdout.txt b/Tests/RunCMake/ctest_test/CTestTestLoadFail-stdout.txt new file mode 100644 index 000000000..e203c10c1 --- /dev/null +++ b/Tests/RunCMake/ctest_test/CTestTestLoadFail-stdout.txt @@ -0,0 +1,2 @@ +Test project .*/Tests/RunCMake/ctest_test/CTestTestLoadFail-build +\*\*\*\*\* WAITING, System Load: 5, Max Allowed Load: 4, Smallest test RunCMakeVersion requires 1\*\*\*\*\*$ diff --git a/Tests/RunCMake/ctest_test/CTestTestLoadInvalid-stderr.txt b/Tests/RunCMake/ctest_test/CTestTestLoadInvalid-stderr.txt new file mode 100644 index 000000000..7f2d7f6df --- /dev/null +++ b/Tests/RunCMake/ctest_test/CTestTestLoadInvalid-stderr.txt @@ -0,0 +1 @@ +^Invalid value for 'CTEST_TEST_LOAD' : ERR2 diff --git a/Tests/RunCMake/ctest_test/CTestTestLoadInvalid-stdout.txt b/Tests/RunCMake/ctest_test/CTestTestLoadInvalid-stdout.txt new file mode 100644 index 000000000..b54220cff --- /dev/null +++ b/Tests/RunCMake/ctest_test/CTestTestLoadInvalid-stdout.txt @@ -0,0 +1,7 @@ +Test project .*/Tests/RunCMake/ctest_test/CTestTestLoadInvalid-build + Start 1: RunCMakeVersion +1/1 Test #1: RunCMakeVersion .................. Passed +[0-9.]+ sec ++ +100% tests passed, 0 tests failed out of 1 ++ +Total Test time \(real\) = +[0-9.]+ sec$ diff --git a/Tests/RunCMake/ctest_test/CTestTestLoadPass-stdout.txt b/Tests/RunCMake/ctest_test/CTestTestLoadPass-stdout.txt new file mode 100644 index 000000000..c221eed72 --- /dev/null +++ b/Tests/RunCMake/ctest_test/CTestTestLoadPass-stdout.txt @@ -0,0 +1,7 @@ +Test project .*/Tests/RunCMake/ctest_test/CTestTestLoadPass-build + Start 1: RunCMakeVersion +1/1 Test #1: RunCMakeVersion .................. Passed +[0-9.]+ sec ++ +100% tests passed, 0 tests failed out of 1 ++ +Total Test time \(real\) = +[0-9.]+ sec$ diff --git a/Tests/RunCMake/ctest_test/RunCMakeTest.cmake b/Tests/RunCMake/ctest_test/RunCMakeTest.cmake index d906290e0..21d0447e5 100644 --- a/Tests/RunCMake/ctest_test/RunCMakeTest.cmake +++ b/Tests/RunCMake/ctest_test/RunCMakeTest.cmake @@ -1,6 +1,8 @@ include(RunCTest) +set(RunCMake_TEST_TIMEOUT 60) set(CASE_CTEST_TEST_ARGS "") +set(CASE_CTEST_TEST_LOAD "") function(run_ctest_test CASE_NAME) set(CASE_CTEST_TEST_ARGS "${ARGN}") @@ -8,3 +10,42 @@ function(run_ctest_test CASE_NAME) endfunction() run_ctest_test(TestQuiet QUIET) + +# Tests for the 'Test Load' feature of ctest +# +# Spoof a load average value to make these tests more reliable. +set(ENV{__CTEST_FAKE_LOAD_AVERAGE_FOR_TESTING} 5) + +# Verify that new tests are started when the load average falls below +# our threshold. +run_ctest_test(TestLoadPass TEST_LOAD 6) + +# Verify that new tests are not started when the load average exceeds +# our threshold. +run_ctest_test(TestLoadFail TEST_LOAD 2) + +# Verify that when an invalid "TEST_LOAD" value is given, a warning +# message is displayed and the value is ignored. +run_ctest_test(TestLoadInvalid TEST_LOAD "ERR1") + +# Verify that new tests are started when the load average falls below +# our threshold. +set(CASE_CTEST_TEST_LOAD 7) +run_ctest_test(CTestTestLoadPass) + +# Verify that new tests are not started when the load average exceeds +# our threshold. +set(CASE_CTEST_TEST_LOAD 4) +run_ctest_test(CTestTestLoadFail) + +# Verify that when an invalid "CTEST_TEST_LOAD" value is given, +# a warning message is displayed and the value is ignored. +set(CASE_CTEST_TEST_LOAD "ERR2") +run_ctest_test(CTestTestLoadInvalid) + +# Verify that the "TEST_LOAD" value has higher precedence than +# the "CTEST_TEST_LOAD" value +set(CASE_CTEST_TEST_LOAD "ERR3") +run_ctest_test(TestLoadOrder TEST_LOAD "ERR4") + +unset(ENV{__CTEST_FAKE_LOAD_AVERAGE_FOR_TESTING}) diff --git a/Tests/RunCMake/ctest_test/TestLoadFail-result.txt b/Tests/RunCMake/ctest_test/TestLoadFail-result.txt new file mode 100644 index 000000000..b57e2deb7 --- /dev/null +++ b/Tests/RunCMake/ctest_test/TestLoadFail-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/ctest_test/TestLoadFail-stderr.txt b/Tests/RunCMake/ctest_test/TestLoadFail-stderr.txt new file mode 100644 index 000000000..eafba1c69 --- /dev/null +++ b/Tests/RunCMake/ctest_test/TestLoadFail-stderr.txt @@ -0,0 +1 @@ +No tests were found!!! diff --git a/Tests/RunCMake/ctest_test/TestLoadFail-stdout.txt b/Tests/RunCMake/ctest_test/TestLoadFail-stdout.txt new file mode 100644 index 000000000..4d7ce48a4 --- /dev/null +++ b/Tests/RunCMake/ctest_test/TestLoadFail-stdout.txt @@ -0,0 +1,2 @@ +Test project .*/Tests/RunCMake/ctest_test/TestLoadFail-build +\*\*\*\*\* WAITING, System Load: 5, Max Allowed Load: 2, Smallest test RunCMakeVersion requires 1\*\*\*\*\*$ diff --git a/Tests/RunCMake/ctest_test/TestLoadInvalid-stderr.txt b/Tests/RunCMake/ctest_test/TestLoadInvalid-stderr.txt new file mode 100644 index 000000000..40ddb3aec --- /dev/null +++ b/Tests/RunCMake/ctest_test/TestLoadInvalid-stderr.txt @@ -0,0 +1 @@ +^Invalid value for 'TEST_LOAD' : ERR1 diff --git a/Tests/RunCMake/ctest_test/TestLoadInvalid-stdout.txt b/Tests/RunCMake/ctest_test/TestLoadInvalid-stdout.txt new file mode 100644 index 000000000..c4fd35b4a --- /dev/null +++ b/Tests/RunCMake/ctest_test/TestLoadInvalid-stdout.txt @@ -0,0 +1,7 @@ +Test project .*/Tests/RunCMake/ctest_test/TestLoadInvalid-build + Start 1: RunCMakeVersion +1/1 Test #1: RunCMakeVersion .................. Passed +[0-9.]+ sec ++ +100% tests passed, 0 tests failed out of 1 ++ +Total Test time \(real\) = +[0-9.]+ sec$ diff --git a/Tests/RunCMake/ctest_test/TestLoadOrder-stderr.txt b/Tests/RunCMake/ctest_test/TestLoadOrder-stderr.txt new file mode 100644 index 000000000..1de730e75 --- /dev/null +++ b/Tests/RunCMake/ctest_test/TestLoadOrder-stderr.txt @@ -0,0 +1 @@ +^Invalid value for 'TEST_LOAD' : ERR4 diff --git a/Tests/RunCMake/ctest_test/TestLoadOrder-stdout.txt b/Tests/RunCMake/ctest_test/TestLoadOrder-stdout.txt new file mode 100644 index 000000000..22da09211 --- /dev/null +++ b/Tests/RunCMake/ctest_test/TestLoadOrder-stdout.txt @@ -0,0 +1,7 @@ +Test project .*/Tests/RunCMake/ctest_test/TestLoadOrder-build + Start 1: RunCMakeVersion +1/1 Test #1: RunCMakeVersion .................. Passed +[0-9.]+ sec ++ +100% tests passed, 0 tests failed out of 1 ++ +Total Test time \(real\) = +[0-9.]+ sec$ diff --git a/Tests/RunCMake/ctest_test/TestLoadPass-stdout.txt b/Tests/RunCMake/ctest_test/TestLoadPass-stdout.txt new file mode 100644 index 000000000..e5048f4b4 --- /dev/null +++ b/Tests/RunCMake/ctest_test/TestLoadPass-stdout.txt @@ -0,0 +1,7 @@ +Test project .*/Tests/RunCMake/ctest_test/TestLoadPass-build + Start 1: RunCMakeVersion +1/1 Test #1: RunCMakeVersion .................. Passed +[0-9.]+ sec ++ +100% tests passed, 0 tests failed out of 1 ++ +Total Test time \(real\) = +[0-9.]+ sec$ diff --git a/Tests/RunCMake/ctest_test/test.cmake.in b/Tests/RunCMake/ctest_test/test.cmake.in index 1350abe00..a8de6a361 100644 --- a/Tests/RunCMake/ctest_test/test.cmake.in +++ b/Tests/RunCMake/ctest_test/test.cmake.in @@ -8,6 +8,7 @@ set(CTEST_CMAKE_GENERATOR "@RunCMake_GENERATOR@") set(CTEST_CMAKE_GENERATOR_PLATFORM "@RunCMake_GENERATOR_PLATFORM@") set(CTEST_CMAKE_GENERATOR_TOOLSET "@RunCMake_GENERATOR_TOOLSET@") set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") +set(CTEST_TEST_LOAD "@CASE_CTEST_TEST_LOAD@") set(ctest_test_args "@CASE_CTEST_TEST_ARGS@") ctest_start(Experimental) From 276c62253e3f25eda4acbf0049a70c7d622c9ea2 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 21 Jun 2015 22:46:42 +0200 Subject: [PATCH 0213/1048] cmMakefile: Move the IncludeScope to where it is used. --- Source/cmMakefile.cxx | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index a3ba13461..522560516 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -405,6 +405,26 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff, return result; } +bool cmMakefile::ProcessBuildsystemFile(const char* filename) +{ + this->AddDefinition("CMAKE_PARENT_LIST_FILE", filename); + std::string curSrc = this->GetCurrentSourceDirectory(); + + this->ListFileStack.push_back(filename); + + cmListFile listFile; + if (!listFile.ParseFile(filename, curSrc == this->GetHomeDirectory(), this)) + { + return false; + } + + this->PushPolicyBarrier(); + this->ReadListFile(listFile, filename); + this->PopPolicyBarrier(!cmSystemTools::GetFatalErrorOccured()); + this->EnforceDirectoryLevelRules(); + return true; +} + //---------------------------------------------------------------------------- class cmMakefile::IncludeScope { @@ -532,26 +552,6 @@ void cmMakefile::IncludeScope::EnforceCMP0011() } } -bool cmMakefile::ProcessBuildsystemFile(const char* filename) -{ - this->AddDefinition("CMAKE_PARENT_LIST_FILE", filename); - std::string curSrc = this->GetCurrentSourceDirectory(); - - this->ListFileStack.push_back(filename); - - cmListFile listFile; - if (!listFile.ParseFile(filename, curSrc == this->GetHomeDirectory(), this)) - { - return false; - } - - this->PushPolicyBarrier(); - this->ReadListFile(listFile, filename); - this->PopPolicyBarrier(!cmSystemTools::GetFatalErrorOccured()); - this->EnforceDirectoryLevelRules(); - return true; -} - bool cmMakefile::ReadDependentFile(const char* filename, bool noPolicyScope) { this->AddDefinition("CMAKE_PARENT_LIST_FILE", From 92cecd936999f9a4c67332d1aeaba3ff120fbbc2 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 21 Jun 2015 22:50:13 +0200 Subject: [PATCH 0214/1048] cmMakefile: Add automatic scopes to listfile readers. --- Source/cmMakefile.cxx | 57 ++++++++++++++++++++++++++++++++++++++----- Source/cmMakefile.h | 4 +++ 2 files changed, 55 insertions(+), 6 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 522560516..a10f99cd2 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -405,6 +405,26 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff, return result; } +class cmMakefile::BuildsystemFileScope +{ +public: + BuildsystemFileScope(cmMakefile* mf) + : Makefile(mf), ReportError(true) + { + this->Makefile->PushPolicyBarrier(); + } + + ~BuildsystemFileScope() + { + this->Makefile->PopPolicyBarrier(this->ReportError); + } + + void Quiet() { this->ReportError = false; } +private: + cmMakefile* Makefile; + bool ReportError; +}; + bool cmMakefile::ProcessBuildsystemFile(const char* filename) { this->AddDefinition("CMAKE_PARENT_LIST_FILE", filename); @@ -417,10 +437,12 @@ bool cmMakefile::ProcessBuildsystemFile(const char* filename) { return false; } - - this->PushPolicyBarrier(); + BuildsystemFileScope scope(this); this->ReadListFile(listFile, filename); - this->PopPolicyBarrier(!cmSystemTools::GetFatalErrorOccured()); + if(cmSystemTools::GetFatalErrorOccured()) + { + scope.Quiet(); + } this->EnforceDirectoryLevelRules(); return true; } @@ -576,6 +598,27 @@ bool cmMakefile::ReadDependentFile(const char* filename, bool noPolicyScope) return true; } +class cmMakefile::ListFileScope +{ +public: + ListFileScope(cmMakefile* mf) + : Makefile(mf), ReportError(true) + { + this->Makefile->PushPolicyBarrier(); + } + + ~ListFileScope() + { + this->Makefile->PopPolicyBarrier(this->ReportError); + this->Makefile->ListFileStack.pop_back(); + } + + void Quiet() { this->ReportError = false; } +private: + cmMakefile* Makefile; + bool ReportError; +}; + bool cmMakefile::ReadListFile(const char* filename) { std::string filenametoread = @@ -590,10 +633,12 @@ bool cmMakefile::ReadListFile(const char* filename) return false; } - this->PushPolicyBarrier(); + ListFileScope scope(this); this->ReadListFile(listFile, filenametoread); - this->PopPolicyBarrier(!cmSystemTools::GetFatalErrorOccured()); - this->ListFileStack.pop_back(); + if(cmSystemTools::GetFatalErrorOccured()) + { + scope.Quiet(); + } return true; } diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 85f117bf6..64783e573 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -968,6 +968,10 @@ private: friend class cmCMakePolicyCommand; class IncludeScope; friend class IncludeScope; + class ListFileScope; + friend class ListFileScope; + class BuildsystemFileScope; + friend class BuildsystemFileScope; // stack of policy settings struct PolicyStackEntry: public cmPolicies::PolicyMap From dd7e42758d4874c087bbbc6ae062f36455f6d49c Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 21 Jun 2015 22:50:52 +0200 Subject: [PATCH 0215/1048] cmMakefile: Move the lexical scope. --- Source/cmMakefile.cxx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index a10f99cd2..9948ac889 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -645,6 +645,8 @@ bool cmMakefile::ReadListFile(const char* filename) void cmMakefile::ReadListFile(cmListFile const& listFile, std::string const& filenametoread) { + LexicalPushPop lexScope(this); + // add this list file to the list of dependencies this->ListFiles.push_back(filenametoread); @@ -661,9 +663,6 @@ void cmMakefile::ReadListFile(cmListFile const& listFile, this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_FILE"); this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_DIR"); - // Enforce balanced blocks (if/endif, function/endfunction, etc.). - LexicalPushPop lexScope(this); - // Run the parsed commands. const size_t numberFunctions = listFile.Functions.size(); for(size_t i =0; i < numberFunctions; ++i) From 0818737c851dce18a6da442ee73029b0de22ad56 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 21 Jun 2015 22:53:16 +0200 Subject: [PATCH 0216/1048] cmMakefile: Make listfile scopes responsible for logical checks. Remove the LexicalPushPop. --- Source/cmMakefile.cxx | 23 ++++++----------------- Source/cmMakefile.h | 13 ------------- 2 files changed, 6 insertions(+), 30 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 9948ac889..d6cf104a5 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -412,10 +412,12 @@ public: : Makefile(mf), ReportError(true) { this->Makefile->PushPolicyBarrier(); + this->Makefile->PushFunctionBlockerBarrier(); } ~BuildsystemFileScope() { + this->Makefile->PopFunctionBlockerBarrier(this->ReportError); this->Makefile->PopPolicyBarrier(this->ReportError); } @@ -502,11 +504,13 @@ cmMakefile::IncludeScope::IncludeScope(cmMakefile* mf, // The included file cannot pop our policy scope. this->Makefile->PushPolicyBarrier(); this->Makefile->ListFileStack.push_back(filenametoread); + this->Makefile->PushFunctionBlockerBarrier(); } //---------------------------------------------------------------------------- cmMakefile::IncludeScope::~IncludeScope() { + this->Makefile->PopFunctionBlockerBarrier(this->ReportError); // Enforce matching policy scopes inside the included file. this->Makefile->PopPolicyBarrier(this->ReportError); @@ -605,10 +609,12 @@ public: : Makefile(mf), ReportError(true) { this->Makefile->PushPolicyBarrier(); + this->Makefile->PushFunctionBlockerBarrier(); } ~ListFileScope() { + this->Makefile->PopFunctionBlockerBarrier(this->ReportError); this->Makefile->PopPolicyBarrier(this->ReportError); this->Makefile->ListFileStack.pop_back(); } @@ -645,8 +651,6 @@ bool cmMakefile::ReadListFile(const char* filename) void cmMakefile::ReadListFile(cmListFile const& listFile, std::string const& filenametoread) { - LexicalPushPop lexScope(this); - // add this list file to the list of dependencies this->ListFiles.push_back(filenametoread); @@ -671,8 +675,6 @@ void cmMakefile::ReadListFile(cmListFile const& listFile, this->ExecuteCommand(listFile.Functions[i],status); if(cmSystemTools::GetFatalErrorOccured()) { - // Exit early due to error. - lexScope.Quiet(); break; } if(status.GetReturnInvoked()) @@ -3521,19 +3523,6 @@ cmMakefile::RemoveFunctionBlocker(cmFunctionBlocker* fb, return cmsys::auto_ptr(); } -//---------------------------------------------------------------------------- -cmMakefile::LexicalPushPop::LexicalPushPop(cmMakefile* mf): - Makefile(mf), ReportError(true) -{ - this->Makefile->PushFunctionBlockerBarrier(); -} - -//---------------------------------------------------------------------------- -cmMakefile::LexicalPushPop::~LexicalPushPop() -{ - this->Makefile->PopFunctionBlockerBarrier(this->ReportError); -} - const char* cmMakefile::GetHomeDirectory() const { return this->GetCMakeInstance()->GetHomeDirectory(); diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 64783e573..ebf33df62 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -100,19 +100,6 @@ public: cmsys::auto_ptr RemoveFunctionBlocker(cmFunctionBlocker* fb, const cmListFileFunction& lff); - /** Push/pop a lexical (function blocker) barrier automatically. */ - class LexicalPushPop - { - public: - LexicalPushPop(cmMakefile* mf); - ~LexicalPushPop(); - void Quiet() { this->ReportError = false; } - private: - cmMakefile* Makefile; - bool ReportError; - }; - friend class LexicalPushPop; - /** * Try running cmake and building a file. This is used for dynalically * loaded commands, not as part of the usual build process. From 6708d21664baf3bab6f8af143c373de7af84bffc Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 23 Jun 2015 09:25:03 +0200 Subject: [PATCH 0217/1048] cmMakefile: Remove IncludeScope Quiet call. --- Source/cmMakefile.cxx | 1 - 1 file changed, 1 deletion(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index d6cf104a5..b21e44117 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -591,7 +591,6 @@ bool cmMakefile::ReadDependentFile(const char* filename, bool noPolicyScope) cmListFile listFile; if (!listFile.ParseFile(filenametoread.c_str(), false, this)) { - incScope.Quiet(); return false; } this->ReadListFile(listFile, filenametoread); From b661403177edb1d22b89cc4a0ea69a8f93ad2ad2 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 21 Jun 2015 22:56:15 +0200 Subject: [PATCH 0218/1048] cmMakefile: Add filename to ReadListFile auto scopes. --- Source/cmMakefile.cxx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index b21e44117..b9a66d3ff 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -408,9 +408,10 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff, class cmMakefile::BuildsystemFileScope { public: - BuildsystemFileScope(cmMakefile* mf) + BuildsystemFileScope(cmMakefile* mf, std::string const& filename) : Makefile(mf), ReportError(true) { + this->Makefile->ListFileStack.push_back(filename); this->Makefile->PushPolicyBarrier(); this->Makefile->PushFunctionBlockerBarrier(); } @@ -432,14 +433,13 @@ bool cmMakefile::ProcessBuildsystemFile(const char* filename) this->AddDefinition("CMAKE_PARENT_LIST_FILE", filename); std::string curSrc = this->GetCurrentSourceDirectory(); - this->ListFileStack.push_back(filename); + BuildsystemFileScope scope(this, filename); cmListFile listFile; if (!listFile.ParseFile(filename, curSrc == this->GetHomeDirectory(), this)) { return false; } - BuildsystemFileScope scope(this); this->ReadListFile(listFile, filename); if(cmSystemTools::GetFatalErrorOccured()) { @@ -604,9 +604,10 @@ bool cmMakefile::ReadDependentFile(const char* filename, bool noPolicyScope) class cmMakefile::ListFileScope { public: - ListFileScope(cmMakefile* mf) + ListFileScope(cmMakefile* mf, std::string const& filenametoread) : Makefile(mf), ReportError(true) { + this->Makefile->ListFileStack.push_back(filenametoread); this->Makefile->PushPolicyBarrier(); this->Makefile->PushFunctionBlockerBarrier(); } @@ -630,7 +631,7 @@ bool cmMakefile::ReadListFile(const char* filename) cmSystemTools::CollapseFullPath(filename, this->GetCurrentSourceDirectory()); - this->ListFileStack.push_back(filenametoread); + ListFileScope scope(this, filenametoread); cmListFile listFile; if (!listFile.ParseFile(filenametoread.c_str(), false, this)) @@ -638,7 +639,6 @@ bool cmMakefile::ReadListFile(const char* filename) return false; } - ListFileScope scope(this); this->ReadListFile(listFile, filenametoread); if(cmSystemTools::GetFatalErrorOccured()) { From f346d88d102c627e98f630ae1c9d26cc899f76d8 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 21 Jun 2015 23:00:44 +0200 Subject: [PATCH 0219/1048] cmMakefile: Avoid invoking EnforceDirectoryLevelRules. This is part of the CMP0000 implementation and only needs to be invoked for top-level buildsystem files currently. --- Source/cmGlobalGenerator.cxx | 1 + Source/cmMakefile.cxx | 1 - Source/cmMakefile.h | 5 ++--- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 23ab93de8..383984d50 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1106,6 +1106,7 @@ void cmGlobalGenerator::Configure() // now do it lg->GetMakefile()->Configure(); + lg->GetMakefile()->EnforceDirectoryLevelRules(); // update the cache entry for the number of local generators, this is used // for progress diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index b9a66d3ff..87292ea62 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -445,7 +445,6 @@ bool cmMakefile::ProcessBuildsystemFile(const char* filename) { scope.Quiet(); } - this->EnforceDirectoryLevelRules(); return true; } diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index ebf33df62..aa70c725b 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -825,6 +825,8 @@ public: std::string GetExecutionFilePath() const; + void EnforceDirectoryLevelRules() const; + protected: // add link libraries and directories to the target void AddGlobalLinkInformation(const std::string& name, cmTarget& target); @@ -975,9 +977,6 @@ private: cmPolicies::PolicyStatus GetPolicyStatusInternal(cmPolicies::PolicyID id) const; - // Enforce rules about CMakeLists.txt files. - void EnforceDirectoryLevelRules() const; - // CMP0053 == old cmake::MessageType ExpandVariablesInStringOld( std::string& errorstr, From 5bf9bfda3f364b27ca91eacab18ec4dad2cc59f7 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 21 Jun 2015 23:01:13 +0200 Subject: [PATCH 0220/1048] cmMakefile: Don't use string comparison to check directory level. --- Source/cmMakefile.cxx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 87292ea62..53c2d4c71 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -431,12 +431,11 @@ private: bool cmMakefile::ProcessBuildsystemFile(const char* filename) { this->AddDefinition("CMAKE_PARENT_LIST_FILE", filename); - std::string curSrc = this->GetCurrentSourceDirectory(); BuildsystemFileScope scope(this, filename); cmListFile listFile; - if (!listFile.ParseFile(filename, curSrc == this->GetHomeDirectory(), this)) + if (!listFile.ParseFile(filename, this->IsRootMakefile(), this)) { return false; } From be5997ef77dccc866ddb96bdfd2f529f74988eef Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 21 Jun 2015 23:13:24 +0200 Subject: [PATCH 0221/1048] cmMakefile: Inline ProcessBuildsystemFile into only caller. --- Source/cmMakefile.cxx | 82 ++++++++++++++++++++----------------------- 1 file changed, 39 insertions(+), 43 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 53c2d4c71..32dd8f53c 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -405,48 +405,6 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff, return result; } -class cmMakefile::BuildsystemFileScope -{ -public: - BuildsystemFileScope(cmMakefile* mf, std::string const& filename) - : Makefile(mf), ReportError(true) - { - this->Makefile->ListFileStack.push_back(filename); - this->Makefile->PushPolicyBarrier(); - this->Makefile->PushFunctionBlockerBarrier(); - } - - ~BuildsystemFileScope() - { - this->Makefile->PopFunctionBlockerBarrier(this->ReportError); - this->Makefile->PopPolicyBarrier(this->ReportError); - } - - void Quiet() { this->ReportError = false; } -private: - cmMakefile* Makefile; - bool ReportError; -}; - -bool cmMakefile::ProcessBuildsystemFile(const char* filename) -{ - this->AddDefinition("CMAKE_PARENT_LIST_FILE", filename); - - BuildsystemFileScope scope(this, filename); - - cmListFile listFile; - if (!listFile.ParseFile(filename, this->IsRootMakefile(), this)) - { - return false; - } - this->ReadListFile(listFile, filename); - if(cmSystemTools::GetFatalErrorOccured()) - { - scope.Quiet(); - } - return true; -} - //---------------------------------------------------------------------------- class cmMakefile::IncludeScope { @@ -1697,6 +1655,29 @@ public: } }; +class cmMakefile::BuildsystemFileScope +{ +public: + BuildsystemFileScope(cmMakefile* mf, std::string const& filename) + : Makefile(mf), ReportError(true) + { + this->Makefile->ListFileStack.push_back(filename); + this->Makefile->PushPolicyBarrier(); + this->Makefile->PushFunctionBlockerBarrier(); + } + + ~BuildsystemFileScope() + { + this->Makefile->PopFunctionBlockerBarrier(this->ReportError); + this->Makefile->PopPolicyBarrier(this->ReportError); + } + + void Quiet() { this->ReportError = false; } +private: + cmMakefile* Makefile; + bool ReportError; +}; + //---------------------------------------------------------------------------- void cmMakefile::Configure() { @@ -1710,7 +1691,22 @@ void cmMakefile::Configure() std::string currentStart = this->StateSnapshot.GetCurrentSourceDirectory(); currentStart += "/CMakeLists.txt"; assert(cmSystemTools::FileExists(currentStart.c_str(), true)); - this->ProcessBuildsystemFile(currentStart.c_str()); + this->AddDefinition("CMAKE_PARENT_LIST_FILE", currentStart.c_str()); + + { + BuildsystemFileScope scope(this, currentStart); + cmListFile listFile; + if (!listFile.ParseFile(currentStart.c_str(), this->IsRootMakefile(), this)) + { + this->SetConfigured(); + return; + } + this->ReadListFile(listFile, currentStart); + if(cmSystemTools::GetFatalErrorOccured()) + { + scope.Quiet(); + } + } // at the end handle any old style subdirs std::vector subdirs = this->UnConfiguredDirectories; From 0a34ea597a954f49335559108bf3fa3382734657 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 21 Jun 2015 23:19:50 +0200 Subject: [PATCH 0222/1048] cmMakefile: Compute the filename processed in a scope. --- Source/cmMakefile.cxx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 32dd8f53c..3aaf8d0cf 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1658,10 +1658,13 @@ public: class cmMakefile::BuildsystemFileScope { public: - BuildsystemFileScope(cmMakefile* mf, std::string const& filename) + BuildsystemFileScope(cmMakefile* mf) : Makefile(mf), ReportError(true) { - this->Makefile->ListFileStack.push_back(filename); + std::string currentStart = + this->Makefile->StateSnapshot.GetCurrentSourceDirectory(); + currentStart += "/CMakeLists.txt"; + this->Makefile->ListFileStack.push_back(currentStart); this->Makefile->PushPolicyBarrier(); this->Makefile->PushFunctionBlockerBarrier(); } @@ -1694,7 +1697,7 @@ void cmMakefile::Configure() this->AddDefinition("CMAKE_PARENT_LIST_FILE", currentStart.c_str()); { - BuildsystemFileScope scope(this, currentStart); + BuildsystemFileScope scope(this); cmListFile listFile; if (!listFile.ParseFile(currentStart.c_str(), this->IsRootMakefile(), this)) { From 3f5200ec5f17de36d0db1729d61e520fb014abe5 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 26 Jun 2015 00:11:10 +0200 Subject: [PATCH 0223/1048] cmMakefile: Expand the scope of scoped buildsystem file state. --- Source/cmMakefile.cxx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 3aaf8d0cf..79f4c44d5 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1685,6 +1685,7 @@ private: void cmMakefile::Configure() { cmMakefileCurrent cmf(this); + BuildsystemFileScope scope(this); // make sure the CMakeFiles dir is there std::string filesDir = this->StateSnapshot.GetCurrentBinaryDirectory(); @@ -1696,8 +1697,6 @@ void cmMakefile::Configure() assert(cmSystemTools::FileExists(currentStart.c_str(), true)); this->AddDefinition("CMAKE_PARENT_LIST_FILE", currentStart.c_str()); - { - BuildsystemFileScope scope(this); cmListFile listFile; if (!listFile.ParseFile(currentStart.c_str(), this->IsRootMakefile(), this)) { @@ -1709,7 +1708,6 @@ void cmMakefile::Configure() { scope.Quiet(); } - } // at the end handle any old style subdirs std::vector subdirs = this->UnConfiguredDirectories; From e28e110d221a50687cc9922743366b2f34ccd852 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 26 Jun 2015 00:11:51 +0200 Subject: [PATCH 0224/1048] cmMakefile: Rename a variable. --- Source/cmMakefile.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 79f4c44d5..0edced5f6 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1630,13 +1630,13 @@ bool cmMakefile::IsRootMakefile() const class cmMakefileCurrent { cmGlobalGenerator* GG; - cmMakefile* MF; + cmMakefile* CurrentMakefile; cmState::Snapshot Snapshot; public: cmMakefileCurrent(cmMakefile* mf) { this->GG = mf->GetGlobalGenerator(); - this->MF = this->GG->GetCurrentMakefile(); + this->CurrentMakefile = this->GG->GetCurrentMakefile(); this->Snapshot = this->GG->GetCMakeInstance()->GetCurrentSnapshot(); this->GG->GetCMakeInstance()->SetCurrentSnapshot( this->GG->GetCMakeInstance()->GetCurrentSnapshot()); @@ -1650,7 +1650,7 @@ public: #if defined(CMAKE_BUILD_WITH_CMAKE) this->GG->GetFileLockPool().PopFileScope(); #endif - this->GG->SetCurrentMakefile(this->MF); + this->GG->SetCurrentMakefile(this->CurrentMakefile); this->GG->GetCMakeInstance()->SetCurrentSnapshot(this->Snapshot); } }; From 48c6a92b286522cf350412d6dd3219b263e9ab5b Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 26 Jun 2015 00:13:22 +0200 Subject: [PATCH 0225/1048] cmMakefile: Merge two Scope types and instances. --- Source/cmMakefile.cxx | 48 ++++++++++++++++--------------------------- 1 file changed, 18 insertions(+), 30 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 0edced5f6..cdcf88c15 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1626,35 +1626,6 @@ bool cmMakefile::IsRootMakefile() const return !this->StateSnapshot.GetBuildsystemDirectoryParent().IsValid(); } -//---------------------------------------------------------------------------- -class cmMakefileCurrent -{ - cmGlobalGenerator* GG; - cmMakefile* CurrentMakefile; - cmState::Snapshot Snapshot; -public: - cmMakefileCurrent(cmMakefile* mf) - { - this->GG = mf->GetGlobalGenerator(); - this->CurrentMakefile = this->GG->GetCurrentMakefile(); - this->Snapshot = this->GG->GetCMakeInstance()->GetCurrentSnapshot(); - this->GG->GetCMakeInstance()->SetCurrentSnapshot( - this->GG->GetCMakeInstance()->GetCurrentSnapshot()); - this->GG->SetCurrentMakefile(mf); -#if defined(CMAKE_BUILD_WITH_CMAKE) - this->GG->GetFileLockPool().PushFileScope(); -#endif - } - ~cmMakefileCurrent() - { -#if defined(CMAKE_BUILD_WITH_CMAKE) - this->GG->GetFileLockPool().PopFileScope(); -#endif - this->GG->SetCurrentMakefile(this->CurrentMakefile); - this->GG->GetCMakeInstance()->SetCurrentSnapshot(this->Snapshot); - } -}; - class cmMakefile::BuildsystemFileScope { public: @@ -1667,24 +1638,41 @@ public: this->Makefile->ListFileStack.push_back(currentStart); this->Makefile->PushPolicyBarrier(); this->Makefile->PushFunctionBlockerBarrier(); + + this->GG = mf->GetGlobalGenerator(); + this->CurrentMakefile = this->GG->GetCurrentMakefile(); + this->Snapshot = this->GG->GetCMakeInstance()->GetCurrentSnapshot(); + this->GG->GetCMakeInstance()->SetCurrentSnapshot( + this->GG->GetCMakeInstance()->GetCurrentSnapshot()); + this->GG->SetCurrentMakefile(mf); +#if defined(CMAKE_BUILD_WITH_CMAKE) + this->GG->GetFileLockPool().PushFileScope(); +#endif } ~BuildsystemFileScope() { this->Makefile->PopFunctionBlockerBarrier(this->ReportError); this->Makefile->PopPolicyBarrier(this->ReportError); +#if defined(CMAKE_BUILD_WITH_CMAKE) + this->GG->GetFileLockPool().PopFileScope(); +#endif + this->GG->SetCurrentMakefile(this->CurrentMakefile); + this->GG->GetCMakeInstance()->SetCurrentSnapshot(this->Snapshot); } void Quiet() { this->ReportError = false; } private: cmMakefile* Makefile; + cmGlobalGenerator* GG; + cmMakefile* CurrentMakefile; + cmState::Snapshot Snapshot; bool ReportError; }; //---------------------------------------------------------------------------- void cmMakefile::Configure() { - cmMakefileCurrent cmf(this); BuildsystemFileScope scope(this); // make sure the CMakeFiles dir is there From 09993d888a31a3944378dd60cc4aef0daaf056dc Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Wed, 1 Jul 2015 00:01:05 -0400 Subject: [PATCH 0226/1048] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index fd8861011..775f60138 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 3) -set(CMake_VERSION_PATCH 20150630) +set(CMake_VERSION_PATCH 20150701) #set(CMake_VERSION_RC 1) From faec4e611d08ea2f75d2127e3ca3f5e9a427465b Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 6 Jun 2015 13:08:17 +0200 Subject: [PATCH 0227/1048] cmComputeTargetDepends: Change API to use cmGeneratorTarget. --- Source/cmComputeTargetDepends.cxx | 81 ++++++++++++---------- Source/cmComputeTargetDepends.h | 16 +++-- Source/cmGhsMultiTargetGenerator.cxx | 4 +- Source/cmGlobalGenerator.cxx | 29 ++++---- Source/cmGlobalGenerator.h | 7 +- Source/cmGlobalNinjaGenerator.cxx | 6 +- Source/cmGlobalUnixMakefileGenerator3.cxx | 24 +++---- Source/cmGlobalUnixMakefileGenerator3.h | 4 +- Source/cmGlobalVisualStudio6Generator.cxx | 2 +- Source/cmGlobalVisualStudio7Generator.cxx | 12 ++-- Source/cmGlobalVisualStudio8Generator.cxx | 3 +- Source/cmGlobalVisualStudioGenerator.cxx | 27 +++++--- Source/cmGlobalVisualStudioGenerator.h | 3 +- Source/cmGlobalXCodeGenerator.cxx | 5 +- Source/cmTargetDepend.h | 13 ++-- Source/cmVisualStudio10TargetGenerator.cxx | 4 +- 16 files changed, 132 insertions(+), 108 deletions(-) diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx index 87b47b49f..c4a03a08d 100644 --- a/Source/cmComputeTargetDepends.cxx +++ b/Source/cmComputeTargetDepends.cxx @@ -147,12 +147,12 @@ bool cmComputeTargetDepends::Compute() //---------------------------------------------------------------------------- void -cmComputeTargetDepends::GetTargetDirectDepends(cmTarget const* t, +cmComputeTargetDepends::GetTargetDirectDepends(cmGeneratorTarget const* t, cmTargetDependSet& deps) { // Lookup the index for this target. All targets should be known by // this point. - std::map::const_iterator tii + std::map::const_iterator tii = this->TargetIndex.find(t); assert(tii != this->TargetIndex.end()); int i = tii->second; @@ -161,7 +161,7 @@ cmComputeTargetDepends::GetTargetDirectDepends(cmTarget const* t, EdgeList const& nl = this->FinalGraph[i]; for(EdgeList::const_iterator ni = nl.begin(); ni != nl.end(); ++ni) { - cmTarget const* dep = this->Targets[*ni]; + cmGeneratorTarget const* dep = this->Targets[*ni]; cmTargetDependSet::iterator di = deps.insert(dep).first; di->SetType(ni->IsStrong()); } @@ -180,9 +180,11 @@ void cmComputeTargetDepends::CollectTargets() ti != targets.end(); ++ti) { cmTarget const* target = &ti->second; + cmGeneratorTarget* gt = + this->GlobalGenerator->GetGeneratorTarget(target); int index = static_cast(this->Targets.size()); - this->TargetIndex[target] = index; - this->Targets.push_back(target); + this->TargetIndex[gt] = index; + this->Targets.push_back(gt); } } } @@ -204,7 +206,7 @@ void cmComputeTargetDepends::CollectDepends() void cmComputeTargetDepends::CollectTargetDepends(int depender_index) { // Get the depender. - cmTarget const* depender = this->Targets[depender_index]; + cmGeneratorTarget const* depender = this->Targets[depender_index]; if (depender->GetType() == cmTarget::INTERFACE_LIBRARY) { return; @@ -216,10 +218,9 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index) // deal with config-specific dependencies. { std::set emitted; - cmGeneratorTarget* gt = this->GlobalGenerator->GetGeneratorTarget(depender); std::vector configs; - depender->GetMakefile()->GetConfigurations(configs); + depender->Makefile->GetConfigurations(configs); if (configs.empty()) { configs.push_back(""); @@ -228,7 +229,7 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index) it != configs.end(); ++it) { std::vector objectFiles; - gt->GetExternalObjects(objectFiles, *it); + depender->GetExternalObjects(objectFiles, *it); for(std::vector::const_iterator oi = objectFiles.begin(); oi != objectFiles.end(); ++oi) { @@ -244,15 +245,15 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index) ->IssueMessage(cmake::FATAL_ERROR, "Only executables and non-OBJECT libraries may " "reference target objects.", - depender->GetBacktrace()); + depender->Target->GetBacktrace()); return; } - const_cast(depender)->AddUtility(objLib); + const_cast(depender)->Target->AddUtility(objLib); } } cmTarget::LinkImplementation const* impl = - depender->GetLinkImplementation(*it); + depender->Target->GetLinkImplementation(*it); // A target should not depend on itself. emitted.insert(depender->GetName()); @@ -272,7 +273,7 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index) // Loop over all utility dependencies. { - std::set const& tutils = depender->GetUtilityItems(); + std::set const& tutils = depender->Target->GetUtilityItems(); std::set emitted; // A target should not depend on itself. emitted.insert(depender->GetName()); @@ -290,13 +291,14 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index) //---------------------------------------------------------------------------- void cmComputeTargetDepends::AddInterfaceDepends(int depender_index, - cmTarget const* dependee, - const std::string& config, - std::set &emitted) + const cmGeneratorTarget* dependee, + const std::string& config, + std::set &emitted) { - cmTarget const* depender = this->Targets[depender_index]; + cmGeneratorTarget const* depender = this->Targets[depender_index]; if(cmTarget::LinkInterface const* iface = - dependee->GetLinkInterface(config, depender)) + dependee->Target->GetLinkInterface(config, + depender->Target)) { for(std::vector::const_iterator lib = iface->Libraries.begin(); @@ -317,7 +319,7 @@ void cmComputeTargetDepends::AddInterfaceDepends(int depender_index, cmLinkItem const& dependee_name, std::set &emitted) { - cmTarget const* depender = this->Targets[depender_index]; + cmGeneratorTarget const* depender = this->Targets[depender_index]; cmTarget const* dependee = dependee_name.Target; // Skip targets that will not really be linked. This is probably a // name conflict between an external library and an executable @@ -331,16 +333,17 @@ void cmComputeTargetDepends::AddInterfaceDepends(int depender_index, if(dependee) { - this->AddInterfaceDepends(depender_index, dependee, "", emitted); + cmGeneratorTarget* gt = + this->GlobalGenerator->GetGeneratorTarget(dependee); + this->AddInterfaceDepends(depender_index, gt, "", emitted); std::vector configs; - depender->GetMakefile()->GetConfigurations(configs); + depender->Makefile->GetConfigurations(configs); for (std::vector::const_iterator it = configs.begin(); it != configs.end(); ++it) { // A target should not depend on itself. emitted.insert(depender->GetName()); - this->AddInterfaceDepends(depender_index, dependee, - *it, emitted); + this->AddInterfaceDepends(depender_index, gt, *it, emitted); } } } @@ -351,7 +354,7 @@ void cmComputeTargetDepends::AddTargetDepend( bool linking) { // Get the depender. - cmTarget const* depender = this->Targets[depender_index]; + cmGeneratorTarget const* depender = this->Targets[depender_index]; // Check the target's makefile first. cmTarget const* dependee = dependee_name.Target; @@ -362,7 +365,7 @@ void cmComputeTargetDepends::AddTargetDepend( cmake::MessageType messageType = cmake::AUTHOR_WARNING; bool issueMessage = false; std::ostringstream e; - switch(depender->GetPolicyStatusCMP0046()) + switch(depender->Target->GetPolicyStatusCMP0046()) { case cmPolicies::WARN: e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0046) << "\n"; @@ -383,7 +386,7 @@ void cmComputeTargetDepends::AddTargetDepend( << "\" of target \"" << depender->GetName() << "\" does not exist."; cmListFileBacktrace const* backtrace = - depender->GetUtilityBacktrace(dependee_name); + depender->Target->GetUtilityBacktrace(dependee_name); if(backtrace) { cm->IssueMessage(messageType, e.str(), *backtrace); @@ -408,27 +411,31 @@ void cmComputeTargetDepends::AddTargetDepend( if(dependee) { - this->AddTargetDepend(depender_index, dependee, linking); + cmGeneratorTarget* gt = + this->GlobalGenerator->GetGeneratorTarget(dependee); + this->AddTargetDepend(depender_index, gt, linking); } } //---------------------------------------------------------------------------- void cmComputeTargetDepends::AddTargetDepend(int depender_index, - cmTarget const* dependee, + const cmGeneratorTarget* dependee, bool linking) { - if(dependee->IsImported() || + if(dependee->Target->IsImported() || dependee->GetType() == cmTarget::INTERFACE_LIBRARY) { // Skip IMPORTED and INTERFACE targets but follow their utility // dependencies. - std::set const& utils = dependee->GetUtilityItems(); + std::set const& utils = dependee->Target->GetUtilityItems(); for(std::set::const_iterator i = utils.begin(); i != utils.end(); ++i) { if(cmTarget const* transitive_dependee = i->Target) { - this->AddTargetDepend(depender_index, transitive_dependee, false); + cmGeneratorTarget* gt = + this->GlobalGenerator->GetGeneratorTarget(transitive_dependee); + this->AddTargetDepend(depender_index, gt, false); } } } @@ -436,7 +443,7 @@ void cmComputeTargetDepends::AddTargetDepend(int depender_index, { // Lookup the index for this target. All targets should be known by // this point. - std::map::const_iterator tii = + std::map::const_iterator tii = this->TargetIndex.find(dependee); assert(tii != this->TargetIndex.end()); int dependee_index = tii->second; @@ -457,13 +464,13 @@ cmComputeTargetDepends::DisplayGraph(Graph const& graph, for(int depender_index = 0; depender_index < n; ++depender_index) { EdgeList const& nl = graph[depender_index]; - cmTarget const* depender = this->Targets[depender_index]; + cmGeneratorTarget const* depender = this->Targets[depender_index]; fprintf(stderr, "target %d is [%s]\n", depender_index, depender->GetName().c_str()); for(EdgeList::const_iterator ni = nl.begin(); ni != nl.end(); ++ni) { int dependee_index = *ni; - cmTarget const* dependee = this->Targets[dependee_index]; + cmGeneratorTarget const* dependee = this->Targets[dependee_index]; fprintf(stderr, " depends on target %d [%s] (%s)\n", dependee_index, dependee->GetName().c_str(), ni->IsStrong()? "strong" : "weak"); } @@ -550,11 +557,11 @@ cmComputeTargetDepends { // Get the depender. int i = *ci; - cmTarget const* depender = this->Targets[i]; + cmGeneratorTarget const* depender = this->Targets[i]; // Describe the depender. e << " \"" << depender->GetName() << "\" of type " - << cmTarget::GetTargetTypeName(depender->GetType()) << "\n"; + << cmTarget::GetTargetTypeName(depender->Target->GetType()) << "\n"; // List its dependencies that are inside the component. EdgeList const& nl = this->InitialGraph[i]; @@ -563,7 +570,7 @@ cmComputeTargetDepends int j = *ni; if(cmap[j] == c) { - cmTarget const* dependee = this->Targets[j]; + cmGeneratorTarget const* dependee = this->Targets[j]; e << " depends on \"" << dependee->GetName() << "\"" << " (" << (ni->IsStrong()? "strong" : "weak") << ")\n"; } diff --git a/Source/cmComputeTargetDepends.h b/Source/cmComputeTargetDepends.h index 902f342bf..6100d970a 100644 --- a/Source/cmComputeTargetDepends.h +++ b/Source/cmComputeTargetDepends.h @@ -21,7 +21,7 @@ class cmComputeComponentGraph; class cmGlobalGenerator; class cmLinkItem; -class cmTarget; +class cmGeneratorTarget; class cmTargetDependSet; /** \class cmComputeTargetDepends @@ -39,9 +39,10 @@ public: bool Compute(); - std::vector const& + std::vector const& GetTargets() const { return this->Targets; } - void GetTargetDirectDepends(cmTarget const* t, cmTargetDependSet& deps); + void GetTargetDirectDepends(cmGeneratorTarget const* t, + cmTargetDependSet& deps); private: void CollectTargets(); void CollectDepends(); @@ -49,13 +50,14 @@ private: void AddTargetDepend(int depender_index, cmLinkItem const& dependee_name, bool linking); - void AddTargetDepend(int depender_index, cmTarget const* dependee, + void AddTargetDepend(int depender_index, cmGeneratorTarget const* dependee, bool linking); bool ComputeFinalDepends(cmComputeComponentGraph const& ccg); void AddInterfaceDepends(int depender_index, cmLinkItem const& dependee_name, std::set &emitted); - void AddInterfaceDepends(int depender_index, cmTarget const* dependee, + void AddInterfaceDepends(int depender_index, + cmGeneratorTarget const* dependee, const std::string& config, std::set &emitted); cmGlobalGenerator* GlobalGenerator; @@ -63,8 +65,8 @@ private: bool NoCycles; // Collect all targets. - std::vector Targets; - std::map TargetIndex; + std::vector Targets; + std::map TargetIndex; // Represent the target dependency graph. The entry at each // top-level index corresponds to a depender whose dependencies are diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx index 14efc3e66..2f9265a91 100644 --- a/Source/cmGhsMultiTargetGenerator.cxx +++ b/Source/cmGhsMultiTargetGenerator.cxx @@ -355,11 +355,11 @@ void cmGhsMultiTargetGenerator::WriteTargetLinkLibraries() { // library directories cmTargetDependSet tds = - this->GetGlobalGenerator()->GetTargetDirectDepends(*this->Target); + this->GetGlobalGenerator()->GetTargetDirectDepends(this->GeneratorTarget); for (cmTargetDependSet::iterator tdsI = tds.begin(); tdsI != tds.end(); ++tdsI) { - const cmTarget *tg(*tdsI); + const cmTarget *tg = (*tdsI)->Target; *this->GetFolderBuildStreams() << " -L\"" << GetAbsBuildFilePath(tg) << "\"" << std::endl; } diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 23ab93de8..a69732e79 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1354,9 +1354,9 @@ bool cmGlobalGenerator::ComputeTargetDepends() { return false; } - std::vector const& targets = ctd.GetTargets(); - for(std::vector::const_iterator ti = targets.begin(); - ti != targets.end(); ++ti) + std::vector const& targets = ctd.GetTargets(); + for(std::vector::const_iterator ti + = targets.begin(); ti != targets.end(); ++ti) { ctd.GetTargetDirectDepends(*ti, this->TargetDependencies[*ti]); } @@ -2050,12 +2050,13 @@ void cmGlobalGenerator::FillLocalGeneratorToTargetMap() // Add dependencies of the included target. An excluded // target may still be included if it is a dependency of a // non-excluded target. - TargetDependSet const& tgtdeps = this->GetTargetDirectDepends(target); + cmGeneratorTarget* gt = this->GetGeneratorTarget(&target); + TargetDependSet const& tgtdeps = this->GetTargetDirectDepends(gt); for(TargetDependSet::const_iterator ti = tgtdeps.begin(); ti != tgtdeps.end(); ++ti) { - cmTarget const* ttt = *ti; - targetSet.insert(ttt); + cmGeneratorTarget const* ttt = *ti; + targetSet.insert(ttt->Target); } } } @@ -2517,9 +2518,9 @@ void cmGlobalGenerator::AppendDirectoryForConfig(const std::string&, //---------------------------------------------------------------------------- cmGlobalGenerator::TargetDependSet const& -cmGlobalGenerator::GetTargetDirectDepends(cmTarget const& target) +cmGlobalGenerator::GetTargetDirectDepends(cmGeneratorTarget const* target) { - return this->TargetDependencies[&target]; + return this->TargetDependencies[target]; } void cmGlobalGenerator::AddTarget(cmTarget* t) @@ -2619,9 +2620,10 @@ void cmGlobalGenerator::GetTargetSets(TargetDependSet& projectTargets, continue; } // put the target in the set of original targets - originalTargets.insert(target); + cmGeneratorTarget* gt = this->GetGeneratorTarget(target); + originalTargets.insert(gt); // Get the set of targets that depend on target - this->AddTargetDepends(target, projectTargets); + this->AddTargetDepends(gt, projectTargets); } } } @@ -2634,7 +2636,7 @@ bool cmGlobalGenerator::IsRootOnlyTarget(cmTarget* target) const } //---------------------------------------------------------------------------- -void cmGlobalGenerator::AddTargetDepends(cmTarget const* target, +void cmGlobalGenerator::AddTargetDepends(cmGeneratorTarget const* target, TargetDependSet& projectTargets) { // add the target itself @@ -2642,11 +2644,10 @@ void cmGlobalGenerator::AddTargetDepends(cmTarget const* target, { // This is the first time we have encountered the target. // Recursively follow its dependencies. - TargetDependSet const& ts = this->GetTargetDirectDepends(*target); + TargetDependSet const& ts = this->GetTargetDirectDepends(target); for(TargetDependSet::const_iterator i = ts.begin(); i != ts.end(); ++i) { - cmTarget const* dtarget = *i; - this->AddTargetDepends(dtarget, projectTargets); + this->AddTargetDepends(*i, projectTargets); } } } diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index d606cc939..f86e82553 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -292,7 +292,8 @@ public: // what targets does the specified target depend on directly // via a target_link_libraries or add_dependencies - TargetDependSet const& GetTargetDirectDepends(cmTarget const& target); + TargetDependSet const& GetTargetDirectDepends( + const cmGeneratorTarget* target); /** Get per-target generator information. */ cmGeneratorTarget* GetGeneratorTarget(cmTarget const*) const; @@ -368,7 +369,7 @@ protected: TargetDependSet& originalTargets, cmLocalGenerator* root, GeneratorVector const&); bool IsRootOnlyTarget(cmTarget* target) const; - void AddTargetDepends(cmTarget const* target, + void AddTargetDepends(const cmGeneratorTarget* target, TargetDependSet& projectTargets); void SetLanguageEnabledFlag(const std::string& l, cmMakefile* mf); void SetLanguageEnabledMaps(const std::string& l, cmMakefile* mf); @@ -477,7 +478,7 @@ private: std::vector FilesReplacedDuringGenerate; // Store computed inter-target dependencies. - typedef std::map TargetDependMap; + typedef std::map TargetDependMap; TargetDependMap TargetDependencies; // Per-target generator information. diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 103d75ab1..722294b75 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -949,8 +949,8 @@ cmGlobalNinjaGenerator std::set const& utils = target->GetUtilities(); std::copy(utils.begin(), utils.end(), std::back_inserter(outputs)); } else { - cmTargetDependSet const& targetDeps = - this->GetTargetDirectDepends(*target); + cmGeneratorTarget* gt = this->GetGeneratorTarget(target); + cmTargetDependSet const& targetDeps = this->GetTargetDirectDepends(gt); for (cmTargetDependSet::const_iterator i = targetDeps.begin(); i != targetDeps.end(); ++i) { @@ -958,7 +958,7 @@ cmGlobalNinjaGenerator { continue; } - this->AppendTargetOutputs(*i, outputs); + this->AppendTargetOutputs((*i)->Target, outputs); } } } diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 0f61225f5..412728f38 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -804,7 +804,7 @@ cmGlobalUnixMakefileGenerator3 lg->AppendEcho(commands, "Built target " + name, cmLocalUnixMakefileGenerator3::EchoNormal, &progress); - this->AppendGlobalTargetDepends(depends,*gtarget->Target); + this->AppendGlobalTargetDepends(depends, gtarget); lg->WriteMakeRule(ruleFileStream, "All Build rule for target.", localName, depends, commands, true); @@ -832,7 +832,7 @@ cmGlobalUnixMakefileGenerator3 // std::set emitted; progCmd << " " - << this->CountProgressMarksInTarget(gtarget->Target, emitted); + << this->CountProgressMarksInTarget(gtarget, emitted); commands.push_back(progCmd.str()); } std::string tmp = cmake::GetCMakeFilesDirectoryPostSlash(); @@ -908,14 +908,14 @@ cmGlobalUnixMakefileGenerator3 //---------------------------------------------------------------------------- size_t cmGlobalUnixMakefileGenerator3 -::CountProgressMarksInTarget(cmTarget const* target, +::CountProgressMarksInTarget(cmGeneratorTarget const* target, std::set& emitted) { size_t count = 0; - if(emitted.insert(target).second) + if(emitted.insert(target->Target).second) { - count = this->ProgressMap[target].Marks.size(); - TargetDependSet const& depends = this->GetTargetDirectDepends(*target); + count = this->ProgressMap[target->Target].Marks.size(); + TargetDependSet const& depends = this->GetTargetDirectDepends(target); for(TargetDependSet::const_iterator di = depends.begin(); di != depends.end(); ++di) { @@ -941,7 +941,8 @@ cmGlobalUnixMakefileGenerator3 for(std::set::const_iterator t = targets.begin(); t != targets.end(); ++t) { - count += this->CountProgressMarksInTarget(*t, emitted); + cmGeneratorTarget* gt = this->GetGeneratorTarget(*t); + count += this->CountProgressMarksInTarget(gt, emitted); } return count; } @@ -987,22 +988,21 @@ cmGlobalUnixMakefileGenerator3::TargetProgress void cmGlobalUnixMakefileGenerator3 ::AppendGlobalTargetDepends(std::vector& depends, - cmTarget& target) + cmGeneratorTarget* target) { TargetDependSet const& depends_set = this->GetTargetDirectDepends(target); for(TargetDependSet::const_iterator i = depends_set.begin(); i != depends_set.end(); ++i) { // Create the target-level dependency. - cmTarget const* dep = *i; + cmGeneratorTarget const* dep = *i; if (dep->GetType() == cmTarget::INTERFACE_LIBRARY) { continue; } cmLocalUnixMakefileGenerator3* lg3 = - static_cast - (dep->GetMakefile()->GetLocalGenerator()); - std::string tgtName = lg3->GetRelativeTargetDirectory(*dep); + static_cast(dep->GetLocalGenerator()); + std::string tgtName = lg3->GetRelativeTargetDirectory(*(*dep).Target); tgtName += "/all"; depends.push_back(tgtName); } diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h index a639ff0fd..8805011df 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.h +++ b/Source/cmGlobalUnixMakefileGenerator3.h @@ -153,7 +153,7 @@ protected: cmLocalUnixMakefileGenerator3* lg); void AppendGlobalTargetDepends(std::vector& depends, - cmTarget& target); + cmGeneratorTarget* target); // does this generator need a requires step for any of its targets bool NeedRequiresStep(cmTarget const&); @@ -198,7 +198,7 @@ protected: cmStrictTargetComparison> ProgressMapType; ProgressMapType ProgressMap; - size_t CountProgressMarksInTarget(cmTarget const* target, + size_t CountProgressMarksInTarget(cmGeneratorTarget const* target, std::set& emitted); size_t CountProgressMarksInAll(cmLocalUnixMakefileGenerator3* lg); diff --git a/Source/cmGlobalVisualStudio6Generator.cxx b/Source/cmGlobalVisualStudio6Generator.cxx index 632141af9..65a15eef1 100644 --- a/Source/cmGlobalVisualStudio6Generator.cxx +++ b/Source/cmGlobalVisualStudio6Generator.cxx @@ -224,7 +224,7 @@ void cmGlobalVisualStudio6Generator tt = orderedProjectTargets.begin(); tt != orderedProjectTargets.end(); ++tt) { - cmTarget const* target = *tt; + cmTarget const* target = (*tt)->Target; if(target->GetType() == cmTarget::INTERFACE_LIBRARY) { continue; diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index f453da198..1674e9818 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -402,7 +402,7 @@ void cmGlobalVisualStudio7Generator::WriteTargetConfigurations( for(OrderedTargetDependSet::const_iterator tt = projectTargets.begin(); tt != projectTargets.end(); ++tt) { - cmTarget const* target = *tt; + cmTarget const* target = (*tt)->Target; if(target->GetType() == cmTarget::INTERFACE_LIBRARY) { continue; @@ -442,7 +442,7 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution( for(OrderedTargetDependSet::const_iterator tt = projectTargets.begin(); tt != projectTargets.end(); ++tt) { - cmTarget const* target = *tt; + cmTarget const* target = (*tt)->Target; if(target->GetType() == cmTarget::INTERFACE_LIBRARY) { continue; @@ -534,7 +534,7 @@ void cmGlobalVisualStudio7Generator::WriteTargetDepends( for(OrderedTargetDependSet::const_iterator tt = projectTargets.begin(); tt != projectTargets.end(); ++tt) { - cmTarget const* target = *tt; + cmTarget const* target = (*tt)->Target; if(target->GetType() == cmTarget::INTERFACE_LIBRARY) { continue; @@ -1045,12 +1045,12 @@ cmGlobalVisualStudio7Generator ::IsDependedOn(OrderedTargetDependSet const& projectTargets, cmTarget const* targetIn) { + cmGeneratorTarget* gtIn = this->GetGeneratorTarget(targetIn); for (OrderedTargetDependSet::const_iterator l = projectTargets.begin(); l != projectTargets.end(); ++l) { - cmTarget const& target = **l; - TargetDependSet const& tgtdeps = this->GetTargetDirectDepends(target); - if(tgtdeps.count(targetIn)) + TargetDependSet const& tgtdeps = this->GetTargetDirectDepends(*l); + if(tgtdeps.count(gtIn)) { return true; } diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index b96a799ab..f3cf36e5f 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -441,7 +441,8 @@ bool cmGlobalVisualStudio8Generator::ComputeTargetDepends() void cmGlobalVisualStudio8Generator::WriteProjectDepends( std::ostream& fout, const std::string&, const char*, cmTarget const& t) { - TargetDependSet const& unordered = this->GetTargetDirectDepends(t); + cmGeneratorTarget* gt = this->GetGeneratorTarget(&t); + TargetDependSet const& unordered = this->GetTargetDirectDepends(gt); OrderedTargetDependSet depends(unordered); for(OrderedTargetDependSet::const_iterator i = depends.begin(); i != depends.end(); ++i) diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index 585d19a81..438d60eca 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -299,13 +299,14 @@ void cmGlobalVisualStudioGenerator::FillLinkClosure(cmTarget const* target, { if(linked.insert(target).second) { - TargetDependSet const& depends = this->GetTargetDirectDepends(*target); + cmGeneratorTarget* gt = this->GetGeneratorTarget(target); + TargetDependSet const& depends = this->GetTargetDirectDepends(gt); for(TargetDependSet::const_iterator di = depends.begin(); di != depends.end(); ++di) { if(di->IsLink()) { - this->FillLinkClosure(*di, linked); + this->FillLinkClosure((*di)->Target, linked); } } } @@ -338,13 +339,14 @@ void cmGlobalVisualStudioGenerator::FollowLinkDepends( { // Static library targets do not list their link dependencies so // we must follow them transitively now. - TargetDependSet const& depends = this->GetTargetDirectDepends(*target); + cmGeneratorTarget* gt = this->GetGeneratorTarget(target); + TargetDependSet const& depends = this->GetTargetDirectDepends(gt); for(TargetDependSet::const_iterator di = depends.begin(); di != depends.end(); ++di) { if(di->IsLink()) { - this->FollowLinkDepends(*di, linked); + this->FollowLinkDepends((*di)->Target, linked); } } } @@ -413,7 +415,8 @@ void cmGlobalVisualStudioGenerator::ComputeVSTargetDepends(cmTarget& target) target.GetType() != cmTarget::MODULE_LIBRARY && target.GetType() != cmTarget::EXECUTABLE); - TargetDependSet const& depends = this->GetTargetDirectDepends(target); + cmGeneratorTarget* gt = this->GetGeneratorTarget(&target); + TargetDependSet const& depends = this->GetTargetDirectDepends(gt); // Collect implicit link dependencies (target_link_libraries). // Static libraries cannot depend on their link implementation @@ -427,7 +430,7 @@ void cmGlobalVisualStudioGenerator::ComputeVSTargetDepends(cmTarget& target) cmTargetDepend dep = *di; if(dep.IsLink()) { - this->FollowLinkDepends(dep, linkDepends); + this->FollowLinkDepends(dep->Target, linkDepends); } } } @@ -440,7 +443,7 @@ void cmGlobalVisualStudioGenerator::ComputeVSTargetDepends(cmTarget& target) cmTargetDepend dep = *di; if(dep.IsUtil()) { - this->FollowLinkDepends(dep, utilDepends); + this->FollowLinkDepends(dep->Target, utilDepends); } } @@ -843,7 +846,7 @@ cmGlobalVisualStudioGenerator::TargetIsFortranOnly(cmTarget const& target) //---------------------------------------------------------------------------- bool cmGlobalVisualStudioGenerator::TargetCompare -::operator()(cmTarget const* l, cmTarget const* r) const +::operator()(cmGeneratorTarget const* l, cmGeneratorTarget const* r) const { // Make sure ALL_BUILD is first so it is the default active project. if(r->GetName() == "ALL_BUILD") @@ -868,7 +871,13 @@ cmGlobalVisualStudioGenerator::OrderedTargetDependSet cmGlobalVisualStudioGenerator::OrderedTargetDependSet ::OrderedTargetDependSet(TargetSet const& targets) { - this->insert(targets.begin(), targets.end()); + for (TargetSet::const_iterator it = targets.begin(); + it != targets.end(); ++it) + { + cmGeneratorTarget* gt = + (*it)->GetMakefile()->GetGlobalGenerator()->GetGeneratorTarget(*it); + this->insert(gt); + } } std::string cmGlobalVisualStudioGenerator::ExpandCFGIntDir( diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h index 69b4564c5..41843b314 100644 --- a/Source/cmGlobalVisualStudioGenerator.h +++ b/Source/cmGlobalVisualStudioGenerator.h @@ -91,7 +91,8 @@ public: class TargetSet: public std::set {}; struct TargetCompare { - bool operator()(cmTarget const* l, cmTarget const* r) const; + bool operator()(cmGeneratorTarget const* l, + cmGeneratorTarget const* r) const; }; class OrderedTargetDependSet; diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 1301e3ebb..505929ea7 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -2895,10 +2895,11 @@ void cmGlobalXCodeGenerator } // Add dependencies on other CMake targets. - TargetDependSet const& deps = this->GetTargetDirectDepends(*cmtarget); + cmGeneratorTarget* gt = this->GetGeneratorTarget(cmtarget); + TargetDependSet const& deps = this->GetTargetDirectDepends(gt); for(TargetDependSet::const_iterator i = deps.begin(); i != deps.end(); ++i) { - if(cmXCodeObject* dptarget = this->FindXCodeTarget(*i)) + if(cmXCodeObject* dptarget = this->FindXCodeTarget((*i)->Target)) { this->AddDependTarget(target, dptarget); } diff --git a/Source/cmTargetDepend.h b/Source/cmTargetDepend.h index 1feb07203..c5059ee2b 100644 --- a/Source/cmTargetDepend.h +++ b/Source/cmTargetDepend.h @@ -14,23 +14,24 @@ #include "cmStandardIncludes.h" -class cmTarget; +class cmGeneratorTarget; /** One edge in the global target dependency graph. It may be marked as a 'link' or 'util' edge or both. */ class cmTargetDepend { - cmTarget const* Target; + cmGeneratorTarget const* Target; // The set order depends only on the Target, so we use // mutable members to acheive a map with set syntax. mutable bool Link; mutable bool Util; public: - cmTargetDepend(cmTarget const* t): Target(t), Link(false), Util(false) {} - operator cmTarget const*() const { return this->Target; } - cmTarget const* operator->() const { return this->Target; } - cmTarget const& operator*() const { return *this->Target; } + cmTargetDepend(cmGeneratorTarget const* t) + : Target(t), Link(false), Util(false) {} + operator cmGeneratorTarget const*() const { return this->Target; } + cmGeneratorTarget const* operator->() const { return this->Target; } + cmGeneratorTarget const& operator*() const { return *this->Target; } friend bool operator < (cmTargetDepend const& l, cmTargetDepend const& r) { return l.Target < r.Target; } void SetType(bool strong) const diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 12a1e42c0..591c2db53 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -2660,7 +2660,7 @@ void cmVisualStudio10TargetGenerator::WriteEvent( void cmVisualStudio10TargetGenerator::WriteProjectReferences() { cmGlobalGenerator::TargetDependSet const& unordered - = this->GlobalGenerator->GetTargetDirectDepends(*this->Target); + = this->GlobalGenerator->GetTargetDirectDepends(this->GeneratorTarget); typedef cmGlobalVisualStudioGenerator::OrderedTargetDependSet OrderedTargetDependSet; OrderedTargetDependSet depends(unordered); @@ -2668,7 +2668,7 @@ void cmVisualStudio10TargetGenerator::WriteProjectReferences() for( OrderedTargetDependSet::const_iterator i = depends.begin(); i != depends.end(); ++i) { - cmTarget const* dt = *i; + cmTarget const* dt = (*i)->Target; if(dt->GetType() == cmTarget::INTERFACE_LIBRARY) { continue; From d4a8a554ea2b3af2ea850cf003e35ac23118a33b Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 6 Jun 2015 15:24:24 +0200 Subject: [PATCH 0228/1048] cmGlobalGenerator: Map local generators to generator targets. --- Source/cmGlobalGenerator.cxx | 9 ++++----- Source/cmGlobalGenerator.h | 2 +- Source/cmGlobalUnixMakefileGenerator3.cxx | 15 +++++++-------- Source/cmGlobalUnixMakefileGenerator3.h | 2 +- 4 files changed, 13 insertions(+), 15 deletions(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index a69732e79..f310744e4 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -2043,20 +2043,19 @@ void cmGlobalGenerator::FillLocalGeneratorToTargetMap() clg = clg->GetParent()) { // This local generator includes the target. - std::set& targetSet = + std::set& targetSet = this->LocalGeneratorToTargetMap[clg]; - targetSet.insert(&target); + cmGeneratorTarget* gt = this->GetGeneratorTarget(&target); + targetSet.insert(gt); // Add dependencies of the included target. An excluded // target may still be included if it is a dependency of a // non-excluded target. - cmGeneratorTarget* gt = this->GetGeneratorTarget(&target); TargetDependSet const& tgtdeps = this->GetTargetDirectDepends(gt); for(TargetDependSet::const_iterator ti = tgtdeps.begin(); ti != tgtdeps.end(); ++ti) { - cmGeneratorTarget const* ttt = *ti; - targetSet.insert(ttt->Target); + targetSet.insert(*ti); } } } diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index f86e82553..398335b6f 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -406,7 +406,7 @@ protected: cmMakefile* CurrentMakefile; // map from project name to vector of local generators in that project std::map > ProjectMap; - std::map > + std::map > LocalGeneratorToTargetMap; // Set of named installation components requested by the project. diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 412728f38..e6a67d32d 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -830,7 +830,7 @@ cmGlobalUnixMakefileGenerator3 cmLocalGenerator::FULL, cmLocalGenerator::SHELL); // - std::set emitted; + std::set emitted; progCmd << " " << this->CountProgressMarksInTarget(gtarget, emitted); commands.push_back(progCmd.str()); @@ -909,10 +909,10 @@ cmGlobalUnixMakefileGenerator3 size_t cmGlobalUnixMakefileGenerator3 ::CountProgressMarksInTarget(cmGeneratorTarget const* target, - std::set& emitted) + std::set& emitted) { size_t count = 0; - if(emitted.insert(target->Target).second) + if(emitted.insert(target).second) { count = this->ProgressMap[target->Target].Marks.size(); TargetDependSet const& depends = this->GetTargetDirectDepends(target); @@ -935,14 +935,13 @@ cmGlobalUnixMakefileGenerator3 ::CountProgressMarksInAll(cmLocalUnixMakefileGenerator3* lg) { size_t count = 0; - std::set emitted; - std::set const& targets + std::set emitted; + std::set const& targets = this->LocalGeneratorToTargetMap[lg]; - for(std::set::const_iterator t = targets.begin(); + for(std::set::const_iterator t = targets.begin(); t != targets.end(); ++t) { - cmGeneratorTarget* gt = this->GetGeneratorTarget(*t); - count += this->CountProgressMarksInTarget(gt, emitted); + count += this->CountProgressMarksInTarget(*t, emitted); } return count; } diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h index 8805011df..14adf2e46 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.h +++ b/Source/cmGlobalUnixMakefileGenerator3.h @@ -199,7 +199,7 @@ protected: ProgressMapType ProgressMap; size_t CountProgressMarksInTarget(cmGeneratorTarget const* target, - std::set& emitted); + std::set& emitted); size_t CountProgressMarksInAll(cmLocalUnixMakefileGenerator3* lg); cmGeneratedFileStream *CommandDatabase; From c6976b0b78c3a6d63126a11eca7eb52339ed82cc Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Thu, 2 Jul 2015 00:01:04 -0400 Subject: [PATCH 0229/1048] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 775f60138..5cf69f79a 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 3) -set(CMake_VERSION_PATCH 20150701) +set(CMake_VERSION_PATCH 20150702) #set(CMake_VERSION_RC 1) From 799c1575898a937fd1fbc0789c4158c9df799fcd Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Thu, 2 Jul 2015 08:50:25 -0400 Subject: [PATCH 0230/1048] KWSys 2015-07-02 (1f19c187) Extract upstream KWSys using the following shell commands. $ git archive --prefix=upstream-kwsys/ 1f19c187 | tar x $ git shortlog --no-merges --abbrev=8 --format='%h %s' d217407c..1f19c187 Brad King (1): 1f19c187 CONTRIBUTING: Spell "offered" correctly --- CONTRIBUTING.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index e097b766f..960eea471 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -29,7 +29,7 @@ License We do not require any formal copyright assignment or contributor license agreement. Any contributions intentionally sent upstream are presumed -to be offerred under terms of the OSI-approved BSD 3-clause License. +to be offered under terms of the OSI-approved BSD 3-clause License. See `Copyright.txt`_ for details. .. _`Copyright.txt`: Copyright.txt From b14fd0f72442d6332a978c9804b8777fed1b7ee8 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 2 Jul 2015 09:08:35 -0400 Subject: [PATCH 0231/1048] CONTRIBUTING: Spell "offered" correctly Reported-by: Radovan Bast --- CONTRIBUTING.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 3499da889..5daaf9c83 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -28,7 +28,7 @@ License We do not require any formal copyright assignment or contributor license agreement. Any contributions intentionally sent upstream are presumed -to be offerred under terms of the OSI-approved BSD 3-clause License. +to be offered under terms of the OSI-approved BSD 3-clause License. See `Copyright.txt`_ for details. .. _`Copyright.txt`: Copyright.txt From 9aed0cd1002deb63eed77381ec4bc3e515d92d12 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 2 Jul 2015 09:09:33 -0400 Subject: [PATCH 0232/1048] README: Fix typo "the the" => "the" Reported-by: Radovan Bast --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index e8524f81a..120705c94 100644 --- a/README.rst +++ b/README.rst @@ -82,7 +82,7 @@ If you have found a bug: 1. If you have a patch, please read the `CONTRIBUTING.rst`_ document. -2. Otherwise, please join the the `CMake Users List`_ and ask about +2. Otherwise, please join the `CMake Users List`_ and ask about the expected and observed behaviors to determine if it is really a bug. From a33fb493de9098a22c4a3bd58a49e32ee156f0f8 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 2 Jul 2015 09:20:14 -0400 Subject: [PATCH 0233/1048] XL: Drop -qalias=noansi from default C flags This was added without explanation by commit v2.8.2~1138 (Add initial XL C compiler flags for safer builds, 2009-09-30). It is not consistent with our default C++ flags for XL and disables several optimizations, so drop it from our default flags for C. Suggested-by: Todd Gamblin --- Modules/Compiler/XL-ASM.cmake | 3 +-- Modules/Compiler/XL-C.cmake | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/Modules/Compiler/XL-ASM.cmake b/Modules/Compiler/XL-ASM.cmake index 07507f9be..212179e34 100644 --- a/Modules/Compiler/XL-ASM.cmake +++ b/Modules/Compiler/XL-ASM.cmake @@ -1,9 +1,8 @@ set(CMAKE_ASM_VERBOSE_FLAG "-V") # -qthreaded = Ensures that all optimizations will be thread-safe -# -qalias=noansi = Turns off type-based aliasing completely (safer optimizer) # -qhalt=e = Halt on error messages (rather than just severe errors) -set(CMAKE_ASM_FLAGS_INIT "-qthreaded -qalias=noansi -qhalt=e -qsourcetype=assembler") +set(CMAKE_ASM_FLAGS_INIT "-qthreaded -qhalt=e -qsourcetype=assembler") set(CMAKE_ASM_FLAGS_DEBUG_INIT "-g") set(CMAKE_ASM_FLAGS_RELEASE_INIT "-O -DNDEBUG") diff --git a/Modules/Compiler/XL-C.cmake b/Modules/Compiler/XL-C.cmake index 09a55291e..97dd01789 100644 --- a/Modules/Compiler/XL-C.cmake +++ b/Modules/Compiler/XL-C.cmake @@ -4,6 +4,5 @@ set(CMAKE_C_FLAGS_RELEASE_INIT "${CMAKE_C_FLAGS_RELEASE_INIT} -DNDEBUG") set(CMAKE_C_FLAGS_MINSIZEREL_INIT "${CMAKE_C_FLAGS_MINSIZEREL_INIT} -DNDEBUG") # -qthreaded = Ensures that all optimizations will be thread-safe -# -qalias=noansi = Turns off type-based aliasing completely (safer optimizer) # -qhalt=e = Halt on error messages (rather than just severe errors) -set(CMAKE_C_FLAGS_INIT "-qthreaded -qalias=noansi -qhalt=e") +set(CMAKE_C_FLAGS_INIT "-qthreaded -qhalt=e") From 58853582be7c8a362db5d220c87025a1c19d1c8a Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Fri, 3 Jul 2015 00:01:05 -0400 Subject: [PATCH 0234/1048] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 5cf69f79a..328cdff16 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 3) -set(CMake_VERSION_PATCH 20150702) +set(CMake_VERSION_PATCH 20150703) #set(CMake_VERSION_RC 1) From 9b7904d528754143ac8c04ac7cc5113746f4978b Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sat, 4 Jul 2015 00:01:04 -0400 Subject: [PATCH 0235/1048] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 328cdff16..2abb04826 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 3) -set(CMake_VERSION_PATCH 20150703) +set(CMake_VERSION_PATCH 20150704) #set(CMake_VERSION_RC 1) From 27ff19a96a7d12f2ed6d9683ef733eff6378472a Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 8 Jun 2015 20:09:55 +0200 Subject: [PATCH 0236/1048] cmLinkedTree: Add operator* to the iterator. --- Source/cmLinkedTree.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Source/cmLinkedTree.h b/Source/cmLinkedTree.h index d2339c4f5..df00b30ff 100644 --- a/Source/cmLinkedTree.h +++ b/Source/cmLinkedTree.h @@ -87,6 +87,24 @@ public: return this->Tree->GetPointer(this->Position - 1); } + ReferenceType operator*() const + { + assert(this->Tree); + assert(this->Tree->UpPositions.size() == this->Tree->Data.size()); + assert(this->Position <= this->Tree->Data.size()); + assert(this->Position > 0); + return this->Tree->GetReference(this->Position - 1); + } + + ReferenceType operator*() + { + assert(this->Tree); + assert(this->Tree->UpPositions.size() == this->Tree->Data.size()); + assert(this->Position <= this->Tree->Data.size()); + assert(this->Position > 0); + return this->Tree->GetReference(this->Position - 1); + } + bool operator==(iterator other) const { assert(this->Tree); From dbafb01580a0d35e33e6577ad07002f4dd345236 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 31 May 2015 19:37:08 +0200 Subject: [PATCH 0237/1048] cmMakefile: Split CallStack into two pieces. --- Source/cmMakefile.cxx | 35 +++++++++++++++++++---------------- Source/cmMakefile.h | 10 ++-------- 2 files changed, 21 insertions(+), 24 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index cdcf88c15..678c1b3af 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -247,11 +247,11 @@ void cmMakefile::IssueMessage(cmake::MessageType t, std::string const& text) const { // Collect context information. - if(!this->CallStack.empty()) + if(!this->ExecutionStatusStack.empty()) { if((t == cmake::FATAL_ERROR) || (t == cmake::INTERNAL_ERROR)) { - this->CallStack.back().Status->SetNestedError(true); + this->ExecutionStatusStack.back()->SetNestedError(true); } this->GetCMakeInstance()->IssueMessage(t, text, this->GetBacktrace()); } @@ -276,10 +276,11 @@ void cmMakefile::IssueMessage(cmake::MessageType t, cmListFileBacktrace cmMakefile::GetBacktrace() const { cmListFileBacktrace backtrace(this->StateSnapshot); - for(CallStackType::const_reverse_iterator i = this->CallStack.rbegin(); - i != this->CallStack.rend(); ++i) + for(std::vector::const_reverse_iterator + i = this->ContextStack.rbegin(); + i != this->ContextStack.rend(); ++i) { - backtrace.Append(*i->Context); + backtrace.Append(*(*i)); } return backtrace; } @@ -290,10 +291,11 @@ cmMakefile::GetBacktrace(cmListFileContext const& lfc) const { cmListFileBacktrace backtrace(this->StateSnapshot); backtrace.Append(lfc); - for(CallStackType::const_reverse_iterator i = this->CallStack.rbegin(); - i != this->CallStack.rend(); ++i) + for(std::vector::const_reverse_iterator + i = this->ContextStack.rbegin(); + i != this->ContextStack.rend(); ++i) { - backtrace.Append(*i->Context); + backtrace.Append(*(*i)); } return backtrace; } @@ -301,7 +303,7 @@ cmMakefile::GetBacktrace(cmListFileContext const& lfc) const //---------------------------------------------------------------------------- cmListFileContext cmMakefile::GetExecutionContext() const { - return *this->CallStack.back().Context; + return *this->ContextStack.back(); } //---------------------------------------------------------------------------- @@ -1996,7 +1998,7 @@ void cmMakefile::LogUnused(const char* reason, { std::string path; cmListFileContext lfc; - if (!this->CallStack.empty()) + if (!this->ExecutionStatusStack.empty()) { lfc = this->GetExecutionContext(); path = lfc.FilePath; @@ -3360,11 +3362,11 @@ bool cmMakefile::IsLoopBlock() const std::string cmMakefile::GetExecutionFilePath() const { - if (this->CallStack.empty()) + if (this->ContextStack.empty()) { return std::string(); } - return this->CallStack.back().Context->FilePath; + return this->ContextStack.back()->FilePath; } //---------------------------------------------------------------------------- @@ -3455,7 +3457,7 @@ bool cmMakefile::ExpandArguments( //---------------------------------------------------------------------------- void cmMakefile::AddFunctionBlocker(cmFunctionBlocker* fb) { - if(!this->CallStack.empty()) + if(!this->ExecutionStatusStack.empty()) { // Record the context in which the blocker is created. fb->SetStartingContext(this->GetExecutionContext()); @@ -5503,11 +5505,12 @@ cmMakefile::MacroPushPop::~MacroPushPop() cmMakefileCall::cmMakefileCall(cmMakefile* mf, const cmListFileContext& lfc, cmExecutionStatus& status): Makefile(mf) { - cmMakefile::CallStackEntry entry = {&lfc, &status}; - this->Makefile->CallStack.push_back(entry); + this->Makefile->ContextStack.push_back(&lfc); + this->Makefile->ExecutionStatusStack.push_back(&status); } cmMakefileCall::~cmMakefileCall() { - this->Makefile->CallStack.pop_back(); + this->Makefile->ExecutionStatusStack.pop_back(); + this->Makefile->ContextStack.pop_back(); } diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index aa70c725b..0ade8e15c 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -935,14 +935,8 @@ private: // stack of list files being read std::vector ListFileStack; - // stack of commands being invoked. - struct CallStackEntry - { - cmListFileContext const* Context; - cmExecutionStatus* Status; - }; - typedef std::vector CallStackType; - CallStackType CallStack; + std::vector ContextStack; + std::vector ExecutionStatusStack; friend class cmMakefileCall; std::vector ImportedTargetsOwned; From a8e54460243b0650145c8684f3d8deb8a712376a Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 21 Jun 2015 21:26:36 +0200 Subject: [PATCH 0238/1048] cmState: Store snapshots for more different types. Adjust cmMakefile implementation to create the snapshots. --- Source/cmMakefile.cxx | 33 ++++++++++++++++++++++++++ Source/cmState.cxx | 55 +++++++++++++++++++++++++++++++++++++++++++ Source/cmState.h | 14 +++++++++-- 3 files changed, 100 insertions(+), 2 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 678c1b3af..a176cdadb 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -463,11 +463,19 @@ cmMakefile::IncludeScope::IncludeScope(cmMakefile* mf, this->Makefile->PushPolicyBarrier(); this->Makefile->ListFileStack.push_back(filenametoread); this->Makefile->PushFunctionBlockerBarrier(); + + this->Makefile->StateSnapshot = + this->Makefile->GetState()->CreateCallStackSnapshot( + this->Makefile->StateSnapshot); } //---------------------------------------------------------------------------- cmMakefile::IncludeScope::~IncludeScope() { + this->Makefile->StateSnapshot = + this->Makefile->GetState()->Pop(this->Makefile->StateSnapshot); + assert(this->Makefile->StateSnapshot.IsValid()); + this->Makefile->PopFunctionBlockerBarrier(this->ReportError); // Enforce matching policy scopes inside the included file. this->Makefile->PopPolicyBarrier(this->ReportError); @@ -567,11 +575,20 @@ public: { this->Makefile->ListFileStack.push_back(filenametoread); this->Makefile->PushPolicyBarrier(); + + this->Makefile->StateSnapshot = + this->Makefile->GetState()->CreateInlineListFileSnapshot( + this->Makefile->StateSnapshot); + assert(this->Makefile->StateSnapshot.IsValid()); this->Makefile->PushFunctionBlockerBarrier(); } ~ListFileScope() { + this->Makefile->StateSnapshot = + this->Makefile->GetState()->Pop(this->Makefile->StateSnapshot); + assert(this->Makefile->StateSnapshot.IsValid()); + this->Makefile->PopFunctionBlockerBarrier(this->ReportError); this->Makefile->PopPolicyBarrier(this->ReportError); this->Makefile->ListFileStack.pop_back(); @@ -1575,6 +1592,11 @@ void cmMakefile::InitializeFromParent(cmMakefile* parent) void cmMakefile::PushFunctionScope(const cmPolicies::PolicyMap& pm) { + this->StateSnapshot = + this->GetState()->CreateFunctionCallSnapshot( + this->StateSnapshot); + assert(this->StateSnapshot.IsValid()); + this->Internal->PushDefinitions(); this->PushLoopBlockBarrier(); @@ -1594,6 +1616,9 @@ void cmMakefile::PopFunctionScope(bool reportError) this->PopPolicyBarrier(reportError); this->PopPolicy(); + this->StateSnapshot = this->GetState()->Pop(this->StateSnapshot); + assert(this->StateSnapshot.IsValid()); + this->PopFunctionBlockerBarrier(reportError); #if defined(CMAKE_BUILD_WITH_CMAKE) @@ -1609,6 +1634,11 @@ void cmMakefile::PopFunctionScope(bool reportError) void cmMakefile::PushMacroScope(const cmPolicies::PolicyMap& pm) { + this->StateSnapshot = + this->GetState()->CreateMacroCallSnapshot( + this->StateSnapshot); + assert(this->StateSnapshot.IsValid()); + this->PushFunctionBlockerBarrier(); this->PushPolicy(true, pm); @@ -1620,6 +1650,9 @@ void cmMakefile::PopMacroScope(bool reportError) this->PopPolicyBarrier(reportError); this->PopPolicy(); + this->StateSnapshot = this->GetState()->Pop(this->StateSnapshot); + assert(this->StateSnapshot.IsValid()); + this->PopFunctionBlockerBarrier(reportError); } diff --git a/Source/cmState.cxx b/Source/cmState.cxx index 58500cc10..ef55e0946 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -20,6 +20,7 @@ struct cmState::SnapshotDataType { + cmState::PositionType CallStackParent; cmState::PositionType DirectoryParent; cmState::SnapshotType SnapshotType; cmLinkedTree::iterator @@ -690,6 +691,7 @@ cmState::CreateBuildsystemDirectorySnapshot(Snapshot originSnapshot) { assert(originSnapshot.IsValid()); PositionType pos = this->SnapshotData.Extend(originSnapshot.Position); + pos->CallStackParent = originSnapshot.Position; pos->DirectoryParent = originSnapshot.Position; pos->SnapshotType = BuildsystemDirectoryType; pos->BuildSystemDirectory = @@ -698,6 +700,59 @@ cmState::CreateBuildsystemDirectorySnapshot(Snapshot originSnapshot) return cmState::Snapshot(this, pos); } +cmState::Snapshot +cmState::CreateFunctionCallSnapshot(cmState::Snapshot originSnapshot) +{ + PositionType pos = this->SnapshotData.Extend(originSnapshot.Position, + *originSnapshot.Position); + pos->CallStackParent = originSnapshot.Position; + pos->SnapshotType = FunctionCallType; + return cmState::Snapshot(this, pos); +} + + +cmState::Snapshot +cmState::CreateMacroCallSnapshot(cmState::Snapshot originSnapshot) +{ + PositionType pos = this->SnapshotData.Extend(originSnapshot.Position, + *originSnapshot.Position); + pos->CallStackParent = originSnapshot.Position; + pos->SnapshotType = MacroCallType; + return cmState::Snapshot(this, pos); +} + +cmState::Snapshot +cmState::CreateCallStackSnapshot(cmState::Snapshot originSnapshot) +{ + PositionType pos = this->SnapshotData.Extend(originSnapshot.Position, + *originSnapshot.Position); + pos->CallStackParent = originSnapshot.Position; + pos->SnapshotType = CallStackType; + return cmState::Snapshot(this, pos); +} + +cmState::Snapshot +cmState::CreateInlineListFileSnapshot(cmState::Snapshot originSnapshot) +{ + PositionType pos = this->SnapshotData.Extend(originSnapshot.Position, + *originSnapshot.Position); + pos->CallStackParent = originSnapshot.Position; + pos->SnapshotType = InlineListFileType; + return cmState::Snapshot(this, pos); +} + +cmState::Snapshot cmState::Pop(cmState::Snapshot originSnapshot) +{ + PositionType pos = originSnapshot.Position; + PositionType prevPos = pos; + ++prevPos; + if (prevPos == this->SnapshotData.Root()) + { + return Snapshot(this, prevPos); + } + return Snapshot(this, originSnapshot.Position->CallStackParent); +} + cmState::Snapshot::Snapshot(cmState* state, PositionType position) : State(state), Position(position) diff --git a/Source/cmState.h b/Source/cmState.h index 9c7574f7b..9a1f76484 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -31,7 +31,11 @@ public: enum SnapshotType { - BuildsystemDirectoryType + BuildsystemDirectoryType, + FunctionCallType, + MacroCallType, + CallStackType, + InlineListFileType }; class Snapshot { @@ -69,7 +73,13 @@ public: }; Snapshot CreateBaseSnapshot(); - Snapshot CreateBuildsystemDirectorySnapshot(Snapshot originSnapshot); + Snapshot + CreateBuildsystemDirectorySnapshot(Snapshot originSnapshot); + Snapshot CreateFunctionCallSnapshot(Snapshot originSnapshot); + Snapshot CreateMacroCallSnapshot(Snapshot originSnapshot); + Snapshot CreateCallStackSnapshot(Snapshot originSnapshot); + Snapshot CreateInlineListFileSnapshot(Snapshot originSnapshot); + Snapshot Pop(Snapshot originSnapshot); enum CacheEntryType{ BOOL=0, PATH, FILEPATH, STRING, INTERNAL,STATIC, UNINITIALIZED }; From 4127a638b053940171b2619be0534a32353dae03 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sun, 5 Jul 2015 00:01:04 -0400 Subject: [PATCH 0239/1048] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 2abb04826..160936f75 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 3) -set(CMake_VERSION_PATCH 20150704) +set(CMake_VERSION_PATCH 20150705) #set(CMake_VERSION_RC 1) From 94704d759cc8939f3573122d36d52c4598fd04ba Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 4 Jul 2015 06:56:13 +0200 Subject: [PATCH 0240/1048] cmState: Add GetCallStackParent method. --- Source/cmState.cxx | 22 ++++++++++++++++++++++ Source/cmState.h | 1 + 2 files changed, 23 insertions(+) diff --git a/Source/cmState.cxx b/Source/cmState.cxx index ef55e0946..5ca1cce09 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -854,6 +854,28 @@ cmState::Snapshot cmState::Snapshot::GetBuildsystemDirectoryParent() const return snapshot; } +cmState::Snapshot cmState::Snapshot::GetCallStackParent() const +{ + assert(this->State); + assert(this->Position != this->State->SnapshotData.Root()); + + Snapshot snapshot; + if (this->Position->SnapshotType == cmState::BuildsystemDirectoryType) + { + return snapshot; + } + + PositionType parentPos = this->Position; + ++parentPos; + if (parentPos == this->State->SnapshotData.Root()) + { + return snapshot; + } + + snapshot = Snapshot(this->State, parentPos); + return snapshot; +} + cmState* cmState::Snapshot::GetState() const { return this->State; diff --git a/Source/cmState.h b/Source/cmState.h index 9a1f76484..e35b843de 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -59,6 +59,7 @@ public: bool IsValid() const; Snapshot GetBuildsystemDirectoryParent() const; + Snapshot GetCallStackParent() const; cmState* GetState() const; From 6361f680568c81e0391fa56cf9a7f4637bd745dc Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 31 May 2015 19:37:08 +0200 Subject: [PATCH 0241/1048] cmState: Store execution context. Extend snapshot creation API to store the file being executed and the entry point to get to that context. --- Source/cmFunctionCommand.cxx | 1 + Source/cmMacroCommand.cxx | 1 + Source/cmMakefile.cxx | 41 ++++++++++++++++----- Source/cmMakefile.h | 12 +++--- Source/cmState.cxx | 71 +++++++++++++++++++++++++++++++++--- Source/cmState.h | 32 +++++++++++++--- 6 files changed, 133 insertions(+), 25 deletions(-) diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx index b3576c35d..78853ceba 100644 --- a/Source/cmFunctionCommand.cxx +++ b/Source/cmFunctionCommand.cxx @@ -95,6 +95,7 @@ bool cmFunctionHelperCommand::InvokeInitialPass } cmMakefile::FunctionPushPop functionScope(this->Makefile, + this->FilePath, this->Policies); // set the value of argc diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx index 0b945b217..3c2117b38 100644 --- a/Source/cmMacroCommand.cxx +++ b/Source/cmMacroCommand.cxx @@ -97,6 +97,7 @@ bool cmMacroHelperCommand::InvokeInitialPass } cmMakefile::MacroPushPop macroScope(this->Makefile, + this->FilePath, this->Policies); // set the value of argc diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index a176cdadb..eb26474ce 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -465,8 +465,11 @@ cmMakefile::IncludeScope::IncludeScope(cmMakefile* mf, this->Makefile->PushFunctionBlockerBarrier(); this->Makefile->StateSnapshot = - this->Makefile->GetState()->CreateCallStackSnapshot( - this->Makefile->StateSnapshot); + this->Makefile->GetState()->CreateCallStackSnapshot( + this->Makefile->StateSnapshot, + this->Makefile->ContextStack.back()->Name, + this->Makefile->ContextStack.back()->Line, + filenametoread); } //---------------------------------------------------------------------------- @@ -576,9 +579,16 @@ public: this->Makefile->ListFileStack.push_back(filenametoread); this->Makefile->PushPolicyBarrier(); + long line = 0; + std::string name; + if (!this->Makefile->ContextStack.empty()) + { + line = this->Makefile->ContextStack.back()->Line; + name = this->Makefile->ContextStack.back()->Name; + } this->Makefile->StateSnapshot = this->Makefile->GetState()->CreateInlineListFileSnapshot( - this->Makefile->StateSnapshot); + this->Makefile->StateSnapshot, name, line, filenametoread); assert(this->Makefile->StateSnapshot.IsValid()); this->Makefile->PushFunctionBlockerBarrier(); } @@ -1590,11 +1600,14 @@ void cmMakefile::InitializeFromParent(cmMakefile* parent) this->ImportedTargets = parent->ImportedTargets; } -void cmMakefile::PushFunctionScope(const cmPolicies::PolicyMap& pm) +void cmMakefile::PushFunctionScope(std::string const& fileName, + const cmPolicies::PolicyMap& pm) { this->StateSnapshot = this->GetState()->CreateFunctionCallSnapshot( - this->StateSnapshot); + this->StateSnapshot, + this->ContextStack.back()->Name, this->ContextStack.back()->Line, + fileName); assert(this->StateSnapshot.IsValid()); this->Internal->PushDefinitions(); @@ -1632,11 +1645,14 @@ void cmMakefile::PopFunctionScope(bool reportError) this->Internal->PopDefinitions(); } -void cmMakefile::PushMacroScope(const cmPolicies::PolicyMap& pm) +void cmMakefile::PushMacroScope(std::string const& fileName, + const cmPolicies::PolicyMap& pm) { this->StateSnapshot = this->GetState()->CreateMacroCallSnapshot( - this->StateSnapshot); + this->StateSnapshot, + this->ContextStack.back()->Name, this->ContextStack.back()->Line, + fileName); assert(this->StateSnapshot.IsValid()); this->PushFunctionBlockerBarrier(); @@ -1670,6 +1686,7 @@ public: std::string currentStart = this->Makefile->StateSnapshot.GetCurrentSourceDirectory(); currentStart += "/CMakeLists.txt"; + this->Makefile->StateSnapshot.SetListFile(currentStart); this->Makefile->ListFileStack.push_back(currentStart); this->Makefile->PushPolicyBarrier(); this->Makefile->PushFunctionBlockerBarrier(); @@ -1813,7 +1830,9 @@ void cmMakefile::AddSubDirectory(const std::string& srcPath, } cmState::Snapshot newSnapshot = this->GetState() - ->CreateBuildsystemDirectorySnapshot(this->StateSnapshot); + ->CreateBuildsystemDirectorySnapshot(this->StateSnapshot, + this->ContextStack.back()->Name, + this->ContextStack.back()->Line); // create a new local generator and set its parent cmLocalGenerator *lg2 = this->GetGlobalGenerator() @@ -5511,10 +5530,11 @@ AddRequiredTargetCFeature(cmTarget *target, const std::string& feature) const cmMakefile::FunctionPushPop::FunctionPushPop(cmMakefile* mf, + const std::string& fileName, cmPolicies::PolicyMap const& pm) : Makefile(mf), ReportError(true) { - this->Makefile->PushFunctionScope(pm); + this->Makefile->PushFunctionScope(fileName, pm); } cmMakefile::FunctionPushPop::~FunctionPushPop() @@ -5524,10 +5544,11 @@ cmMakefile::FunctionPushPop::~FunctionPushPop() cmMakefile::MacroPushPop::MacroPushPop(cmMakefile* mf, + const std::string& fileName, const cmPolicies::PolicyMap& pm) : Makefile(mf), ReportError(true) { - this->Makefile->PushMacroScope(pm); + this->Makefile->PushMacroScope(fileName, pm); } cmMakefile::MacroPushPop::~MacroPushPop() diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 0ade8e15c..01c9e8c5e 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -720,7 +720,7 @@ public: class FunctionPushPop { public: - FunctionPushPop(cmMakefile* mf, + FunctionPushPop(cmMakefile* mf, std::string const& fileName, cmPolicies::PolicyMap const& pm); ~FunctionPushPop(); @@ -733,8 +733,8 @@ public: class MacroPushPop { public: - MacroPushPop(cmMakefile* mf, - cmPolicies::PolicyMap const& pm); + MacroPushPop(cmMakefile* mf, std::string const& fileName, + cmPolicies::PolicyMap const& pm); ~MacroPushPop(); void Quiet() { this->ReportError = false; } @@ -743,9 +743,11 @@ public: bool ReportError; }; - void PushFunctionScope(cmPolicies::PolicyMap const& pm); + void PushFunctionScope(std::string const& fileName, + cmPolicies::PolicyMap const& pm); void PopFunctionScope(bool reportError); - void PushMacroScope(cmPolicies::PolicyMap const& pm); + void PushMacroScope(std::string const& fileName, + cmPolicies::PolicyMap const& pm); void PopMacroScope(bool reportError); void PushScope(); void PopScope(); diff --git a/Source/cmState.cxx b/Source/cmState.cxx index 5ca1cce09..d918f657e 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -23,8 +23,11 @@ struct cmState::SnapshotDataType cmState::PositionType CallStackParent; cmState::PositionType DirectoryParent; cmState::SnapshotType SnapshotType; + cmLinkedTree::iterator ExecutionListFile; cmLinkedTree::iterator BuildSystemDirectory; + std::string EntryPointCommand; + long EntryPointLine; }; struct cmState::BuildsystemDirectoryStateType @@ -227,6 +230,7 @@ cmState::Snapshot cmState::Reset() this->BuildsystemDirectory.Truncate(); PositionType pos = this->SnapshotData.Truncate(); + this->ExecutionListFiles.Truncate(); this->DefineProperty ("RULE_LAUNCH_COMPILE", cmProperty::DIRECTORY, @@ -683,61 +687,98 @@ cmState::Snapshot cmState::CreateBaseSnapshot() pos->SnapshotType = BuildsystemDirectoryType; pos->BuildSystemDirectory = this->BuildsystemDirectory.Extend(this->BuildsystemDirectory.Root()); + pos->ExecutionListFile = + this->ExecutionListFiles.Extend(this->ExecutionListFiles.Root()); return cmState::Snapshot(this, pos); } cmState::Snapshot -cmState::CreateBuildsystemDirectorySnapshot(Snapshot originSnapshot) +cmState::CreateBuildsystemDirectorySnapshot(Snapshot originSnapshot, + std::string const& entryPointCommand, + long entryPointLine) { assert(originSnapshot.IsValid()); PositionType pos = this->SnapshotData.Extend(originSnapshot.Position); pos->CallStackParent = originSnapshot.Position; + pos->EntryPointLine = entryPointLine; + pos->EntryPointCommand = entryPointCommand; pos->DirectoryParent = originSnapshot.Position; pos->SnapshotType = BuildsystemDirectoryType; pos->BuildSystemDirectory = this->BuildsystemDirectory.Extend( originSnapshot.Position->BuildSystemDirectory); + pos->ExecutionListFile = + this->ExecutionListFiles.Extend( + originSnapshot.Position->ExecutionListFile); return cmState::Snapshot(this, pos); } cmState::Snapshot -cmState::CreateFunctionCallSnapshot(cmState::Snapshot originSnapshot) +cmState::CreateFunctionCallSnapshot(cmState::Snapshot originSnapshot, + std::string const& entryPointCommand, + long entryPointLine, + std::string const& fileName) { PositionType pos = this->SnapshotData.Extend(originSnapshot.Position, *originSnapshot.Position); pos->CallStackParent = originSnapshot.Position; + pos->EntryPointLine = entryPointLine; + pos->EntryPointCommand = entryPointCommand; pos->SnapshotType = FunctionCallType; + pos->ExecutionListFile = this->ExecutionListFiles.Extend( + originSnapshot.Position->ExecutionListFile, fileName); return cmState::Snapshot(this, pos); } cmState::Snapshot -cmState::CreateMacroCallSnapshot(cmState::Snapshot originSnapshot) +cmState::CreateMacroCallSnapshot(cmState::Snapshot originSnapshot, + std::string const& entryPointCommand, + long entryPointLine, + std::string const& fileName) { PositionType pos = this->SnapshotData.Extend(originSnapshot.Position, *originSnapshot.Position); pos->CallStackParent = originSnapshot.Position; + pos->EntryPointLine = entryPointLine; + pos->EntryPointCommand = entryPointCommand; pos->SnapshotType = MacroCallType; + pos->ExecutionListFile = this->ExecutionListFiles.Extend( + originSnapshot.Position->ExecutionListFile, fileName); return cmState::Snapshot(this, pos); } cmState::Snapshot -cmState::CreateCallStackSnapshot(cmState::Snapshot originSnapshot) +cmState::CreateCallStackSnapshot(cmState::Snapshot originSnapshot, + const std::string& entryPointCommand, + long entryPointLine, + const std::string& fileName) { PositionType pos = this->SnapshotData.Extend(originSnapshot.Position, *originSnapshot.Position); pos->CallStackParent = originSnapshot.Position; + pos->EntryPointLine = entryPointLine; + pos->EntryPointCommand = entryPointCommand; pos->SnapshotType = CallStackType; + pos->ExecutionListFile = this->ExecutionListFiles.Extend( + originSnapshot.Position->ExecutionListFile, fileName); return cmState::Snapshot(this, pos); } cmState::Snapshot -cmState::CreateInlineListFileSnapshot(cmState::Snapshot originSnapshot) +cmState::CreateInlineListFileSnapshot(cmState::Snapshot originSnapshot, + const std::string& entryPointCommand, + long entryPointLine, + const std::string& fileName) { PositionType pos = this->SnapshotData.Extend(originSnapshot.Position, *originSnapshot.Position); pos->CallStackParent = originSnapshot.Position; + pos->EntryPointLine = entryPointLine; + pos->EntryPointCommand = entryPointCommand; pos->SnapshotType = InlineListFileType; + pos->ExecutionListFile = this->ExecutionListFiles.Extend( + originSnapshot.Position->ExecutionListFile, fileName); return cmState::Snapshot(this, pos); } @@ -797,6 +838,11 @@ void cmState::Snapshot::SetCurrentBinaryDirectory(std::string const& dir) this->ComputeRelativePathTopBinary(); } +void cmState::Snapshot::SetListFile(const std::string& listfile) +{ + *this->Position->ExecutionListFile = listfile; +} + std::vector const& cmState::Snapshot::GetCurrentSourceDirectoryComponents() const { @@ -831,6 +877,21 @@ void cmState::Snapshot::SetRelativePathTopBinary(const char* dir) this->Position->BuildSystemDirectory->RelativePathTopBinary = dir; } +std::string cmState::Snapshot::GetExecutionListFile() const +{ + return *this->Position->ExecutionListFile; +} + +std::string cmState::Snapshot::GetEntryPointCommand() const +{ + return this->Position->EntryPointCommand; +} + +long cmState::Snapshot::GetEntryPointLine() const +{ + return this->Position->EntryPointLine; +} + bool cmState::Snapshot::IsValid() const { return this->State && this->Position.IsValid() diff --git a/Source/cmState.h b/Source/cmState.h index e35b843de..473a1948b 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -47,6 +47,8 @@ public: const char* GetCurrentBinaryDirectory() const; void SetCurrentBinaryDirectory(std::string const& dir); + void SetListFile(std::string const& listfile); + std::vector const& GetCurrentSourceDirectoryComponents() const; std::vector const& @@ -57,6 +59,10 @@ public: void SetRelativePathTopSource(const char* dir); void SetRelativePathTopBinary(const char* dir); + std::string GetExecutionListFile() const; + std::string GetEntryPointCommand() const; + long GetEntryPointLine() const; + bool IsValid() const; Snapshot GetBuildsystemDirectoryParent() const; Snapshot GetCallStackParent() const; @@ -75,11 +81,25 @@ public: Snapshot CreateBaseSnapshot(); Snapshot - CreateBuildsystemDirectorySnapshot(Snapshot originSnapshot); - Snapshot CreateFunctionCallSnapshot(Snapshot originSnapshot); - Snapshot CreateMacroCallSnapshot(Snapshot originSnapshot); - Snapshot CreateCallStackSnapshot(Snapshot originSnapshot); - Snapshot CreateInlineListFileSnapshot(Snapshot originSnapshot); + CreateBuildsystemDirectorySnapshot(Snapshot originSnapshot, + std::string const& entryPointCommand, + long entryPointLine); + Snapshot CreateFunctionCallSnapshot(Snapshot originSnapshot, + std::string const& entryPointCommand, + long entryPointLine, + std::string const& fileName); + Snapshot CreateMacroCallSnapshot(Snapshot originSnapshot, + std::string const& entryPointCommand, + long entryPointLine, + std::string const& fileName); + Snapshot CreateCallStackSnapshot(Snapshot originSnapshot, + std::string const& entryPointCommand, + long entryPointLine, + std::string const& fileName); + Snapshot CreateInlineListFileSnapshot(Snapshot originSnapshot, + const std::string& entryPointCommand, + long entryPointLine, + std::string const& fileName); Snapshot Pop(Snapshot originSnapshot); enum CacheEntryType{ BOOL=0, PATH, FILEPATH, STRING, INTERNAL,STATIC, @@ -186,6 +206,8 @@ private: struct BuildsystemDirectoryStateType; cmLinkedTree BuildsystemDirectory; + cmLinkedTree ExecutionListFiles; + cmLinkedTree SnapshotData; std::vector SourceDirectoryComponents; From 30d44efaf86194271c70f90a8fafa94a7d56f92c Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 4 Jul 2015 12:20:47 +0200 Subject: [PATCH 0242/1048] cmMakefile: Access the execution list file from the cmState. --- Source/cmMakefile.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index eb26474ce..08df6559a 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -3418,7 +3418,8 @@ std::string cmMakefile::GetExecutionFilePath() const { return std::string(); } - return this->ContextStack.back()->FilePath; + assert(this->StateSnapshot.IsValid()); + return this->StateSnapshot.GetExecutionListFile(); } //---------------------------------------------------------------------------- From d1db123e1c3eeba3fcc27b8ae2f65c7ae8f91a7f Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Mon, 6 Jul 2015 00:01:04 -0400 Subject: [PATCH 0243/1048] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 160936f75..fd23b9218 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 3) -set(CMake_VERSION_PATCH 20150705) +set(CMake_VERSION_PATCH 20150706) #set(CMake_VERSION_RC 1) From 42747fcc73478073eaaee4c906ffe03c0b33c632 Mon Sep 17 00:00:00 2001 From: Betsy McPhail Date: Thu, 2 Jul 2015 10:21:36 -0400 Subject: [PATCH 0244/1048] CTest: Show the number of tests for each label in the summary --- Source/CTest/cmCTestTestHandler.cxx | 21 +++++++++++++---- .../CTestCommandLine/LabelCount-stdout.txt | 7 ++++++ .../CTestCommandLine/RunCMakeTest.cmake | 23 +++++++++++++++++++ 3 files changed, 47 insertions(+), 4 deletions(-) create mode 100644 Tests/RunCMake/CTestCommandLine/LabelCount-stdout.txt diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 59576f4d9..5faf00189 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -656,9 +656,8 @@ int cmCTestTestHandler::ProcessHandler() void cmCTestTestHandler::PrintLabelSummary() { cmCTestTestHandler::ListOfTests::iterator it = this->TestList.begin(); - cmCTestTestHandler::TestResultsVector::iterator ri = - this->TestResults.begin(); std::map labelTimes; + std::map labelCounts; std::set labels; // initialize maps std::string::size_type maxlen = 0; @@ -676,10 +675,12 @@ void cmCTestTestHandler::PrintLabelSummary() } labels.insert(*l); labelTimes[*l] = 0; + labelCounts[*l] = 0; } } } - ri = this->TestResults.begin(); + cmCTestTestHandler::TestResultsVector::iterator ri = + this->TestResults.begin(); // fill maps for(; ri != this->TestResults.end(); ++ri) { @@ -691,6 +692,7 @@ void cmCTestTestHandler::PrintLabelSummary() l != p.Labels.end(); ++l) { labelTimes[*l] += result.ExecutionTime; + ++labelCounts[*l]; } } } @@ -705,10 +707,21 @@ void cmCTestTestHandler::PrintLabelSummary() { std::string label = *i; label.resize(maxlen +3, ' '); + char buf[1024]; sprintf(buf, "%6.2f sec", labelTimes[*i]); + + std::ostringstream labelCountStr; + labelCountStr << "(" << labelCounts[*i] << " test"; + if (labelCounts[*i] > 1) + { + labelCountStr << "s"; + } + labelCountStr << ")"; + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, "\n" - << label << " = " << buf, this->Quiet ); + << label << " = " << buf << " " << labelCountStr.str(), + this->Quiet ); if ( this->LogFile ) { *this->LogFile << "\n" << *i << " = " diff --git a/Tests/RunCMake/CTestCommandLine/LabelCount-stdout.txt b/Tests/RunCMake/CTestCommandLine/LabelCount-stdout.txt new file mode 100644 index 000000000..7fe04eb6a --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/LabelCount-stdout.txt @@ -0,0 +1,7 @@ +100% tests passed, 0 tests failed out of 4 ++ ++Label Time Summary: ++'bar' = +[0-9.]+ sec \(3 tests\) ++'foo' = +[0-9.]+ sec \(1 test\) ++ +Total Test time \(real\) = +[0-9.]+ sec diff --git a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake index aba1dafc2..dfc1e3335 100644 --- a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake @@ -54,6 +54,29 @@ add_test(MergeOutput \"${CMAKE_COMMAND}\" -P \"${RunCMake_SOURCE_DIR}/MergeOutpu endfunction() run_MergeOutput() +function(run_LabelCount) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/LabelCount) + set(RunCMake_TEST_NO_CLEAN 1) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + file(WRITE "${RunCMake_TEST_BINARY_DIR}/CTestTestfile.cmake" " +add_test(test1 \"${CMAKE_COMMAND}\" -E echo \"test1\") +set_tests_properties(test1 PROPERTIES LABELS 'bar') + +add_test(test2 \"${CMAKE_COMMAND}\" -E echo \"test2\") +set_tests_properties(test2 PROPERTIES LABELS 'bar') + +add_test(test3 \"${CMAKE_COMMAND}\" -E echo \"test3\") +set_tests_properties(test3 PROPERTIES LABELS 'foo') + +add_test(test4 \"${CMAKE_COMMAND}\" -E echo \"test4\") +set_tests_properties(test4 PROPERTIES LABELS 'bar') +") + + run_cmake_command(LabelCount ${CMAKE_CTEST_COMMAND} -V) +endfunction() + +run_LabelCount() function(run_TestLoad name load) set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/TestLoad) From 65086ad778b5d8312e4168fc5ed670e545be7d4b Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Fri, 19 Jun 2015 16:12:43 -0400 Subject: [PATCH 0245/1048] bindexplib: Import original implementation from CERN Download the original implementation provided by root.cern.ch with the following session: $ wget https://raw.githubusercontent.com/gordonwatts/root-vc-port/f0ee59af/build/win/bindexplib/bindexplib.cxx $ sha1sum bindexplib.cxx fa6efafb2c58a0644bd0f6a56fe02ee0d55c7fcd bindexplib.cxx $ sed -i 's/ *$//;s/'$'\t''/ /' bindexplib.cxx --- Source/bindexplib.cxx | 739 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 739 insertions(+) create mode 100644 Source/bindexplib.cxx diff --git a/Source/bindexplib.cxx b/Source/bindexplib.cxx new file mode 100644 index 000000000..6f9605c42 --- /dev/null +++ b/Source/bindexplib.cxx @@ -0,0 +1,739 @@ +/* +*---------------------------------------------------------------------- +* Program: dumpexts.exe +* Author: Gordon Chaffee +* +* History: The real functionality of this file was written by +* Matt Pietrek in 1993 in his pedump utility. I've +* modified it to dump the externals in a bunch of object +* files to create a .def file. +* +* Notes: Visual C++ puts an underscore before each exported symbol. +* This file removes them. I don't know if this is a problem +* this other compilers. If _MSC_VER is defined, +* the underscore is removed. If not, it isn't. To get a +* full dump of an object file, use the -f option. This can +* help determine the something that may be different with a +* compiler other than Visual C++. +* ====================================== +* Corrections (Axel 2006-04-04): +* Conversion to C++. Mostly. +* + * Extension (Axel 2006-03-15) + * As soon as an object file contains an /EXPORT directive (which + * is generated by the compiler when a symbol is declared as + * declspec(dllexport)) no to-be-exported symbols are printed, + * as the linker will see these directives, and if those directives + * are present we only export selectively (i.e. we trust the + * programmer). + * + * ====================================== +* ====================================== +* Corrections (Valery Fine 23/02/98): +* +* The "(vector) deleting destructor" MUST not be exported +* To recognize it the following test are introduced: +* "@@UAEPAXI@Z" scalar deleting dtor +* "@@QAEPAXI@Z" vector deleting dtor +* "AEPAXI@Z" vector deleting dtor with thunk adjustor +* ====================================== +* Corrections (Valery Fine 12/02/97): +* +* It created a wrong EXPORTS for the global pointers and constants. +* The Section Header has been involved to discover the missing information +* Now the pointers are correctly supplied supplied with "DATA" descriptor +* the constants with no extra descriptor. +* +* Corrections (Valery Fine 16/09/96): +* +* It didn't work for C++ code with global variables and class definitons +* The DumpExternalObject function has been introduced to generate .DEF file +* +* Author: Valery Fine 16/09/96 (E-mail: fine@vxcern.cern.ch) +*---------------------------------------------------------------------- +*/ + +static char sccsid[] = "@(#) winDumpExts.c 1.2 95/10/03 15:27:34"; + +#include +#include +#include +#include + +/* +*---------------------------------------------------------------------- +* GetArgcArgv -- +* +* Break up a line into argc argv +*---------------------------------------------------------------------- +*/ +int +GetArgcArgv(std::string &s, char **argv) +{ + int quote = 0; + int argc = 0; + std::string::iterator bp = s.begin(); + + while (1) { + while (isspace(*bp)) { + bp++; + } + if (*bp == '\n' || *bp == '\0') { + *bp = '\0'; + return argc; + } + if (*bp == '\"') { + quote = 1; + bp++; + } + argv[argc++] = &(*bp); + + while (*bp != '\0') { + if (quote) { + if (*bp == '\"') { + quote = 0; + *bp = '\0'; + bp++; + break; + } + bp++; + continue; + } + if (isspace(*bp)) { + *bp = '\0'; + bp++; + break; + } + bp++; + } + } +} + +/* +* The names of the first group of possible symbol table storage classes +*/ +char * SzStorageClass1[] = { + "NULL","AUTOMATIC","EXTERNAL","STATIC","REGISTER","EXTERNAL_DEF","LABEL", + "UNDEFINED_LABEL","MEMBER_OF_STRUCT","ARGUMENT","STRUCT_TAG", + "MEMBER_OF_UNION","UNION_TAG","TYPE_DEFINITION","UNDEFINED_STATIC", + "ENUM_TAG","MEMBER_OF_ENUM","REGISTER_PARAM","BIT_FIELD" +}; + +/* +* The names of the second group of possible symbol table storage classes +*/ +char * SzStorageClass2[] = { + "BLOCK","FUNCTION","END_OF_STRUCT","FILE","SECTION","WEAK_EXTERNAL" +}; + +/* +*---------------------------------------------------------------------- +* GetSZStorageClass -- +* +* Given a symbol storage class value, return a descriptive +* ASCII string +*---------------------------------------------------------------------- +*/ +PSTR +GetSZStorageClass(BYTE storageClass) +{ + if ( storageClass <= IMAGE_SYM_CLASS_BIT_FIELD ) + return SzStorageClass1[storageClass]; + else if ( (storageClass >= IMAGE_SYM_CLASS_BLOCK) + && (storageClass <= IMAGE_SYM_CLASS_WEAK_EXTERNAL) ) + return SzStorageClass2[storageClass-IMAGE_SYM_CLASS_BLOCK]; + else + return "???"; +} + +void AddHex(std::string& buf, long val, bool caps=false) +{ + buf += "0x"; + size_t len=buf.length(); + while (val) { + char hex = (char)(val & 16); + val = val >> 4; + if (hex<10) hex+='0'; + else if (caps) hex+='A'-10; + else hex+='a'-10; + buf.insert(len, hex, 1); + } +} + +/* +*---------------------------------------------------------------------- +* GetSectionName -- +* +* Used by DumpSymbolTable, it gives meaningful names to +* the non-normal section number. +* +* Results: +* A name is returned in buffer +*---------------------------------------------------------------------- +*/ +void +GetSectionName(PIMAGE_SYMBOL pSymbolTable, std::string& buffer) +{ + DWORD section; + + section = pSymbolTable->SectionNumber; + + switch ( (SHORT)section ) + { + case IMAGE_SYM_UNDEFINED: if (pSymbolTable->Value) buffer += "COMM"; else buffer += "UNDEF"; break; + case IMAGE_SYM_ABSOLUTE: buffer += "ABS "; break; + case IMAGE_SYM_DEBUG: buffer += "DEBUG"; break; + default: AddHex(buffer, section, true); + } +} + +/* +*---------------------------------------------------------------------- +* GetSectionCharacteristics -- +* +* Converts the Characteristics field of IMAGE_SECTION_HEADER +* to print. +* +* Results: +* A definiton of the section symbol type +*---------------------------------------------------------------------- +*/ +void +GetSectionCharacteristics(PIMAGE_SECTION_HEADER pSectionHeaders, int nSectNum, std::string &buffer) +{ + DWORD SectChar; + std::string TempBuf; + buffer.clear(); + if (nSectNum > 0) { + SectChar = pSectionHeaders[nSectNum-1].Characteristics; + + buffer = " "; + AddHex(buffer, SectChar); + if (SectChar & IMAGE_SCN_CNT_CODE) buffer += " Code"; + else if (SectChar & IMAGE_SCN_CNT_INITIALIZED_DATA) buffer += " Init. data"; + else if (SectChar & IMAGE_SCN_CNT_UNINITIALIZED_DATA ) buffer += " UnInit data"; + else buffer += " Unknow type"; + + if (SectChar & IMAGE_SCN_MEM_READ) { + buffer += " Read"; + if (SectChar & IMAGE_SCN_MEM_WRITE) + buffer += " and Write"; + else buffer += " only"; + } + else if (SectChar & IMAGE_SCN_MEM_WRITE) + buffer +=" Write only"; + + } +} + +/* +*---------------------------------------------------------------------- +* DumpSymbolTable -- +* +* Dumps a COFF symbol table from an EXE or OBJ. We only use +* it to dump tables from OBJs. +*---------------------------------------------------------------------- +*/ +void +DumpSymbolTable(PIMAGE_SYMBOL pSymbolTable, PIMAGE_SECTION_HEADER pSectionHeaders, FILE *fout, unsigned cSymbols) +{ + unsigned i; + PSTR stringTable; + std::string sectionName; + std::string sectionCharacter; + int iSectNum; + + fprintf(fout, "Symbol Table - %X entries (* = auxillary symbol)\n", + cSymbols); + + fprintf(fout, + "Indx Name Value Section cAux Type Storage Character\n" + "---- -------------------- -------- ---------- ----- ------- -------- ---------\n"); + + /* + * The string table apparently starts right after the symbol table + */ + stringTable = (PSTR)&pSymbolTable[cSymbols]; + + for ( i=0; i < cSymbols; i++ ) { + fprintf(fout, "%04X ", i); + if ( pSymbolTable->N.Name.Short != 0 ) + fprintf(fout, "%-20.8s", pSymbolTable->N.ShortName); + else + fprintf(fout, "%-20s", stringTable + pSymbolTable->N.Name.Long); + + fprintf(fout, " %08X", pSymbolTable->Value); + + iSectNum = pSymbolTable->SectionNumber; + GetSectionName(pSymbolTable, sectionName); + fprintf(fout, " sect:%s aux:%X type:%02X st:%s", + sectionName.c_str(), + pSymbolTable->NumberOfAuxSymbols, + pSymbolTable->Type, + GetSZStorageClass(pSymbolTable->StorageClass) ); + + GetSectionCharacteristics(pSectionHeaders,iSectNum,sectionCharacter); + fprintf(fout," hc: %s \n",sectionCharacter.c_str()); +#if 0 + if ( pSymbolTable->NumberOfAuxSymbols ) + DumpAuxSymbols(pSymbolTable); +#endif + + /* + * Take into account any aux symbols + */ + i += pSymbolTable->NumberOfAuxSymbols; + pSymbolTable += pSymbolTable->NumberOfAuxSymbols; + pSymbolTable++; + } +} + +/* +*---------------------------------------------------------------------- +* DumpExternals -- +* +* Dumps a COFF symbol table from an EXE or OBJ. We only use +* it to dump tables from OBJs. +*---------------------------------------------------------------------- +*/ +void +DumpExternals(PIMAGE_SYMBOL pSymbolTable, FILE *fout, unsigned cSymbols) +{ + unsigned i; + PSTR stringTable; + std::string symbol; + + /* + * The string table apparently starts right after the symbol table + */ + stringTable = (PSTR)&pSymbolTable[cSymbols]; + + for ( i=0; i < cSymbols; i++ ) { + if (pSymbolTable->SectionNumber > 0 && pSymbolTable->Type == 0x20) { + if (pSymbolTable->StorageClass == IMAGE_SYM_CLASS_EXTERNAL) { + if (pSymbolTable->N.Name.Short != 0) { + symbol = ""; + symbol.insert(0, (const char *)(pSymbolTable->N.ShortName), 8); + } else { + symbol = stringTable + pSymbolTable->N.Name.Long; + } + std::string::size_type posAt = symbol.find('@'); + if (posAt != std::string::npos) symbol.erase(posAt); +#ifndef _MSC_VER + fprintf(fout, "\t%s\n", symbol.c_str()); +#else + fprintf(fout, "\t%s\n", symbol.c_str()+1); +#endif + } + } + + /* + * Take into account any aux symbols + */ + i += pSymbolTable->NumberOfAuxSymbols; + pSymbolTable += pSymbolTable->NumberOfAuxSymbols; + pSymbolTable++; + } +} + +/* ++ * Utility func, strstr with size ++ */ +const char* StrNStr(const char* start, const char* find, size_t &size) { + size_t len; + const char* hint; + + if (!start || !find || !size) { + size = 0; + return 0; + } + len = strlen(find); + + while (hint = (const char*) memchr(start, find[0], size-len+1)) { + size -= (hint - start); + if (!strncmp(hint, find, len)) + return hint; + start = hint + 1; + } + + size = 0; + return 0; +} + +/* + *---------------------------------------------------------------------- + * HaveExportedObjects -- + * + * Returns >0 if export directives (declspec(dllexport)) exist. + * + *---------------------------------------------------------------------- + */ +int +HaveExportedObjects(PIMAGE_FILE_HEADER pImageFileHeader, PIMAGE_SECTION_HEADER pSectionHeaders, FILE *fout) +{ + static int fImportFlag = 0; /* The status is nor defined yet */ + WORD i; + size_t size; + char foundExports; + const char * rawdata; + + PIMAGE_SECTION_HEADER pDirectivesSectionHeader; + + if (fImportFlag) return 1; + + i = 0; + foundExports = 0; + pDirectivesSectionHeader = 0; + for(i = 0; i < pImageFileHeader->NumberOfSections && !pDirectivesSectionHeader; i++) + if (!strncmp((const char*)&pSectionHeaders[i].Name[0], ".drectve",8)) + pDirectivesSectionHeader = &pSectionHeaders[i]; + if (!pDirectivesSectionHeader) return 0; + + rawdata=(const char*)pImageFileHeader+pDirectivesSectionHeader->PointerToRawData; + if (!pDirectivesSectionHeader->PointerToRawData || !rawdata) return 0; + + size = pDirectivesSectionHeader->SizeOfRawData; + const char* posImportFlag = rawdata; + while ((posImportFlag = StrNStr(posImportFlag, " /EXPORT:", size))) { + const char* lookingForDict = posImportFlag + 9; + if (!strncmp(lookingForDict, "_G__cpp_",8) || + !strncmp(lookingForDict, "_G__set_cpp_",12)) { + posImportFlag = lookingForDict; + continue; + } + + const char* lookingForDATA = posImportFlag + 9; + while (*(++lookingForDATA) && *lookingForDATA != ' '); + lookingForDATA -= 5; + // ignore DATA exports + if (strncmp(lookingForDATA, ",DATA", 5)) break; + posImportFlag = lookingForDATA + 5; + } + fImportFlag = (int)posImportFlag; + return fImportFlag; +} + + + +/* + *---------------------------------------------------------------------- +* DumpExternalsObjects -- +* +* Dumps a COFF symbol table from an EXE or OBJ. We only use +* it to dump tables from OBJs. +*---------------------------------------------------------------------- +*/ +void +DumpExternalsObjects(PIMAGE_SYMBOL pSymbolTable, PIMAGE_SECTION_HEADER pSectionHeaders, + FILE *fout, unsigned cSymbols, int fort) +{ + unsigned i; + PSTR stringTable; + std::string symbol; + DWORD SectChar; + static int fImportFlag = -1; /* The status is nor defined yet */ + + /* + * The string table apparently starts right after the symbol table + */ + stringTable = (PSTR)&pSymbolTable[cSymbols]; + + for ( i=0; i < cSymbols; i++ ) { + if (pSymbolTable->SectionNumber > 0 && ( pSymbolTable->Type == 0x20 || pSymbolTable->Type == 0x0)) { + if (pSymbolTable->StorageClass == IMAGE_SYM_CLASS_EXTERNAL) { + /* + * The name of the Function entry points + */ + if (pSymbolTable->N.Name.Short != 0) { + symbol = ""; + symbol.insert(0, (const char *)pSymbolTable->N.ShortName, 8); + } else { + symbol = stringTable + pSymbolTable->N.Name.Long; + } + + while (isspace(symbol[0])) symbol.erase(0,1); +#ifdef _MSC_VER + if (symbol[0] == '_') symbol.erase(0,1); + if (fort) { + std::string::size_type posAt = symbol.find('@'); + if (posAt != std::string::npos) symbol.erase(posAt); + } +#endif + if (fImportFlag) { + fImportFlag = 0; + fprintf(fout,"EXPORTS \n"); + } + /* + Check whether it is "Scalar deleting destructor" and + "Vector deleting destructor" + */ + /* + if (!strstr(s,"@@UAEPAXI@Z") && !strstr(s,"@@QAEPAXI@Z") && + !strstr(s,"@AEPAXI@Z") && !strstr(s,"AEPAXI@Z") && + !strstr(s,"real@")) + */ + const char *scalarPrefix = "??_G"; + const char *vectorPrefix = "??_E"; + if (symbol.compare(0, 4, scalarPrefix) && + symbol.compare(0, 4, vectorPrefix) && + symbol.find("real@") == std::string::npos) + { + SectChar = pSectionHeaders[pSymbolTable->SectionNumber-1].Characteristics; + if (!pSymbolTable->Type && (SectChar & IMAGE_SCN_MEM_WRITE)) { + // Read only (i.e. constants) must be excluded + fprintf(fout, "\t%s \t DATA\n", symbol.c_str()); + } else { + if ( pSymbolTable->Type || !(SectChar & IMAGE_SCN_MEM_READ)) { + fprintf(fout, "\t%s\n", symbol.c_str()); + } else { + // printf(" strange symbol: %s \n",s); + } + } + } + } + } + else if (pSymbolTable->SectionNumber == IMAGE_SYM_UNDEFINED && !pSymbolTable->Type && 0){ + /* + * The IMPORT global variable entry points + */ + if (pSymbolTable->StorageClass == IMAGE_SYM_CLASS_EXTERNAL) { + symbol = stringTable + pSymbolTable->N.Name.Long; + while (isspace(symbol[0])) symbol.erase(0,1); + if (symbol[0] == '_') symbol.erase(0,1); + if (!fImportFlag) { + fImportFlag = 1; + fprintf(fout,"IMPORTS \n"); + } + fprintf(fout, "\t%s DATA \n", symbol.c_str()+1); + } + } + + /* + * Take into account any aux symbols + */ + i += pSymbolTable->NumberOfAuxSymbols; + pSymbolTable += pSymbolTable->NumberOfAuxSymbols; + pSymbolTable++; + } +} + +/* +*---------------------------------------------------------------------- +* DumpObjFile -- +* +* Dump an object file--either a full listing or just the exported +* symbols. +*---------------------------------------------------------------------- +*/ +void +DumpObjFile(PIMAGE_FILE_HEADER pImageFileHeader, FILE *fout, int full, int fort) +{ + PIMAGE_SYMBOL PCOFFSymbolTable; + PIMAGE_SECTION_HEADER PCOFFSectionHeaders; + DWORD_PTR COFFSymbolCount; + + PCOFFSymbolTable = (PIMAGE_SYMBOL) + ((DWORD_PTR)pImageFileHeader + pImageFileHeader->PointerToSymbolTable); + COFFSymbolCount = pImageFileHeader->NumberOfSymbols; + + PCOFFSectionHeaders = (PIMAGE_SECTION_HEADER) + ((DWORD_PTR)pImageFileHeader + + IMAGE_SIZEOF_FILE_HEADER + + pImageFileHeader->SizeOfOptionalHeader); + + + if (full) { + DumpSymbolTable(PCOFFSymbolTable, PCOFFSectionHeaders, fout, COFFSymbolCount); + } else { + int haveExports = HaveExportedObjects(pImageFileHeader, PCOFFSectionHeaders, fout); + if (!haveExports) + DumpExternalsObjects(PCOFFSymbolTable, PCOFFSectionHeaders, fout, COFFSymbolCount, fort); + } +} + +/* +*---------------------------------------------------------------------- +* DumpFile -- +* +* Open up a file, memory map it, and call the appropriate +* dumping routine +*---------------------------------------------------------------------- +*/ +void +DumpFile(LPSTR filename, FILE *fout, int full, int fort) +{ + HANDLE hFile; + HANDLE hFileMapping; + LPVOID lpFileBase; + PIMAGE_DOS_HEADER dosHeader; + + hFile = CreateFile(filename, GENERIC_READ, FILE_SHARE_READ, NULL, + OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); + + if (hFile == INVALID_HANDLE_VALUE) { + fprintf(stderr, "Couldn't open file with CreateFile()\n"); + return; + } + + hFileMapping = CreateFileMapping(hFile, NULL, PAGE_READONLY, 0, 0, NULL); + if (hFileMapping == 0) { + CloseHandle(hFile); + fprintf(stderr, "Couldn't open file mapping with CreateFileMapping()\n"); + return; + } + + lpFileBase = MapViewOfFile(hFileMapping, FILE_MAP_READ, 0, 0, 0); + if (lpFileBase == 0) { + CloseHandle(hFileMapping); + CloseHandle(hFile); + fprintf(stderr, "Couldn't map view of file with MapViewOfFile()\n"); + return; + } + + dosHeader = (PIMAGE_DOS_HEADER)lpFileBase; + if (dosHeader->e_magic == IMAGE_DOS_SIGNATURE) { +#if 0 + DumpExeFile( dosHeader ); +#else + fprintf(stderr, "File is an executable. I don't dump those.\n"); + return; +#endif + } + /* Does it look like a i386 COFF OBJ file??? */ + else if ( + ((dosHeader->e_magic == IMAGE_FILE_MACHINE_I386) || (dosHeader->e_magic == IMAGE_FILE_MACHINE_AMD64)) + && (dosHeader->e_sp == 0) + ) { + /* + * The two tests above aren't what they look like. They're + * really checking for IMAGE_FILE_HEADER.Machine == i386 (0x14C) + * and IMAGE_FILE_HEADER.SizeOfOptionalHeader == 0; + */ + DumpObjFile((PIMAGE_FILE_HEADER) lpFileBase, fout, full, fort); + } else { + printf("unrecognized file format\n"); + } + UnmapViewOfFile(lpFileBase); + CloseHandle(hFileMapping); + CloseHandle(hFile); +} + +void +main(int argc, char **argv) +{ + std::string cmdline; + int i, arg; + FILE *fout; + int full = 0; + int fort = 0; + char *dllname = ""; + char *outfile = NULL; + + if (argc < 3) { +Usage: + fprintf(stderr, "Usage: %s ?-o outfile? ?-f(ull)? ..\n", argv[0]); + exit(1); + } + + arg = 1; + while (argv[arg][0] == '-') { + if (strcmp(argv[arg], "--") == 0) { + arg++; + break; + } else if (strcmp(argv[arg], "-f") == 0) { + full = 1; + } else if (strcmp(argv[arg], "-x") == 0) { + fort = 1; + } else if (strcmp(argv[arg], "-o") == 0) { + arg++; + if (arg == argc) { + goto Usage; + } + outfile = argv[arg]; + } + arg++; + } + if (arg == argc) { + goto Usage; + } + + if (outfile) { + fout = fopen(outfile, "w+"); + if (fout == NULL) { + fprintf(stderr, "Unable to open \'%s\' for writing:\n", + argv[arg]); + perror(""); + exit(1); + } + } else { + fout = stdout; + } + + if (! full) { + dllname = argv[arg]; + arg++; + if (arg == argc) { + goto Usage; + } + fprintf(fout, "LIBRARY %s\n", dllname); +#ifndef _X86_ + fprintf(fout, "CODE PRELOAD MOVEABLE DISCARDABLE\n"); + fprintf(fout, "DATA PRELOAD MOVEABLE MULTIPLE\n\n"); +#endif + } + + for (; arg < argc; arg++) { + WIN32_FIND_DATA FindFileData; + HANDLE SearchFile; + if (argv[arg][0] == '@') { + std::ifstream fargs(&argv[arg][1]); + if (!fargs) { + fprintf(stderr, "Unable to open \'%s\' for reading:\n", + argv[arg]); + perror(""); + exit(1); + } + char *fargv[1000]; + for (i = 0; i < arg; i++) { + cmdline += argv[i]; + fargv[i] = argv[i]; + } + std::string line; + std::getline(fargs, line); + cmdline += line; + fprintf(stderr, "%s\n", line.c_str()); + i += GetArgcArgv(line, &fargv[i]); + argc = i; + argv = fargv; + } + /* + * Argument can contain the wildcard names + */ + SearchFile = FindFirstFile(argv[arg],&FindFileData); + if (SearchFile == INVALID_HANDLE_VALUE){ + fprintf(stderr, "Unable to find \'%s\' for reading:\n", + argv[arg]); + exit(1); + } + else { + /* + * Since WIN32_FIND_DATA has no path information one has to extract it himself. + */ + TCHAR *filename = argv[arg]; + TCHAR path[2048]; + size_t i = strlen(filename); + i--; + while( filename[i] != '\\' && filename[i] != '/' && i >=0) i--; + do + { + if (i >= 0) strncpy( path, filename, i+1); /* Generate the 'path' info */ + path[i+1] = '\0'; + DumpFile(strcat(path, FindFileData.cFileName), fout, full, fort); + } while (FindNextFile(SearchFile,&FindFileData)); + + + FindClose(SearchFile); + } + } + exit(0); +} From 7de8276ca92db0630009eeab865afc445a30e1b8 Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Fri, 19 Jun 2015 16:12:43 -0400 Subject: [PATCH 0246/1048] bindexplib: Add copyright/license notice block --- Source/bindexplib.cxx | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Source/bindexplib.cxx b/Source/bindexplib.cxx index 6f9605c42..a86318f63 100644 --- a/Source/bindexplib.cxx +++ b/Source/bindexplib.cxx @@ -1,3 +1,21 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2015 Kitware, Inc. + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +/*------------------------------------------------------------------------- + Portions of this source have been derived from the 'bindexplib' tool + provided by the CERN ROOT Data Analysis Framework project (root.cern.ch). + Permission has been granted by Pere Mato to distribute + this derived work under the CMake license. +-------------------------------------------------------------------------*/ + /* *---------------------------------------------------------------------- * Program: dumpexts.exe From 4ff09893232b26b5c2961fb1e2a31836cad00a35 Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Fri, 19 Jun 2015 16:12:43 -0400 Subject: [PATCH 0247/1048] bindexplib: Drop code that CMake does not need --- Source/bindexplib.cxx | 433 +----------------------------------------- 1 file changed, 8 insertions(+), 425 deletions(-) diff --git a/Source/bindexplib.cxx b/Source/bindexplib.cxx index a86318f63..33f81618a 100644 --- a/Source/bindexplib.cxx +++ b/Source/bindexplib.cxx @@ -71,289 +71,11 @@ *---------------------------------------------------------------------- */ -static char sccsid[] = "@(#) winDumpExts.c 1.2 95/10/03 15:27:34"; - #include #include #include #include -/* -*---------------------------------------------------------------------- -* GetArgcArgv -- -* -* Break up a line into argc argv -*---------------------------------------------------------------------- -*/ -int -GetArgcArgv(std::string &s, char **argv) -{ - int quote = 0; - int argc = 0; - std::string::iterator bp = s.begin(); - - while (1) { - while (isspace(*bp)) { - bp++; - } - if (*bp == '\n' || *bp == '\0') { - *bp = '\0'; - return argc; - } - if (*bp == '\"') { - quote = 1; - bp++; - } - argv[argc++] = &(*bp); - - while (*bp != '\0') { - if (quote) { - if (*bp == '\"') { - quote = 0; - *bp = '\0'; - bp++; - break; - } - bp++; - continue; - } - if (isspace(*bp)) { - *bp = '\0'; - bp++; - break; - } - bp++; - } - } -} - -/* -* The names of the first group of possible symbol table storage classes -*/ -char * SzStorageClass1[] = { - "NULL","AUTOMATIC","EXTERNAL","STATIC","REGISTER","EXTERNAL_DEF","LABEL", - "UNDEFINED_LABEL","MEMBER_OF_STRUCT","ARGUMENT","STRUCT_TAG", - "MEMBER_OF_UNION","UNION_TAG","TYPE_DEFINITION","UNDEFINED_STATIC", - "ENUM_TAG","MEMBER_OF_ENUM","REGISTER_PARAM","BIT_FIELD" -}; - -/* -* The names of the second group of possible symbol table storage classes -*/ -char * SzStorageClass2[] = { - "BLOCK","FUNCTION","END_OF_STRUCT","FILE","SECTION","WEAK_EXTERNAL" -}; - -/* -*---------------------------------------------------------------------- -* GetSZStorageClass -- -* -* Given a symbol storage class value, return a descriptive -* ASCII string -*---------------------------------------------------------------------- -*/ -PSTR -GetSZStorageClass(BYTE storageClass) -{ - if ( storageClass <= IMAGE_SYM_CLASS_BIT_FIELD ) - return SzStorageClass1[storageClass]; - else if ( (storageClass >= IMAGE_SYM_CLASS_BLOCK) - && (storageClass <= IMAGE_SYM_CLASS_WEAK_EXTERNAL) ) - return SzStorageClass2[storageClass-IMAGE_SYM_CLASS_BLOCK]; - else - return "???"; -} - -void AddHex(std::string& buf, long val, bool caps=false) -{ - buf += "0x"; - size_t len=buf.length(); - while (val) { - char hex = (char)(val & 16); - val = val >> 4; - if (hex<10) hex+='0'; - else if (caps) hex+='A'-10; - else hex+='a'-10; - buf.insert(len, hex, 1); - } -} - -/* -*---------------------------------------------------------------------- -* GetSectionName -- -* -* Used by DumpSymbolTable, it gives meaningful names to -* the non-normal section number. -* -* Results: -* A name is returned in buffer -*---------------------------------------------------------------------- -*/ -void -GetSectionName(PIMAGE_SYMBOL pSymbolTable, std::string& buffer) -{ - DWORD section; - - section = pSymbolTable->SectionNumber; - - switch ( (SHORT)section ) - { - case IMAGE_SYM_UNDEFINED: if (pSymbolTable->Value) buffer += "COMM"; else buffer += "UNDEF"; break; - case IMAGE_SYM_ABSOLUTE: buffer += "ABS "; break; - case IMAGE_SYM_DEBUG: buffer += "DEBUG"; break; - default: AddHex(buffer, section, true); - } -} - -/* -*---------------------------------------------------------------------- -* GetSectionCharacteristics -- -* -* Converts the Characteristics field of IMAGE_SECTION_HEADER -* to print. -* -* Results: -* A definiton of the section symbol type -*---------------------------------------------------------------------- -*/ -void -GetSectionCharacteristics(PIMAGE_SECTION_HEADER pSectionHeaders, int nSectNum, std::string &buffer) -{ - DWORD SectChar; - std::string TempBuf; - buffer.clear(); - if (nSectNum > 0) { - SectChar = pSectionHeaders[nSectNum-1].Characteristics; - - buffer = " "; - AddHex(buffer, SectChar); - if (SectChar & IMAGE_SCN_CNT_CODE) buffer += " Code"; - else if (SectChar & IMAGE_SCN_CNT_INITIALIZED_DATA) buffer += " Init. data"; - else if (SectChar & IMAGE_SCN_CNT_UNINITIALIZED_DATA ) buffer += " UnInit data"; - else buffer += " Unknow type"; - - if (SectChar & IMAGE_SCN_MEM_READ) { - buffer += " Read"; - if (SectChar & IMAGE_SCN_MEM_WRITE) - buffer += " and Write"; - else buffer += " only"; - } - else if (SectChar & IMAGE_SCN_MEM_WRITE) - buffer +=" Write only"; - - } -} - -/* -*---------------------------------------------------------------------- -* DumpSymbolTable -- -* -* Dumps a COFF symbol table from an EXE or OBJ. We only use -* it to dump tables from OBJs. -*---------------------------------------------------------------------- -*/ -void -DumpSymbolTable(PIMAGE_SYMBOL pSymbolTable, PIMAGE_SECTION_HEADER pSectionHeaders, FILE *fout, unsigned cSymbols) -{ - unsigned i; - PSTR stringTable; - std::string sectionName; - std::string sectionCharacter; - int iSectNum; - - fprintf(fout, "Symbol Table - %X entries (* = auxillary symbol)\n", - cSymbols); - - fprintf(fout, - "Indx Name Value Section cAux Type Storage Character\n" - "---- -------------------- -------- ---------- ----- ------- -------- ---------\n"); - - /* - * The string table apparently starts right after the symbol table - */ - stringTable = (PSTR)&pSymbolTable[cSymbols]; - - for ( i=0; i < cSymbols; i++ ) { - fprintf(fout, "%04X ", i); - if ( pSymbolTable->N.Name.Short != 0 ) - fprintf(fout, "%-20.8s", pSymbolTable->N.ShortName); - else - fprintf(fout, "%-20s", stringTable + pSymbolTable->N.Name.Long); - - fprintf(fout, " %08X", pSymbolTable->Value); - - iSectNum = pSymbolTable->SectionNumber; - GetSectionName(pSymbolTable, sectionName); - fprintf(fout, " sect:%s aux:%X type:%02X st:%s", - sectionName.c_str(), - pSymbolTable->NumberOfAuxSymbols, - pSymbolTable->Type, - GetSZStorageClass(pSymbolTable->StorageClass) ); - - GetSectionCharacteristics(pSectionHeaders,iSectNum,sectionCharacter); - fprintf(fout," hc: %s \n",sectionCharacter.c_str()); -#if 0 - if ( pSymbolTable->NumberOfAuxSymbols ) - DumpAuxSymbols(pSymbolTable); -#endif - - /* - * Take into account any aux symbols - */ - i += pSymbolTable->NumberOfAuxSymbols; - pSymbolTable += pSymbolTable->NumberOfAuxSymbols; - pSymbolTable++; - } -} - -/* -*---------------------------------------------------------------------- -* DumpExternals -- -* -* Dumps a COFF symbol table from an EXE or OBJ. We only use -* it to dump tables from OBJs. -*---------------------------------------------------------------------- -*/ -void -DumpExternals(PIMAGE_SYMBOL pSymbolTable, FILE *fout, unsigned cSymbols) -{ - unsigned i; - PSTR stringTable; - std::string symbol; - - /* - * The string table apparently starts right after the symbol table - */ - stringTable = (PSTR)&pSymbolTable[cSymbols]; - - for ( i=0; i < cSymbols; i++ ) { - if (pSymbolTable->SectionNumber > 0 && pSymbolTable->Type == 0x20) { - if (pSymbolTable->StorageClass == IMAGE_SYM_CLASS_EXTERNAL) { - if (pSymbolTable->N.Name.Short != 0) { - symbol = ""; - symbol.insert(0, (const char *)(pSymbolTable->N.ShortName), 8); - } else { - symbol = stringTable + pSymbolTable->N.Name.Long; - } - std::string::size_type posAt = symbol.find('@'); - if (posAt != std::string::npos) symbol.erase(posAt); -#ifndef _MSC_VER - fprintf(fout, "\t%s\n", symbol.c_str()); -#else - fprintf(fout, "\t%s\n", symbol.c_str()+1); -#endif - } - } - - /* - * Take into account any aux symbols - */ - i += pSymbolTable->NumberOfAuxSymbols; - pSymbolTable += pSymbolTable->NumberOfAuxSymbols; - pSymbolTable++; - } -} - /* + * Utility func, strstr with size + */ @@ -387,7 +109,7 @@ const char* StrNStr(const char* start, const char* find, size_t &size) { *---------------------------------------------------------------------- */ int -HaveExportedObjects(PIMAGE_FILE_HEADER pImageFileHeader, PIMAGE_SECTION_HEADER pSectionHeaders, FILE *fout) +HaveExportedObjects(PIMAGE_FILE_HEADER pImageFileHeader, PIMAGE_SECTION_HEADER pSectionHeaders) { static int fImportFlag = 0; /* The status is nor defined yet */ WORD i; @@ -443,7 +165,7 @@ HaveExportedObjects(PIMAGE_FILE_HEADER pImageFileHeader, PIMAGE_SECTION_HEADER p */ void DumpExternalsObjects(PIMAGE_SYMBOL pSymbolTable, PIMAGE_SECTION_HEADER pSectionHeaders, - FILE *fout, unsigned cSymbols, int fort) + FILE *fout, unsigned cSymbols) { unsigned i; PSTR stringTable; @@ -470,13 +192,7 @@ DumpExternalsObjects(PIMAGE_SYMBOL pSymbolTable, PIMAGE_SECTION_HEADER pSectionH } while (isspace(symbol[0])) symbol.erase(0,1); -#ifdef _MSC_VER if (symbol[0] == '_') symbol.erase(0,1); - if (fort) { - std::string::size_type posAt = symbol.find('@'); - if (posAt != std::string::npos) symbol.erase(posAt); - } -#endif if (fImportFlag) { fImportFlag = 0; fprintf(fout,"EXPORTS \n"); @@ -485,11 +201,6 @@ DumpExternalsObjects(PIMAGE_SYMBOL pSymbolTable, PIMAGE_SECTION_HEADER pSectionH Check whether it is "Scalar deleting destructor" and "Vector deleting destructor" */ - /* - if (!strstr(s,"@@UAEPAXI@Z") && !strstr(s,"@@QAEPAXI@Z") && - !strstr(s,"@AEPAXI@Z") && !strstr(s,"AEPAXI@Z") && - !strstr(s,"real@")) - */ const char *scalarPrefix = "??_G"; const char *vectorPrefix = "??_E"; if (symbol.compare(0, 4, scalarPrefix) && @@ -544,7 +255,7 @@ DumpExternalsObjects(PIMAGE_SYMBOL pSymbolTable, PIMAGE_SECTION_HEADER pSectionH *---------------------------------------------------------------------- */ void -DumpObjFile(PIMAGE_FILE_HEADER pImageFileHeader, FILE *fout, int full, int fort) +DumpObjFile(PIMAGE_FILE_HEADER pImageFileHeader, FILE *fout) { PIMAGE_SYMBOL PCOFFSymbolTable; PIMAGE_SECTION_HEADER PCOFFSectionHeaders; @@ -560,13 +271,9 @@ DumpObjFile(PIMAGE_FILE_HEADER pImageFileHeader, FILE *fout, int full, int fort) pImageFileHeader->SizeOfOptionalHeader); - if (full) { - DumpSymbolTable(PCOFFSymbolTable, PCOFFSectionHeaders, fout, COFFSymbolCount); - } else { - int haveExports = HaveExportedObjects(pImageFileHeader, PCOFFSectionHeaders, fout); - if (!haveExports) - DumpExternalsObjects(PCOFFSymbolTable, PCOFFSectionHeaders, fout, COFFSymbolCount, fort); - } + int haveExports = HaveExportedObjects(pImageFileHeader, PCOFFSectionHeaders); + if (!haveExports) + DumpExternalsObjects(PCOFFSymbolTable, PCOFFSectionHeaders, fout, COFFSymbolCount); } /* @@ -578,7 +285,7 @@ DumpObjFile(PIMAGE_FILE_HEADER pImageFileHeader, FILE *fout, int full, int fort) *---------------------------------------------------------------------- */ void -DumpFile(LPSTR filename, FILE *fout, int full, int fort) +DumpFile(LPSTR filename, FILE *fout) { HANDLE hFile; HANDLE hFileMapping; @@ -610,12 +317,8 @@ DumpFile(LPSTR filename, FILE *fout, int full, int fort) dosHeader = (PIMAGE_DOS_HEADER)lpFileBase; if (dosHeader->e_magic == IMAGE_DOS_SIGNATURE) { -#if 0 - DumpExeFile( dosHeader ); -#else fprintf(stderr, "File is an executable. I don't dump those.\n"); return; -#endif } /* Does it look like a i386 COFF OBJ file??? */ else if ( @@ -627,7 +330,7 @@ DumpFile(LPSTR filename, FILE *fout, int full, int fort) * really checking for IMAGE_FILE_HEADER.Machine == i386 (0x14C) * and IMAGE_FILE_HEADER.SizeOfOptionalHeader == 0; */ - DumpObjFile((PIMAGE_FILE_HEADER) lpFileBase, fout, full, fort); + DumpObjFile((PIMAGE_FILE_HEADER) lpFileBase, fout); } else { printf("unrecognized file format\n"); } @@ -635,123 +338,3 @@ DumpFile(LPSTR filename, FILE *fout, int full, int fort) CloseHandle(hFileMapping); CloseHandle(hFile); } - -void -main(int argc, char **argv) -{ - std::string cmdline; - int i, arg; - FILE *fout; - int full = 0; - int fort = 0; - char *dllname = ""; - char *outfile = NULL; - - if (argc < 3) { -Usage: - fprintf(stderr, "Usage: %s ?-o outfile? ?-f(ull)? ..\n", argv[0]); - exit(1); - } - - arg = 1; - while (argv[arg][0] == '-') { - if (strcmp(argv[arg], "--") == 0) { - arg++; - break; - } else if (strcmp(argv[arg], "-f") == 0) { - full = 1; - } else if (strcmp(argv[arg], "-x") == 0) { - fort = 1; - } else if (strcmp(argv[arg], "-o") == 0) { - arg++; - if (arg == argc) { - goto Usage; - } - outfile = argv[arg]; - } - arg++; - } - if (arg == argc) { - goto Usage; - } - - if (outfile) { - fout = fopen(outfile, "w+"); - if (fout == NULL) { - fprintf(stderr, "Unable to open \'%s\' for writing:\n", - argv[arg]); - perror(""); - exit(1); - } - } else { - fout = stdout; - } - - if (! full) { - dllname = argv[arg]; - arg++; - if (arg == argc) { - goto Usage; - } - fprintf(fout, "LIBRARY %s\n", dllname); -#ifndef _X86_ - fprintf(fout, "CODE PRELOAD MOVEABLE DISCARDABLE\n"); - fprintf(fout, "DATA PRELOAD MOVEABLE MULTIPLE\n\n"); -#endif - } - - for (; arg < argc; arg++) { - WIN32_FIND_DATA FindFileData; - HANDLE SearchFile; - if (argv[arg][0] == '@') { - std::ifstream fargs(&argv[arg][1]); - if (!fargs) { - fprintf(stderr, "Unable to open \'%s\' for reading:\n", - argv[arg]); - perror(""); - exit(1); - } - char *fargv[1000]; - for (i = 0; i < arg; i++) { - cmdline += argv[i]; - fargv[i] = argv[i]; - } - std::string line; - std::getline(fargs, line); - cmdline += line; - fprintf(stderr, "%s\n", line.c_str()); - i += GetArgcArgv(line, &fargv[i]); - argc = i; - argv = fargv; - } - /* - * Argument can contain the wildcard names - */ - SearchFile = FindFirstFile(argv[arg],&FindFileData); - if (SearchFile == INVALID_HANDLE_VALUE){ - fprintf(stderr, "Unable to find \'%s\' for reading:\n", - argv[arg]); - exit(1); - } - else { - /* - * Since WIN32_FIND_DATA has no path information one has to extract it himself. - */ - TCHAR *filename = argv[arg]; - TCHAR path[2048]; - size_t i = strlen(filename); - i--; - while( filename[i] != '\\' && filename[i] != '/' && i >=0) i--; - do - { - if (i >= 0) strncpy( path, filename, i+1); /* Generate the 'path' info */ - path[i+1] = '\0'; - DumpFile(strcat(path, FindFileData.cFileName), fout, full, fort); - } while (FindNextFile(SearchFile,&FindFileData)); - - - FindClose(SearchFile); - } - } - exit(0); -} From 2963cb2a559fd27edd53b7fb7036cba0adc8b9ca Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Fri, 19 Jun 2015 16:12:43 -0400 Subject: [PATCH 0248/1048] bindexplib: Wrap long lines --- Source/bindexplib.cxx | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/Source/bindexplib.cxx b/Source/bindexplib.cxx index 33f81618a..8328213a5 100644 --- a/Source/bindexplib.cxx +++ b/Source/bindexplib.cxx @@ -109,7 +109,8 @@ const char* StrNStr(const char* start, const char* find, size_t &size) { *---------------------------------------------------------------------- */ int -HaveExportedObjects(PIMAGE_FILE_HEADER pImageFileHeader, PIMAGE_SECTION_HEADER pSectionHeaders) +HaveExportedObjects(PIMAGE_FILE_HEADER pImageFileHeader, + PIMAGE_SECTION_HEADER pSectionHeaders) { static int fImportFlag = 0; /* The status is nor defined yet */ WORD i; @@ -124,12 +125,14 @@ HaveExportedObjects(PIMAGE_FILE_HEADER pImageFileHeader, PIMAGE_SECTION_HEADER p i = 0; foundExports = 0; pDirectivesSectionHeader = 0; - for(i = 0; i < pImageFileHeader->NumberOfSections && !pDirectivesSectionHeader; i++) + for(i = 0; (i < pImageFileHeader->NumberOfSections && + !pDirectivesSectionHeader); i++) if (!strncmp((const char*)&pSectionHeaders[i].Name[0], ".drectve",8)) pDirectivesSectionHeader = &pSectionHeaders[i]; if (!pDirectivesSectionHeader) return 0; - rawdata=(const char*)pImageFileHeader+pDirectivesSectionHeader->PointerToRawData; + rawdata=(const char*) + pImageFileHeader+pDirectivesSectionHeader->PointerToRawData; if (!pDirectivesSectionHeader->PointerToRawData || !rawdata) return 0; size = pDirectivesSectionHeader->SizeOfRawData; @@ -164,7 +167,8 @@ HaveExportedObjects(PIMAGE_FILE_HEADER pImageFileHeader, PIMAGE_SECTION_HEADER p *---------------------------------------------------------------------- */ void -DumpExternalsObjects(PIMAGE_SYMBOL pSymbolTable, PIMAGE_SECTION_HEADER pSectionHeaders, +DumpExternalsObjects(PIMAGE_SYMBOL pSymbolTable, + PIMAGE_SECTION_HEADER pSectionHeaders, FILE *fout, unsigned cSymbols) { unsigned i; @@ -179,7 +183,8 @@ DumpExternalsObjects(PIMAGE_SYMBOL pSymbolTable, PIMAGE_SECTION_HEADER pSectionH stringTable = (PSTR)&pSymbolTable[cSymbols]; for ( i=0; i < cSymbols; i++ ) { - if (pSymbolTable->SectionNumber > 0 && ( pSymbolTable->Type == 0x20 || pSymbolTable->Type == 0x0)) { + if (pSymbolTable->SectionNumber > 0 && + ( pSymbolTable->Type == 0x20 || pSymbolTable->Type == 0x0)) { if (pSymbolTable->StorageClass == IMAGE_SYM_CLASS_EXTERNAL) { /* * The name of the Function entry points @@ -207,12 +212,14 @@ DumpExternalsObjects(PIMAGE_SYMBOL pSymbolTable, PIMAGE_SECTION_HEADER pSectionH symbol.compare(0, 4, vectorPrefix) && symbol.find("real@") == std::string::npos) { - SectChar = pSectionHeaders[pSymbolTable->SectionNumber-1].Characteristics; + SectChar = + pSectionHeaders[pSymbolTable->SectionNumber-1].Characteristics; if (!pSymbolTable->Type && (SectChar & IMAGE_SCN_MEM_WRITE)) { // Read only (i.e. constants) must be excluded fprintf(fout, "\t%s \t DATA\n", symbol.c_str()); } else { - if ( pSymbolTable->Type || !(SectChar & IMAGE_SCN_MEM_READ)) { + if ( pSymbolTable->Type || + !(SectChar & IMAGE_SCN_MEM_READ)) { fprintf(fout, "\t%s\n", symbol.c_str()); } else { // printf(" strange symbol: %s \n",s); @@ -221,7 +228,8 @@ DumpExternalsObjects(PIMAGE_SYMBOL pSymbolTable, PIMAGE_SECTION_HEADER pSectionH } } } - else if (pSymbolTable->SectionNumber == IMAGE_SYM_UNDEFINED && !pSymbolTable->Type && 0){ + else if (pSymbolTable->SectionNumber == IMAGE_SYM_UNDEFINED && + !pSymbolTable->Type && 0) { /* * The IMPORT global variable entry points */ @@ -271,9 +279,11 @@ DumpObjFile(PIMAGE_FILE_HEADER pImageFileHeader, FILE *fout) pImageFileHeader->SizeOfOptionalHeader); - int haveExports = HaveExportedObjects(pImageFileHeader, PCOFFSectionHeaders); + int haveExports = HaveExportedObjects(pImageFileHeader, + PCOFFSectionHeaders); if (!haveExports) - DumpExternalsObjects(PCOFFSymbolTable, PCOFFSectionHeaders, fout, COFFSymbolCount); + DumpExternalsObjects(PCOFFSymbolTable, PCOFFSectionHeaders, + fout, COFFSymbolCount); } /* @@ -322,7 +332,8 @@ DumpFile(LPSTR filename, FILE *fout) } /* Does it look like a i386 COFF OBJ file??? */ else if ( - ((dosHeader->e_magic == IMAGE_FILE_MACHINE_I386) || (dosHeader->e_magic == IMAGE_FILE_MACHINE_AMD64)) + ((dosHeader->e_magic == IMAGE_FILE_MACHINE_I386) || + (dosHeader->e_magic == IMAGE_FILE_MACHINE_AMD64)) && (dosHeader->e_sp == 0) ) { /* From 8ea69dfef1e81a9811fe8a3d7198580dd21cb48f Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Fri, 19 Jun 2015 16:12:43 -0400 Subject: [PATCH 0249/1048] bindexplib: Build source as part of CMakeLib --- Source/CMakeLists.txt | 1 + Source/bindexplib.cxx | 11 +++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 6d012fdde..069f2834f 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -430,6 +430,7 @@ if (WIN32) set(SRCS ${SRCS} cmCallVisualStudioMacro.cxx cmCallVisualStudioMacro.h + bindexplib.cxx ) if(NOT UNIX) diff --git a/Source/bindexplib.cxx b/Source/bindexplib.cxx index 8328213a5..f14d301f6 100644 --- a/Source/bindexplib.cxx +++ b/Source/bindexplib.cxx @@ -71,10 +71,12 @@ *---------------------------------------------------------------------- */ +#include #include #include #include #include +#include /* + * Utility func, strstr with size @@ -89,7 +91,7 @@ const char* StrNStr(const char* start, const char* find, size_t &size) { } len = strlen(find); - while (hint = (const char*) memchr(start, find[0], size-len+1)) { + while ((hint = (const char*) memchr(start, find[0], size-len+1))) { size -= (hint - start); if (!strncmp(hint, find, len)) return hint; @@ -169,7 +171,7 @@ HaveExportedObjects(PIMAGE_FILE_HEADER pImageFileHeader, void DumpExternalsObjects(PIMAGE_SYMBOL pSymbolTable, PIMAGE_SECTION_HEADER pSectionHeaders, - FILE *fout, unsigned cSymbols) + FILE *fout, DWORD_PTR cSymbols) { unsigned i; PSTR stringTable; @@ -295,14 +297,15 @@ DumpObjFile(PIMAGE_FILE_HEADER pImageFileHeader, FILE *fout) *---------------------------------------------------------------------- */ void -DumpFile(LPSTR filename, FILE *fout) +DumpFile(const char* filename, FILE *fout) { HANDLE hFile; HANDLE hFileMapping; LPVOID lpFileBase; PIMAGE_DOS_HEADER dosHeader; - hFile = CreateFile(filename, GENERIC_READ, FILE_SHARE_READ, NULL, + hFile = CreateFileW(cmsys::Encoding::ToWide(filename).c_str(), + GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); if (hFile == INVALID_HANDLE_VALUE) { From de70c922d9c846cf3a6fabfbedd054c02f4b8934 Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Fri, 19 Jun 2015 16:12:43 -0400 Subject: [PATCH 0250/1048] bindexplib: Teach DumpFile to return errors This will allow callers to know if it worked. --- Source/bindexplib.cxx | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/Source/bindexplib.cxx b/Source/bindexplib.cxx index f14d301f6..4024e2f56 100644 --- a/Source/bindexplib.cxx +++ b/Source/bindexplib.cxx @@ -296,7 +296,8 @@ DumpObjFile(PIMAGE_FILE_HEADER pImageFileHeader, FILE *fout) * dumping routine *---------------------------------------------------------------------- */ -void + +bool DumpFile(const char* filename, FILE *fout) { HANDLE hFile; @@ -309,15 +310,15 @@ DumpFile(const char* filename, FILE *fout) OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); if (hFile == INVALID_HANDLE_VALUE) { - fprintf(stderr, "Couldn't open file with CreateFile()\n"); - return; + fprintf(stderr, "Couldn't open file '%s' with CreateFile()\n", filename); + return false; } hFileMapping = CreateFileMapping(hFile, NULL, PAGE_READONLY, 0, 0, NULL); if (hFileMapping == 0) { CloseHandle(hFile); fprintf(stderr, "Couldn't open file mapping with CreateFileMapping()\n"); - return; + return false; } lpFileBase = MapViewOfFile(hFileMapping, FILE_MAP_READ, 0, 0, 0); @@ -325,13 +326,13 @@ DumpFile(const char* filename, FILE *fout) CloseHandle(hFileMapping); CloseHandle(hFile); fprintf(stderr, "Couldn't map view of file with MapViewOfFile()\n"); - return; + return false; } dosHeader = (PIMAGE_DOS_HEADER)lpFileBase; if (dosHeader->e_magic == IMAGE_DOS_SIGNATURE) { fprintf(stderr, "File is an executable. I don't dump those.\n"); - return; + return false; } /* Does it look like a i386 COFF OBJ file??? */ else if ( @@ -346,9 +347,11 @@ DumpFile(const char* filename, FILE *fout) */ DumpObjFile((PIMAGE_FILE_HEADER) lpFileBase, fout); } else { - printf("unrecognized file format\n"); + printf("unrecognized file format in '%s'\n", filename); + return false; } UnmapViewOfFile(lpFileBase); CloseHandle(hFileMapping); CloseHandle(hFile); + return true; } From 61bbbdcf9c0d1aed584fb976cd20c55ee9077850 Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Fri, 19 Jun 2015 16:12:43 -0400 Subject: [PATCH 0251/1048] bindexplib: Fix treatment of some symbols --- Source/bindexplib.cxx | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/Source/bindexplib.cxx b/Source/bindexplib.cxx index 4024e2f56..6a63279a0 100644 --- a/Source/bindexplib.cxx +++ b/Source/bindexplib.cxx @@ -198,7 +198,16 @@ DumpExternalsObjects(PIMAGE_SYMBOL pSymbolTable, symbol = stringTable + pSymbolTable->N.Name.Long; } + // clear out any leading spaces while (isspace(symbol[0])) symbol.erase(0,1); + // if it starts with _ and has an @ then it is a __cdecl + // so remove the @ stuff for the export + if(symbol[0] == '_') { + std::string::size_type posAt = symbol.find('@'); + if (posAt != std::string::npos) { + symbol.erase(posAt); + } + } if (symbol[0] == '_') symbol.erase(0,1); if (fImportFlag) { fImportFlag = 0; @@ -210,9 +219,13 @@ DumpExternalsObjects(PIMAGE_SYMBOL pSymbolTable, */ const char *scalarPrefix = "??_G"; const char *vectorPrefix = "??_E"; + // original code had a check for + // symbol.find("real@") == std::string::npos) + // but if this disallows memmber functions with the name real + // if scalarPrefix and vectorPrefix are not found then print + // the symbol if (symbol.compare(0, 4, scalarPrefix) && - symbol.compare(0, 4, vectorPrefix) && - symbol.find("real@") == std::string::npos) + symbol.compare(0, 4, vectorPrefix) ) { SectChar = pSectionHeaders[pSymbolTable->SectionNumber-1].Characteristics; @@ -224,7 +237,7 @@ DumpExternalsObjects(PIMAGE_SYMBOL pSymbolTable, !(SectChar & IMAGE_SCN_MEM_READ)) { fprintf(fout, "\t%s\n", symbol.c_str()); } else { - // printf(" strange symbol: %s \n",s); + // printf(" strange symbol: %s \n",symbol.c_str()); } } } From 069aa93b555293679f4b8c07623133ba62a74ee4 Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Thu, 2 Jul 2015 17:46:25 -0400 Subject: [PATCH 0252/1048] bindexplib: Add support for "/bigobj" format objects --- Source/bindexplib.cxx | 290 +++++++++++++++++++++++++----------------- 1 file changed, 174 insertions(+), 116 deletions(-) diff --git a/Source/bindexplib.cxx b/Source/bindexplib.cxx index 6a63279a0..11e3f3400 100644 --- a/Source/bindexplib.cxx +++ b/Source/bindexplib.cxx @@ -78,6 +78,59 @@ #include #include +typedef struct cmANON_OBJECT_HEADER_BIGOBJ { + /* same as ANON_OBJECT_HEADER_V2 */ + WORD Sig1; // Must be IMAGE_FILE_MACHINE_UNKNOWN + WORD Sig2; // Must be 0xffff + WORD Version; // >= 2 (implies the Flags field is present) + WORD Machine; // Actual machine - IMAGE_FILE_MACHINE_xxx + DWORD TimeDateStamp; + CLSID ClassID; // {D1BAA1C7-BAEE-4ba9-AF20-FAF66AA4DCB8} + DWORD SizeOfData; // Size of data that follows the header + DWORD Flags; // 0x1 -> contains metadata + DWORD MetaDataSize; // Size of CLR metadata + DWORD MetaDataOffset; // Offset of CLR metadata + + /* bigobj specifics */ + DWORD NumberOfSections; // extended from WORD + DWORD PointerToSymbolTable; + DWORD NumberOfSymbols; +} cmANON_OBJECT_HEADER_BIGOBJ; + +typedef struct _cmIMAGE_SYMBOL_EX { + union { + BYTE ShortName[8]; + struct { + DWORD Short; // if 0, use LongName + DWORD Long; // offset into string table + } Name; + DWORD LongName[2]; // PBYTE [2] + } N; + DWORD Value; + LONG SectionNumber; + WORD Type; + BYTE StorageClass; + BYTE NumberOfAuxSymbols; +} cmIMAGE_SYMBOL_EX; +typedef cmIMAGE_SYMBOL_EX UNALIGNED *cmPIMAGE_SYMBOL_EX; + +PIMAGE_SECTION_HEADER GetSectionHeaderOffset(PIMAGE_FILE_HEADER + pImageFileHeader) +{ + return (PIMAGE_SECTION_HEADER) + ((DWORD_PTR)pImageFileHeader + + IMAGE_SIZEOF_FILE_HEADER + + pImageFileHeader->SizeOfOptionalHeader); +} + +PIMAGE_SECTION_HEADER GetSectionHeaderOffset(cmANON_OBJECT_HEADER_BIGOBJ* + pImageFileHeader) +{ + return (PIMAGE_SECTION_HEADER) + ((DWORD_PTR)pImageFileHeader + + sizeof(cmANON_OBJECT_HEADER_BIGOBJ)); +} + /* + * Utility func, strstr with size + */ @@ -102,44 +155,64 @@ const char* StrNStr(const char* start, const char* find, size_t &size) { return 0; } -/* - *---------------------------------------------------------------------- - * HaveExportedObjects -- - * - * Returns >0 if export directives (declspec(dllexport)) exist. - * - *---------------------------------------------------------------------- - */ -int -HaveExportedObjects(PIMAGE_FILE_HEADER pImageFileHeader, - PIMAGE_SECTION_HEADER pSectionHeaders) +template < + // cmANON_OBJECT_HEADER_BIGOBJ or IMAGE_FILE_HEADER + class ObjectHeaderType, + // cmPIMAGE_SYMBOL_EX or PIMAGE_SYMBOL + class SymbolTableType> +class DumpSymbols { - static int fImportFlag = 0; /* The status is nor defined yet */ - WORD i; - size_t size; - char foundExports; - const char * rawdata; +public: + /* + *---------------------------------------------------------------------- + * Constructor -- + * + * Initialize variables from pointer to object header. + * + *---------------------------------------------------------------------- + */ - PIMAGE_SECTION_HEADER pDirectivesSectionHeader; + DumpSymbols(ObjectHeaderType* ih, + FILE* fout) { + this->ObjectImageHeader = ih; + this->SymbolTable = (SymbolTableType*) + ((DWORD_PTR)this->ObjectImageHeader + + this->ObjectImageHeader->PointerToSymbolTable); + this->FileOut = fout; + this->SectionHeaders = + GetSectionHeaderOffset(this->ObjectImageHeader); + this->ImportFlag = true; + this->SymbolCount = this->ObjectImageHeader->NumberOfSymbols; + } - if (fImportFlag) return 1; + /* + *---------------------------------------------------------------------- + * HaveExportedObjects -- + * + * Returns true if export directives (declspec(dllexport)) exist. + * + *---------------------------------------------------------------------- + */ - i = 0; - foundExports = 0; - pDirectivesSectionHeader = 0; - for(i = 0; (i < pImageFileHeader->NumberOfSections && - !pDirectivesSectionHeader); i++) + bool HaveExportedObjects() { + WORD i = 0; + size_t size = 0; + const char * rawdata = 0; + PIMAGE_SECTION_HEADER pDirectivesSectionHeader = 0; + PIMAGE_SECTION_HEADER pSectionHeaders = this->SectionHeaders; + for(i = 0; (i < this->ObjectImageHeader->NumberOfSections && + !pDirectivesSectionHeader); i++) if (!strncmp((const char*)&pSectionHeaders[i].Name[0], ".drectve",8)) - pDirectivesSectionHeader = &pSectionHeaders[i]; - if (!pDirectivesSectionHeader) return 0; + pDirectivesSectionHeader = &pSectionHeaders[i]; + if (!pDirectivesSectionHeader) return 0; - rawdata=(const char*) - pImageFileHeader+pDirectivesSectionHeader->PointerToRawData; - if (!pDirectivesSectionHeader->PointerToRawData || !rawdata) return 0; + rawdata=(const char*) + this->ObjectImageHeader+pDirectivesSectionHeader->PointerToRawData; + if (!pDirectivesSectionHeader->PointerToRawData || !rawdata) return 0; - size = pDirectivesSectionHeader->SizeOfRawData; - const char* posImportFlag = rawdata; - while ((posImportFlag = StrNStr(posImportFlag, " /EXPORT:", size))) { + size = pDirectivesSectionHeader->SizeOfRawData; + const char* posImportFlag = rawdata; + while ((posImportFlag = StrNStr(posImportFlag, " /EXPORT:", size))) { const char* lookingForDict = posImportFlag + 9; if (!strncmp(lookingForDict, "_G__cpp_",8) || !strncmp(lookingForDict, "_G__set_cpp_",12)) { @@ -153,38 +226,44 @@ HaveExportedObjects(PIMAGE_FILE_HEADER pImageFileHeader, // ignore DATA exports if (strncmp(lookingForDATA, ",DATA", 5)) break; posImportFlag = lookingForDATA + 5; - } - fImportFlag = (int)posImportFlag; - return fImportFlag; -} + } + if(posImportFlag) { + return true; + } + return false; + } - - -/* - *---------------------------------------------------------------------- -* DumpExternalsObjects -- -* -* Dumps a COFF symbol table from an EXE or OBJ. We only use -* it to dump tables from OBJs. -*---------------------------------------------------------------------- -*/ -void -DumpExternalsObjects(PIMAGE_SYMBOL pSymbolTable, - PIMAGE_SECTION_HEADER pSectionHeaders, - FILE *fout, DWORD_PTR cSymbols) -{ - unsigned i; - PSTR stringTable; - std::string symbol; - DWORD SectChar; - static int fImportFlag = -1; /* The status is nor defined yet */ - - /* - * The string table apparently starts right after the symbol table + /* + *---------------------------------------------------------------------- + * DumpObjFile -- + * + * Dump an object file's exported symbols. + *---------------------------------------------------------------------- */ - stringTable = (PSTR)&pSymbolTable[cSymbols]; + void DumpObjFile() { + if(!HaveExportedObjects()) { + this->DumpExternalsObjects(); + } + } - for ( i=0; i < cSymbols; i++ ) { + /* + *---------------------------------------------------------------------- + * DumpExternalsObjects -- + * + * Dumps a COFF symbol table from an OBJ. + *---------------------------------------------------------------------- + */ + void DumpExternalsObjects() { + unsigned i; + PSTR stringTable; + std::string symbol; + DWORD SectChar; + /* + * The string table apparently starts right after the symbol table + */ + stringTable = (PSTR)&this->SymbolTable[this->SymbolCount]; + SymbolTableType* pSymbolTable = this->SymbolTable; + for ( i=0; i < this->SymbolCount; i++ ) { if (pSymbolTable->SectionNumber > 0 && ( pSymbolTable->Type == 0x20 || pSymbolTable->Type == 0x0)) { if (pSymbolTable->StorageClass == IMAGE_SYM_CLASS_EXTERNAL) { @@ -209,9 +288,9 @@ DumpExternalsObjects(PIMAGE_SYMBOL pSymbolTable, } } if (symbol[0] == '_') symbol.erase(0,1); - if (fImportFlag) { - fImportFlag = 0; - fprintf(fout,"EXPORTS \n"); + if (this->ImportFlag) { + this->ImportFlag = false; + fprintf(this->FileOut,"EXPORTS \n"); } /* Check whether it is "Scalar deleting destructor" and @@ -228,14 +307,15 @@ DumpExternalsObjects(PIMAGE_SYMBOL pSymbolTable, symbol.compare(0, 4, vectorPrefix) ) { SectChar = - pSectionHeaders[pSymbolTable->SectionNumber-1].Characteristics; + this-> + SectionHeaders[pSymbolTable->SectionNumber-1].Characteristics; if (!pSymbolTable->Type && (SectChar & IMAGE_SCN_MEM_WRITE)) { // Read only (i.e. constants) must be excluded - fprintf(fout, "\t%s \t DATA\n", symbol.c_str()); + fprintf(this->FileOut, "\t%s \t DATA\n", symbol.c_str()); } else { if ( pSymbolTable->Type || !(SectChar & IMAGE_SCN_MEM_READ)) { - fprintf(fout, "\t%s\n", symbol.c_str()); + fprintf(this->FileOut, "\t%s\n", symbol.c_str()); } else { // printf(" strange symbol: %s \n",symbol.c_str()); } @@ -252,11 +332,11 @@ DumpExternalsObjects(PIMAGE_SYMBOL pSymbolTable, symbol = stringTable + pSymbolTable->N.Name.Long; while (isspace(symbol[0])) symbol.erase(0,1); if (symbol[0] == '_') symbol.erase(0,1); - if (!fImportFlag) { - fImportFlag = 1; - fprintf(fout,"IMPORTS \n"); + if (!this->ImportFlag) { + this->ImportFlag = true; + fprintf(this->FileOut,"IMPORTS \n"); } - fprintf(fout, "\t%s DATA \n", symbol.c_str()+1); + fprintf(this->FileOut, "\t%s DATA \n", symbol.c_str()+1); } } @@ -266,49 +346,16 @@ DumpExternalsObjects(PIMAGE_SYMBOL pSymbolTable, i += pSymbolTable->NumberOfAuxSymbols; pSymbolTable += pSymbolTable->NumberOfAuxSymbols; pSymbolTable++; - } -} - -/* -*---------------------------------------------------------------------- -* DumpObjFile -- -* -* Dump an object file--either a full listing or just the exported -* symbols. -*---------------------------------------------------------------------- -*/ -void -DumpObjFile(PIMAGE_FILE_HEADER pImageFileHeader, FILE *fout) -{ - PIMAGE_SYMBOL PCOFFSymbolTable; - PIMAGE_SECTION_HEADER PCOFFSectionHeaders; - DWORD_PTR COFFSymbolCount; - - PCOFFSymbolTable = (PIMAGE_SYMBOL) - ((DWORD_PTR)pImageFileHeader + pImageFileHeader->PointerToSymbolTable); - COFFSymbolCount = pImageFileHeader->NumberOfSymbols; - - PCOFFSectionHeaders = (PIMAGE_SECTION_HEADER) - ((DWORD_PTR)pImageFileHeader + - IMAGE_SIZEOF_FILE_HEADER + - pImageFileHeader->SizeOfOptionalHeader); - - - int haveExports = HaveExportedObjects(pImageFileHeader, - PCOFFSectionHeaders); - if (!haveExports) - DumpExternalsObjects(PCOFFSymbolTable, PCOFFSectionHeaders, - fout, COFFSymbolCount); -} - -/* -*---------------------------------------------------------------------- -* DumpFile -- -* -* Open up a file, memory map it, and call the appropriate -* dumping routine -*---------------------------------------------------------------------- -*/ + } + } +private: + bool ImportFlag; + FILE* FileOut; + DWORD_PTR SymbolCount; + PIMAGE_SECTION_HEADER SectionHeaders; + ObjectHeaderType* ObjectImageHeader; + SymbolTableType* SymbolTable; +}; bool DumpFile(const char* filename, FILE *fout) @@ -358,10 +405,21 @@ DumpFile(const char* filename, FILE *fout) * really checking for IMAGE_FILE_HEADER.Machine == i386 (0x14C) * and IMAGE_FILE_HEADER.SizeOfOptionalHeader == 0; */ - DumpObjFile((PIMAGE_FILE_HEADER) lpFileBase, fout); + DumpSymbols + symbolDumper((PIMAGE_FILE_HEADER) lpFileBase, fout); + symbolDumper.DumpObjFile(); } else { - printf("unrecognized file format in '%s'\n", filename); - return false; + // check for /bigobj format + cmANON_OBJECT_HEADER_BIGOBJ* h = + (cmANON_OBJECT_HEADER_BIGOBJ*) lpFileBase; + if(h->Sig1 == 0x0 && h->Sig2 == 0xffff) { + DumpSymbols + symbolDumper((cmANON_OBJECT_HEADER_BIGOBJ*) lpFileBase, fout); + symbolDumper.DumpObjFile(); + } else { + printf("unrecognized file format in '%s'\n", filename); + return false; + } } UnmapViewOfFile(lpFileBase); CloseHandle(hFileMapping); From 8f86407cfd4331dc1f2eb67f4f179ed8fe9dea06 Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Fri, 19 Jun 2015 16:12:43 -0400 Subject: [PATCH 0253/1048] Windows: Optionally generate DLL module definition files automatically Create target property WINDOWS_EXPORT_ALL_SYMBOLS to automatically generate a module definition file from MS-compatible .obj files and give it to the linker in order to export all symbols from the .dll part of a SHARED library. --- Help/manual/cmake-properties.7.rst | 1 + Help/manual/cmake-variables.7.rst | 1 + Help/prop_tgt/WINDOWS_EXPORT_ALL_SYMBOLS.rst | 18 +++++ Help/release/dev/auto_export_dll_symbols.rst | 6 ++ .../CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS.rst | 6 ++ Modules/Platform/Windows-MSVC.cmake | 2 + Source/cmGlobalVisualStudioGenerator.cxx | 70 +++++++++++++++++++ Source/cmGlobalVisualStudioGenerator.h | 4 ++ Source/cmLocalVisualStudio7Generator.cxx | 31 +++++++- Source/cmMakefileLibraryTargetGenerator.cxx | 53 ++++++++++++++ Source/cmNinjaNormalTargetGenerator.cxx | 54 ++++++++++++++ Source/cmTarget.cxx | 5 ++ Source/cmVisualStudio10TargetGenerator.cxx | 30 +++++++- Source/cmcmd.cxx | 39 +++++++++++ Tests/RunCMake/AutoExportDll/AutoExport.cmake | 7 ++ .../AutoExportDll/AutoExportBuild-stderr.txt | 1 + Tests/RunCMake/AutoExportDll/CMakeLists.txt | 3 + .../RunCMake/AutoExportDll/RunCMakeTest.cmake | 26 +++++++ Tests/RunCMake/AutoExportDll/foo.c | 15 ++++ Tests/RunCMake/AutoExportDll/hello.cxx | 13 ++++ Tests/RunCMake/AutoExportDll/hello.h | 18 +++++ Tests/RunCMake/AutoExportDll/say.cxx | 37 ++++++++++ .../RunCMake/AutoExportDll/sub/CMakeLists.txt | 5 ++ Tests/RunCMake/AutoExportDll/sub/sub.cxx | 4 ++ Tests/RunCMake/AutoExportDll/world.cxx | 6 ++ Tests/RunCMake/CMakeLists.txt | 3 + 26 files changed, 455 insertions(+), 3 deletions(-) create mode 100644 Help/prop_tgt/WINDOWS_EXPORT_ALL_SYMBOLS.rst create mode 100644 Help/release/dev/auto_export_dll_symbols.rst create mode 100644 Help/variable/CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS.rst create mode 100644 Tests/RunCMake/AutoExportDll/AutoExport.cmake create mode 100644 Tests/RunCMake/AutoExportDll/AutoExportBuild-stderr.txt create mode 100644 Tests/RunCMake/AutoExportDll/CMakeLists.txt create mode 100644 Tests/RunCMake/AutoExportDll/RunCMakeTest.cmake create mode 100644 Tests/RunCMake/AutoExportDll/foo.c create mode 100644 Tests/RunCMake/AutoExportDll/hello.cxx create mode 100644 Tests/RunCMake/AutoExportDll/hello.h create mode 100644 Tests/RunCMake/AutoExportDll/say.cxx create mode 100644 Tests/RunCMake/AutoExportDll/sub/CMakeLists.txt create mode 100644 Tests/RunCMake/AutoExportDll/sub/sub.cxx create mode 100644 Tests/RunCMake/AutoExportDll/world.cxx diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index 9a60a103c..b767ed624 100644 --- a/Help/manual/cmake-properties.7.rst +++ b/Help/manual/cmake-properties.7.rst @@ -251,6 +251,7 @@ Properties on Targets /prop_tgt/VS_WINRT_EXTENSIONS /prop_tgt/VS_WINRT_REFERENCES /prop_tgt/WIN32_EXECUTABLE + /prop_tgt/WINDOWS_EXPORT_ALL_SYMBOLS /prop_tgt/XCODE_ATTRIBUTE_an-attribute /prop_tgt/XCTEST diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index 0e6222f25..7c7db5e92 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -275,6 +275,7 @@ Variables that Control the Build /variable/CMAKE_USE_RELATIVE_PATHS /variable/CMAKE_VISIBILITY_INLINES_HIDDEN /variable/CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD + /variable/CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS /variable/CMAKE_WIN32_EXECUTABLE /variable/CMAKE_XCODE_ATTRIBUTE_an-attribute /variable/EXECUTABLE_OUTPUT_PATH diff --git a/Help/prop_tgt/WINDOWS_EXPORT_ALL_SYMBOLS.rst b/Help/prop_tgt/WINDOWS_EXPORT_ALL_SYMBOLS.rst new file mode 100644 index 000000000..3f48af88c --- /dev/null +++ b/Help/prop_tgt/WINDOWS_EXPORT_ALL_SYMBOLS.rst @@ -0,0 +1,18 @@ +WINDOWS_EXPORT_ALL_SYMBOLS +-------------------------- + +This property is implemented only for MS-compatible tools on Windows. + +Enable this boolean property to automatically create a module definition +(``.def``) file with all global symbols found in the input ``.obj`` files +for a ``SHARED`` library on Windows. The module definition file will be +passed to the linker causing all symbols to be exported from the ``.dll``. +For global *data* symbols, ``__declspec(dllimport)`` must still be used when +compiling against the code in the ``.dll``. All other function symbols will +be automatically exported and imported by callers. This simplifies porting +projects to Windows by reducing the need for explicit ``dllexport`` markup, +even in ``C++`` classes. + +This property is initialized by the value of +the :variable:`CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS` variable if it is set +when a target is created. diff --git a/Help/release/dev/auto_export_dll_symbols.rst b/Help/release/dev/auto_export_dll_symbols.rst new file mode 100644 index 000000000..9db2b5eab --- /dev/null +++ b/Help/release/dev/auto_export_dll_symbols.rst @@ -0,0 +1,6 @@ +auto_export_dll_symbols +----------------------- + +* On Windows with MS-compatible tools, CMake learned to optionally + generate a module definition (``.def``) file for ``SHARED`` libraries. + See the :prop_tgt:`WINDOWS_EXPORT_ALL_SYMBOLS` target property. diff --git a/Help/variable/CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS.rst b/Help/variable/CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS.rst new file mode 100644 index 000000000..1636842d9 --- /dev/null +++ b/Help/variable/CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS.rst @@ -0,0 +1,6 @@ +CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS +-------------------------------- + +Default value for :prop_tgt:`WINDOWS_EXPORT_ALL_SYMBOLS` target property. +This variable is used to initialize the property on each target as it is +created. diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake index 13fe8bc9c..aeaa2bdab 100644 --- a/Modules/Platform/Windows-MSVC.cmake +++ b/Modules/Platform/Windows-MSVC.cmake @@ -46,8 +46,10 @@ else() set(_PLATFORM_LINK_FLAGS "") endif() +set(CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS 1) if(CMAKE_GENERATOR MATCHES "Visual Studio 6") set (CMAKE_NO_BUILD_TYPE 1) + set(CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS 0) # not implemented for VS6 endif() if(NOT CMAKE_NO_BUILD_TYPE AND CMAKE_GENERATOR MATCHES "Visual Studio") set (CMAKE_NO_BUILD_TYPE 1) diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index 585d19a81..bc134e1de 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -13,12 +13,14 @@ #include "cmGlobalVisualStudioGenerator.h" #include "cmCallVisualStudioMacro.h" +#include "cmGeneratedFileStream.h" #include "cmGeneratorTarget.h" #include "cmLocalVisualStudioGenerator.h" #include "cmMakefile.h" #include "cmSourceFile.h" #include "cmTarget.h" #include +#include "cmAlgorithms.h" //---------------------------------------------------------------------------- cmGlobalVisualStudioGenerator::cmGlobalVisualStudioGenerator(cmake* cm) @@ -887,3 +889,71 @@ std::string cmGlobalVisualStudioGenerator::ExpandCFGIntDir( } return tmp; } + +void cmGlobalVisualStudioGenerator::AddSymbolExportCommand( + cmGeneratorTarget* gt, std::vector& commands, + std::string const& configName) +{ + std::vector outputs; + std::string deffile = gt->ObjectDirectory; + deffile += "/exportall.def"; + outputs.push_back(deffile); + std::vector empty; + std::vector objectSources; + gt->GetObjectSources(objectSources, configName); + std::map mapping; + for(std::vector::const_iterator it + = objectSources.begin(); it != objectSources.end(); ++it) + { + mapping[*it]; + } + gt->LocalGenerator-> + ComputeObjectFilenames(mapping, gt); + std::string obj_dir = gt->ObjectDirectory; + std::string cmakeCommand = cmSystemTools::GetCMakeCommand(); + cmSystemTools::ConvertToWindowsExtendedPath(cmakeCommand); + cmCustomCommandLine cmdl; + cmdl.push_back(cmakeCommand); + cmdl.push_back("-E"); + cmdl.push_back("__create_def"); + cmdl.push_back(deffile); + std::string obj_dir_expanded = obj_dir; + cmSystemTools::ReplaceString(obj_dir_expanded, + this->GetCMakeCFGIntDir(), + configName.c_str()); + std::string objs_file = obj_dir_expanded; + cmSystemTools::MakeDirectory(objs_file.c_str()); + objs_file += "/objects.txt"; + cmdl.push_back(objs_file); + cmGeneratedFileStream fout(objs_file.c_str()); + if(!fout) + { + cmSystemTools::Error("could not open ", objs_file.c_str()); + return; + } + for(std::vector::const_iterator it + = objectSources.begin(); it != objectSources.end(); ++it) + { + // Find the object file name corresponding to this source file. + std::map::const_iterator + map_it = mapping.find(*it); + // It must exist because we populated the mapping just above. + assert(!map_it->second.empty()); + std::string objFile = obj_dir + map_it->second; + // replace $(ConfigurationName) in the object names + cmSystemTools::ReplaceString(objFile, this->GetCMakeCFGIntDir(), + configName.c_str()); + if(cmHasLiteralSuffix(objFile, ".obj")) + { + fout << objFile << "\n"; + } + } + cmCustomCommandLines commandLines; + commandLines.push_back(cmdl); + cmCustomCommand command(gt->Target->GetMakefile(), + outputs, empty, empty, + commandLines, + "Auto build dll exports", + "."); + commands.push_back(command); +} diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h index 69b4564c5..022e19005 100644 --- a/Source/cmGlobalVisualStudioGenerator.h +++ b/Source/cmGlobalVisualStudioGenerator.h @@ -102,6 +102,10 @@ public: const std::string& config) const; void ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const; + + void AddSymbolExportCommand( + cmGeneratorTarget*, std::vector& commands, + std::string const& configName); protected: virtual void Generate(); diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index dc3a16d4c..a0e9e4da0 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -1081,6 +1081,14 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, this->ConvertToOutputFormat(this->ModuleDefinitionFile, SHELL); linkOptions.AddFlag("ModuleDefinitionFile", defFile.c_str()); } + if (target.GetType() == cmTarget::SHARED_LIBRARY && + this->Makefile->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS")) + { + if (target.GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS")) + { + linkOptions.AddFlag("ModuleDefinitionFile", "$(IntDir)/exportall.def"); + } + } switch(target.GetType()) { case cmTarget::UNKNOWN_LIBRARY: @@ -2015,7 +2023,28 @@ void cmLocalVisualStudio7Generator // Add pre-link event. tool = this->FortranProject? "VFPreLinkEventTool":"VCPreLinkEventTool"; event.Start(tool); - event.Write(target.GetPreLinkCommands()); + bool addedPrelink = false; + if (target.GetType() == cmTarget::SHARED_LIBRARY && + this->Makefile->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS")) + { + if (target.GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS")) + { + addedPrelink = true; + std::vector commands = + target.GetPreLinkCommands(); + cmGlobalVisualStudioGenerator* gg + = static_cast(this->GlobalGenerator); + cmGeneratorTarget* gt = + this->GlobalGenerator->GetGeneratorTarget(&target); + gg->AddSymbolExportCommand( + gt, commands, configName); + event.Write(commands); + } + } + if (!addedPrelink) + { + event.Write(target.GetPreLinkCommands()); + } cmsys::auto_ptr pcc( this->MaybeCreateImplibDir(target, configName, this->FortranProject)); if(pcc.get()) diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index 660027c96..696dcc4f5 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -18,6 +18,7 @@ #include "cmSourceFile.h" #include "cmTarget.h" #include "cmake.h" +#include "cmAlgorithms.h" //---------------------------------------------------------------------------- cmMakefileLibraryTargetGenerator @@ -563,6 +564,58 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules useResponseFileForObjects, buildObjs, depends, useWatcomQuote); + // maybe create .def file from list of objects + if (this->Target->GetType() == cmTarget::SHARED_LIBRARY && + this->Makefile->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS")) + { + if(this->Target->GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS")) + { + std::string name_of_def_file = + this->Target->GetSupportDirectory(); + name_of_def_file += std::string("/") + + this->Target->GetName(); + name_of_def_file += ".def"; + std::string cmd = cmSystemTools::GetCMakeCommand(); + cmd = this->Convert(cmd, cmLocalGenerator::NONE, + cmLocalGenerator::SHELL); + cmd += " -E __create_def "; + cmd += this->Convert(name_of_def_file, + cmLocalGenerator::START_OUTPUT, + cmLocalGenerator::SHELL); + cmd += " "; + std::string objlist_file = name_of_def_file; + objlist_file += ".objs"; + cmd += this->Convert(objlist_file, + cmLocalGenerator::START_OUTPUT, + cmLocalGenerator::SHELL); + real_link_commands.push_back(cmd); + // create a list of obj files for the -E __create_def to read + cmGeneratedFileStream fout(objlist_file.c_str()); + for(std::vector::const_iterator i = this->Objects.begin(); + i != this->Objects.end(); ++i) + { + if(cmHasLiteralSuffix(*i, ".obj")) + { + fout << *i << "\n"; + } + } + for(std::vector::const_iterator i = + this->ExternalObjects.begin(); + i != this->ExternalObjects.end(); ++i) + { + fout << *i << "\n"; + } + // now add the def file link flag + linkFlags += " "; + linkFlags += + this->Makefile->GetSafeDefinition("CMAKE_LINK_DEF_FILE_FLAG"); + linkFlags += this->Convert(name_of_def_file, + cmLocalGenerator::START_OUTPUT, + cmLocalGenerator::SHELL); + linkFlags += " "; + } + } + cmLocalGenerator::RuleVariables vars; vars.TargetPDB = targetOutPathPDB.c_str(); diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index 2fe53bfff..88da09bab 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -486,6 +486,22 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() linkPath, &genTarget, useWatcomQuote); + if(this->GetMakefile()->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS") + && target.GetType() == cmTarget::SHARED_LIBRARY) + { + if(target.GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS")) + { + std::string dllname = targetOutput; + std::string name_of_def_file + = target.GetSupportDirectory(); + name_of_def_file += "/" + target.GetName(); + name_of_def_file += ".def "; + vars["LINK_FLAGS"] += " /DEF:"; + vars["LINK_FLAGS"] += this->GetLocalGenerator() + ->ConvertToOutputFormat(name_of_def_file.c_str(), + cmLocalGenerator::SHELL); + } + } this->addPoolNinjaVariable("JOB_POOL_LINK", &target, vars); @@ -600,6 +616,44 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() } } + // maybe create .def file from list of objects + if (target.GetType() == cmTarget::SHARED_LIBRARY && + this->GetMakefile()->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS")) + { + if(target.GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS")) + { + std::string cmakeCommand = + this->GetLocalGenerator()->ConvertToOutputFormat( + cmSystemTools::GetCMakeCommand(), cmLocalGenerator::SHELL); + std::string dllname = targetOutput; + std::string name_of_def_file + = target.GetSupportDirectory(); + name_of_def_file += "/" + target.GetName(); + name_of_def_file += ".def"; + std::string cmd = cmakeCommand; + cmd += " -E __create_def "; + cmd += this->GetLocalGenerator() + ->ConvertToOutputFormat(name_of_def_file.c_str(), + cmLocalGenerator::SHELL); + cmd += " "; + cmNinjaDeps objs = this->GetObjects(); + std::string obj_list_file = name_of_def_file; + obj_list_file += ".objs"; + cmd += this->GetLocalGenerator() + ->ConvertToOutputFormat(obj_list_file.c_str(), + cmLocalGenerator::SHELL); + preLinkCmdLines.push_back(cmd); + // create a list of obj files for the -E __create_def to read + cmGeneratedFileStream fout(obj_list_file.c_str()); + for(cmNinjaDeps::iterator i=objs.begin(); i != objs.end(); ++i) + { + if(cmHasLiteralSuffix(*i, ".obj")) + { + fout << *i << "\n"; + } + } + } + } // If we have any PRE_LINK commands, we need to go back to HOME_OUTPUT for // the link commands. if (!preLinkCmdLines.empty()) diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index c7a13bcd7..844843108 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -429,6 +429,11 @@ void cmTarget::SetMakefile(cmMakefile* mf) { this->SetProperty("POSITION_INDEPENDENT_CODE", "True"); } + if(this->TargetTypeValue == cmTarget::SHARED_LIBRARY) + { + this->SetPropertyDefault("WINDOWS_EXPORT_ALL_SYMBOLS", 0); + } + if (this->GetType() != INTERFACE_LIBRARY && this->GetType() != UTILITY) { this->SetPropertyDefault("POSITION_INDEPENDENT_CODE", 0); diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 12a1e42c0..57ec21234 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -2466,6 +2466,15 @@ cmVisualStudio10TargetGenerator::ComputeLinkOptions(std::string const& config) "%(IgnoreSpecificDefaultLibraries)"); } + if (this->Target->GetType() == cmTarget::SHARED_LIBRARY && + this->Makefile->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS")) + { + if (this->Target->GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS")) + { + linkOptions.AddFlag("ModuleDefinitionFile", "$(IntDir)exportall.def"); + } + } + this->LinkOptions[config] = pOptions.release(); return true; } @@ -2613,8 +2622,25 @@ void cmVisualStudio10TargetGenerator::WriteItemDefinitionGroups() void cmVisualStudio10TargetGenerator::WriteEvents(std::string const& configName) { - this->WriteEvent("PreLinkEvent", - this->Target->GetPreLinkCommands(), configName); + bool addedPrelink = false; + if (this->Target->GetType() == cmTarget::SHARED_LIBRARY && + this->Makefile->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS")) + { + if (this->Target->GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS")) + { + addedPrelink = true; + std::vector commands = + this->Target->GetPreLinkCommands(); + this->GlobalGenerator->AddSymbolExportCommand( + this->GeneratorTarget, commands, configName); + this->WriteEvent("PreLinkEvent", commands, configName); + } + } + if (!addedPrelink) + { + this->WriteEvent("PreLinkEvent", + this->Target->GetPreLinkCommands(), configName); + } this->WriteEvent("PreBuildEvent", this->Target->GetPreBuildCommands(), configName); this->WriteEvent("PostBuildEvent", diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 3ea21866e..63838b49b 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -34,6 +34,10 @@ #include #include // required for atoi +#if defined(_WIN32) && defined(CMAKE_BUILD_WITH_CMAKE) +// defined in binexplib.cxx +bool DumpFile(const char* filename, FILE *fout); +#endif void CMakeCommandUsage(const char* program) { @@ -211,6 +215,41 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) return 0; } +#if defined(_WIN32) && defined(CMAKE_BUILD_WITH_CMAKE) + else if(args[1] == "__create_def") + { + if(args.size() < 4) + { + std::cerr << + "__create_def Usage: -E __create_def outfile.def objlistfile\n"; + return 1; + } + FILE* fout = cmsys::SystemTools::Fopen(args[2].c_str(), "w+"); + if(!fout) + { + std::cerr << "could not open output .def file: " << args[2].c_str() + << "\n"; + return 1; + } + cmsys::ifstream fin(args[3].c_str(), + std::ios::in | std::ios::binary); + if(!fin) + { + std::cerr << "could not open object list file: " << args[3].c_str() + << "\n"; + return 1; + } + std::string objfile; + while(cmSystemTools::GetLineFromStream(fin, objfile)) + { + if (!DumpFile(objfile.c_str(), fout)) + { + return 1; + } + } + return 0; + } +#endif // run include what you use command and then run the compile // command. This is an internal undocumented option and should // only be used by CMake itself when running iwyu. diff --git a/Tests/RunCMake/AutoExportDll/AutoExport.cmake b/Tests/RunCMake/AutoExportDll/AutoExport.cmake new file mode 100644 index 000000000..3b2b2c5b4 --- /dev/null +++ b/Tests/RunCMake/AutoExportDll/AutoExport.cmake @@ -0,0 +1,7 @@ +project(autoexport) +set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${autoexport_BINARY_DIR}/bin) +add_subdirectory(sub) +add_library(autoexport SHARED hello.cxx world.cxx foo.c) +add_executable(say say.cxx) +target_link_libraries(say autoexport autoexport2) diff --git a/Tests/RunCMake/AutoExportDll/AutoExportBuild-stderr.txt b/Tests/RunCMake/AutoExportDll/AutoExportBuild-stderr.txt new file mode 100644 index 000000000..d483c2ce1 --- /dev/null +++ b/Tests/RunCMake/AutoExportDll/AutoExportBuild-stderr.txt @@ -0,0 +1 @@ +^.*$ diff --git a/Tests/RunCMake/AutoExportDll/CMakeLists.txt b/Tests/RunCMake/AutoExportDll/CMakeLists.txt new file mode 100644 index 000000000..18dfd2686 --- /dev/null +++ b/Tests/RunCMake/AutoExportDll/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.2) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/AutoExportDll/RunCMakeTest.cmake b/Tests/RunCMake/AutoExportDll/RunCMakeTest.cmake new file mode 100644 index 000000000..3784a6a14 --- /dev/null +++ b/Tests/RunCMake/AutoExportDll/RunCMakeTest.cmake @@ -0,0 +1,26 @@ +include(RunCMake) +set(RunCMake_TEST_NO_CLEAN TRUE) +set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/AutoExport-build") +# start by cleaning up because we don't clean up along the way +file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") +# configure the AutoExport test +run_cmake(AutoExport) +unset(RunCMake_TEST_OPTIONS) +# don't run this test on VS 6 as it is not supported +if("${RunCMake_GENERATOR}" MATCHES "Visual Studio 6|Watcom WMake|Borland Makefiles") + return() +endif() +# we build debug so the say.exe will be found in Debug/say.exe for +# Visual Studio generators +if("${RunCMake_GENERATOR}" MATCHES "Visual Studio|Xcode") + set(INTDIR "Debug/") +endif() +# build AutoExport +run_cmake_command(AutoExportBuild ${CMAKE_COMMAND} --build + ${RunCMake_TEST_BINARY_DIR} --config Debug --clean-first) +# run the executable that uses symbols from the dll +if(WIN32) + set(EXE_EXT ".exe") +endif() +run_cmake_command(AutoExportRun + ${RunCMake_BINARY_DIR}/AutoExport-build/bin/${INTDIR}say${EXE_EXT}) diff --git a/Tests/RunCMake/AutoExportDll/foo.c b/Tests/RunCMake/AutoExportDll/foo.c new file mode 100644 index 000000000..4b1318b9e --- /dev/null +++ b/Tests/RunCMake/AutoExportDll/foo.c @@ -0,0 +1,15 @@ +#ifdef _MSC_VER +#include "windows.h" +#else +#define WINAPI +#endif + +int WINAPI foo() +{ + return 10; +} + +int bar() +{ + return 5; +} diff --git a/Tests/RunCMake/AutoExportDll/hello.cxx b/Tests/RunCMake/AutoExportDll/hello.cxx new file mode 100644 index 000000000..3933fc114 --- /dev/null +++ b/Tests/RunCMake/AutoExportDll/hello.cxx @@ -0,0 +1,13 @@ +#include +#include "hello.h" +int Hello::Data = 0; +void Hello::real() +{ + return; +} +void hello() +{ + printf("hello"); +} +void Hello::operator delete[](void*) {}; +void Hello::operator delete(void*) {}; diff --git a/Tests/RunCMake/AutoExportDll/hello.h b/Tests/RunCMake/AutoExportDll/hello.h new file mode 100644 index 000000000..3749b976f --- /dev/null +++ b/Tests/RunCMake/AutoExportDll/hello.h @@ -0,0 +1,18 @@ +#ifndef _MSC_VER +#define winexport +#else +#ifdef autoexport_EXPORTS +#define winexport +#else +#define winexport __declspec(dllimport) +#endif +#endif + +class Hello +{ +public: + static winexport int Data; + void real(); + static void operator delete[](void*); + static void operator delete(void*); +}; diff --git a/Tests/RunCMake/AutoExportDll/say.cxx b/Tests/RunCMake/AutoExportDll/say.cxx new file mode 100644 index 000000000..655b3c21a --- /dev/null +++ b/Tests/RunCMake/AutoExportDll/say.cxx @@ -0,0 +1,37 @@ +#include +#include "hello.h" +#ifdef _MSC_VER +#include "windows.h" +#else +#define WINAPI +#endif + +extern "C" +{ +// test __cdecl stuff + int WINAPI foo(); +// test regular C + int bar(); +} + +// test c++ functions +// forward declare hello and world +void hello(); +void world(); + +int main() +{ + // test static data (needs declspec to work) + Hello::Data = 120; + Hello h; + h.real(); + hello(); + printf(" "); + world(); + printf("\n"); + foo(); + printf("\n"); + bar(); + printf("\n"); + return 0; +} diff --git a/Tests/RunCMake/AutoExportDll/sub/CMakeLists.txt b/Tests/RunCMake/AutoExportDll/sub/CMakeLists.txt new file mode 100644 index 000000000..8b70e7dfa --- /dev/null +++ b/Tests/RunCMake/AutoExportDll/sub/CMakeLists.txt @@ -0,0 +1,5 @@ +add_library(autoexport2 SHARED sub.cxx) +if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + # Try msvc "big" object format. + target_compile_options(autoexport2 PRIVATE /bigobj) +endif() diff --git a/Tests/RunCMake/AutoExportDll/sub/sub.cxx b/Tests/RunCMake/AutoExportDll/sub/sub.cxx new file mode 100644 index 000000000..9766b41ec --- /dev/null +++ b/Tests/RunCMake/AutoExportDll/sub/sub.cxx @@ -0,0 +1,4 @@ +int sub() +{ + return 10; +} diff --git a/Tests/RunCMake/AutoExportDll/world.cxx b/Tests/RunCMake/AutoExportDll/world.cxx new file mode 100644 index 000000000..3a54df315 --- /dev/null +++ b/Tests/RunCMake/AutoExportDll/world.cxx @@ -0,0 +1,6 @@ +#include "stdio.h" + +void world() +{ + printf("world"); +} diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index bc706d312..743ef4be1 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -266,3 +266,6 @@ if("${CMAKE_GENERATOR}" MATCHES "Make|Ninja") endif() add_RunCMake_test_group(CPack "DEB;RPM") +# add a test to make sure symbols are exported from a shared library +# for MSVC compilers CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS property is used +add_RunCMake_test(AutoExportDll) From 02fd035689ab5bbb12a16f47bca214600a9a2fde Mon Sep 17 00:00:00 2001 From: Matt McCormick Date: Thu, 2 Jul 2015 11:21:08 -0400 Subject: [PATCH 0254/1048] FindPythonLibs: Find the python.org libraries (#14809) Address the test case cmake_minimum_required(VERSION 2.8) set(Python_ADDITIONAL_VERSIONS 3.4 3.5 3.6) find_package(PythonLibs 3 REQUIRED) with a Python 3.4.x .pkg installed from python.org on OSX. Temporarily set CMAKE_FIND_FRAMEWORK to LAST to avoid finding the system Python.h prematurely. Add directories inside the frameworks to the search list for the library as is done for the header. --- Modules/FindPythonLibs.cmake | 39 +++++++++++++++++++++++++++++------- 1 file changed, 32 insertions(+), 7 deletions(-) diff --git a/Modules/FindPythonLibs.cmake b/Modules/FindPythonLibs.cmake index cc875ade7..b80d3ce94 100644 --- a/Modules/FindPythonLibs.cmake +++ b/Modules/FindPythonLibs.cmake @@ -53,6 +53,15 @@ include(${CMAKE_CURRENT_LIST_DIR}/CMakeFindFrameworks.cmake) # Search for the python framework on Apple. CMAKE_FIND_FRAMEWORKS(Python) +# Save CMAKE_FIND_FRAMEWORK +if(DEFINED CMAKE_FIND_FRAMEWORK) + set(_PythonLibs_CMAKE_FIND_FRAMEWORK ${CMAKE_FIND_FRAMEWORK}) +else() + unset(_PythonLibs_CMAKE_FIND_FRAMEWORK) +endif() +# To avoid picking up the system Python.h pre-maturely. +set(CMAKE_FIND_FRAMEWORK LAST) + set(_PYTHON1_VERSIONS 1.6 1.5) set(_PYTHON2_VERSIONS 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0) set(_PYTHON3_VERSIONS 3.4 3.3 3.2 3.1 3.0) @@ -111,14 +120,22 @@ foreach(_CURRENT_VERSION ${_Python_VERSIONS}) ) endif() + set(PYTHON_FRAMEWORK_LIBRARIES) + if(Python_FRAMEWORKS AND NOT PYTHON_LIBRARY) + foreach(dir ${Python_FRAMEWORKS}) + list(APPEND PYTHON_FRAMEWORK_LIBRARIES + ${dir}/Versions/${_CURRENT_VERSION}/lib) + endforeach() + endif() find_library(PYTHON_LIBRARY NAMES - python${_CURRENT_VERSION_NO_DOTS} - python${_CURRENT_VERSION}mu - python${_CURRENT_VERSION}m - python${_CURRENT_VERSION}u - python${_CURRENT_VERSION} + python${_CURRENT_VERSION_NO_DOTS} + python${_CURRENT_VERSION}mu + python${_CURRENT_VERSION}m + python${_CURRENT_VERSION}u + python${_CURRENT_VERSION} PATHS + ${PYTHON_FRAMEWORK_LIBRARIES} [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs # Avoid finding the .dll in the PATH. We want the .lib. @@ -143,8 +160,8 @@ foreach(_CURRENT_VERSION ${_Python_VERSIONS}) set(PYTHON_FRAMEWORK_INCLUDES) if(Python_FRAMEWORKS AND NOT PYTHON_INCLUDE_DIR) foreach(dir ${Python_FRAMEWORKS}) - set(PYTHON_FRAMEWORK_INCLUDES ${PYTHON_FRAMEWORK_INCLUDES} - ${dir}/Versions/${_CURRENT_VERSION}/include/python${_CURRENT_VERSION}) + list(APPEND PYTHON_FRAMEWORK_INCLUDES + ${dir}/Versions/${_CURRENT_VERSION}/include/python${_CURRENT_VERSION}) endforeach() endif() @@ -201,6 +218,14 @@ SELECT_LIBRARY_CONFIGURATIONS(PYTHON) # for historical reasons. unset(PYTHON_FOUND) +# Restore CMAKE_FIND_FRAMEWORK +if(DEFINED _PythonLibs_CMAKE_FIND_FRAMEWORK) + set(CMAKE_FIND_FRAMEWORK ${_PythonLibs_CMAKE_FIND_FRAMEWORK}) + unset(_PythonLibs_CMAKE_FIND_FRAMEWORK) +else() + unset(CMAKE_FIND_FRAMEWORK) +endif() + include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(PythonLibs REQUIRED_VARS PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS From 821f91d6ab668bbfcfc645a872acf91f71f76ff1 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 5 Jul 2015 19:28:45 +0200 Subject: [PATCH 0255/1048] cmMakefile: Create a scoped context for parsing listfiles. Update the Syntax tests to check for updated/improved backtraces. --- Source/cmMakefile.cxx | 30 +++++++++++++++++++ Source/cmMakefile.h | 1 + .../RunCMake/Syntax/BOM-UTF-16-BE-stderr.txt | 4 ++- .../RunCMake/Syntax/BOM-UTF-16-LE-stderr.txt | 4 ++- .../RunCMake/Syntax/BOM-UTF-32-BE-stderr.txt | 4 ++- .../RunCMake/Syntax/BOM-UTF-32-LE-stderr.txt | 4 ++- .../Syntax/BracketNoSpace0-stderr.txt | 4 ++- .../Syntax/BracketNoSpace1-stderr.txt | 4 ++- .../Syntax/BracketNoSpace2-stderr.txt | 4 ++- .../Syntax/BracketNoSpace3-stderr.txt | 4 ++- .../Syntax/BracketNoSpace4-stderr.txt | 4 ++- .../Syntax/BracketNoSpace5-stderr.txt | 4 ++- Tests/RunCMake/Syntax/ParenInENV-stderr.txt | 4 ++- .../RunCMake/Syntax/ParenNoSpace1-stderr.txt | 12 ++++++-- .../RunCMake/Syntax/StringNoSpace-stderr.txt | 8 +++-- 15 files changed, 79 insertions(+), 16 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 08df6559a..0d48cbc0c 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -547,6 +547,26 @@ void cmMakefile::IncludeScope::EnforceCMP0011() } } +class cmParseFileScope +{ +public: + cmParseFileScope(cmMakefile* mf) + : Makefile(mf) + { + this->Context.FilePath = this->Makefile->GetExecutionFilePath(); + this->Makefile->ContextStack.push_back(&this->Context); + } + + ~cmParseFileScope() + { + this->Makefile->ContextStack.pop_back(); + } + +private: + cmMakefile* Makefile; + cmListFileContext Context; +}; + bool cmMakefile::ReadDependentFile(const char* filename, bool noPolicyScope) { this->AddDefinition("CMAKE_PARENT_LIST_FILE", @@ -558,10 +578,14 @@ bool cmMakefile::ReadDependentFile(const char* filename, bool noPolicyScope) IncludeScope incScope(this, filenametoread, noPolicyScope); cmListFile listFile; + { + cmParseFileScope pfs(this); if (!listFile.ParseFile(filenametoread.c_str(), false, this)) { return false; } + } + this->ReadListFile(listFile, filenametoread); if(cmSystemTools::GetFatalErrorOccured()) { @@ -619,10 +643,13 @@ bool cmMakefile::ReadListFile(const char* filename) ListFileScope scope(this, filenametoread); cmListFile listFile; + { + cmParseFileScope pfs(this); if (!listFile.ParseFile(filenametoread.c_str(), false, this)) { return false; } + } this->ReadListFile(listFile, filenametoread); if(cmSystemTools::GetFatalErrorOccured()) @@ -1738,11 +1765,14 @@ void cmMakefile::Configure() this->AddDefinition("CMAKE_PARENT_LIST_FILE", currentStart.c_str()); cmListFile listFile; + { + cmParseFileScope pfs(this); if (!listFile.ParseFile(currentStart.c_str(), this->IsRootMakefile(), this)) { this->SetConfigured(); return; } + } this->ReadListFile(listFile, currentStart); if(cmSystemTools::GetFatalErrorOccured()) { diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 01c9e8c5e..03b9c04b5 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -940,6 +940,7 @@ private: std::vector ContextStack; std::vector ExecutionStatusStack; friend class cmMakefileCall; + friend class cmParseFileScope; std::vector ImportedTargetsOwned; TargetMap ImportedTargets; diff --git a/Tests/RunCMake/Syntax/BOM-UTF-16-BE-stderr.txt b/Tests/RunCMake/Syntax/BOM-UTF-16-BE-stderr.txt index b3f1e47d1..a845ffb1d 100644 --- a/Tests/RunCMake/Syntax/BOM-UTF-16-BE-stderr.txt +++ b/Tests/RunCMake/Syntax/BOM-UTF-16-BE-stderr.txt @@ -1,6 +1,8 @@ -CMake Error at CMakeLists.txt:3 \(include\): +CMake Error in BOM-UTF-16-BE.cmake: File .*/Tests/RunCMake/Syntax/BOM-UTF-16-BE.cmake starts with a Byte-Order-Mark that is not UTF-8. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/Syntax/BOM-UTF-16-LE-stderr.txt b/Tests/RunCMake/Syntax/BOM-UTF-16-LE-stderr.txt index c08c9020d..cc4244b8f 100644 --- a/Tests/RunCMake/Syntax/BOM-UTF-16-LE-stderr.txt +++ b/Tests/RunCMake/Syntax/BOM-UTF-16-LE-stderr.txt @@ -1,6 +1,8 @@ -CMake Error at CMakeLists.txt:3 \(include\): +CMake Error in BOM-UTF-16-LE.cmake: File .*/Tests/RunCMake/Syntax/BOM-UTF-16-LE.cmake starts with a Byte-Order-Mark that is not UTF-8. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/Syntax/BOM-UTF-32-BE-stderr.txt b/Tests/RunCMake/Syntax/BOM-UTF-32-BE-stderr.txt index 5dde4e333..5f851bfa8 100644 --- a/Tests/RunCMake/Syntax/BOM-UTF-32-BE-stderr.txt +++ b/Tests/RunCMake/Syntax/BOM-UTF-32-BE-stderr.txt @@ -1,6 +1,8 @@ -CMake Error at CMakeLists.txt:3 \(include\): +CMake Error in BOM-UTF-32-BE.cmake: File .*/Tests/RunCMake/Syntax/BOM-UTF-32-BE.cmake starts with a Byte-Order-Mark that is not UTF-8. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/Syntax/BOM-UTF-32-LE-stderr.txt b/Tests/RunCMake/Syntax/BOM-UTF-32-LE-stderr.txt index eb054ec88..d8fafd0ea 100644 --- a/Tests/RunCMake/Syntax/BOM-UTF-32-LE-stderr.txt +++ b/Tests/RunCMake/Syntax/BOM-UTF-32-LE-stderr.txt @@ -1,6 +1,8 @@ -CMake Error at CMakeLists.txt:3 \(include\): +CMake Error in BOM-UTF-32-LE.cmake: File .*/Tests/RunCMake/Syntax/BOM-UTF-32-LE.cmake starts with a Byte-Order-Mark that is not UTF-8. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/Syntax/BracketNoSpace0-stderr.txt b/Tests/RunCMake/Syntax/BracketNoSpace0-stderr.txt index afd91f9f2..a28828004 100644 --- a/Tests/RunCMake/Syntax/BracketNoSpace0-stderr.txt +++ b/Tests/RunCMake/Syntax/BracketNoSpace0-stderr.txt @@ -1,6 +1,8 @@ -CMake Error at CMakeLists.txt:3 \(include\): +CMake Error in BracketNoSpace0.cmake: Syntax Error in cmake code at .*/Tests/RunCMake/Syntax/BracketNoSpace0.cmake:1:27 Argument not separated from preceding token by whitespace. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/Syntax/BracketNoSpace1-stderr.txt b/Tests/RunCMake/Syntax/BracketNoSpace1-stderr.txt index 826e51125..391e11b7e 100644 --- a/Tests/RunCMake/Syntax/BracketNoSpace1-stderr.txt +++ b/Tests/RunCMake/Syntax/BracketNoSpace1-stderr.txt @@ -1,6 +1,8 @@ -CMake Error at CMakeLists.txt:3 \(include\): +CMake Error in BracketNoSpace1.cmake: Syntax Error in cmake code at .*/Tests/RunCMake/Syntax/BracketNoSpace1.cmake:1:24 Argument not separated from preceding token by whitespace. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/Syntax/BracketNoSpace2-stderr.txt b/Tests/RunCMake/Syntax/BracketNoSpace2-stderr.txt index 23ecdcddc..acaf7fe6e 100644 --- a/Tests/RunCMake/Syntax/BracketNoSpace2-stderr.txt +++ b/Tests/RunCMake/Syntax/BracketNoSpace2-stderr.txt @@ -1,6 +1,8 @@ -CMake Error at CMakeLists.txt:3 \(include\): +CMake Error in BracketNoSpace2.cmake: Syntax Error in cmake code at .*/Tests/RunCMake/Syntax/BracketNoSpace2.cmake:1:44 Argument not separated from preceding token by whitespace. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/Syntax/BracketNoSpace3-stderr.txt b/Tests/RunCMake/Syntax/BracketNoSpace3-stderr.txt index 906d6fc3e..f12b2e50b 100644 --- a/Tests/RunCMake/Syntax/BracketNoSpace3-stderr.txt +++ b/Tests/RunCMake/Syntax/BracketNoSpace3-stderr.txt @@ -1,6 +1,8 @@ -CMake Error at CMakeLists.txt:3 \(include\): +CMake Error in BracketNoSpace3.cmake: Syntax Error in cmake code at .*/Tests/RunCMake/Syntax/BracketNoSpace3.cmake:1:45 Argument not separated from preceding token by whitespace. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/Syntax/BracketNoSpace4-stderr.txt b/Tests/RunCMake/Syntax/BracketNoSpace4-stderr.txt index a461e93f7..71577632d 100644 --- a/Tests/RunCMake/Syntax/BracketNoSpace4-stderr.txt +++ b/Tests/RunCMake/Syntax/BracketNoSpace4-stderr.txt @@ -1,6 +1,8 @@ -CMake Error at CMakeLists.txt:3 \(include\): +CMake Error in BracketNoSpace4.cmake: Syntax Error in cmake code at .*/Tests/RunCMake/Syntax/BracketNoSpace4.cmake:1:44 Argument not separated from preceding token by whitespace. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/Syntax/BracketNoSpace5-stderr.txt b/Tests/RunCMake/Syntax/BracketNoSpace5-stderr.txt index ff8bf1c40..c13969ddc 100644 --- a/Tests/RunCMake/Syntax/BracketNoSpace5-stderr.txt +++ b/Tests/RunCMake/Syntax/BracketNoSpace5-stderr.txt @@ -1,6 +1,8 @@ -CMake Error at CMakeLists.txt:3 \(include\): +CMake Error in BracketNoSpace5.cmake: Syntax Error in cmake code at .*/Tests/RunCMake/Syntax/BracketNoSpace5.cmake:1:45 Argument not separated from preceding token by whitespace. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/Syntax/ParenInENV-stderr.txt b/Tests/RunCMake/Syntax/ParenInENV-stderr.txt index 7ecfe1124..37c5d6eb2 100644 --- a/Tests/RunCMake/Syntax/ParenInENV-stderr.txt +++ b/Tests/RunCMake/Syntax/ParenInENV-stderr.txt @@ -1,9 +1,11 @@ -CMake Warning \(dev\) at CMakeLists.txt:3 \(include\): +CMake Warning \(dev\) in ParenInENV.cmake: Syntax Warning in cmake code at .*/Tests/RunCMake/Syntax/ParenInENV.cmake:2:21 Argument not separated from preceding token by whitespace. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) This warning is for project developers. Use -Wno-dev to suppress it. CMake Error at ParenInENV.cmake:2 \(message\): diff --git a/Tests/RunCMake/Syntax/ParenNoSpace1-stderr.txt b/Tests/RunCMake/Syntax/ParenNoSpace1-stderr.txt index 64ef8b131..45b2e6a6a 100644 --- a/Tests/RunCMake/Syntax/ParenNoSpace1-stderr.txt +++ b/Tests/RunCMake/Syntax/ParenNoSpace1-stderr.txt @@ -1,22 +1,28 @@ -CMake Warning \(dev\) at CMakeLists.txt:3 \(include\): +CMake Warning \(dev\) in ParenNoSpace1.cmake: Syntax Warning in cmake code at .*/Tests/RunCMake/Syntax/ParenNoSpace1.cmake:1:26 Argument not separated from preceding token by whitespace. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) This warning is for project developers. Use -Wno-dev to suppress it. -CMake Warning \(dev\) at CMakeLists.txt:3 \(include\): +CMake Warning \(dev\) in ParenNoSpace1.cmake: Syntax Warning in cmake code at .*/Tests/RunCMake/Syntax/ParenNoSpace1.cmake:2:26 Argument not separated from preceding token by whitespace. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) This warning is for project developers. Use -Wno-dev to suppress it. -CMake Error at CMakeLists.txt:3 \(include\): +CMake Error in ParenNoSpace1.cmake: Syntax Error in cmake code at .*/Tests/RunCMake/Syntax/ParenNoSpace1.cmake:3:29 Argument not separated from preceding token by whitespace. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/Syntax/StringNoSpace-stderr.txt b/Tests/RunCMake/Syntax/StringNoSpace-stderr.txt index 89c2d2ae5..a4ec6e779 100644 --- a/Tests/RunCMake/Syntax/StringNoSpace-stderr.txt +++ b/Tests/RunCMake/Syntax/StringNoSpace-stderr.txt @@ -1,17 +1,21 @@ -CMake Warning \(dev\) at CMakeLists.txt:3 \(include\): +CMake Warning \(dev\) in StringNoSpace.cmake: Syntax Warning in cmake code at .*/Tests/RunCMake/Syntax/StringNoSpace.cmake:2:28 Argument not separated from preceding token by whitespace. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) This warning is for project developers. Use -Wno-dev to suppress it. -CMake Warning \(dev\) at CMakeLists.txt:3 \(include\): +CMake Warning \(dev\) in StringNoSpace.cmake: Syntax Warning in cmake code at .*/Tests/RunCMake/Syntax/StringNoSpace.cmake:2:31 Argument not separated from preceding token by whitespace. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) This warning is for project developers. Use -Wno-dev to suppress it. \[1 \${var} \\n 4\] From 91158a3369e0f06600a9ada93222535d53361035 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 4 Jul 2015 12:14:58 +0200 Subject: [PATCH 0256/1048] cmMakefile: Create intermediate variables for snapshot frames. --- Source/cmMakefile.cxx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 0d48cbc0c..8d02092d5 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -280,7 +280,8 @@ cmListFileBacktrace cmMakefile::GetBacktrace() const i = this->ContextStack.rbegin(); i != this->ContextStack.rend(); ++i) { - backtrace.Append(*(*i)); + cmListFileContext frame = *(*i); + backtrace.Append(frame); } return backtrace; } @@ -295,7 +296,8 @@ cmMakefile::GetBacktrace(cmListFileContext const& lfc) const i = this->ContextStack.rbegin(); i != this->ContextStack.rend(); ++i) { - backtrace.Append(*(*i)); + cmListFileContext frame = *(*i); + backtrace.Append(frame); } return backtrace; } From 329098a9a0e81e67bd760f53811cce582a3ebdcd Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 4 Jul 2015 12:16:39 +0200 Subject: [PATCH 0257/1048] cmMakefile: Set the FilePath on the frame from the cmState. To verify unit tests pass and for future bisecting. --- Source/cmMakefile.cxx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 8d02092d5..a65f6bac4 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -276,11 +276,13 @@ void cmMakefile::IssueMessage(cmake::MessageType t, cmListFileBacktrace cmMakefile::GetBacktrace() const { cmListFileBacktrace backtrace(this->StateSnapshot); + cmState::Snapshot snp = this->StateSnapshot; for(std::vector::const_reverse_iterator i = this->ContextStack.rbegin(); - i != this->ContextStack.rend(); ++i) + i != this->ContextStack.rend(); ++i, snp = snp.GetCallStackParent()) { cmListFileContext frame = *(*i); + frame.FilePath = snp.GetExecutionListFile(); backtrace.Append(frame); } return backtrace; @@ -292,11 +294,15 @@ cmMakefile::GetBacktrace(cmListFileContext const& lfc) const { cmListFileBacktrace backtrace(this->StateSnapshot); backtrace.Append(lfc); + cmState::Snapshot snp = this->StateSnapshot; + assert(snp.GetExecutionListFile() == lfc.FilePath); + snp = snp.GetCallStackParent(); for(std::vector::const_reverse_iterator i = this->ContextStack.rbegin(); - i != this->ContextStack.rend(); ++i) + i != this->ContextStack.rend(); ++i, snp = snp.GetCallStackParent()) { cmListFileContext frame = *(*i); + frame.FilePath = snp.GetExecutionListFile(); backtrace.Append(frame); } return backtrace; From 238aac23514ecdae0d4edb71033e443f30e94158 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 4 Jul 2015 13:12:50 +0200 Subject: [PATCH 0258/1048] cmListFile: Remove FilePath member from cmListFileContext. There is no need to store the FilePath for every function, as it is known by other means. --- Source/cmIfCommand.cxx | 5 ++++- Source/cmListFileCache.cxx | 1 - Source/cmListFileCache.h | 19 ++++++++++++++++- Source/cmMacroCommand.cxx | 1 - Source/cmMakefile.cxx | 35 +++++++++++++++++++------------ Source/cmMakefile.h | 4 ++-- Source/cmVariableWatchCommand.cxx | 1 - 7 files changed, 46 insertions(+), 20 deletions(-) diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx index 20448c163..cdf278c32 100644 --- a/Source/cmIfCommand.cxx +++ b/Source/cmIfCommand.cxx @@ -115,7 +115,10 @@ IsFunctionBlocked(const cmListFileFunction& lff, { std::string err = cmIfCommandError(expandedArguments); err += errorString; - cmListFileBacktrace bt = mf.GetBacktrace(this->Functions[c]); + cmListFileContext lfc = + cmListFileContext::FromCommandContext( + this->Functions[c], this->GetStartingContext().FilePath); + cmListFileBacktrace bt = mf.GetBacktrace(lfc); mf.GetCMakeInstance()->IssueMessage(messType, err, bt); if (messType == cmake::FATAL_ERROR) { diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx index 006ca4c1f..9141d8853 100644 --- a/Source/cmListFileCache.cxx +++ b/Source/cmListFileCache.cxx @@ -251,7 +251,6 @@ bool cmListFileParser::ParseFunction(const char* name, long line) { // Inintialize a new function call. this->Function = cmListFileFunction(); - this->Function.FilePath = this->FileName; this->Function.Name = name; this->Function.Line = line; diff --git a/Source/cmListFileCache.h b/Source/cmListFileCache.h index f5859ec63..57bf25386 100644 --- a/Source/cmListFileCache.h +++ b/Source/cmListFileCache.h @@ -25,6 +25,13 @@ class cmMakefile; +struct cmCommandContext +{ + std::string Name; + long Line; + cmCommandContext(): Name(), Line(0) {} +}; + struct cmListFileArgument { enum Delimiter @@ -57,6 +64,16 @@ struct cmListFileContext std::string FilePath; long Line; cmListFileContext(): Name(), FilePath(), Line(0) {} + + static cmListFileContext FromCommandContext(cmCommandContext const& lfcc, + std::string const& fileName) + { + cmListFileContext lfc; + lfc.FilePath = fileName; + lfc.Line = lfcc.Line; + lfc.Name = lfcc.Name; + return lfc; + } }; std::ostream& operator<<(std::ostream&, cmListFileContext const&); @@ -64,7 +81,7 @@ bool operator<(const cmListFileContext& lhs, const cmListFileContext& rhs); bool operator==(cmListFileContext const& lhs, cmListFileContext const& rhs); bool operator!=(cmListFileContext const& lhs, cmListFileContext const& rhs); -struct cmListFileFunction: public cmListFileContext +struct cmListFileFunction: public cmCommandContext { std::vector Arguments; }; diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx index 3c2117b38..6d3054a1b 100644 --- a/Source/cmMacroCommand.cxx +++ b/Source/cmMacroCommand.cxx @@ -132,7 +132,6 @@ bool cmMacroHelperCommand::InvokeInitialPass newLFF.Arguments.clear(); newLFF.Arguments.reserve(this->Functions[c].Arguments.size()); newLFF.Name = this->Functions[c].Name; - newLFF.FilePath = this->Functions[c].FilePath; newLFF.Line = this->Functions[c].Line; // for each argument of the current function diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index a65f6bac4..9f2abff2f 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -277,12 +277,15 @@ cmListFileBacktrace cmMakefile::GetBacktrace() const { cmListFileBacktrace backtrace(this->StateSnapshot); cmState::Snapshot snp = this->StateSnapshot; - for(std::vector::const_reverse_iterator + for(std::vector::const_reverse_iterator i = this->ContextStack.rbegin(); - i != this->ContextStack.rend(); ++i, snp = snp.GetCallStackParent()) + i != this->ContextStack.rend(); + ++i, snp = snp.GetCallStackParent()) { - cmListFileContext frame = *(*i); - frame.FilePath = snp.GetExecutionListFile(); + assert(snp.IsValid()); + cmListFileContext frame = + cmListFileContext::FromCommandContext(*(*i), + snp.GetExecutionListFile()); backtrace.Append(frame); } return backtrace; @@ -297,12 +300,15 @@ cmMakefile::GetBacktrace(cmListFileContext const& lfc) const cmState::Snapshot snp = this->StateSnapshot; assert(snp.GetExecutionListFile() == lfc.FilePath); snp = snp.GetCallStackParent(); - for(std::vector::const_reverse_iterator + for(std::vector::const_reverse_iterator i = this->ContextStack.rbegin(); - i != this->ContextStack.rend(); ++i, snp = snp.GetCallStackParent()) + i != this->ContextStack.rend(); + ++i, snp = snp.GetCallStackParent()) { - cmListFileContext frame = *(*i); - frame.FilePath = snp.GetExecutionListFile(); + assert(snp.IsValid()); + cmListFileContext frame = + cmListFileContext::FromCommandContext(*(*i), + snp.GetExecutionListFile()); backtrace.Append(frame); } return backtrace; @@ -311,7 +317,9 @@ cmMakefile::GetBacktrace(cmListFileContext const& lfc) const //---------------------------------------------------------------------------- cmListFileContext cmMakefile::GetExecutionContext() const { - return *this->ContextStack.back(); + return cmListFileContext::FromCommandContext( + *this->ContextStack.back(), + this->StateSnapshot.GetExecutionListFile()); } //---------------------------------------------------------------------------- @@ -561,7 +569,6 @@ public: cmParseFileScope(cmMakefile* mf) : Makefile(mf) { - this->Context.FilePath = this->Makefile->GetExecutionFilePath(); this->Makefile->ContextStack.push_back(&this->Context); } @@ -572,7 +579,7 @@ public: private: cmMakefile* Makefile; - cmListFileContext Context; + cmCommandContext Context; }; bool cmMakefile::ReadDependentFile(const char* filename, bool noPolicyScope) @@ -3581,11 +3588,13 @@ cmMakefile::RemoveFunctionBlocker(cmFunctionBlocker* fb, if(!(*pos)->ShouldRemove(lff, *this)) { cmListFileContext const& lfc = fb->GetStartingContext(); + cmListFileContext closingContext = + cmListFileContext::FromCommandContext(lff, lfc.FilePath); std::ostringstream e; e << "A logical block opening on the line\n" << " " << lfc << "\n" << "closes on the line\n" - << " " << lff << "\n" + << " " << closingContext << "\n" << "with mis-matching arguments."; this->IssueMessage(cmake::AUTHOR_WARNING, e.str()); } @@ -5595,7 +5604,7 @@ cmMakefile::MacroPushPop::~MacroPushPop() this->Makefile->PopMacroScope(this->ReportError); } -cmMakefileCall::cmMakefileCall(cmMakefile* mf, const cmListFileContext& lfc, +cmMakefileCall::cmMakefileCall(cmMakefile* mf, const cmCommandContext& lfc, cmExecutionStatus& status): Makefile(mf) { this->Makefile->ContextStack.push_back(&lfc); diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 03b9c04b5..d3cf02eed 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -937,7 +937,7 @@ private: // stack of list files being read std::vector ListFileStack; - std::vector ContextStack; + std::vector ContextStack; std::vector ExecutionStatusStack; friend class cmMakefileCall; friend class cmParseFileScope; @@ -1055,7 +1055,7 @@ class cmMakefileCall { public: cmMakefileCall(cmMakefile* mf, - cmListFileContext const& lfc, + cmCommandContext const& lfc, cmExecutionStatus& status); ~cmMakefileCall(); private: diff --git a/Source/cmVariableWatchCommand.cxx b/Source/cmVariableWatchCommand.cxx index 6521c04c2..98a397cf2 100644 --- a/Source/cmVariableWatchCommand.cxx +++ b/Source/cmVariableWatchCommand.cxx @@ -63,7 +63,6 @@ static void cmVariableWatchCommandVariableAccessed( cmListFileArgument(stack, cmListFileArgument::Quoted, 9999)); newLFF.Name = data->Command; - newLFF.FilePath = "unknown"; newLFF.Line = 9999; cmExecutionStatus status; if(!makefile->ExecuteCommand(newLFF,status)) From d2475bb5c4488a0ef6015f13ee46ddc7a2e4455b Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 29 May 2015 22:37:59 +0200 Subject: [PATCH 0259/1048] cmListFileBacktrace: Implement in terms of cmState::Snapshot. Avoid copying many strings into each backtrace object. --- Source/cmIfCommand.cxx | 5 +---- Source/cmListFileCache.cxx | 38 ++++++++++++++++++++++++-------------- Source/cmListFileCache.h | 10 +++++----- Source/cmMakefile.cxx | 34 ++++++---------------------------- Source/cmMakefile.h | 2 +- 5 files changed, 37 insertions(+), 52 deletions(-) diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx index cdf278c32..20448c163 100644 --- a/Source/cmIfCommand.cxx +++ b/Source/cmIfCommand.cxx @@ -115,10 +115,7 @@ IsFunctionBlocked(const cmListFileFunction& lff, { std::string err = cmIfCommandError(expandedArguments); err += errorString; - cmListFileContext lfc = - cmListFileContext::FromCommandContext( - this->Functions[c], this->GetStartingContext().FilePath); - cmListFileBacktrace bt = mf.GetBacktrace(lfc); + cmListFileBacktrace bt = mf.GetBacktrace(this->Functions[c]); mf.GetCMakeInstance()->IssueMessage(messType, err, bt); if (messType == cmake::FATAL_ERROR) { diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx index 9141d8853..1097dc2cc 100644 --- a/Source/cmListFileCache.cxx +++ b/Source/cmListFileCache.cxx @@ -398,40 +398,50 @@ bool cmListFileParser::AddArgument(cmListFileLexer_Token* token, } } -void cmListFileBacktrace::Append(cmListFileContext const& context) -{ - this->push_back(context); -} - void cmListFileBacktrace::PrintTitle(std::ostream& out) { - if (this->empty()) + if (!this->Snapshot.IsValid()) { return; } - cmOutputConverter converter(this->Snapshot); - cmListFileContext lfc = this->front(); + cmListFileContext lfc = + cmListFileContext::FromCommandContext( + this->Context, this->Snapshot.GetExecutionListFile()); lfc.FilePath = converter.Convert(lfc.FilePath, cmOutputConverter::HOME); out << (lfc.Line ? " at " : " in ") << lfc; } void cmListFileBacktrace::PrintCallStack(std::ostream& out) { - if (size() <= 1) + if (!this->Snapshot.IsValid()) + { + return; + } + cmState::Snapshot parent = this->Snapshot.GetCallStackParent(); + if (!parent.IsValid() || parent.GetExecutionListFile().empty()) { return; } cmOutputConverter converter(this->Snapshot); - const_iterator i = this->begin() + 1; + std::string commandName = this->Snapshot.GetEntryPointCommand(); + long commandLine = this->Snapshot.GetEntryPointLine(); + out << "Call Stack (most recent call first):\n"; - while(i != this->end()) + while(parent.IsValid()) { - cmListFileContext lfc = *i; - lfc.FilePath = converter.Convert(lfc.FilePath, cmOutputConverter::HOME); + cmListFileContext lfc; + lfc.Name = commandName; + lfc.Line = commandLine; + + lfc.FilePath = converter.Convert(parent.GetExecutionListFile(), + cmOutputConverter::HOME); out << " " << lfc << "\n"; - ++i; + + commandName = parent.GetEntryPointCommand(); + commandLine = parent.GetEntryPointLine(); + parent = parent.GetCallStackParent(); } } diff --git a/Source/cmListFileCache.h b/Source/cmListFileCache.h index 57bf25386..aa8a34c6c 100644 --- a/Source/cmListFileCache.h +++ b/Source/cmListFileCache.h @@ -86,19 +86,19 @@ struct cmListFileFunction: public cmCommandContext std::vector Arguments; }; -class cmListFileBacktrace: private std::vector +class cmListFileBacktrace { public: - cmListFileBacktrace(cmState::Snapshot snapshot = cmState::Snapshot()) - : Snapshot(snapshot) + cmListFileBacktrace(cmState::Snapshot snapshot = cmState::Snapshot(), + cmCommandContext const& cc = cmCommandContext()) + : Context(cc), Snapshot(snapshot) { } - void Append(cmListFileContext const& context); - void PrintTitle(std::ostream& out); void PrintCallStack(std::ostream& out); private: + cmCommandContext Context; cmState::Snapshot Snapshot; }; diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 9f2abff2f..94c77e13e 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -275,43 +275,21 @@ void cmMakefile::IssueMessage(cmake::MessageType t, //---------------------------------------------------------------------------- cmListFileBacktrace cmMakefile::GetBacktrace() const { - cmListFileBacktrace backtrace(this->StateSnapshot); - cmState::Snapshot snp = this->StateSnapshot; - for(std::vector::const_reverse_iterator - i = this->ContextStack.rbegin(); - i != this->ContextStack.rend(); - ++i, snp = snp.GetCallStackParent()) + cmListFileBacktrace backtrace; + if (!this->ContextStack.empty()) { - assert(snp.IsValid()); - cmListFileContext frame = - cmListFileContext::FromCommandContext(*(*i), - snp.GetExecutionListFile()); - backtrace.Append(frame); + backtrace = cmListFileBacktrace(this->StateSnapshot, + *this->ContextStack.back()); } return backtrace; } //---------------------------------------------------------------------------- cmListFileBacktrace -cmMakefile::GetBacktrace(cmListFileContext const& lfc) const +cmMakefile::GetBacktrace(cmCommandContext const& cc) const { - cmListFileBacktrace backtrace(this->StateSnapshot); - backtrace.Append(lfc); cmState::Snapshot snp = this->StateSnapshot; - assert(snp.GetExecutionListFile() == lfc.FilePath); - snp = snp.GetCallStackParent(); - for(std::vector::const_reverse_iterator - i = this->ContextStack.rbegin(); - i != this->ContextStack.rend(); - ++i, snp = snp.GetCallStackParent()) - { - assert(snp.IsValid()); - cmListFileContext frame = - cmListFileContext::FromCommandContext(*(*i), - snp.GetExecutionListFile()); - backtrace.Append(frame); - } - return backtrace; + return cmListFileBacktrace(snp, cc); } //---------------------------------------------------------------------------- diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index d3cf02eed..82a227940 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -547,7 +547,7 @@ public: * Get the current context backtrace. */ cmListFileBacktrace GetBacktrace() const; - cmListFileBacktrace GetBacktrace(cmListFileContext const& lfc) const; + cmListFileBacktrace GetBacktrace(cmCommandContext const& lfc) const; cmListFileContext GetExecutionContext() const; /** From 140b18648030135fbfc8fb074317c77d93a4b584 Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Fri, 3 Jul 2015 22:52:23 +0200 Subject: [PATCH 0260/1048] CTest: hide progress ticks in verbose output The progress ticks and information about the length of the output are useful when the actual output is not visible. When the output is printed, the progress ticks * add no useful information, * do not look pretty, and * make the output hard to parse for tools. --- Source/CTest/cmCTestBuildHandler.cxx | 10 +++++----- Source/cmCTest.cxx | 14 ++++++++++---- Source/cmCTest.h | 1 + 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx index e141b6019..6dbb2451c 100644 --- a/Source/CTest/cmCTestBuildHandler.cxx +++ b/Source/CTest/cmCTestBuildHandler.cxx @@ -920,7 +920,7 @@ int cmCTestBuildHandler::RunMakeCommand(const char* command, char* data; int length; - cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, + cmCTestOptionalLog(this->CTest, HANDLER_PROGRESS_OUTPUT, " Each symbol represents " << tick_len << " bytes of output." << std::endl << (this->UseCTestLaunch? "" : @@ -968,7 +968,7 @@ int cmCTestBuildHandler::RunMakeCommand(const char* command, this->ProcessBuffer(0, 0, tick, tick_len, ofs, &this->BuildProcessingQueue); this->ProcessBuffer(0, 0, tick, tick_len, ofs, &this->BuildProcessingErrorQueue); - cmCTestOptionalLog(this->CTest, OUTPUT, " Size of output: " + cmCTestOptionalLog(this->CTest, HANDLER_PROGRESS_OUTPUT, " Size of output: " << ((this->BuildOutputLogSize + 512) / 1024) << "K" << std::endl, this->Quiet); @@ -1175,12 +1175,12 @@ void cmCTestBuildHandler::ProcessBuffer(const char* data, int length, while ( this->BuildOutputLogSize > (tick * tick_len) ) { tick ++; - cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, this->LastTickChar, - this->Quiet); + cmCTestOptionalLog(this->CTest, HANDLER_PROGRESS_OUTPUT, + this->LastTickChar, this->Quiet); tickDisplayed = true; if ( tick % tick_line_len == 0 && tick > 0 ) { - cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " Size: " + cmCTestOptionalLog(this->CTest, HANDLER_PROGRESS_OUTPUT, " Size: " << ((this->BuildOutputLogSize + 512) / 1024) << "K" << std::endl << " ", this->Quiet); } diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 5887ba8ed..5676dda7b 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -1220,7 +1220,7 @@ int cmCTest::RunMakeCommand(const char* command, std::string& output, char* data; int length; - cmCTestLog(this, HANDLER_OUTPUT, + cmCTestLog(this, HANDLER_PROGRESS_OUTPUT, " Each . represents " << tick_len << " bytes of output" << std::endl << " " << std::flush); while(cmsysProcess_WaitForData(cp, &data, &length, 0)) @@ -1236,10 +1236,10 @@ int cmCTest::RunMakeCommand(const char* command, std::string& output, while ( output.size() > (tick * tick_len) ) { tick ++; - cmCTestLog(this, HANDLER_OUTPUT, "." << std::flush); + cmCTestLog(this, HANDLER_PROGRESS_OUTPUT, "." << std::flush); if ( tick % tick_line_len == 0 && tick > 0 ) { - cmCTestLog(this, HANDLER_OUTPUT, + cmCTestLog(this, HANDLER_PROGRESS_OUTPUT, " Size: " << int((double(output.size()) / 1024.0) + 1) << "K" << std::endl @@ -1252,7 +1252,7 @@ int cmCTest::RunMakeCommand(const char* command, std::string& output, ofs << cmCTestLogWrite(data, length); } } - cmCTestLog(this, OUTPUT, " Size of output: " + cmCTestLog(this, HANDLER_PROGRESS_OUTPUT, " Size of output: " << int(double(output.size()) / 1024.0) << "K" << std::endl); cmsysProcess_WaitForExit(cp, 0); @@ -3101,6 +3101,7 @@ static const char* cmCTestStringLogType[] = "DEBUG", "OUTPUT", "HANDLER_OUTPUT", + "HANDLER_PROGRESS_OUTPUT", "HANDLER_VERBOSE_OUTPUT", "WARNING", "ERROR_MESSAGE", @@ -3139,6 +3140,11 @@ void cmCTest::Log(int logType, const char* file, int line, const char* msg, { return; } + if ( logType == cmCTest::HANDLER_PROGRESS_OUTPUT && + ( this->Debug || this->ExtraVerbose ) ) + { + return; + } if ( this->OutputLogFile ) { bool display = true; diff --git a/Source/cmCTest.h b/Source/cmCTest.h index 47245ae00..73c280752 100644 --- a/Source/cmCTest.h +++ b/Source/cmCTest.h @@ -382,6 +382,7 @@ public: DEBUG = 0, OUTPUT, HANDLER_OUTPUT, + HANDLER_PROGRESS_OUTPUT, HANDLER_VERBOSE_OUTPUT, WARNING, ERROR_MESSAGE, From e494763997c2e28ead2269f21a1c6a66a815ac2e Mon Sep 17 00:00:00 2001 From: James Johnston Date: Sun, 5 Jul 2015 16:32:20 -0400 Subject: [PATCH 0261/1048] ExternalProject: Added new USES_TERMINAL options Added new USES_TERMINAL option to the ExternalProject_Add_Step function. This option passes USES_TERMINAL to the underlying add_custom_command call so that the Ninja console pool is used. Also, corresponding new USES_TERMINAL_ options were added to the ExternalProject_Add function. Justification: if using Ninja with a CMake superbuild, it's often desirable to limit the superbuild to ONE sub-Ninja process at a time to avoid oversubscribing the CPU. Using the console pool also makes it easy to monitor the progress of the sub-Ninja process. Independent USES_TERMINAL_ arguments are passed to ExternalProject_Add instead of one USES_TERMINAL argument that controls everything. Users may wish to run some steps in parallel but not others (e.g. parallelize configure but not build). --- .../dev/ExternalProject-USES_TERMINAL.rst | 7 ++ Modules/ExternalProject.cmake | 83 ++++++++++++++++ .../ExternalProject/RunCMakeTest.cmake | 1 + .../ExternalProject/UsesTerminal-check.cmake | 97 +++++++++++++++++++ .../ExternalProject/UsesTerminal.cmake | 45 +++++++++ 5 files changed, 233 insertions(+) create mode 100644 Help/release/dev/ExternalProject-USES_TERMINAL.rst create mode 100644 Tests/RunCMake/ExternalProject/UsesTerminal-check.cmake create mode 100644 Tests/RunCMake/ExternalProject/UsesTerminal.cmake diff --git a/Help/release/dev/ExternalProject-USES_TERMINAL.rst b/Help/release/dev/ExternalProject-USES_TERMINAL.rst new file mode 100644 index 000000000..415540d75 --- /dev/null +++ b/Help/release/dev/ExternalProject-USES_TERMINAL.rst @@ -0,0 +1,7 @@ +ExternalProject-USES_TERMINAL +----------------------------- + +* The :module:`ExternalProject` module learned new ``USES_TERMINAL`` + arguments for giving steps exclusive terminal access. Especially + useful with the :generator:`Ninja` generator to monitor CMake + superbuild progress and prevent CPU oversubscription. diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index eee1841db..f6844be85 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -175,6 +175,23 @@ Create custom targets to build projects in external trees ``LOG_INSTALL 1`` Wrap install in script to log output + Steps can be given direct access to the terminal if possible. With + the :generator:`Ninja` generator, this places the steps in the + ``console`` :prop_gbl:`pool `. Options are: + + ``USES_TERMINAL_DOWNLOAD 1`` + Give download terminal access. + ``USES_TERMINAL_UPDATE 1`` + Give update terminal access. + ``USES_TERMINAL_CONFIGURE 1`` + Give configure terminal access. + ``USES_TERMINAL_BUILD 1`` + Give build terminal access. + ``USES_TERMINAL_TEST 1`` + Give test terminal access. + ``USES_TERMINAL_INSTALL 1`` + Give install terminal access. + Other options are: ``STEP_TARGETS ...`` @@ -256,6 +273,8 @@ Create custom targets to build projects in external trees Working directory for command ``LOG 1`` Wrap step in script to log output + ``USES_TERMINAL 1`` + Give the step direct access to the terminal if possible. The command line, comment, working directory, and byproducts of every standard and custom step are processed to replace tokens ````, @@ -1463,6 +1482,14 @@ function(ExternalProject_Add_Step name step) get_property(comment TARGET ${name} PROPERTY _EP_${step}_COMMENT) endif() + # Uses terminal? + get_property(uses_terminal TARGET ${name} PROPERTY _EP_${step}_USES_TERMINAL) + if(uses_terminal) + set(uses_terminal USES_TERMINAL) + else() + set(uses_terminal "") + endif() + # Run every time? get_property(always TARGET ${name} PROPERTY _EP_${step}_ALWAYS) if(always) @@ -1505,6 +1532,7 @@ function(ExternalProject_Add_Step name step) DEPENDS ${depends} WORKING_DIRECTORY ${work_dir} VERBATIM + ${uses_terminal} ) set_property(TARGET ${name} APPEND PROPERTY _EP_STEPS ${step}) @@ -1890,6 +1918,14 @@ function(_ep_add_download_command name) set(log "") endif() + get_property(uses_terminal TARGET ${name} PROPERTY + _EP_USES_TERMINAL_DOWNLOAD) + if(uses_terminal) + set(uses_terminal USES_TERMINAL 1) + else() + set(uses_terminal "") + endif() + ExternalProject_Add_Step(${name} download COMMENT ${comment} COMMAND ${cmd} @@ -1897,6 +1933,7 @@ function(_ep_add_download_command name) DEPENDS ${depends} DEPENDEES mkdir ${log} + ${uses_terminal} ) endfunction() @@ -2001,6 +2038,14 @@ Update to Mercurial >= 2.1.1. set(log "") endif() + get_property(uses_terminal TARGET ${name} PROPERTY + _EP_USES_TERMINAL_UPDATE) + if(uses_terminal) + set(uses_terminal USES_TERMINAL 1) + else() + set(uses_terminal "") + endif() + ExternalProject_Add_Step(${name} update COMMENT ${comment} COMMAND ${cmd} @@ -2009,6 +2054,7 @@ Update to Mercurial >= 2.1.1. WORKING_DIRECTORY ${work_dir} DEPENDEES download ${log} + ${uses_terminal} ) if(always AND update_disconnected) @@ -2021,6 +2067,7 @@ Update to Mercurial >= 2.1.1. WORKING_DIRECTORY ${work_dir} DEPENDEES download ${log} + ${uses_terminal} ) set_property(SOURCE ${skip-update_stamp_file} PROPERTY SYMBOLIC 1) endif() @@ -2149,6 +2196,14 @@ function(_ep_add_configure_command name) set(log "") endif() + get_property(uses_terminal TARGET ${name} PROPERTY + _EP_USES_TERMINAL_CONFIGURE) + if(uses_terminal) + set(uses_terminal USES_TERMINAL 1) + else() + set(uses_terminal "") + endif() + get_property(update_disconnected_set TARGET ${name} PROPERTY _EP_UPDATE_DISCONNECTED SET) if(update_disconnected_set) get_property(update_disconnected TARGET ${name} PROPERTY _EP_UPDATE_DISCONNECTED) @@ -2167,6 +2222,7 @@ function(_ep_add_configure_command name) DEPENDEES ${update_dep} patch DEPENDS ${file_deps} ${log} + ${uses_terminal} ) endfunction() @@ -2188,6 +2244,14 @@ function(_ep_add_build_command name) set(log "") endif() + get_property(uses_terminal TARGET ${name} PROPERTY + _EP_USES_TERMINAL_BUILD) + if(uses_terminal) + set(uses_terminal USES_TERMINAL 1) + else() + set(uses_terminal "") + endif() + get_property(build_always TARGET ${name} PROPERTY _EP_BUILD_ALWAYS) if(build_always) set(always 1) @@ -2204,6 +2268,7 @@ function(_ep_add_build_command name) DEPENDEES configure ALWAYS ${always} ${log} + ${uses_terminal} ) endfunction() @@ -2225,11 +2290,20 @@ function(_ep_add_install_command name) set(log "") endif() + get_property(uses_terminal TARGET ${name} PROPERTY + _EP_USES_TERMINAL_INSTALL) + if(uses_terminal) + set(uses_terminal USES_TERMINAL 1) + else() + set(uses_terminal "") + endif() + ExternalProject_Add_Step(${name} install COMMAND ${cmd} WORKING_DIRECTORY ${binary_dir} DEPENDEES build ${log} + ${uses_terminal} ) endfunction() @@ -2277,6 +2351,14 @@ function(_ep_add_test_command name) set(log "") endif() + get_property(uses_terminal TARGET ${name} PROPERTY + _EP_USES_TERMINAL_TEST) + if(uses_terminal) + set(uses_terminal USES_TERMINAL 1) + else() + set(uses_terminal "") + endif() + ExternalProject_Add_Step(${name} test COMMAND ${cmd} WORKING_DIRECTORY ${binary_dir} @@ -2284,6 +2366,7 @@ function(_ep_add_test_command name) ${dependers_args} ${exclude_args} ${log} + ${uses_terminal} ) endif() endfunction() diff --git a/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake b/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake index e038409bf..47d612969 100644 --- a/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake +++ b/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake @@ -11,3 +11,4 @@ run_cmake(Add_StepDependencies) run_cmake(Add_StepDependencies_iface) run_cmake(Add_StepDependencies_iface_step) run_cmake(Add_StepDependencies_no_target) +run_cmake(UsesTerminal) diff --git a/Tests/RunCMake/ExternalProject/UsesTerminal-check.cmake b/Tests/RunCMake/ExternalProject/UsesTerminal-check.cmake new file mode 100644 index 000000000..201d822ba --- /dev/null +++ b/Tests/RunCMake/ExternalProject/UsesTerminal-check.cmake @@ -0,0 +1,97 @@ +cmake_minimum_required(VERSION 3.3) + +# If we are using the Ninja generator, we can check and verify that the +# USES_TERMINAL option actually works by examining the Ninja build file. +# This is the only way, since CMake doesn't offer a way to examine the +# options on a custom command after it has been added. Furthermore, +# there isn't an easy way to test for this by actually running Ninja. +# +# Other generators don't currently support USES_TERMINAL at this time. +# This file can be improved to support them if they do. Until then, we +# simply assume success for new generator types. +# +# For Ninja, there is a complication. If the Ninja generator detects a +# version of Ninja < 1.5, it won't actually emit the console pool command, +# because those Ninja versions don't yet support the console pool. In +# that case, we also have to assume success. + +# Check Ninja build output to verify whether or not a target step is in the +# console pool. +macro(CheckNinjaStep _target _step _require) + if("${_build}" MATCHES +" DESC = Performing ${_step} step for '${_target}' + pool = console" + ) + if(NOT ${_require}) + set(RunCMake_TEST_FAILED "${_target} ${_step} step is in console pool") + return() + endif() + else() + if(${_require}) + set(RunCMake_TEST_FAILED "${_target} ${_step} step not in console pool") + return() + endif() + endif() +endmacro() + +# Check Ninja build output to verify whether each target step is in the +# console pool. +macro(CheckNinjaTarget _target + _download _update _configure _build _test _install + ) + CheckNinjaStep(${_target} download ${_download}) + CheckNinjaStep(${_target} update ${_update}) + CheckNinjaStep(${_target} configure ${_configure}) + CheckNinjaStep(${_target} build ${_build}) + CheckNinjaStep(${_target} test ${_test}) + CheckNinjaStep(${_target} install ${_install}) +endmacro() + +# Load build/make file, depending on generator +if(RunCMake_GENERATOR STREQUAL Ninja) + # Check the Ninja version. If < 1.5, console pool isn't supported and + # so the generator would not emit console pool usage. That would cause + # this test to fail. + execute_process(COMMAND ${RunCMake_MAKE_PROGRAM} --version + RESULT_VARIABLE _version_result + OUTPUT_VARIABLE _version + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + if(_version_result OR _version VERSION_EQUAL "0") + set(RunCMake_TEST_FAILED "Failed to get Ninja version") + return() + endif() + if(_version VERSION_LESS "1.5") + return() # console pool not supported on Ninja < 1.5 + endif() + + # Read the Ninja build file + set(_build_file "${RunCMake_TEST_BINARY_DIR}/build.ninja") + + if(NOT EXISTS "${_build_file}") + set(RunCMake_TEST_FAILED "Ninja build file not created") + return() + endif() + + file(READ "${_build_file}" _build) + + set(_target_check_macro CheckNinjaTarget) +elseif((RunCMake_GENERATOR STREQUAL "") OR NOT DEFINED RunCMake_GENERATOR) + # protection in case somebody renamed RunCMake_GENERATOR + set(RunCMake_TEST_FAILED "Unknown generator") + return() +else() + # We don't yet know how to test USES_TERMINAL on this generator. + return() +endif() + +# Actual tests: +CheckNinjaTarget(TerminalTest1 + true true true true true true ) +CheckNinjaTarget(TerminalTest2 + true false true false true false) +CheckNinjaTarget(TerminalTest3 + false true false true false true ) +CheckNinjaTarget(TerminalTest4 + false false false false false false) diff --git a/Tests/RunCMake/ExternalProject/UsesTerminal.cmake b/Tests/RunCMake/ExternalProject/UsesTerminal.cmake new file mode 100644 index 000000000..cd874039d --- /dev/null +++ b/Tests/RunCMake/ExternalProject/UsesTerminal.cmake @@ -0,0 +1,45 @@ +if(NOT CMAKE_CONFIGURATION_TYPES) + set(CMAKE_BUILD_TYPE Debug) +endif() +include(ExternalProject) + +# Test various combinations of USES_TERMINAL with ExternalProject_Add. + +macro(DoTerminalTest _target) + ExternalProject_Add(${_target} + DOWNLOAD_COMMAND "${CMAKE_COMMAND}" -E echo "download" + UPDATE_COMMAND "${CMAKE_COMMAND}" -E echo "update" + CONFIGURE_COMMAND "${CMAKE_COMMAND}" -E echo "configure" + BUILD_COMMAND "${CMAKE_COMMAND}" -E echo "build" + TEST_COMMAND "${CMAKE_COMMAND}" -E echo "test" + INSTALL_COMMAND "${CMAKE_COMMAND}" -E echo "install" + ${ARGN} + ) +endmacro() + +# USES_TERMINAL on all steps +DoTerminalTest(TerminalTest1 + USES_TERMINAL_DOWNLOAD 1 + USES_TERMINAL_UPDATE 1 + USES_TERMINAL_CONFIGURE 1 + USES_TERMINAL_BUILD 1 + USES_TERMINAL_TEST 1 + USES_TERMINAL_INSTALL 1 + ) + +# USES_TERMINAL on every other step, starting with download +DoTerminalTest(TerminalTest2 + USES_TERMINAL_DOWNLOAD 1 + USES_TERMINAL_CONFIGURE 1 + USES_TERMINAL_TEST 1 + ) + +# USES_TERMINAL on every other step, starting with update +DoTerminalTest(TerminalTest3 + USES_TERMINAL_UPDATE 1 + USES_TERMINAL_BUILD 1 + USES_TERMINAL_INSTALL 1 + ) + +# USES_TERMINAL on no step +DoTerminalTest(TerminalTest4) From edae40239e64f8ea6c03d28601c9e7403a354f65 Mon Sep 17 00:00:00 2001 From: Roman Donchenko Date: Mon, 6 Jul 2015 17:54:19 +0300 Subject: [PATCH 0262/1048] cmArchiveWrite: do not store sparse files when using standard tar formats Sparse files in tars are a GNU extension that libarchive will use if it detects holes in the input file, even when using the standard pax/paxr formats. Not all tar implementations can handle sparse files; in particular, the internal implementation dpkg uses to extract packages can't. To maximize archive portability, turn this feature off by clearing the sparseness information from archive entries. --- Source/cmArchiveWrite.cxx | 11 ++++++++++- Source/cmArchiveWrite.h | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Source/cmArchiveWrite.cxx b/Source/cmArchiveWrite.cxx index 72818f50a..44d0d4ec4 100644 --- a/Source/cmArchiveWrite.cxx +++ b/Source/cmArchiveWrite.cxx @@ -84,7 +84,8 @@ cmArchiveWrite::cmArchiveWrite( Stream(os), Archive(archive_write_new()), Disk(archive_read_disk_new()), - Verbose(false) + Verbose(false), + Format(format) { switch (c) { @@ -282,6 +283,14 @@ bool cmArchiveWrite::AddFile(const char* file, archive_entry_acl_clear(e); archive_entry_xattr_clear(e); archive_entry_set_fflags(e, 0, 0); + + if (this->Format == "pax" || this->Format == "paxr") + { + // Sparse files are a GNU tar extension. + // Do not use them in standard tar files. + archive_entry_sparse_clear(e); + } + if(archive_write_header(this->Archive, e) != ARCHIVE_OK) { this->Error = "archive_write_header: "; diff --git a/Source/cmArchiveWrite.h b/Source/cmArchiveWrite.h index 794cb282c..e6f515ddc 100644 --- a/Source/cmArchiveWrite.h +++ b/Source/cmArchiveWrite.h @@ -84,6 +84,7 @@ private: struct archive* Archive; struct archive* Disk; bool Verbose; + std::string Format; std::string Error; std::string MTime; }; From bf11253163b54f7c18b001cb00973a6341ee859b Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 6 Jul 2015 16:15:49 -0400 Subject: [PATCH 0263/1048] Add rudimentary support for the Apple Swift language with Xcode Allow the `Swift` language to be enabled with the Xcode generator for Xcode >= 6.1. Reject it on other generators and with older Xcode versions. Since Apple is the only vendor implementing the language right now, the compiler id can be just `Apple`. --- Help/release/dev/add-apple-swift-language.rst | 9 ++++ Modules/CMakeDetermineSwiftCompiler.cmake | 53 +++++++++++++++++++ Modules/CMakeSwiftCompiler.cmake.in | 5 ++ Modules/CMakeSwiftInformation.cmake | 41 ++++++++++++++ Modules/CMakeTestSwiftCompiler.cmake | 15 ++++++ Modules/CompilerId/main.swift.in | 1 + Source/cmGlobalXCodeGenerator.cxx | 4 ++ Tests/CMakeLists.txt | 6 +++ Tests/RunCMake/CMakeLists.txt | 5 ++ Tests/RunCMake/Swift/CMakeLists.txt | 3 ++ Tests/RunCMake/Swift/Enable-stdout.txt | 1 + Tests/RunCMake/Swift/Enable.cmake | 1 + Tests/RunCMake/Swift/NotSupported-result.txt | 1 + Tests/RunCMake/Swift/NotSupported-stderr.txt | 5 ++ Tests/RunCMake/Swift/NotSupported.cmake | 1 + Tests/RunCMake/Swift/RunCMakeTest.cmake | 11 ++++ Tests/RunCMake/Swift/XcodeTooOld-result.txt | 1 + Tests/RunCMake/Swift/XcodeTooOld-stderr.txt | 5 ++ Tests/RunCMake/Swift/XcodeTooOld.cmake | 1 + Tests/SwiftMix/CMain.c | 4 ++ Tests/SwiftMix/CMakeLists.txt | 5 ++ Tests/SwiftMix/ObjC-Swift.h | 0 Tests/SwiftMix/ObjCMain.m | 4 ++ Tests/SwiftMix/SwiftMain.swift | 10 ++++ Tests/SwiftOnly/CMakeLists.txt | 4 ++ Tests/SwiftOnly/main.swift | 1 + 26 files changed, 197 insertions(+) create mode 100644 Help/release/dev/add-apple-swift-language.rst create mode 100644 Modules/CMakeDetermineSwiftCompiler.cmake create mode 100644 Modules/CMakeSwiftCompiler.cmake.in create mode 100644 Modules/CMakeSwiftInformation.cmake create mode 100644 Modules/CMakeTestSwiftCompiler.cmake create mode 100644 Modules/CompilerId/main.swift.in create mode 100644 Tests/RunCMake/Swift/CMakeLists.txt create mode 100644 Tests/RunCMake/Swift/Enable-stdout.txt create mode 100644 Tests/RunCMake/Swift/Enable.cmake create mode 100644 Tests/RunCMake/Swift/NotSupported-result.txt create mode 100644 Tests/RunCMake/Swift/NotSupported-stderr.txt create mode 100644 Tests/RunCMake/Swift/NotSupported.cmake create mode 100644 Tests/RunCMake/Swift/RunCMakeTest.cmake create mode 100644 Tests/RunCMake/Swift/XcodeTooOld-result.txt create mode 100644 Tests/RunCMake/Swift/XcodeTooOld-stderr.txt create mode 100644 Tests/RunCMake/Swift/XcodeTooOld.cmake create mode 100644 Tests/SwiftMix/CMain.c create mode 100644 Tests/SwiftMix/CMakeLists.txt create mode 100644 Tests/SwiftMix/ObjC-Swift.h create mode 100644 Tests/SwiftMix/ObjCMain.m create mode 100644 Tests/SwiftMix/SwiftMain.swift create mode 100644 Tests/SwiftOnly/CMakeLists.txt create mode 100644 Tests/SwiftOnly/main.swift diff --git a/Help/release/dev/add-apple-swift-language.rst b/Help/release/dev/add-apple-swift-language.rst new file mode 100644 index 000000000..60ce5d82e --- /dev/null +++ b/Help/release/dev/add-apple-swift-language.rst @@ -0,0 +1,9 @@ +add-apple-swift-language +------------------------ + +* CMake learned rudimentary support for the Apple Swift language. When using + the :generator:`Xcode` generator with Xcode 6.1 or higher, one may enable + the ``Swift`` language with the :command:`enable_language` command or the + :command:`project` command (this is an error with other generators or when + Xcode is too old). Then one may list ``.swift`` source files in targets + for compilation. diff --git a/Modules/CMakeDetermineSwiftCompiler.cmake b/Modules/CMakeDetermineSwiftCompiler.cmake new file mode 100644 index 000000000..bff1ae9cd --- /dev/null +++ b/Modules/CMakeDetermineSwiftCompiler.cmake @@ -0,0 +1,53 @@ + +#============================================================================= +# Copyright 2002-2015 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +include(${CMAKE_ROOT}/Modules/CMakeDetermineCompiler.cmake) + +if("${CMAKE_GENERATOR}" STREQUAL "Xcode") + if(XCODE_VERSION VERSION_LESS 6.1) + message(FATAL_ERROR "Swift language not supported by Xcode ${XCODE_VERSION}") + endif() + set(CMAKE_Swift_COMPILER_XCODE_TYPE sourcecode.swift) + _cmake_find_compiler_path(Swift) +else() + message(FATAL_ERROR "Swift language not supported by \"${CMAKE_GENERATOR}\" generator") +endif() + +# Build a small source file to identify the compiler. +if(NOT CMAKE_Swift_COMPILER_ID_RUN) + set(CMAKE_Swift_COMPILER_ID_RUN 1) + + list(APPEND CMAKE_Swift_COMPILER_ID_MATCH_VENDORS Apple) + set(CMAKE_Swift_COMPILER_ID_MATCH_VENDOR_REGEX_Apple "com.apple.xcode.tools.swift.compiler") + + set(CMAKE_Swift_COMPILER_ID_TOOL_MATCH_REGEX "\nCompileSwiftSources[^\n]*(\n[ \t]+[^\n]*)*\n[ \t]+([^ \t\r\n]+)[^\r\n]* -c[^\r\n]*CompilerIdSwift/CompilerId/main.swift") + set(CMAKE_Swift_COMPILER_ID_TOOL_MATCH_INDEX 2) + + # Try to identify the compiler. + set(CMAKE_Swift_COMPILER_ID) + include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerId.cmake) + CMAKE_DETERMINE_COMPILER_ID(Swift "" CompilerId/main.swift) +endif() + +if (NOT _CMAKE_TOOLCHAIN_LOCATION) + get_filename_component(_CMAKE_TOOLCHAIN_LOCATION "${CMAKE_Swift_COMPILER}" PATH) +endif () + +include(CMakeFindBinUtils) + +# configure variables set in this file for fast reload later on +configure_file(${CMAKE_ROOT}/Modules/CMakeSwiftCompiler.cmake.in + ${CMAKE_PLATFORM_INFO_DIR}/CMakeSwiftCompiler.cmake + @ONLY + ) diff --git a/Modules/CMakeSwiftCompiler.cmake.in b/Modules/CMakeSwiftCompiler.cmake.in new file mode 100644 index 000000000..45f0a3105 --- /dev/null +++ b/Modules/CMakeSwiftCompiler.cmake.in @@ -0,0 +1,5 @@ +set(CMAKE_Swift_COMPILER "@CMAKE_Swift_COMPILER@") +set(CMAKE_Swift_COMPILER_ID "@CMAKE_Swift_COMPILER_ID@") + +set(CMAKE_Swift_COMPILER_ID_RUN 1) +set(CMAKE_Swift_SOURCE_FILE_EXTENSIONS swift) diff --git a/Modules/CMakeSwiftInformation.cmake b/Modules/CMakeSwiftInformation.cmake new file mode 100644 index 000000000..61ad92834 --- /dev/null +++ b/Modules/CMakeSwiftInformation.cmake @@ -0,0 +1,41 @@ + +#============================================================================= +# Copyright 2004-2015 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +set(CMAKE_Swift_OUTPUT_EXTENSION .o) + +# Load compiler-specific information. +if(CMAKE_Swift_COMPILER_ID) + include(Compiler/${CMAKE_Swift_COMPILER_ID}-Swift OPTIONAL) +endif() + +# load the system- and compiler specific files +if(CMAKE_Swift_COMPILER_ID) + # load a hardware specific file, mostly useful for embedded compilers + if(CMAKE_SYSTEM_PROCESSOR) + include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_Swift_COMPILER_ID}-Swift-${CMAKE_SYSTEM_PROCESSOR} OPTIONAL) + endif() + include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_Swift_COMPILER_ID}-Swift OPTIONAL) +endif() + +# for most systems a module is the same as a shared library +# so unless the variable CMAKE_MODULE_EXISTS is set just +# copy the values from the LIBRARY variables +if(NOT CMAKE_MODULE_EXISTS) + set(CMAKE_SHARED_MODULE_Swift_FLAGS ${CMAKE_SHARED_LIBRARY_Swift_FLAGS}) + set(CMAKE_SHARED_MODULE_CREATE_Swift_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_Swift_FLAGS}) +endif() + +include(CMakeCommonLanguageInclude) + +set(CMAKE_Swift_INFORMATION_LOADED 1) diff --git a/Modules/CMakeTestSwiftCompiler.cmake b/Modules/CMakeTestSwiftCompiler.cmake new file mode 100644 index 000000000..918642654 --- /dev/null +++ b/Modules/CMakeTestSwiftCompiler.cmake @@ -0,0 +1,15 @@ + +#============================================================================= +# Copyright 2003-2015 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +set(CMAKE_Swift_COMPILER_WORKS 1) diff --git a/Modules/CompilerId/main.swift.in b/Modules/CompilerId/main.swift.in new file mode 100644 index 000000000..962e85728 --- /dev/null +++ b/Modules/CompilerId/main.swift.in @@ -0,0 +1 @@ +println("CMakeSwiftCompilerId") diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 505929ea7..21075bba5 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -843,6 +843,10 @@ GetSourcecodeValueFromFileExtension(const std::string& _ext, { sourcecode += ".c.objc"; } + else if (ext == "swift") + { + sourcecode += ".swift"; + } else if(ext == "plist") { sourcecode += ".text.plist"; diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 886506394..8de1c79d3 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -260,6 +260,12 @@ if(BUILD_TESTING) ADD_TEST_MACRO(MissingSourceFile MissingSourceFile) set_tests_properties(MissingSourceFile PROPERTIES PASS_REGULAR_EXPRESSION "CMake Error at CMakeLists.txt:3 \\(add_executable\\):[ \r\n]*Cannot find source file:[ \r\n]*DoesNotExist/MissingSourceFile.c") + if(CMake_TEST_XCODE_VERSION AND NOT CMake_TEST_XCODE_VERSION VERSION_LESS 6.1) + if(CMAKE_GENERATOR STREQUAL "Xcode") + ADD_TEST_MACRO(SwiftMix SwiftMix) + ADD_TEST_MACRO(SwiftOnly SwiftOnly) + endif() + endif() if(CMAKE_Fortran_COMPILER) ADD_TEST_MACRO(FortranOnly FortranOnly) endif() diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index bc706d312..adbe7cc91 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -59,6 +59,10 @@ function(add_RunCMake_test_group test types) endforeach() endfunction() +if(XCODE_VERSION AND "${XCODE_VERSION}" VERSION_LESS 6.1) + set(Swift_ARGS -DXCODE_BELOW_6_1=1) +endif() + if(XCODE_VERSION AND "${XCODE_VERSION}" VERSION_LESS 3) set(GeneratorToolset_ARGS -DXCODE_BELOW_3=1) endif() @@ -132,6 +136,7 @@ add_RunCMake_test(GNUInstallDirs) add_RunCMake_test(TargetPropertyGeneratorExpressions) add_RunCMake_test(Languages) add_RunCMake_test(ObjectLibrary) +add_RunCMake_test(Swift) add_RunCMake_test(TargetObjects) add_RunCMake_test(TargetSources) add_RunCMake_test(find_dependency) diff --git a/Tests/RunCMake/Swift/CMakeLists.txt b/Tests/RunCMake/Swift/CMakeLists.txt new file mode 100644 index 000000000..74b3ff8de --- /dev/null +++ b/Tests/RunCMake/Swift/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.3) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/Swift/Enable-stdout.txt b/Tests/RunCMake/Swift/Enable-stdout.txt new file mode 100644 index 000000000..39e133fc6 --- /dev/null +++ b/Tests/RunCMake/Swift/Enable-stdout.txt @@ -0,0 +1 @@ +-- The Swift compiler identification is Apple diff --git a/Tests/RunCMake/Swift/Enable.cmake b/Tests/RunCMake/Swift/Enable.cmake new file mode 100644 index 000000000..19f297a87 --- /dev/null +++ b/Tests/RunCMake/Swift/Enable.cmake @@ -0,0 +1 @@ +enable_language(Swift) diff --git a/Tests/RunCMake/Swift/NotSupported-result.txt b/Tests/RunCMake/Swift/NotSupported-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/Swift/NotSupported-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Swift/NotSupported-stderr.txt b/Tests/RunCMake/Swift/NotSupported-stderr.txt new file mode 100644 index 000000000..9a9c23ff3 --- /dev/null +++ b/Tests/RunCMake/Swift/NotSupported-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error at .*/Modules/CMakeDetermineSwiftCompiler.cmake:[0-9]+ \(message\): + Swift language not supported by "[^"]*" generator +Call Stack \(most recent call first\): + NotSupported.cmake:[0-9]+ \(enable_language\) + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/Swift/NotSupported.cmake b/Tests/RunCMake/Swift/NotSupported.cmake new file mode 100644 index 000000000..19f297a87 --- /dev/null +++ b/Tests/RunCMake/Swift/NotSupported.cmake @@ -0,0 +1 @@ +enable_language(Swift) diff --git a/Tests/RunCMake/Swift/RunCMakeTest.cmake b/Tests/RunCMake/Swift/RunCMakeTest.cmake new file mode 100644 index 000000000..0a5712142 --- /dev/null +++ b/Tests/RunCMake/Swift/RunCMakeTest.cmake @@ -0,0 +1,11 @@ +include(RunCMake) + +if(RunCMake_GENERATOR STREQUAL Xcode) + if(XCODE_BELOW_6_1) + run_cmake(XcodeTooOld) + else() + run_cmake(Enable) + endif() +else() + run_cmake(NotSupported) +endif() diff --git a/Tests/RunCMake/Swift/XcodeTooOld-result.txt b/Tests/RunCMake/Swift/XcodeTooOld-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/Swift/XcodeTooOld-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Swift/XcodeTooOld-stderr.txt b/Tests/RunCMake/Swift/XcodeTooOld-stderr.txt new file mode 100644 index 000000000..8d18f294f --- /dev/null +++ b/Tests/RunCMake/Swift/XcodeTooOld-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error at .*/Modules/CMakeDetermineSwiftCompiler.cmake:[0-9]+ \(message\): + Swift language not supported by Xcode [0-9.]+ +Call Stack \(most recent call first\): + XcodeTooOld.cmake:[0-9]+ \(enable_language\) + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/Swift/XcodeTooOld.cmake b/Tests/RunCMake/Swift/XcodeTooOld.cmake new file mode 100644 index 000000000..19f297a87 --- /dev/null +++ b/Tests/RunCMake/Swift/XcodeTooOld.cmake @@ -0,0 +1 @@ +enable_language(Swift) diff --git a/Tests/SwiftMix/CMain.c b/Tests/SwiftMix/CMain.c new file mode 100644 index 000000000..13e2f8cc6 --- /dev/null +++ b/Tests/SwiftMix/CMain.c @@ -0,0 +1,4 @@ +extern int ObjCMain(int argc, char const* const argv[]); +int main(int argc, char* argv[]) { + return ObjCMain(argc, argv); +} diff --git a/Tests/SwiftMix/CMakeLists.txt b/Tests/SwiftMix/CMakeLists.txt new file mode 100644 index 000000000..5e50470f6 --- /dev/null +++ b/Tests/SwiftMix/CMakeLists.txt @@ -0,0 +1,5 @@ +cmake_minimum_required(VERSION 3.3) +project(SwiftMix C Swift) + +add_executable(SwiftMix CMain.c ObjCMain.m SwiftMain.swift ObjC-Swift.h) +set_property(TARGET SwiftMix PROPERTY XCODE_ATTRIBUTE_SWIFT_OBJC_BRIDGING_HEADER "ObjC-Swift.h") diff --git a/Tests/SwiftMix/ObjC-Swift.h b/Tests/SwiftMix/ObjC-Swift.h new file mode 100644 index 000000000..e69de29bb diff --git a/Tests/SwiftMix/ObjCMain.m b/Tests/SwiftMix/ObjCMain.m new file mode 100644 index 000000000..7fa90aefb --- /dev/null +++ b/Tests/SwiftMix/ObjCMain.m @@ -0,0 +1,4 @@ +#import "SwiftMix-Swift.h" +int ObjCMain(int argc, char const* const argv[]) { + return [SwiftMainClass SwiftMain:argc argv:argv]; +} diff --git a/Tests/SwiftMix/SwiftMain.swift b/Tests/SwiftMix/SwiftMain.swift new file mode 100644 index 000000000..9af988375 --- /dev/null +++ b/Tests/SwiftMix/SwiftMain.swift @@ -0,0 +1,10 @@ +@objc class SwiftMainClass { + class func SwiftMain(argc:Int, argv:UnsafePointer>) -> Int32 { + println("argc: \(argc)") + for (var i = 0; i < argc; ++i) { + var argi = String.fromCString(argv[i]) + println("arg[\(i)]: \(argi)"); + } + return 0; + } +} diff --git a/Tests/SwiftOnly/CMakeLists.txt b/Tests/SwiftOnly/CMakeLists.txt new file mode 100644 index 000000000..5cb973945 --- /dev/null +++ b/Tests/SwiftOnly/CMakeLists.txt @@ -0,0 +1,4 @@ +cmake_minimum_required(VERSION 3.3) +project(SwiftOnly Swift) + +add_executable(SwiftOnly main.swift) diff --git a/Tests/SwiftOnly/main.swift b/Tests/SwiftOnly/main.swift new file mode 100644 index 000000000..67be9861e --- /dev/null +++ b/Tests/SwiftOnly/main.swift @@ -0,0 +1 @@ +println("SwiftOnly") From fd23fc57115d21ad08da6b131ec9abe141e583e5 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Tue, 7 Jul 2015 00:01:05 -0400 Subject: [PATCH 0264/1048] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index fd23b9218..d573101cc 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 3) -set(CMake_VERSION_PATCH 20150706) +set(CMake_VERSION_PATCH 20150707) #set(CMake_VERSION_RC 1) From 938bbc4352cf34532dc1f52998ec7d23532df765 Mon Sep 17 00:00:00 2001 From: Konstantin Podsvirov Date: Sun, 7 Dec 2014 21:25:28 +0300 Subject: [PATCH 0265/1048] CMake: Install COMPONENTs Added components: - cmake - ctest - cpack - cmake-gui - ccmake - data - sphinx-html - sphinx-singlehtml - sphinx-qthelp Other now Unspecified. --- CMakeCPack.cmake | 48 ++++++++--- CMakeCPackOptions.cmake.in | 84 ++++++++++++++++++- CMakeLists.txt | 1 + Source/CMakeLists.txt | 11 ++- Source/CursesDialog/CMakeLists.txt | 2 +- Source/QtDialog/CMakeLists.txt | 4 +- Source/QtIFW/CMake.Dialogs.QtGUI.qs | 21 +++++ .../CMake.Documentation.SphinxHTML.qs.in | 21 +++++ .../{installscript.qs.in => CMake.qs.in} | 12 ++- Utilities/Sphinx/CMakeLists.txt | 4 +- 10 files changed, 183 insertions(+), 25 deletions(-) create mode 100644 Source/QtIFW/CMake.Dialogs.QtGUI.qs create mode 100644 Source/QtIFW/CMake.Documentation.SphinxHTML.qs.in rename Source/QtIFW/{installscript.qs.in => CMake.qs.in} (81%) diff --git a/CMakeCPack.cmake b/CMakeCPack.cmake index 22ca8cfa1..b299e7f96 100644 --- a/CMakeCPack.cmake +++ b/CMakeCPack.cmake @@ -65,22 +65,48 @@ if(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake") endif() endif() + # Components + set(_CPACK_IFW_COMPONENTS_ALL cmake ctest cpack) + list(APPEND _CPACK_IFW_COMPONENTS_ALL data) + if(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME) + set(_CPACK_IFW_COMPONENT_UNSPECIFIED_NAME + ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME}) + else() + set(_CPACK_IFW_COMPONENT_UNSPECIFIED_NAME Unspecified) + endif() + list(APPEND _CPACK_IFW_COMPONENTS_ALL ${_CPACK_IFW_COMPONENT_UNSPECIFIED_NAME}) + string(TOUPPER "${_CPACK_IFW_COMPONENT_UNSPECIFIED_NAME}" + _CPACK_IFW_COMPONENT_UNSPECIFIED_UNAME) + if(BUILD_CursesDialog) + list(APPEND _CPACK_IFW_COMPONENTS_ALL ccmake) + endif() + if(BUILD_QtDialog) + list(APPEND _CPACK_IFW_COMPONENTS_ALL cmake-gui) + endif() + if(SPHINX_HTML) + list(APPEND _CPACK_IFW_COMPONENTS_ALL sphinx-html) + endif() + if(SPHINX_SINGLEHTML) + list(APPEND _CPACK_IFW_COMPONENTS_ALL sphinx-singlehtml) + endif() + if(SPHINX_QTHELP) + list(APPEND _CPACK_IFW_COMPONENTS_ALL sphinx-qthelp) + endif() + + # Components scripts configuration + foreach(_script + CMake + CMake.Documentation.SphinxHTML) + configure_file("${CMake_SOURCE_DIR}/Source/QtIFW/${_script}.qs.in" + "${CMake_BINARY_DIR}/${_script}.qs" @ONLY) + endforeach() + if(${CMAKE_SYSTEM_NAME} MATCHES Windows) set(_CPACK_IFW_PACKAGE_ICON "set(CPACK_IFW_PACKAGE_ICON \"${CMake_SOURCE_DIR}/Source/QtDialog/CMakeSetup.ico\")") - if(BUILD_QtDialog) - set(_CPACK_IFW_SHORTCUT_OPTIONAL "${_CPACK_IFW_SHORTCUT_OPTIONAL}component.addOperation(\"CreateShortcut\", \"@TargetDir@/bin/cmake-gui.exe\", \"@StartMenuDir@/CMake (cmake-gui).lnk\");\n") - endif() - if(SPHINX_HTML) - set(_CPACK_IFW_SHORTCUT_OPTIONAL "${_CPACK_IFW_SHORTCUT_OPTIONAL}component.addOperation(\"CreateShortcut\", \"@TargetDir@/doc/cmake-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}/html/index.html\", \"@StartMenuDir@/CMake Documentation.lnk\");\n") - endif() - configure_file("${CMake_SOURCE_DIR}/Source/QtIFW/installscript.qs.in" - "${CMake_BINARY_DIR}/installscript.qs" @ONLY - ) install(FILES "${CMake_SOURCE_DIR}/Source/QtIFW/cmake.org.html" - DESTINATION "." + DESTINATION "${CMAKE_DOC_DIR}" ) - set(_CPACK_IFW_PACKAGE_SCRIPT "set(CPACK_IFW_COMPONENT_GROUP_CMAKE_SCRIPT \"${CMake_BINARY_DIR}/installscript.qs\")") endif() if(${CMAKE_SYSTEM_NAME} MATCHES Linux) diff --git a/CMakeCPackOptions.cmake.in b/CMakeCPackOptions.cmake.in index 600356513..07c7017dc 100644 --- a/CMakeCPackOptions.cmake.in +++ b/CMakeCPackOptions.cmake.in @@ -44,17 +44,97 @@ if(CPACK_GENERATOR MATCHES "IFW") set(CPACK_IFW_PACKAGE_MAINTENANCE_TOOL_NAME "cmake-maintenance") # Package configuration group set(CPACK_IFW_PACKAGE_GROUP CMake) + # Components + set(CPACK_COMPONENTS_ALL "@_CPACK_IFW_COMPONENTS_ALL@") + set(CPACK_COMPONENTS_GROUPING IGNORE) + # Unspecified + set(CPACK_IFW_COMPONENT_@_CPACK_IFW_COMPONENT_UNSPECIFIED_UNAME@_VERSION + "@_CPACK_IFW_PACKAGE_VERSION@") # Group configuration set(CPACK_COMPONENT_GROUP_CMAKE_DISPLAY_NAME "@CPACK_PACKAGE_NAME@") set(CPACK_COMPONENT_GROUP_CMAKE_DESCRIPTION "@CPACK_PACKAGE_DESCRIPTION_SUMMARY@") - # IFW group configuration set(CPACK_IFW_COMPONENT_GROUP_CMAKE_VERSION "@_CPACK_IFW_PACKAGE_VERSION@") set(CPACK_IFW_COMPONENT_GROUP_CMAKE_LICENSES "@CPACK_PACKAGE_NAME@ Copyright" "@CPACK_RESOURCE_FILE_LICENSE@") - @_CPACK_IFW_PACKAGE_SCRIPT@ + set(CPACK_IFW_COMPONENT_GROUP_CMAKE_SCRIPT "@CMake_BINARY_DIR@/CMake.qs") + set(CPACK_IFW_COMPONENT_GROUP_CMAKE_PRIORITY 100) + + # Tools + set(CPACK_COMPONENT_GROUP_TOOLS_DISPLAY_NAME "Command-Line Tools") + set(CPACK_COMPONENT_GROUP_TOOLS_PARENT_GROUP CMake) + set(CPACK_IFW_COMPONENT_GROUP_TOOLS_PRIORITY 90) + set(CPACK_IFW_COMPONENT_GROUP_TOOLS_VERSION "@_CPACK_IFW_PACKAGE_VERSION@") + + set(CPACK_COMPONENT_CMAKE_DISPLAY_NAME "cmake") + set(CPACK_COMPONENT_CMAKE_GROUP Tools) + set(CPACK_IFW_COMPONENT_CMAKE_NAME "CMake") + set(CPACK_IFW_COMPONENT_CMAKE_VERSION "@_CPACK_IFW_PACKAGE_VERSION@") + + set(CPACK_COMPONENT_CTEST_DISPLAY_NAME "ctest") + set(CPACK_COMPONENT_CTEST_GROUP Tools) + set(CPACK_IFW_COMPONENT_CTEST_NAME "CTest") + set(CPACK_IFW_COMPONENT_CTEST_VERSION "@_CPACK_IFW_PACKAGE_VERSION@") + + set(CPACK_COMPONENT_CPACK_DISPLAY_NAME "cpack") + set(CPACK_COMPONENT_CPACK_GROUP Tools) + set(CPACK_IFW_COMPONENT_CPACK_NAME "CPack") + set(CPACK_IFW_COMPONENT_CPACK_VERSION "@_CPACK_IFW_PACKAGE_VERSION@") + + # Dialogs + set(CPACK_COMPONENT_GROUP_DIALOGS_DISPLAY_NAME "Interactive Dialogs") + set(CPACK_COMPONENT_GROUP_DIALOGS_PARENT_GROUP CMake) + set(CPACK_IFW_COMPONENT_GROUP_DIALOGS_PRIORITY 80) + set(CPACK_IFW_COMPONENT_GROUP_DIALOGS_VERSION "@_CPACK_IFW_PACKAGE_VERSION@") + + set(CPACK_COMPONENT_CMAKE-GUI_DISPLAY_NAME "cmake-gui") + set(CPACK_COMPONENT_CMAKE-GUI_GROUP Dialogs) + set(CPACK_IFW_COMPONENT_CMAKE-GUI_NAME "QtGUI") + set(CPACK_IFW_COMPONENT_CMAKE-GUI_SCRIPT + "@CMake_SOURCE_DIR@/Source/QtIFW/CMake.Dialogs.QtGUI.qs") + set(CPACK_IFW_COMPONENT_CMAKE-GUI_VERSION "@_CPACK_IFW_PACKAGE_VERSION@") + + set(CPACK_COMPONENT_CCMAKE_DISPLAY_NAME "ccmake") + set(CPACK_COMPONENT_CCMAKE_GROUP Dialogs) + set(CPACK_IFW_COMPONENT_CCMAKE_NAME "CursesGUI") + set(CPACK_IFW_COMPONENT_CCMAKE_VERSION "@_CPACK_IFW_PACKAGE_VERSION@") + + # Data + set(CPACK_COMPONENT_DATA_DISPLAY_NAME "Data") + set(CPACK_COMPONENT_DATA_DESCRIPTION + "CMake data files (help, modules and templates)") + set(CPACK_COMPONENT_DATA_GROUP CMake) + set(CPACK_IFW_COMPONENT_DATA_PRIORITY 70) + set(CPACK_IFW_COMPONENT_DATA_NAME "Data") + set(CPACK_IFW_COMPONENT_DATA_VERSION "@_CPACK_IFW_PACKAGE_VERSION@") + + # Documentation + set(CPACK_COMPONENT_GROUP_DOCUMENTATION_DISPLAY_NAME "Documentation") + set(CPACK_COMPONENT_GROUP_DOCUMENTATION_PARENT_GROUP CMake) + set(CPACK_IFW_COMPONENT_GROUP_DOCUMENTATION_PRIORITY 60) + set(CPACK_IFW_COMPONENT_GROUP_DOCUMENTATION_VERSION + "@_CPACK_IFW_PACKAGE_VERSION@") + + set(CPACK_COMPONENT_SPHINX-HTML_DISPLAY_NAME "HTML") + set(CPACK_COMPONENT_SPHINX-HTML_GROUP Documentation) + set(CPACK_IFW_COMPONENT_SPHINX-HTML_NAME "SphinxHTML") + set(CPACK_IFW_COMPONENT_SPHINX-HTML_SCRIPT + "@CMake_BINARY_DIR@/CMake.Documentation.SphinxHTML.qs") + set(CPACK_IFW_COMPONENT_SPHINX-HTML_VERSION "@_CPACK_IFW_PACKAGE_VERSION@") + + set(CPACK_COMPONENT_SPHINX-SINGLEHTML_DISPLAY_NAME "Single HTML") + set(CPACK_COMPONENT_SPHINX-SINGLEHTML_GROUP Documentation) + set(CPACK_IFW_COMPONENT_SPHINX-SINGLEHTML_NAME "SphinxSingleHTML") + set(CPACK_IFW_COMPONENT_SPHINX-SINGLEHTML_VERSION + "@_CPACK_IFW_PACKAGE_VERSION@") + + set(CPACK_COMPONENT_SPHINX-QTHELP_DISPLAY_NAME "Qt Compressed Help") + set(CPACK_COMPONENT_SPHINX-QTHELP_GROUP Documentation) + set(CPACK_IFW_COMPONENT_SPHINX-QTHELP_NAME "SphinxQtHelp") + set(CPACK_IFW_COMPONENT_SPHINX-QTHELP_VERSION "@_CPACK_IFW_PACKAGE_VERSION@") + endif() if(CPACK_GENERATOR MATCHES "CygwinSource") diff --git a/CMakeLists.txt b/CMakeLists.txt index 1b91ab893..2c40a1a4b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -652,6 +652,7 @@ if(NOT CMake_TEST_EXTERNAL_CMAKE) DIRECTORY_PERMISSIONS OWNER_READ OWNER_EXECUTE OWNER_WRITE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE + COMPONENT data PATTERN "*.sh*" PERMISSIONS OWNER_READ OWNER_EXECUTE OWNER_WRITE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 6d012fdde..83d3090eb 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -734,9 +734,16 @@ endif() include (${CMake_BINARY_DIR}/Source/LocalUserOptions.cmake OPTIONAL) include (${CMake_SOURCE_DIR}/Source/LocalUserOptions.cmake OPTIONAL) -install(TARGETS cmake ctest cpack DESTINATION bin) +# Install tools + +set(_tools cmake ctest cpack) + if(APPLE) - install(TARGETS cmakexbuild DESTINATION bin) + list(APPEND _tools cmakexbuild) endif() +foreach(_tool ${_tools}) + install(TARGETS ${_tool} DESTINATION bin COMPONENT ${_tool}) +endforeach() + install(FILES cmCPluginAPI.h DESTINATION ${CMAKE_DATA_DIR}/include) diff --git a/Source/CursesDialog/CMakeLists.txt b/Source/CursesDialog/CMakeLists.txt index 7d4e88cdc..14eb46c46 100644 --- a/Source/CursesDialog/CMakeLists.txt +++ b/Source/CursesDialog/CMakeLists.txt @@ -47,4 +47,4 @@ else() target_link_libraries(ccmake cmForm) endif() -install(TARGETS ccmake DESTINATION bin) +install(TARGETS ccmake DESTINATION bin COMPONENT ccmake) diff --git a/Source/QtDialog/CMakeLists.txt b/Source/QtDialog/CMakeLists.txt index 168f57d04..f3590c43b 100644 --- a/Source/QtDialog/CMakeLists.txt +++ b/Source/QtDialog/CMakeLists.txt @@ -165,7 +165,9 @@ endif() set(CMAKE_INSTALL_DESTINATION_ARGS BUNDLE DESTINATION "${CMAKE_BUNDLE_LOCATION}") -install(TARGETS cmake-gui RUNTIME DESTINATION bin ${CMAKE_INSTALL_DESTINATION_ARGS}) +install(TARGETS cmake-gui + RUNTIME DESTINATION bin COMPONENT cmake-gui + ${CMAKE_INSTALL_DESTINATION_ARGS}) if(UNIX AND NOT APPLE) foreach (size IN ITEMS 32 128) diff --git a/Source/QtIFW/CMake.Dialogs.QtGUI.qs b/Source/QtIFW/CMake.Dialogs.QtGUI.qs new file mode 100644 index 000000000..219a0a90a --- /dev/null +++ b/Source/QtIFW/CMake.Dialogs.QtGUI.qs @@ -0,0 +1,21 @@ +// Component: CMake.Dialogs.QtGUI + +function Component() +{ + // Default constructor +} + +Component.prototype.createOperations = function() +{ + // Create shortcut + if (installer.value("os") === "win") { + + component.addOperation("CreateShortcut", + installer.value("TargetDir") + "/bin/cmake-gui.exe", + installer.value("StartMenuDir") + "/CMake (cmake-gui).lnk"); + + } + + // Call default implementation + component.createOperations(); +} diff --git a/Source/QtIFW/CMake.Documentation.SphinxHTML.qs.in b/Source/QtIFW/CMake.Documentation.SphinxHTML.qs.in new file mode 100644 index 000000000..5c929e86f --- /dev/null +++ b/Source/QtIFW/CMake.Documentation.SphinxHTML.qs.in @@ -0,0 +1,21 @@ +// Component: CMake.Documentation.SphinxHTML + +function Component() +{ + // Default constructor +} + +Component.prototype.createOperations = function() +{ + // Create shortcut + if (installer.value("os") === "win") { + + component.addOperation("CreateShortcut", + installer.value("TargetDir") + "/@CMAKE_DOC_DIR@/html/index.html", + installer.value("StartMenuDir") + "/CMake Documentation.lnk"); + + } + + // Call default implementation + component.createOperations(); +} diff --git a/Source/QtIFW/installscript.qs.in b/Source/QtIFW/CMake.qs.in similarity index 81% rename from Source/QtIFW/installscript.qs.in rename to Source/QtIFW/CMake.qs.in index 570dba1e0..828cc7cb2 100644 --- a/Source/QtIFW/installscript.qs.in +++ b/Source/QtIFW/CMake.qs.in @@ -1,24 +1,22 @@ function Component() { - // default constructor + // Default constructor } Component.prototype.createOperations = function() { - // call default implementation to actually install applications! - component.createOperations(); - // Create shortcut if (installer.value("os") === "win") { -@_CPACK_IFW_SHORTCUT_OPTIONAL@ - component.addOperation("CreateShortcut", - installer.value("TargetDir") + "/cmake.org.html", + installer.value("TargetDir") + "/@CMAKE_DOC_DIR@/cmake.org.html", installer.value("StartMenuDir") + "/CMake Web Site.lnk"); component.addOperation("CreateShortcut", installer.value("TargetDir") + "/cmake-maintenance.exe", installer.value("StartMenuDir") + "/CMake Maintenance Tool.lnk"); } + + // Call default implementation + component.createOperations(); } diff --git a/Utilities/Sphinx/CMakeLists.txt b/Utilities/Sphinx/CMakeLists.txt index a755ca129..f2a3727fd 100644 --- a/Utilities/Sphinx/CMakeLists.txt +++ b/Utilities/Sphinx/CMakeLists.txt @@ -162,6 +162,7 @@ endif() if(SPHINX_HTML) install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html DESTINATION ${CMAKE_DOC_DIR} + COMPONENT sphinx-html PATTERN .buildinfo EXCLUDE ) endif() @@ -169,12 +170,13 @@ endif() if(SPHINX_SINGLEHTML) install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/singlehtml DESTINATION ${CMAKE_DOC_DIR} + COMPONENT sphinx-singlehtml PATTERN .buildinfo EXCLUDE ) endif() if(SPHINX_QTHELP) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/qthelp/CMake-${CMake_VERSION_MAJOR}${CMake_VERSION_MINOR}${CMake_VERSION_PATCH}.qch - DESTINATION ${CMAKE_DOC_DIR} + DESTINATION ${CMAKE_DOC_DIR} COMPONENT sphinx-qthelp ) endif() From 2531b9095491966c7dbcf717a8b6d3dc72c0fb9f Mon Sep 17 00:00:00 2001 From: Konstantin Podsvirov Date: Mon, 8 Dec 2014 00:30:15 +0300 Subject: [PATCH 0266/1048] CMake: Install COMPONENTs (QtDialog) Added "COMPONENT cmake-gui" for all install commands in lists file --- Source/QtDialog/CMakeLists.txt | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/Source/QtDialog/CMakeLists.txt b/Source/QtDialog/CMakeLists.txt index f3590c43b..abd440076 100644 --- a/Source/QtDialog/CMakeLists.txt +++ b/Source/QtDialog/CMakeLists.txt @@ -47,7 +47,8 @@ if (Qt5Widgets_FOUND) get_filename_component(_qt_plugin_type "${_qt_plugin_type}" NAME) set(_qt_plugin_dest "PlugIns/${_qt_plugin_type}") install(FILES "${_qt_plugin_path}" - DESTINATION "${_qt_plugin_dest}") + DESTINATION "${_qt_plugin_dest}" + COMPONENT cmake-gui) set(${_qt_plugins_var} "${${_qt_plugins_var}};\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${_qt_plugin_dest}/${_qt_plugin_file}") else() @@ -58,7 +59,8 @@ if (Qt5Widgets_FOUND) file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/qt.conf" "[Paths]\nPlugins = PlugIns\n") install(FILES "${CMAKE_CURRENT_BINARY_DIR}/qt.conf" - DESTINATION "${CMAKE_INSTALL_PREFIX}/Resources") + DESTINATION "${CMAKE_INSTALL_PREFIX}/Resources" + COMPONENT cmake-gui) endif() if(WIN32 AND TARGET Qt5::Core) @@ -130,7 +132,8 @@ endif() if(CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL) install(FILES ${CMake_SOURCE_DIR}/Licenses/LGPLv2.1.txt - DESTINATION ${CMAKE_DATA_DIR}/Licenses) + DESTINATION ${CMAKE_DATA_DIR}/Licenses + COMPONENT cmake-gui) set_property(SOURCE CMakeSetupDialog.cxx PROPERTY COMPILE_DEFINITIONS CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL) endif() @@ -163,7 +166,7 @@ if(APPLE) ) endif() set(CMAKE_INSTALL_DESTINATION_ARGS - BUNDLE DESTINATION "${CMAKE_BUNDLE_LOCATION}") + BUNDLE DESTINATION "${CMAKE_BUNDLE_LOCATION}" COMPONENT cmake-gui) install(TARGETS cmake-gui RUNTIME DESTINATION bin COMPONENT cmake-gui @@ -174,18 +177,25 @@ if(UNIX AND NOT APPLE) install( FILES "${CMAKE_CURRENT_SOURCE_DIR}/CMakeSetup${size}.png" DESTINATION "share/icons/hicolor/${size}x${size}/apps" + COMPONENT cmake-gui RENAME "CMakeSetup.png") endforeach () # install a desktop file so CMake appears in the application start menu # with an icon - install(FILES CMake.desktop DESTINATION share/applications ) - install(FILES cmakecache.xml DESTINATION share/mime/packages ) + install(FILES CMake.desktop + DESTINATION share/applications + COMPONENT cmake-gui) + install(FILES cmakecache.xml + DESTINATION share/mime/packages + COMPONENT cmake-gui) endif() if(APPLE) - install(CODE "execute_process(COMMAND ln -s \"../MacOS/CMake\" cmake-gui - WORKING_DIRECTORY \$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/bin)") + install(CODE " + execute_process(COMMAND ln -s \"../MacOS/CMake\" cmake-gui + WORKING_DIRECTORY \$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/bin) + " COMPONENT cmake-gui) endif() if(APPLE OR WIN32) @@ -199,7 +209,7 @@ if(APPLE OR WIN32) include(\"${CMake_SOURCE_DIR}/Modules/BundleUtilities.cmake\") set(BU_CHMOD_BUNDLE_ITEMS ON) fixup_bundle(\"${fixup_exe}\" \"${QT_PLUGINS}\" \"${QT_LIBRARY_DIR};${QT_BINARY_DIR}\") - ") + " COMPONENT cmake-gui) endif() set(CMAKE_PACKAGE_QTGUI TRUE) From 7383e4d722809e2460bd4e87ea7fdbef5f64c303 Mon Sep 17 00:00:00 2001 From: Konstantin Podsvirov Date: Wed, 10 Dec 2014 01:13:42 +0300 Subject: [PATCH 0267/1048] CMake: Install COMPONENTs (sphinx-man) Added component sphinx-man --- CMakeCPack.cmake | 3 +++ CMakeCPackOptions.cmake.in | 5 +++++ Utilities/Sphinx/CMakeLists.txt | 3 ++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CMakeCPack.cmake b/CMakeCPack.cmake index b299e7f96..0eda2bd06 100644 --- a/CMakeCPack.cmake +++ b/CMakeCPack.cmake @@ -83,6 +83,9 @@ if(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake") if(BUILD_QtDialog) list(APPEND _CPACK_IFW_COMPONENTS_ALL cmake-gui) endif() + if(SPHINX_MAN) + list(APPEND _CPACK_IFW_COMPONENTS_ALL sphinx-man) + endif() if(SPHINX_HTML) list(APPEND _CPACK_IFW_COMPONENTS_ALL sphinx-html) endif() diff --git a/CMakeCPackOptions.cmake.in b/CMakeCPackOptions.cmake.in index 07c7017dc..51ee4dbd7 100644 --- a/CMakeCPackOptions.cmake.in +++ b/CMakeCPackOptions.cmake.in @@ -117,6 +117,11 @@ if(CPACK_GENERATOR MATCHES "IFW") set(CPACK_IFW_COMPONENT_GROUP_DOCUMENTATION_VERSION "@_CPACK_IFW_PACKAGE_VERSION@") + set(CPACK_COMPONENT_SPHINX-MAN_DISPLAY_NAME "man") + set(CPACK_COMPONENT_SPHINX-MAN_GROUP Documentation) + set(CPACK_IFW_COMPONENT_SPHINX-MAN_NAME "SphinxMan") + set(CPACK_IFW_COMPONENT_SPHINX-MAN_VERSION "@_CPACK_IFW_PACKAGE_VERSION@") + set(CPACK_COMPONENT_SPHINX-HTML_DISPLAY_NAME "HTML") set(CPACK_COMPONENT_SPHINX-HTML_GROUP Documentation) set(CPACK_IFW_COMPONENT_SPHINX-HTML_NAME "SphinxHTML") diff --git a/Utilities/Sphinx/CMakeLists.txt b/Utilities/Sphinx/CMakeLists.txt index f2a3727fd..a76ee2653 100644 --- a/Utilities/Sphinx/CMakeLists.txt +++ b/Utilities/Sphinx/CMakeLists.txt @@ -154,7 +154,8 @@ if(SPHINX_MAN) set(name "${CMAKE_MATCH_1}") set(sec "${CMAKE_MATCH_2}") install(FILES ${CMAKE_CURRENT_BINARY_DIR}/man/${name}.${sec} - DESTINATION ${CMAKE_MAN_DIR}/man${sec}) + DESTINATION ${CMAKE_MAN_DIR}/man${sec} + COMPONENT sphinx-man) endif() endforeach() endif() From c823f04e0cbc4753cc5b6d5c9f45b9f015a12568 Mon Sep 17 00:00:00 2001 From: Konstantin Podsvirov Date: Fri, 3 Jul 2015 12:58:22 +0300 Subject: [PATCH 0268/1048] CMake: New option CMake_INSTALL_COMPONENTS By default is OFF. Now it's used with CPack IFW himself installer. --- CMakeCPack.cmake | 76 +++++++++++++++++++----------- CMakeCPackOptions.cmake.in | 46 ++++++++++++------ CMakeLists.txt | 12 ++++- Source/CMakeLists.txt | 3 +- Source/CursesDialog/CMakeLists.txt | 3 +- Source/QtDialog/CMakeLists.txt | 21 +++++---- Source/QtIFW/installscript.qs.in | 24 ++++++++++ Utilities/Sphinx/CMakeLists.txt | 12 +++-- 8 files changed, 137 insertions(+), 60 deletions(-) create mode 100644 Source/QtIFW/installscript.qs.in diff --git a/CMakeCPack.cmake b/CMakeCPack.cmake index 0eda2bd06..d7c602403 100644 --- a/CMakeCPack.cmake +++ b/CMakeCPack.cmake @@ -66,34 +66,40 @@ if(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake") endif() # Components - set(_CPACK_IFW_COMPONENTS_ALL cmake ctest cpack) - list(APPEND _CPACK_IFW_COMPONENTS_ALL data) - if(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME) - set(_CPACK_IFW_COMPONENT_UNSPECIFIED_NAME - ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME}) - else() - set(_CPACK_IFW_COMPONENT_UNSPECIFIED_NAME Unspecified) - endif() - list(APPEND _CPACK_IFW_COMPONENTS_ALL ${_CPACK_IFW_COMPONENT_UNSPECIFIED_NAME}) - string(TOUPPER "${_CPACK_IFW_COMPONENT_UNSPECIFIED_NAME}" - _CPACK_IFW_COMPONENT_UNSPECIFIED_UNAME) - if(BUILD_CursesDialog) - list(APPEND _CPACK_IFW_COMPONENTS_ALL ccmake) - endif() - if(BUILD_QtDialog) - list(APPEND _CPACK_IFW_COMPONENTS_ALL cmake-gui) - endif() - if(SPHINX_MAN) - list(APPEND _CPACK_IFW_COMPONENTS_ALL sphinx-man) - endif() - if(SPHINX_HTML) - list(APPEND _CPACK_IFW_COMPONENTS_ALL sphinx-html) - endif() - if(SPHINX_SINGLEHTML) - list(APPEND _CPACK_IFW_COMPONENTS_ALL sphinx-singlehtml) - endif() - if(SPHINX_QTHELP) - list(APPEND _CPACK_IFW_COMPONENTS_ALL sphinx-qthelp) + if(CMake_INSTALL_COMPONENTS) + set(_CPACK_IFW_COMPONENTS_ALL cmake ctest cpack) + if(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME) + set(_CPACK_IFW_COMPONENT_UNSPECIFIED_NAME + ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME}) + else() + set(_CPACK_IFW_COMPONENT_UNSPECIFIED_NAME Unspecified) + endif() + list(APPEND _CPACK_IFW_COMPONENTS_ALL ${_CPACK_IFW_COMPONENT_UNSPECIFIED_NAME}) + string(TOUPPER "${_CPACK_IFW_COMPONENT_UNSPECIFIED_NAME}" + _CPACK_IFW_COMPONENT_UNSPECIFIED_UNAME) + if(BUILD_CursesDialog) + list(APPEND _CPACK_IFW_COMPONENTS_ALL ccmake) + endif() + if(BUILD_QtDialog) + list(APPEND _CPACK_IFW_COMPONENTS_ALL cmake-gui) + endif() + if(SPHINX_MAN) + list(APPEND _CPACK_IFW_COMPONENTS_ALL sphinx-man) + endif() + if(SPHINX_HTML) + list(APPEND _CPACK_IFW_COMPONENTS_ALL sphinx-html) + endif() + if(SPHINX_SINGLEHTML) + list(APPEND _CPACK_IFW_COMPONENTS_ALL sphinx-singlehtml) + endif() + if(SPHINX_QTHELP) + list(APPEND _CPACK_IFW_COMPONENTS_ALL sphinx-qthelp) + endif() + set(_CPACK_IFW_COMPONENTS_CONFIGURATION " + # Components + set(CPACK_COMPONENTS_ALL \"${_CPACK_IFW_COMPONENTS_ALL}\") + set(CPACK_COMPONENTS_GROUPING IGNORE) +") endif() # Components scripts configuration @@ -107,9 +113,23 @@ if(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake") if(${CMAKE_SYSTEM_NAME} MATCHES Windows) set(_CPACK_IFW_PACKAGE_ICON "set(CPACK_IFW_PACKAGE_ICON \"${CMake_SOURCE_DIR}/Source/QtDialog/CMakeSetup.ico\")") + if(BUILD_QtDialog) + set(_CPACK_IFW_SHORTCUT_OPTIONAL "${_CPACK_IFW_SHORTCUT_OPTIONAL}component.addOperation(\"CreateShortcut\", \"@TargetDir@/bin/cmake-gui.exe\", \"@StartMenuDir@/CMake (cmake-gui).lnk\");\n") + endif() + if(SPHINX_HTML) + set(_CPACK_IFW_SHORTCUT_OPTIONAL "${_CPACK_IFW_SHORTCUT_OPTIONAL}component.addOperation(\"CreateShortcut\", \"@TargetDir@/doc/cmake-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}/html/index.html\", \"@StartMenuDir@/CMake Documentation.lnk\");\n") + endif() + configure_file("${CMake_SOURCE_DIR}/Source/QtIFW/installscript.qs.in" + "${CMake_BINARY_DIR}/installscript.qs" @ONLY + ) install(FILES "${CMake_SOURCE_DIR}/Source/QtIFW/cmake.org.html" DESTINATION "${CMAKE_DOC_DIR}" ) + if(CMake_INSTALL_COMPONENTS) + set(_CPACK_IFW_PACKAGE_SCRIPT "${CMake_BINARY_DIR}/CMake.qs") + else() + set(_CPACK_IFW_PACKAGE_SCRIPT "${CMake_BINARY_DIR}/installscript.qs") + endif() endif() if(${CMAKE_SYSTEM_NAME} MATCHES Linux) diff --git a/CMakeCPackOptions.cmake.in b/CMakeCPackOptions.cmake.in index 51ee4dbd7..c0e76e240 100644 --- a/CMakeCPackOptions.cmake.in +++ b/CMakeCPackOptions.cmake.in @@ -32,6 +32,7 @@ endif() include("@QT_DIALOG_CPACK_OPTIONS_FILE@" OPTIONAL) if(CPACK_GENERATOR MATCHES "IFW") + # Installer configuration set(CPACK_IFW_PACKAGE_TITLE "CMake Build Tool") set(CPACK_IFW_PRODUCT_URL "http://www.cmake.org") @@ -40,17 +41,20 @@ if(CPACK_GENERATOR MATCHES "IFW") "@CMake_SOURCE_DIR@/Source/QtDialog/CMakeSetup128.png") set(CPACK_IFW_PACKAGE_CONTROL_SCRIPT "@CMake_SOURCE_DIR@/Source/QtIFW/controlscript.qs") + # Uninstaller configuration set(CPACK_IFW_PACKAGE_MAINTENANCE_TOOL_NAME "cmake-maintenance") - # Package configuration group - set(CPACK_IFW_PACKAGE_GROUP CMake) - # Components - set(CPACK_COMPONENTS_ALL "@_CPACK_IFW_COMPONENTS_ALL@") - set(CPACK_COMPONENTS_GROUPING IGNORE) + @_CPACK_IFW_COMPONENTS_CONFIGURATION@ # Unspecified set(CPACK_IFW_COMPONENT_@_CPACK_IFW_COMPONENT_UNSPECIFIED_UNAME@_VERSION "@_CPACK_IFW_PACKAGE_VERSION@") + + # Package configuration group + set(CPACK_IFW_PACKAGE_GROUP CMake) + # Group configuration + + # CMake set(CPACK_COMPONENT_GROUP_CMAKE_DISPLAY_NAME "@CPACK_PACKAGE_NAME@") set(CPACK_COMPONENT_GROUP_CMAKE_DESCRIPTION @@ -59,32 +63,48 @@ if(CPACK_GENERATOR MATCHES "IFW") "@_CPACK_IFW_PACKAGE_VERSION@") set(CPACK_IFW_COMPONENT_GROUP_CMAKE_LICENSES "@CPACK_PACKAGE_NAME@ Copyright" "@CPACK_RESOURCE_FILE_LICENSE@") - set(CPACK_IFW_COMPONENT_GROUP_CMAKE_SCRIPT "@CMake_BINARY_DIR@/CMake.qs") + set(CPACK_IFW_COMPONENT_GROUP_CMAKE_SCRIPT "@_CPACK_IFW_PACKAGE_SCRIPT@") set(CPACK_IFW_COMPONENT_GROUP_CMAKE_PRIORITY 100) # Tools set(CPACK_COMPONENT_GROUP_TOOLS_DISPLAY_NAME "Command-Line Tools") + set(CPACK_COMPONENT_GROUP_TOOLS_DESCRIPTION + "Command-Line Tools: cmake, ctest and cpack") set(CPACK_COMPONENT_GROUP_TOOLS_PARENT_GROUP CMake) set(CPACK_IFW_COMPONENT_GROUP_TOOLS_PRIORITY 90) set(CPACK_IFW_COMPONENT_GROUP_TOOLS_VERSION "@_CPACK_IFW_PACKAGE_VERSION@") set(CPACK_COMPONENT_CMAKE_DISPLAY_NAME "cmake") + set(CPACK_COMPONENT_CMAKE_DESCRIPTION + "The \"cmake\" executable is the CMake command-line interface") + set(CPACK_COMPONENT_CMAKE_REQUIRED TRUE) set(CPACK_COMPONENT_CMAKE_GROUP Tools) set(CPACK_IFW_COMPONENT_CMAKE_NAME "CMake") + set(CPACK_IFW_COMPONENT_CMAKE_PRIORITY 89) set(CPACK_IFW_COMPONENT_CMAKE_VERSION "@_CPACK_IFW_PACKAGE_VERSION@") set(CPACK_COMPONENT_CTEST_DISPLAY_NAME "ctest") + set(CPACK_COMPONENT_CTEST_DESCRIPTION + "The \"ctest\" executable is the CMake test driver program") + set(CPACK_COMPONENT_CTEST_REQUIRED TRUE) set(CPACK_COMPONENT_CTEST_GROUP Tools) set(CPACK_IFW_COMPONENT_CTEST_NAME "CTest") + set(CPACK_IFW_COMPONENT_CTEST_PRIORITY 88) set(CPACK_IFW_COMPONENT_CTEST_VERSION "@_CPACK_IFW_PACKAGE_VERSION@") set(CPACK_COMPONENT_CPACK_DISPLAY_NAME "cpack") + set(CPACK_COMPONENT_CPACK_DESCRIPTION + "The \"cpack\" executable is the CMake packaging program") + set(CPACK_COMPONENT_CPACK_REQUIRED TRUE) set(CPACK_COMPONENT_CPACK_GROUP Tools) set(CPACK_IFW_COMPONENT_CPACK_NAME "CPack") + set(CPACK_IFW_COMPONENT_CPACK_PRIORITY 87) set(CPACK_IFW_COMPONENT_CPACK_VERSION "@_CPACK_IFW_PACKAGE_VERSION@") # Dialogs set(CPACK_COMPONENT_GROUP_DIALOGS_DISPLAY_NAME "Interactive Dialogs") + set(CPACK_COMPONENT_GROUP_DIALOGS_DESCRIPTION + "Interactive Dialogs with Console and GUI interfaces") set(CPACK_COMPONENT_GROUP_DIALOGS_PARENT_GROUP CMake) set(CPACK_IFW_COMPONENT_GROUP_DIALOGS_PRIORITY 80) set(CPACK_IFW_COMPONENT_GROUP_DIALOGS_VERSION "@_CPACK_IFW_PACKAGE_VERSION@") @@ -101,17 +121,10 @@ if(CPACK_GENERATOR MATCHES "IFW") set(CPACK_IFW_COMPONENT_CCMAKE_NAME "CursesGUI") set(CPACK_IFW_COMPONENT_CCMAKE_VERSION "@_CPACK_IFW_PACKAGE_VERSION@") - # Data - set(CPACK_COMPONENT_DATA_DISPLAY_NAME "Data") - set(CPACK_COMPONENT_DATA_DESCRIPTION - "CMake data files (help, modules and templates)") - set(CPACK_COMPONENT_DATA_GROUP CMake) - set(CPACK_IFW_COMPONENT_DATA_PRIORITY 70) - set(CPACK_IFW_COMPONENT_DATA_NAME "Data") - set(CPACK_IFW_COMPONENT_DATA_VERSION "@_CPACK_IFW_PACKAGE_VERSION@") - # Documentation set(CPACK_COMPONENT_GROUP_DOCUMENTATION_DISPLAY_NAME "Documentation") + set(CPACK_COMPONENT_GROUP_DOCUMENTATION_DESCRIPTION + "CMake Documentation in different formats (html, man, qch)") set(CPACK_COMPONENT_GROUP_DOCUMENTATION_PARENT_GROUP CMake) set(CPACK_IFW_COMPONENT_GROUP_DOCUMENTATION_PRIORITY 60) set(CPACK_IFW_COMPONENT_GROUP_DOCUMENTATION_VERSION @@ -119,6 +132,7 @@ if(CPACK_GENERATOR MATCHES "IFW") set(CPACK_COMPONENT_SPHINX-MAN_DISPLAY_NAME "man") set(CPACK_COMPONENT_SPHINX-MAN_GROUP Documentation) + set(CPACK_COMPONENT_SPHINX-MAN_DISABLED TRUE) set(CPACK_IFW_COMPONENT_SPHINX-MAN_NAME "SphinxMan") set(CPACK_IFW_COMPONENT_SPHINX-MAN_VERSION "@_CPACK_IFW_PACKAGE_VERSION@") @@ -131,12 +145,14 @@ if(CPACK_GENERATOR MATCHES "IFW") set(CPACK_COMPONENT_SPHINX-SINGLEHTML_DISPLAY_NAME "Single HTML") set(CPACK_COMPONENT_SPHINX-SINGLEHTML_GROUP Documentation) + set(CPACK_COMPONENT_SPHINX-SINGLEHTML_DISABLED TRUE) set(CPACK_IFW_COMPONENT_SPHINX-SINGLEHTML_NAME "SphinxSingleHTML") set(CPACK_IFW_COMPONENT_SPHINX-SINGLEHTML_VERSION "@_CPACK_IFW_PACKAGE_VERSION@") set(CPACK_COMPONENT_SPHINX-QTHELP_DISPLAY_NAME "Qt Compressed Help") set(CPACK_COMPONENT_SPHINX-QTHELP_GROUP Documentation) + set(CPACK_COMPONENT_SPHINX-QTHELP_DISABLED TRUE) set(CPACK_IFW_COMPONENT_SPHINX-QTHELP_NAME "SphinxQtHelp") set(CPACK_IFW_COMPONENT_SPHINX-QTHELP_VERSION "@_CPACK_IFW_PACKAGE_VERSION@") diff --git a/CMakeLists.txt b/CMakeLists.txt index 2c40a1a4b..5e9402847 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -59,6 +59,17 @@ if(CMAKE_ENCODING_UTF8) set(KWSYS_ENCODING_DEFAULT_CODEPAGE CP_UTF8) endif() +# option to use COMPONENT with install command +option(CMake_INSTALL_COMPONENTS "Using components when installing" OFF) +mark_as_advanced(CMake_INSTALL_COMPONENTS) +macro(CMake_OPTIONAL_COMPONENT NAME) + if(CMake_INSTALL_COMPONENTS) + set(COMPONENT COMPONENT ${NAME}) + else() + set(COMPONENT) + endif() +endmacro() + #----------------------------------------------------------------------- # a macro to deal with system libraries, implemented as a macro # simply to improve readability of the main script @@ -652,7 +663,6 @@ if(NOT CMake_TEST_EXTERNAL_CMAKE) DIRECTORY_PERMISSIONS OWNER_READ OWNER_EXECUTE OWNER_WRITE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE - COMPONENT data PATTERN "*.sh*" PERMISSIONS OWNER_READ OWNER_EXECUTE OWNER_WRITE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 83d3090eb..aa3f675e0 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -743,7 +743,8 @@ if(APPLE) endif() foreach(_tool ${_tools}) - install(TARGETS ${_tool} DESTINATION bin COMPONENT ${_tool}) + CMake_OPTIONAL_COMPONENT(${_tool}) + install(TARGETS ${_tool} DESTINATION bin ${COMPONENT}) endforeach() install(FILES cmCPluginAPI.h DESTINATION ${CMAKE_DATA_DIR}/include) diff --git a/Source/CursesDialog/CMakeLists.txt b/Source/CursesDialog/CMakeLists.txt index 14eb46c46..93ff4256e 100644 --- a/Source/CursesDialog/CMakeLists.txt +++ b/Source/CursesDialog/CMakeLists.txt @@ -47,4 +47,5 @@ else() target_link_libraries(ccmake cmForm) endif() -install(TARGETS ccmake DESTINATION bin COMPONENT ccmake) +CMake_OPTIONAL_COMPONENT(ccmake) +install(TARGETS ccmake DESTINATION bin ${COMPONENT}) diff --git a/Source/QtDialog/CMakeLists.txt b/Source/QtDialog/CMakeLists.txt index abd440076..038c41170 100644 --- a/Source/QtDialog/CMakeLists.txt +++ b/Source/QtDialog/CMakeLists.txt @@ -14,6 +14,7 @@ project(QtDialog) if(POLICY CMP0020) cmake_policy(SET CMP0020 NEW) # Drop when CMake >= 2.8.11 required endif() +CMake_OPTIONAL_COMPONENT(cmake-gui) find_package(Qt5Widgets QUIET) if (Qt5Widgets_FOUND) include_directories(${Qt5Widgets_INCLUDE_DIRS}) @@ -48,7 +49,7 @@ if (Qt5Widgets_FOUND) set(_qt_plugin_dest "PlugIns/${_qt_plugin_type}") install(FILES "${_qt_plugin_path}" DESTINATION "${_qt_plugin_dest}" - COMPONENT cmake-gui) + ${COMPONENT}) set(${_qt_plugins_var} "${${_qt_plugins_var}};\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${_qt_plugin_dest}/${_qt_plugin_file}") else() @@ -60,7 +61,7 @@ if (Qt5Widgets_FOUND) "[Paths]\nPlugins = PlugIns\n") install(FILES "${CMAKE_CURRENT_BINARY_DIR}/qt.conf" DESTINATION "${CMAKE_INSTALL_PREFIX}/Resources" - COMPONENT cmake-gui) + ${COMPONENT}) endif() if(WIN32 AND TARGET Qt5::Core) @@ -133,7 +134,7 @@ endif() if(CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL) install(FILES ${CMake_SOURCE_DIR}/Licenses/LGPLv2.1.txt DESTINATION ${CMAKE_DATA_DIR}/Licenses - COMPONENT cmake-gui) + ${COMPONENT}) set_property(SOURCE CMakeSetupDialog.cxx PROPERTY COMPILE_DEFINITIONS CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL) endif() @@ -166,10 +167,10 @@ if(APPLE) ) endif() set(CMAKE_INSTALL_DESTINATION_ARGS - BUNDLE DESTINATION "${CMAKE_BUNDLE_LOCATION}" COMPONENT cmake-gui) + BUNDLE DESTINATION "${CMAKE_BUNDLE_LOCATION}" ${COMPONENT}) install(TARGETS cmake-gui - RUNTIME DESTINATION bin COMPONENT cmake-gui + RUNTIME DESTINATION bin ${COMPONENT} ${CMAKE_INSTALL_DESTINATION_ARGS}) if(UNIX AND NOT APPLE) @@ -177,7 +178,7 @@ if(UNIX AND NOT APPLE) install( FILES "${CMAKE_CURRENT_SOURCE_DIR}/CMakeSetup${size}.png" DESTINATION "share/icons/hicolor/${size}x${size}/apps" - COMPONENT cmake-gui + ${COMPONENT} RENAME "CMakeSetup.png") endforeach () @@ -185,17 +186,17 @@ if(UNIX AND NOT APPLE) # with an icon install(FILES CMake.desktop DESTINATION share/applications - COMPONENT cmake-gui) + ${COMPONENT}) install(FILES cmakecache.xml DESTINATION share/mime/packages - COMPONENT cmake-gui) + ${COMPONENT}) endif() if(APPLE) install(CODE " execute_process(COMMAND ln -s \"../MacOS/CMake\" cmake-gui WORKING_DIRECTORY \$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/bin) - " COMPONENT cmake-gui) + " ${COMPONENT}) endif() if(APPLE OR WIN32) @@ -209,7 +210,7 @@ if(APPLE OR WIN32) include(\"${CMake_SOURCE_DIR}/Modules/BundleUtilities.cmake\") set(BU_CHMOD_BUNDLE_ITEMS ON) fixup_bundle(\"${fixup_exe}\" \"${QT_PLUGINS}\" \"${QT_LIBRARY_DIR};${QT_BINARY_DIR}\") - " COMPONENT cmake-gui) + " ${COMPONENT}) endif() set(CMAKE_PACKAGE_QTGUI TRUE) diff --git a/Source/QtIFW/installscript.qs.in b/Source/QtIFW/installscript.qs.in new file mode 100644 index 000000000..570dba1e0 --- /dev/null +++ b/Source/QtIFW/installscript.qs.in @@ -0,0 +1,24 @@ +function Component() +{ + // default constructor +} + +Component.prototype.createOperations = function() +{ + // call default implementation to actually install applications! + component.createOperations(); + + // Create shortcut + if (installer.value("os") === "win") { + +@_CPACK_IFW_SHORTCUT_OPTIONAL@ + + component.addOperation("CreateShortcut", + installer.value("TargetDir") + "/cmake.org.html", + installer.value("StartMenuDir") + "/CMake Web Site.lnk"); + + component.addOperation("CreateShortcut", + installer.value("TargetDir") + "/cmake-maintenance.exe", + installer.value("StartMenuDir") + "/CMake Maintenance Tool.lnk"); + } +} diff --git a/Utilities/Sphinx/CMakeLists.txt b/Utilities/Sphinx/CMakeLists.txt index a76ee2653..77a12558a 100644 --- a/Utilities/Sphinx/CMakeLists.txt +++ b/Utilities/Sphinx/CMakeLists.txt @@ -153,31 +153,35 @@ if(SPHINX_MAN) if("x${m}" MATCHES "^x(.+)\\.([1-9])\\.rst$") set(name "${CMAKE_MATCH_1}") set(sec "${CMAKE_MATCH_2}") + CMake_OPTIONAL_COMPONENT(sphinx-man) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/man/${name}.${sec} DESTINATION ${CMAKE_MAN_DIR}/man${sec} - COMPONENT sphinx-man) + ${COMPONENT}) endif() endforeach() endif() if(SPHINX_HTML) + CMake_OPTIONAL_COMPONENT(sphinx-html) install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html DESTINATION ${CMAKE_DOC_DIR} - COMPONENT sphinx-html + ${COMPONENT} PATTERN .buildinfo EXCLUDE ) endif() if(SPHINX_SINGLEHTML) + CMake_OPTIONAL_COMPONENT(sphinx-singlehtml) install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/singlehtml DESTINATION ${CMAKE_DOC_DIR} - COMPONENT sphinx-singlehtml + ${COMPONENT} PATTERN .buildinfo EXCLUDE ) endif() if(SPHINX_QTHELP) + CMake_OPTIONAL_COMPONENT(sphinx-qthelp) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/qthelp/CMake-${CMake_VERSION_MAJOR}${CMake_VERSION_MINOR}${CMake_VERSION_PATCH}.qch - DESTINATION ${CMAKE_DOC_DIR} COMPONENT sphinx-qthelp + DESTINATION ${CMAKE_DOC_DIR} ${COMPONENT} ) endif() From c14f20f7dd827bd1b9164b3641db697776de85bf Mon Sep 17 00:00:00 2001 From: Konstantin Podsvirov Date: Fri, 3 Jul 2015 14:05:40 +0300 Subject: [PATCH 0269/1048] CMake: Fix Web Site shortcut in IFW installer for Windows --- Source/QtIFW/installscript.qs.in | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/QtIFW/installscript.qs.in b/Source/QtIFW/installscript.qs.in index 570dba1e0..3411e34e4 100644 --- a/Source/QtIFW/installscript.qs.in +++ b/Source/QtIFW/installscript.qs.in @@ -5,20 +5,20 @@ function Component() Component.prototype.createOperations = function() { - // call default implementation to actually install applications! - component.createOperations(); - // Create shortcut if (installer.value("os") === "win") { @_CPACK_IFW_SHORTCUT_OPTIONAL@ component.addOperation("CreateShortcut", - installer.value("TargetDir") + "/cmake.org.html", + installer.value("TargetDir") + "/@CMAKE_DOC_DIR@/cmake.org.html", installer.value("StartMenuDir") + "/CMake Web Site.lnk"); component.addOperation("CreateShortcut", installer.value("TargetDir") + "/cmake-maintenance.exe", installer.value("StartMenuDir") + "/CMake Maintenance Tool.lnk"); } + + // Call default implementation + component.createOperations(); } From ecca26855a786bb126341e7fba59557325e54f7b Mon Sep 17 00:00:00 2001 From: Konstantin Podsvirov Date: Fri, 3 Jul 2015 14:50:27 +0300 Subject: [PATCH 0270/1048] CMake: optional show LGPLv2.1 license when install cmake-gui component In IFW installer if cmake-gui component selected and CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL enabled license will be showed. --- CMakeCPack.cmake | 7 +++++++ CMakeCPackOptions.cmake.in | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CMakeCPack.cmake b/CMakeCPack.cmake index d7c602403..54816ecf0 100644 --- a/CMakeCPack.cmake +++ b/CMakeCPack.cmake @@ -82,6 +82,8 @@ if(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake") endif() if(BUILD_QtDialog) list(APPEND _CPACK_IFW_COMPONENTS_ALL cmake-gui) + set(_CPACK_IFW_COMPONENT_CMAKE-GUI_LICENSES "set(CPACK_IFW_COMPONENT_CMAKE-GUI_LICENSES + \"LGPLv2.1\" \"${CMake_SOURCE_DIR}/Licenses/LGPLv2.1.txt\")") endif() if(SPHINX_MAN) list(APPEND _CPACK_IFW_COMPONENTS_ALL sphinx-man) @@ -100,6 +102,11 @@ if(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake") set(CPACK_COMPONENTS_ALL \"${_CPACK_IFW_COMPONENTS_ALL}\") set(CPACK_COMPONENTS_GROUPING IGNORE) ") + else() + if(BUILD_QtDialog AND CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL) + set(_CPACK_IFW_ADDITIONAL_LICENSES + "\"LGPLv2.1\" \"${CMake_SOURCE_DIR}/Licenses/LGPLv2.1.txt\"") + endif() endif() # Components scripts configuration diff --git a/CMakeCPackOptions.cmake.in b/CMakeCPackOptions.cmake.in index c0e76e240..7beda8c86 100644 --- a/CMakeCPackOptions.cmake.in +++ b/CMakeCPackOptions.cmake.in @@ -62,7 +62,8 @@ if(CPACK_GENERATOR MATCHES "IFW") set(CPACK_IFW_COMPONENT_GROUP_CMAKE_VERSION "@_CPACK_IFW_PACKAGE_VERSION@") set(CPACK_IFW_COMPONENT_GROUP_CMAKE_LICENSES - "@CPACK_PACKAGE_NAME@ Copyright" "@CPACK_RESOURCE_FILE_LICENSE@") + "@CPACK_PACKAGE_NAME@ Copyright" "@CPACK_RESOURCE_FILE_LICENSE@" + @_CPACK_IFW_ADDITIONAL_LICENSES@) set(CPACK_IFW_COMPONENT_GROUP_CMAKE_SCRIPT "@_CPACK_IFW_PACKAGE_SCRIPT@") set(CPACK_IFW_COMPONENT_GROUP_CMAKE_PRIORITY 100) @@ -115,6 +116,7 @@ if(CPACK_GENERATOR MATCHES "IFW") set(CPACK_IFW_COMPONENT_CMAKE-GUI_SCRIPT "@CMake_SOURCE_DIR@/Source/QtIFW/CMake.Dialogs.QtGUI.qs") set(CPACK_IFW_COMPONENT_CMAKE-GUI_VERSION "@_CPACK_IFW_PACKAGE_VERSION@") + @_CPACK_IFW_COMPONENT_CMAKE-GUI_LICENSES@ set(CPACK_COMPONENT_CCMAKE_DISPLAY_NAME "ccmake") set(CPACK_COMPONENT_CCMAKE_GROUP Dialogs) From d7725a178bd498f7b50634490b6846ab9bb245f2 Mon Sep 17 00:00:00 2001 From: Konstantin Podsvirov Date: Tue, 7 Jul 2015 09:28:25 +0300 Subject: [PATCH 0271/1048] CMake: Add cmakexbuild component as REQUIRED to Tools group for IFW installer --- CMakeCPack.cmake | 3 +++ CMakeCPackOptions.cmake.in | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/CMakeCPack.cmake b/CMakeCPack.cmake index 54816ecf0..ce10ad0ed 100644 --- a/CMakeCPack.cmake +++ b/CMakeCPack.cmake @@ -68,6 +68,9 @@ if(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake") # Components if(CMake_INSTALL_COMPONENTS) set(_CPACK_IFW_COMPONENTS_ALL cmake ctest cpack) + if(APPLE) + list(APPEND _CPACK_IFW_COMPONENTS_ALL cmakexbuild) + endif() if(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME) set(_CPACK_IFW_COMPONENT_UNSPECIFIED_NAME ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME}) diff --git a/CMakeCPackOptions.cmake.in b/CMakeCPackOptions.cmake.in index 7beda8c86..a1e425a3a 100644 --- a/CMakeCPackOptions.cmake.in +++ b/CMakeCPackOptions.cmake.in @@ -102,6 +102,15 @@ if(CPACK_GENERATOR MATCHES "IFW") set(CPACK_IFW_COMPONENT_CPACK_PRIORITY 87) set(CPACK_IFW_COMPONENT_CPACK_VERSION "@_CPACK_IFW_PACKAGE_VERSION@") + set(CPACK_COMPONENT_CMAKEXBUILD_DISPLAY_NAME "cmakexbuild") + set(CPACK_COMPONENT_CMAKEXBUILD_DESCRIPTION + "The \"cmakexbuild\" executable is a wrapper program for \"xcodebuild\"") + set(CPACK_COMPONENT_CMAKEXBUILD_REQUIRED TRUE) + set(CPACK_COMPONENT_CMAKEXBUILD_GROUP Tools) + set(CPACK_IFW_COMPONENT_CMAKEXBUILD_NAME "CMakeXBuild") + set(CPACK_IFW_COMPONENT_CMAKEXBUILD_PRIORITY 86) + set(CPACK_IFW_COMPONENT_CMAKEXBUILD_VERSION "@_CPACK_IFW_PACKAGE_VERSION@") + # Dialogs set(CPACK_COMPONENT_GROUP_DIALOGS_DISPLAY_NAME "Interactive Dialogs") set(CPACK_COMPONENT_GROUP_DIALOGS_DESCRIPTION From 2b18cdcaba48ffeee753d97d8241dbf2a8333493 Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Mon, 6 Jul 2015 22:28:04 +0200 Subject: [PATCH 0272/1048] string: add APPEND subcommand --- Help/command/string.rst | 3 + Help/release/dev/string-append.rst | 4 ++ Source/cmStringCommand.cxx | 32 ++++++++++ Source/cmStringCommand.h | 1 + Tests/RunCMake/string/Append.cmake | 58 +++++++++++++++++++ Tests/RunCMake/string/AppendNoArgs-result.txt | 1 + Tests/RunCMake/string/AppendNoArgs-stderr.txt | 4 ++ Tests/RunCMake/string/AppendNoArgs.cmake | 1 + Tests/RunCMake/string/RunCMakeTest.cmake | 3 + 9 files changed, 107 insertions(+) create mode 100644 Help/release/dev/string-append.rst create mode 100644 Tests/RunCMake/string/Append.cmake create mode 100644 Tests/RunCMake/string/AppendNoArgs-result.txt create mode 100644 Tests/RunCMake/string/AppendNoArgs-stderr.txt create mode 100644 Tests/RunCMake/string/AppendNoArgs.cmake diff --git a/Help/command/string.rst b/Help/command/string.rst index 34c1b6179..bc4399c05 100644 --- a/Help/command/string.rst +++ b/Help/command/string.rst @@ -15,6 +15,7 @@ String operations. string(REPLACE [...]) + string(APPEND [...]) string(CONCAT [...]) string( ) @@ -55,6 +56,8 @@ through argument parsing. ``REPLACE`` will replace all occurrences of ``match_string`` in the input with ``replace_string`` and store the result in the output. +``APPEND`` will append all the input arguments to the string. + ``CONCAT`` will concatenate all the input arguments together and store the result in the named output variable. diff --git a/Help/release/dev/string-append.rst b/Help/release/dev/string-append.rst new file mode 100644 index 000000000..190b51ee7 --- /dev/null +++ b/Help/release/dev/string-append.rst @@ -0,0 +1,4 @@ +string-append +------------- + +* The :command:`string` command learned a new ``APPEND`` subcommand. diff --git a/Source/cmStringCommand.cxx b/Source/cmStringCommand.cxx index edc6afc19..efc1f1627 100644 --- a/Source/cmStringCommand.cxx +++ b/Source/cmStringCommand.cxx @@ -74,6 +74,10 @@ bool cmStringCommand { return this->HandleLengthCommand(args); } + else if(subCommand == "APPEND") + { + return this->HandleAppendCommand(args); + } else if(subCommand == "CONCAT") { return this->HandleConcatCommand(args); @@ -729,6 +733,34 @@ bool cmStringCommand return true; } +//---------------------------------------------------------------------------- +bool cmStringCommand::HandleAppendCommand(std::vector const& args) +{ + if(args.size() < 2) + { + this->SetError("sub-command APPEND requires at least one argument."); + return false; + } + + // Skip if nothing to append. + if(args.size() < 3) + { + return true; + } + + const std::string& variable = args[1]; + + std::string value; + const char* oldValue = this->Makefile->GetDefinition(variable); + if(oldValue) + { + value = oldValue; + } + value += cmJoin(cmRange(args).advance(2), std::string()); + this->Makefile->AddDefinition(variable, value.c_str()); + return true; +} + //---------------------------------------------------------------------------- bool cmStringCommand ::HandleConcatCommand(std::vector const& args) diff --git a/Source/cmStringCommand.h b/Source/cmStringCommand.h index 9c75095c1..3ed17ebd3 100644 --- a/Source/cmStringCommand.h +++ b/Source/cmStringCommand.h @@ -67,6 +67,7 @@ protected: bool HandleReplaceCommand(std::vector const& args); bool HandleLengthCommand(std::vector const& args); bool HandleSubstringCommand(std::vector const& args); + bool HandleAppendCommand(std::vector const& args); bool HandleConcatCommand(std::vector const& args); bool HandleStripCommand(std::vector const& args); bool HandleRandomCommand(std::vector const& args); diff --git a/Tests/RunCMake/string/Append.cmake b/Tests/RunCMake/string/Append.cmake new file mode 100644 index 000000000..2634274bf --- /dev/null +++ b/Tests/RunCMake/string/Append.cmake @@ -0,0 +1,58 @@ +set(out) +string(APPEND out) +if(DEFINED out) + message(FATAL_ERROR "\"string(APPEND out)\" set out to \"${out}\"") +endif() + +set(out "") +string(APPEND out) +if(NOT out STREQUAL "") + message(FATAL_ERROR "\"string(APPEND out)\" set out to \"${out}\"") +endif() + +set(out x) +string(APPEND out) +if(NOT out STREQUAL "x") + message(FATAL_ERROR "\"string(APPEND out)\" set out to \"${out}\"") +endif() + + +set(out) +string(APPEND out a) +if(NOT out STREQUAL "a") + message(FATAL_ERROR "\"string(APPEND out a)\" set out to \"${out}\"") +endif() + +set(out "") +string(APPEND out a) +if(NOT out STREQUAL "a") + message(FATAL_ERROR "\"string(APPEND out a)\" set out to \"${out}\"") +endif() + +set(out x) +string(APPEND out a) +if(NOT out STREQUAL "xa") + message(FATAL_ERROR "\"string(APPEND out a)\" set out to \"${out}\"") +endif() + + +set(out x) +string(APPEND out a "b") +if(NOT out STREQUAL "xab") + message(FATAL_ERROR "\"string(APPEND out a \"b\")\" set out to \"${out}\"") +endif() + +set(b) +set(out x) +string(APPEND out ${b}) +if(NOT out STREQUAL "x") + message(FATAL_ERROR "\"string(APPEND out \${b})\" set out to \"${out}\"") +endif() + +set(b b) +set(out x) +string(APPEND out a "${b}" [[ +${c}]]) +if(NOT out STREQUAL "xab\${c}") + message(FATAL_ERROR "\"string(APPEND out a \"\${b}\" [[\${c}]])\" set out to \"${out}\"") +endif() diff --git a/Tests/RunCMake/string/AppendNoArgs-result.txt b/Tests/RunCMake/string/AppendNoArgs-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/string/AppendNoArgs-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/string/AppendNoArgs-stderr.txt b/Tests/RunCMake/string/AppendNoArgs-stderr.txt new file mode 100644 index 000000000..75ad427fd --- /dev/null +++ b/Tests/RunCMake/string/AppendNoArgs-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at AppendNoArgs.cmake:1 \(string\): + string sub-command APPEND requires at least one argument. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/string/AppendNoArgs.cmake b/Tests/RunCMake/string/AppendNoArgs.cmake new file mode 100644 index 000000000..f54fb7719 --- /dev/null +++ b/Tests/RunCMake/string/AppendNoArgs.cmake @@ -0,0 +1 @@ +string(APPEND) diff --git a/Tests/RunCMake/string/RunCMakeTest.cmake b/Tests/RunCMake/string/RunCMakeTest.cmake index 89f7ea517..8067d9dbf 100644 --- a/Tests/RunCMake/string/RunCMakeTest.cmake +++ b/Tests/RunCMake/string/RunCMakeTest.cmake @@ -1,5 +1,8 @@ include(RunCMake) +run_cmake(Append) +run_cmake(AppendNoArgs) + run_cmake(Concat) run_cmake(ConcatNoArgs) From 9ce7a663d6d50c6f2d7a3fbc76ed10c5af6a91a5 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 7 Jul 2015 09:38:48 -0400 Subject: [PATCH 0273/1048] Utilities/Sphinx: Add CMake_OPTIONAL_COMPONENT macro When building this directory independently define the macro since we will not get the definition from the top level of the source tree. --- Utilities/Sphinx/CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Utilities/Sphinx/CMakeLists.txt b/Utilities/Sphinx/CMakeLists.txt index 77a12558a..1baca35e4 100644 --- a/Utilities/Sphinx/CMakeLists.txt +++ b/Utilities/Sphinx/CMakeLists.txt @@ -19,6 +19,9 @@ if(NOT CMake_SOURCE_DIR) include(${CMake_SOURCE_DIR}/Source/CMakeInstallDestinations.cmake) unset(CMAKE_DATA_DIR) unset(CMAKE_DATA_DIR CACHE) + macro(CMake_OPTIONAL_COMPONENT) + set(COMPONENT "") + endmacro() endif() project(CMakeHelp NONE) From 3b60232ebcde69789a6c26f5c523ad107a7099c5 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 7 Jul 2015 14:12:38 -0400 Subject: [PATCH 0274/1048] cmake: Preserve cached CMAKE_GENERATOR when an error occurs (#15640) Since commit v2.4.0~4158 (When the initially configured generator is invalid, allow the user to change the generator without deleting the cache by hand, 2003-05-13) we remove CMAKE_GENERATOR from the cache if an error occurs and CMAKE_MAKE_PROGRAM is not cached. This worked at the time because all generators initialized the CMAKE_MAKE_PROGRAM cache entry. Since commit v3.0.0-rc1~260^2~4 (VS: Switch to internal CMAKE_MAKE_PROGRAM lookup by generators, 2013-11-15) and commit v3.2.0-rc1~39^2 (Xcode: Switch to internal CMAKE_MAKE_PROGRAM lookup by generator, 2015-01-28) the VS and Xcode generators no longer store CMAKE_MAKE_PROGRAM in the cache. Therefore any error during generation would wipe out CMAKE_GENERATOR from the cache and cause the next configuration to choose a default generator. Simply drop the behavior introduced by the original commit and always preserve CMAKE_GENERATOR. Since the time that behavior was introduced a lot more state is now saved in CMakeCache.txt and CMakeFiles/ during the initial configuration so it is not safe to change generators without starting fresh anyway. --- Source/cmake.cxx | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 05703990f..7bf3832a9 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -1439,19 +1439,6 @@ int cmake::ActualConfigure() } } - if(cmSystemTools::GetFatalErrorOccured()) - { - const char* makeProgram = - this->State->GetInitializedCacheValue("CMAKE_MAKE_PROGRAM"); - if (!makeProgram || cmSystemTools::IsOff(makeProgram)) - { - // We must have a bad generator selection. Wipe the cache entry so the - // user can select another. - this->State->RemoveCacheEntry("CMAKE_GENERATOR"); - this->State->RemoveCacheEntry("CMAKE_EXTRA_GENERATOR"); - } - } - cmMakefile* mf=this->GlobalGenerator->GetLocalGenerators()[0]->GetMakefile(); if (mf->IsOn("CTEST_USE_LAUNCHERS") && !this->State->GetGlobalProperty("RULE_LAUNCH_COMPILE")) From b98574dab2f4fb28c53025c5204cc06ece7de0c2 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Wed, 8 Jul 2015 00:01:05 -0400 Subject: [PATCH 0275/1048] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index d573101cc..1348c2789 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 3) -set(CMake_VERSION_PATCH 20150707) +set(CMake_VERSION_PATCH 20150708) #set(CMake_VERSION_RC 1) From 42272a82ca0992d40200bb881df41407f8386b8c Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Tue, 7 Jul 2015 13:06:39 -0400 Subject: [PATCH 0276/1048] KWSys 2015-07-07 (8504e845) Extract upstream KWSys using the following shell commands. $ git archive --prefix=upstream-kwsys/ 8504e845 | tar x $ git shortlog --no-merges --abbrev=8 --format='%h %s' 1f19c187..8504e845 Brad King (1): 8504e845 Process: Simplify Windows command line construction --- ProcessWin32.c | 151 +++++++++++++++++++------------------------------ 1 file changed, 58 insertions(+), 93 deletions(-) diff --git a/ProcessWin32.c b/ProcessWin32.c index f63017187..a7dd2ca3e 100644 --- a/ProcessWin32.c +++ b/ProcessWin32.c @@ -11,14 +11,12 @@ ============================================================================*/ #include "kwsysPrivate.h" #include KWSYS_HEADER(Process.h) -#include KWSYS_HEADER(System.h) #include KWSYS_HEADER(Encoding.h) /* Work-around CMake dependency scanning limitation. This must duplicate the above list of headers. */ #if 0 # include "Process.h.in" -# include "System.h.in" # include "Encoding_c.h.in" #endif @@ -120,11 +118,6 @@ static void kwsysProcessSetupPipeNative(HANDLE native, PHANDLE handle); static void kwsysProcessCleanupHandle(PHANDLE h); static void kwsysProcessCleanup(kwsysProcess* cp, int error); static void kwsysProcessCleanErrorMessage(kwsysProcess* cp); -static int kwsysProcessComputeCommandLength(kwsysProcess* cp, - char const* const* command); -static void kwsysProcessComputeCommandLine(kwsysProcess* cp, - char const* const* command, - char* cmd); static int kwsysProcessGetTimeoutTime(kwsysProcess* cp, double* userTimeout, kwsysProcessTime* timeoutTime); static int kwsysProcessGetTimeoutLeft(kwsysProcessTime* timeoutTime, @@ -602,37 +595,69 @@ int kwsysProcess_AddCommand(kwsysProcess* cp, char const* const* command) } } - /* We need to construct a single string representing the command - and its arguments. We will surround each argument containing - spaces with double-quotes. Inside a double-quoted argument, we - need to escape double-quotes and all backslashes before them. - We also need to escape backslashes at the end of an argument - because they come before the closing double-quote for the - argument. */ - { - /* First determine the length of the final string. */ - int length = kwsysProcessComputeCommandLength(cp, command); - - /* Allocate enough space for the command. We do not need an extra - byte for the terminating null because we allocated a space for - the first argument that we will not use. */ - char* new_cmd = malloc(length); - if(!new_cmd) + if (cp->Verbatim) { - /* Out of memory. */ + /* Copy the verbatim command line into the buffer. */ + newCommands[cp->NumberOfCommands] = kwsysEncoding_DupToWide(*command); + } + else + { + /* Encode the arguments so CommandLineToArgvW can decode + them from the command line string in the child. */ + char buffer[32768]; /* CreateProcess max command-line length. */ + char* end = buffer + sizeof(buffer); + char* out = buffer; + char const* const* a; + for (a = command; *a; ++a) + { + int quote = !**a; /* Quote the empty string. */ + int slashes = 0; + char const* c; + if (a != command && out != end) { *out++ = ' '; } + for (c = *a; !quote && *c; ++c) + { quote = (*c == ' ' || *c == '\t'); } + if (quote && out != end) { *out++ = '"'; } + for (c = *a; *c; ++c) + { + if (*c == '\\') + { + ++slashes; + } + else + { + if (*c == '"') + { + // Add n+1 backslashes to total 2n+1 before internal '"'. + while(slashes-- >= 0 && out != end) { *out++ = '\\'; } + } + slashes = 0; + } + if (out != end) { *out++ = *c; } + } + if (quote) + { + // Add n backslashes to total 2n before ending '"'. + while (slashes-- > 0 && out != end) { *out++ = '\\'; } + if (out != end) { *out++ = '"'; } + } + } + if(out != end) + { + *out = '\0'; + newCommands[cp->NumberOfCommands] = kwsysEncoding_DupToWide(buffer); + } + else + { + newCommands[cp->NumberOfCommands] = 0; + } + } + if (!newCommands[cp->NumberOfCommands]) + { + /* Out of memory or command line too long. */ free(newCommands); return 0; } - /* Construct the command line in the allocated buffer. */ - kwsysProcessComputeCommandLine(cp, command, - new_cmd); - - newCommands[cp->NumberOfCommands] = kwsysEncoding_DupToWide(new_cmd); - free(new_cmd); - } - - /* Save the new array of commands. */ free(cp->Commands); cp->Commands = newCommands; @@ -1961,66 +1986,6 @@ void kwsysProcessCleanErrorMessage(kwsysProcess* cp) } } -/*--------------------------------------------------------------------------*/ -int kwsysProcessComputeCommandLength(kwsysProcess* cp, - char const* const* command) -{ - int length = 0; - if(cp->Verbatim) - { - /* Treat the first argument as a verbatim command line. Use its - length directly and add space for the null-terminator. */ - length = (int)strlen(*command)+1; - } - else - { - /* Compute the length of the command line when it is converted to - a single string. Space for the null-terminator is allocated by - the whitespace character allocated for the first argument that - will not be used. */ - char const* const* arg; - for(arg = command; *arg; ++arg) - { - /* Add the length of this argument. It already includes room - for a separating space or terminating null. */ - length += kwsysSystem_Shell_GetArgumentSizeForWindows(*arg, 0); - } - } - - return length; -} - -/*--------------------------------------------------------------------------*/ -void kwsysProcessComputeCommandLine(kwsysProcess* cp, - char const* const* command, - char* cmd) -{ - if(cp->Verbatim) - { - /* Copy the verbatim command line into the buffer. */ - strcpy(cmd, *command); - } - else - { - /* Construct the command line in the allocated buffer. */ - char const* const* arg; - for(arg = command; *arg; ++arg) - { - /* Add the separating space if this is not the first argument. */ - if(arg != command) - { - *cmd++ = ' '; - } - - /* Add the current argument. */ - cmd = kwsysSystem_Shell_GetArgumentForWindows(*arg, cmd, 0); - } - - /* Add the terminating null character to the command line. */ - *cmd = 0; - } -} - /*--------------------------------------------------------------------------*/ /* Get the time at which either the process or user timeout will expire. Returns 1 if the user timeout is first, and 0 otherwise. */ From 30faf20caf43c93f9211622124d6b91dffdedb42 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 7 Jul 2015 14:27:32 -0400 Subject: [PATCH 0277/1048] cmLocalGenerator: Remove unused include --- Source/cmLocalGenerator.cxx | 2 -- 1 file changed, 2 deletions(-) diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 6f98ee2a0..e1702535f 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -32,8 +32,6 @@ # include #endif -#include - #include // for isalpha #include From cedd6e65d22870524eaee1394f023cf001d56aff Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 7 Jul 2015 14:33:46 -0400 Subject: [PATCH 0278/1048] cmLocalVisualStudio7Generator: Remove unused include --- Source/cmLocalVisualStudio7Generator.cxx | 2 -- 1 file changed, 2 deletions(-) diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index dc3a16d4c..65f9bba2f 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -23,8 +23,6 @@ #include "cmComputeLinkInformation.h" #include "cmGeneratedFileStream.h" -#include - #include // for isspace static bool cmLVS6G_IsFAT(const char* dir); From bb7eefe4dd4b1385b830ac0f784af883a3d91985 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 7 Jul 2015 14:31:46 -0400 Subject: [PATCH 0279/1048] cmOutputConverter: Adopt EscapeWindowsShellArgument method Move it out of cmSystemTools and into cmOutputConverter. --- Source/cmOutputConverter.cxx | 20 ++++++++++++++++++++ Source/cmOutputConverter.h | 5 +++++ Source/cmSystemTools.cxx | 19 ------------------- Source/cmSystemTools.h | 5 ----- Source/cmVisualStudioGeneratorOptions.cxx | 3 ++- 5 files changed, 27 insertions(+), 25 deletions(-) diff --git a/Source/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx index b0a30a1ca..161a5b493 100644 --- a/Source/cmOutputConverter.cxx +++ b/Source/cmOutputConverter.cxx @@ -411,6 +411,26 @@ std::string cmOutputConverter::EscapeForCMake(const std::string& str) return result; } +//---------------------------------------------------------------------------- +std::string +cmOutputConverter::EscapeWindowsShellArgument(const char* arg, int shell_flags) +{ + char local_buffer[1024]; + char* buffer = local_buffer; + int size = cmsysSystem_Shell_GetArgumentSizeForWindows(arg, shell_flags); + if(size > 1024) + { + buffer = new char[size]; + } + cmsysSystem_Shell_GetArgumentForWindows(arg, buffer, shell_flags); + std::string result(buffer); + if(buffer != local_buffer) + { + delete [] buffer; + } + return result; +} + //---------------------------------------------------------------------------- cmOutputConverter::FortranFormat cmOutputConverter::GetFortranFormat(const char* value) diff --git a/Source/cmOutputConverter.h b/Source/cmOutputConverter.h index 482a64b1c..8739b979f 100644 --- a/Source/cmOutputConverter.h +++ b/Source/cmOutputConverter.h @@ -71,6 +71,11 @@ public: static std::string EscapeForCMake(const std::string& str); + /** Compute an escaped version of the given argument for use in a + windows shell. */ + static std::string EscapeWindowsShellArgument(const char* arg, + int shell_flags); + enum FortranFormat { FortranFormatNone, diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 7230a64f9..2543e6841 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -556,25 +556,6 @@ void cmSystemTools::ParseUnixCommandLine(const char* command, argv.Store(args); } -std::string cmSystemTools::EscapeWindowsShellArgument(const char* arg, - int shell_flags) -{ - char local_buffer[1024]; - char* buffer = local_buffer; - int size = cmsysSystem_Shell_GetArgumentSizeForWindows(arg, shell_flags); - if(size > 1024) - { - buffer = new char[size]; - } - cmsysSystem_Shell_GetArgumentForWindows(arg, buffer, shell_flags); - std::string result(buffer); - if(buffer != local_buffer) - { - delete [] buffer; - } - return result; -} - std::vector cmSystemTools::ParseArguments(const char* command) { std::vector args; diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index 8ebb4e325..fb58307d0 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -256,11 +256,6 @@ public: static void ParseUnixCommandLine(const char* command, std::vector& args); - /** Compute an escaped version of the given argument for use in a - windows shell. See kwsys/System.h.in for details. */ - static std::string EscapeWindowsShellArgument(const char* arg, - int shell_flags); - static void EnableMessages() { s_DisableMessages = false; } static void DisableMessages() { s_DisableMessages = true; } static void DisableRunCommandOutput() {s_DisableRunCommandOutput = true; } diff --git a/Source/cmVisualStudioGeneratorOptions.cxx b/Source/cmVisualStudioGeneratorOptions.cxx index 6512fc25e..c028ab716 100644 --- a/Source/cmVisualStudioGeneratorOptions.cxx +++ b/Source/cmVisualStudioGeneratorOptions.cxx @@ -1,4 +1,5 @@ #include "cmVisualStudioGeneratorOptions.h" +#include "cmOutputConverter.h" #include "cmSystemTools.h" #include #include "cmVisualStudio10TargetGenerator.h" @@ -246,7 +247,7 @@ void cmVisualStudioGeneratorOptions::StoreUnknownFlag(const char* flag) // This option is not known. Store it in the output flags. this->FlagString += " "; this->FlagString += - cmSystemTools::EscapeWindowsShellArgument( + cmOutputConverter::EscapeWindowsShellArgument( flag, cmsysSystem_Shell_Flag_AllowMakeVariables | cmsysSystem_Shell_Flag_VSIDE); From df97bea2427706d56dc15587b88e0f268ee37622 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 7 Jul 2015 15:06:44 -0400 Subject: [PATCH 0280/1048] cmOutputConverter: Adopt command line escaping code Port code from the KWSys System_Shell APIs into cmOutputConverter. Drop it from our copy of KWSys because upstream will drop it too, and by doing it in this commit 'git blame' may have an easier time connecting the history of the content. --- Source/cmOutputConverter.cxx | 615 +++++++++++++++++++++- Source/cmOutputConverter.h | 70 +++ Source/cmVisualStudioGeneratorOptions.cxx | 5 +- Source/kwsys/System.c | 585 +------------------- Source/kwsys/System.h.in | 98 ---- 5 files changed, 673 insertions(+), 700 deletions(-) diff --git a/Source/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx index 161a5b493..7cd6a47b5 100644 --- a/Source/cmOutputConverter.cxx +++ b/Source/cmOutputConverter.cxx @@ -14,10 +14,11 @@ #include "cmAlgorithms.h" #include "cmake.h" -#include - #include +#include /* strlen */ +#include /* isalpha */ + cmOutputConverter::cmOutputConverter(cmState::Snapshot snapshot) : StateSnapshot(snapshot), LinkScriptShell(false) { @@ -330,51 +331,51 @@ std::string cmOutputConverter::EscapeForShell(const std::string& str, int flags = 0; if(this->GetState()->UseWindowsVSIDE()) { - flags |= cmsysSystem_Shell_Flag_VSIDE; + flags |= Shell_Flag_VSIDE; } else if(!this->LinkScriptShell) { - flags |= cmsysSystem_Shell_Flag_Make; + flags |= Shell_Flag_Make; } if(makeVars) { - flags |= cmsysSystem_Shell_Flag_AllowMakeVariables; + flags |= Shell_Flag_AllowMakeVariables; } if(forEcho) { - flags |= cmsysSystem_Shell_Flag_EchoWindows; + flags |= Shell_Flag_EchoWindows; } if(useWatcomQuote) { - flags |= cmsysSystem_Shell_Flag_WatcomQuote; + flags |= Shell_Flag_WatcomQuote; } if(this->GetState()->UseWatcomWMake()) { - flags |= cmsysSystem_Shell_Flag_WatcomWMake; + flags |= Shell_Flag_WatcomWMake; } if(this->GetState()->UseMinGWMake()) { - flags |= cmsysSystem_Shell_Flag_MinGWMake; + flags |= Shell_Flag_MinGWMake; } if(this->GetState()->UseNMake()) { - flags |= cmsysSystem_Shell_Flag_NMake; + flags |= Shell_Flag_NMake; } // Compute the buffer size needed. int size = (this->GetState()->UseWindowsShell() ? - cmsysSystem_Shell_GetArgumentSizeForWindows(str.c_str(), flags) : - cmsysSystem_Shell_GetArgumentSizeForUnix(str.c_str(), flags)); + Shell_GetArgumentSizeForWindows(str.c_str(), flags) : + Shell_GetArgumentSizeForUnix(str.c_str(), flags)); // Compute the shell argument itself. std::vector arg(size); if(this->GetState()->UseWindowsShell()) { - cmsysSystem_Shell_GetArgumentForWindows(str.c_str(), &arg[0], flags); + Shell_GetArgumentForWindows(str.c_str(), &arg[0], flags); } else { - cmsysSystem_Shell_GetArgumentForUnix(str.c_str(), &arg[0], flags); + Shell_GetArgumentForUnix(str.c_str(), &arg[0], flags); } return std::string(&arg[0]); } @@ -417,12 +418,12 @@ cmOutputConverter::EscapeWindowsShellArgument(const char* arg, int shell_flags) { char local_buffer[1024]; char* buffer = local_buffer; - int size = cmsysSystem_Shell_GetArgumentSizeForWindows(arg, shell_flags); + int size = Shell_GetArgumentSizeForWindows(arg, shell_flags); if(size > 1024) { buffer = new char[size]; } - cmsysSystem_Shell_GetArgumentForWindows(arg, buffer, shell_flags); + Shell_GetArgumentForWindows(arg, buffer, shell_flags); std::string result(buffer); if(buffer != local_buffer) { @@ -465,3 +466,585 @@ cmState* cmOutputConverter::GetState() const { return this->StateSnapshot.GetState(); } + +//---------------------------------------------------------------------------- +/* + +Notes: + +Make variable replacements open a can of worms. Sometimes they should +be quoted and sometimes not. Sometimes their replacement values are +already quoted. + +VS variables cause problems. In order to pass the referenced value +with spaces the reference must be quoted. If the variable value ends +in a backslash then it will escape the ending quote! In order to make +the ending backslash appear we need this: + + "$(InputDir)\" + +However if there is not a trailing backslash then this will put a +quote in the value so we need: + + "$(InputDir)" + +Make variable references are platform specific so we should probably +just NOT quote them and let the listfile author deal with it. + +*/ + +/* +TODO: For windows echo: + +To display a pipe (|) or redirection character (< or >) when using the +echo command, use a caret character immediately before the pipe or +redirection character (for example, ^>, ^<, or ^| ). If you need to +use the caret character itself (^), use two in a row (^^). +*/ + +/*--------------------------------------------------------------------------*/ +int cmOutputConverter::Shell__CharIsWhitespace(char c) +{ + return ((c == ' ') || (c == '\t')); +} + +/*--------------------------------------------------------------------------*/ +int cmOutputConverter::Shell__CharNeedsQuotesOnUnix(char c) +{ + return ((c == '\'') || (c == '`') || (c == ';') || (c == '#') || + (c == '&') || (c == '$') || (c == '(') || (c == ')') || + (c == '~') || (c == '<') || (c == '>') || (c == '|') || + (c == '*') || (c == '^') || (c == '\\')); +} + +/*--------------------------------------------------------------------------*/ +int cmOutputConverter::Shell__CharNeedsQuotesOnWindows(char c) +{ + return ((c == '\'') || (c == '#') || (c == '&') || + (c == '<') || (c == '>') || (c == '|') || (c == '^')); +} + +/*--------------------------------------------------------------------------*/ +int cmOutputConverter::Shell__CharNeedsQuotes(char c, int isUnix, int flags) +{ + /* On Windows the built-in command shell echo never needs quotes. */ + if(!isUnix && (flags & Shell_Flag_EchoWindows)) + { + return 0; + } + + /* On all platforms quotes are needed to preserve whitespace. */ + if(Shell__CharIsWhitespace(c)) + { + return 1; + } + + if(isUnix) + { + /* On UNIX several special characters need quotes to preserve them. */ + if(Shell__CharNeedsQuotesOnUnix(c)) + { + return 1; + } + } + else + { + /* On Windows several special characters need quotes to preserve them. */ + if(Shell__CharNeedsQuotesOnWindows(c)) + { + return 1; + } + } + return 0; +} + +/*--------------------------------------------------------------------------*/ +int cmOutputConverter::Shell__CharIsMakeVariableName(char c) +{ + return c && (c == '_' || isalpha(((int)c))); +} + +/*--------------------------------------------------------------------------*/ +const char* cmOutputConverter::Shell__SkipMakeVariables(const char* c) +{ + while(*c == '$' && *(c+1) == '(') + { + const char* skip = c+2; + while(Shell__CharIsMakeVariableName(*skip)) + { + ++skip; + } + if(*skip == ')') + { + c = skip+1; + } + else + { + break; + } + } + return c; +} + +/* +Allowing make variable replacements opens a can of worms. Sometimes +they should be quoted and sometimes not. Sometimes their replacement +values are already quoted or contain escapes. + +Some Visual Studio variables cause problems. In order to pass the +referenced value with spaces the reference must be quoted. If the +variable value ends in a backslash then it will escape the ending +quote! In order to make the ending backslash appear we need this: + + "$(InputDir)\" + +However if there is not a trailing backslash then this will put a +quote in the value so we need: + + "$(InputDir)" + +This macro decides whether we quote an argument just because it +contains a make variable reference. This should be replaced with a +flag later when we understand applications of this better. +*/ +#define KWSYS_SYSTEM_SHELL_QUOTE_MAKE_VARIABLES 0 + +/*--------------------------------------------------------------------------*/ +int cmOutputConverter::Shell__ArgumentNeedsQuotes(const char* in, + int isUnix, int flags) +{ + /* The empty string needs quotes. */ + if(!*in) + { + return 1; + } + + /* Scan the string for characters that require quoting. */ + { + const char* c; + for(c=in; *c; ++c) + { + /* Look for $(MAKEVAR) syntax if requested. */ + if(flags & Shell_Flag_AllowMakeVariables) + { +#if KWSYS_SYSTEM_SHELL_QUOTE_MAKE_VARIABLES + const char* skip = Shell__SkipMakeVariables(c); + if(skip != c) + { + /* We need to quote make variable references to preserve the + string with contents substituted in its place. */ + return 1; + } +#else + /* Skip over the make variable references if any are present. */ + c = Shell__SkipMakeVariables(c); + + /* Stop if we have reached the end of the string. */ + if(!*c) + { + break; + } +#endif + } + + /* Check whether this character needs quotes. */ + if(Shell__CharNeedsQuotes(*c, isUnix, flags)) + { + return 1; + } + } + } + + /* On Windows some single character arguments need quotes. */ + if(!isUnix && *in && !*(in+1)) + { + char c = *in; + if((c == '?') || (c == '&') || (c == '^') || (c == '|') || (c == '#')) + { + return 1; + } + } + + return 0; +} + +/*--------------------------------------------------------------------------*/ +int cmOutputConverter::Shell__GetArgumentSize(const char* in, + int isUnix, int flags) +{ + /* Start with the length of the original argument, plus one for + either a terminating null or a separating space. */ + int size = (int)strlen(in) + 1; + + /* String iterator. */ + const char* c; + + /* Keep track of how many backslashes have been encountered in a row. */ + int windows_backslashes = 0; + + /* Scan the string for characters that require escaping or quoting. */ + for(c=in; *c; ++c) + { + /* Look for $(MAKEVAR) syntax if requested. */ + if(flags & Shell_Flag_AllowMakeVariables) + { + /* Skip over the make variable references if any are present. */ + c = Shell__SkipMakeVariables(c); + + /* Stop if we have reached the end of the string. */ + if(!*c) + { + break; + } + } + + /* Check whether this character needs escaping for the shell. */ + if(isUnix) + { + /* On Unix a few special characters need escaping even inside a + quoted argument. */ + if(*c == '\\' || *c == '"' || *c == '`' || *c == '$') + { + /* This character needs a backslash to escape it. */ + ++size; + } + } + else if(flags & Shell_Flag_EchoWindows) + { + /* On Windows the built-in command shell echo never needs escaping. */ + } + else + { + /* On Windows only backslashes and double-quotes need escaping. */ + if(*c == '\\') + { + /* Found a backslash. It may need to be escaped later. */ + ++windows_backslashes; + } + else if(*c == '"') + { + /* Found a double-quote. We need to escape it and all + immediately preceding backslashes. */ + size += windows_backslashes + 1; + windows_backslashes = 0; + } + else + { + /* Found another character. This eliminates the possibility + that any immediately preceding backslashes will be + escaped. */ + windows_backslashes = 0; + } + } + + /* Check whether this character needs escaping for a make tool. */ + if(*c == '$') + { + if(flags & Shell_Flag_Make) + { + /* In Makefiles a dollar is written $$ so we need one extra + character. */ + ++size; + } + else if(flags & Shell_Flag_VSIDE) + { + /* In a VS IDE a dollar is written "$" so we need two extra + characters. */ + size += 2; + } + } + else if(*c == '#') + { + if((flags & Shell_Flag_Make) && + (flags & Shell_Flag_WatcomWMake)) + { + /* In Watcom WMake makefiles a pound is written $# so we need + one extra character. */ + ++size; + } + } + else if(*c == '%') + { + if((flags & Shell_Flag_VSIDE) || + ((flags & Shell_Flag_Make) && + ((flags & Shell_Flag_MinGWMake) || + (flags & Shell_Flag_NMake)))) + { + /* In the VS IDE, NMake, or MinGW make a percent is written %% + so we need one extra characters. */ + size += 1; + } + } + else if(*c == ';') + { + if(flags & Shell_Flag_VSIDE) + { + /* In a VS IDE a semicolon is written ";" so we need two extra + characters. */ + size += 2; + } + } + } + + /* Check whether the argument needs surrounding quotes. */ + if(Shell__ArgumentNeedsQuotes(in, isUnix, flags)) + { + /* Surrounding quotes are needed. Allocate space for them. */ + if((flags & Shell_Flag_WatcomQuote) && (isUnix)) + { + size += 2; + } + size += 2; + + /* We must escape all ending backslashes when quoting on windows. */ + size += windows_backslashes; + } + + return size; +} + +/*--------------------------------------------------------------------------*/ +char* cmOutputConverter::Shell__GetArgument(const char* in, char* out, + int isUnix, int flags) +{ + /* String iterator. */ + const char* c; + + /* Keep track of how many backslashes have been encountered in a row. */ + int windows_backslashes = 0; + + /* Whether the argument must be quoted. */ + int needQuotes = Shell__ArgumentNeedsQuotes(in, isUnix, flags); + if(needQuotes) + { + /* Add the opening quote for this argument. */ + if(flags & Shell_Flag_WatcomQuote) + { + if(isUnix) + { + *out++ = '"'; + } + *out++ = '\''; + } + else + { + *out++ = '"'; + } + } + + /* Scan the string for characters that require escaping or quoting. */ + for(c=in; *c; ++c) + { + /* Look for $(MAKEVAR) syntax if requested. */ + if(flags & Shell_Flag_AllowMakeVariables) + { + const char* skip = Shell__SkipMakeVariables(c); + if(skip != c) + { + /* Copy to the end of the make variable references. */ + while(c != skip) + { + *out++ = *c++; + } + + /* The make variable reference eliminates any escaping needed + for preceding backslashes. */ + windows_backslashes = 0; + + /* Stop if we have reached the end of the string. */ + if(!*c) + { + break; + } + } + } + + /* Check whether this character needs escaping for the shell. */ + if(isUnix) + { + /* On Unix a few special characters need escaping even inside a + quoted argument. */ + if(*c == '\\' || *c == '"' || *c == '`' || *c == '$') + { + /* This character needs a backslash to escape it. */ + *out++ = '\\'; + } + } + else if(flags & Shell_Flag_EchoWindows) + { + /* On Windows the built-in command shell echo never needs escaping. */ + } + else + { + /* On Windows only backslashes and double-quotes need escaping. */ + if(*c == '\\') + { + /* Found a backslash. It may need to be escaped later. */ + ++windows_backslashes; + } + else if(*c == '"') + { + /* Found a double-quote. Escape all immediately preceding + backslashes. */ + while(windows_backslashes > 0) + { + --windows_backslashes; + *out++ = '\\'; + } + + /* Add the backslash to escape the double-quote. */ + *out++ = '\\'; + } + else + { + /* We encountered a normal character. This eliminates any + escaping needed for preceding backslashes. */ + windows_backslashes = 0; + } + } + + /* Check whether this character needs escaping for a make tool. */ + if(*c == '$') + { + if(flags & Shell_Flag_Make) + { + /* In Makefiles a dollar is written $$. The make tool will + replace it with just $ before passing it to the shell. */ + *out++ = '$'; + *out++ = '$'; + } + else if(flags & Shell_Flag_VSIDE) + { + /* In a VS IDE a dollar is written "$". If this is written in + an un-quoted argument it starts a quoted segment, inserts + the $ and ends the segment. If it is written in a quoted + argument it ends quoting, inserts the $ and restarts + quoting. Either way the $ is isolated from surrounding + text to avoid looking like a variable reference. */ + *out++ = '"'; + *out++ = '$'; + *out++ = '"'; + } + else + { + /* Otherwise a dollar is written just $. */ + *out++ = '$'; + } + } + else if(*c == '#') + { + if((flags & Shell_Flag_Make) && + (flags & Shell_Flag_WatcomWMake)) + { + /* In Watcom WMake makefiles a pound is written $#. The make + tool will replace it with just # before passing it to the + shell. */ + *out++ = '$'; + *out++ = '#'; + } + else + { + /* Otherwise a pound is written just #. */ + *out++ = '#'; + } + } + else if(*c == '%') + { + if((flags & Shell_Flag_VSIDE) || + ((flags & Shell_Flag_Make) && + ((flags & Shell_Flag_MinGWMake) || + (flags & Shell_Flag_NMake)))) + { + /* In the VS IDE, NMake, or MinGW make a percent is written %%. */ + *out++ = '%'; + *out++ = '%'; + } + else + { + /* Otherwise a percent is written just %. */ + *out++ = '%'; + } + } + else if(*c == ';') + { + if(flags & Shell_Flag_VSIDE) + { + /* In a VS IDE a semicolon is written ";". If this is written + in an un-quoted argument it starts a quoted segment, + inserts the ; and ends the segment. If it is written in a + quoted argument it ends quoting, inserts the ; and restarts + quoting. Either way the ; is isolated. */ + *out++ = '"'; + *out++ = ';'; + *out++ = '"'; + } + else + { + /* Otherwise a semicolon is written just ;. */ + *out++ = ';'; + } + } + else + { + /* Store this character. */ + *out++ = *c; + } + } + + if(needQuotes) + { + /* Add enough backslashes to escape any trailing ones. */ + while(windows_backslashes > 0) + { + --windows_backslashes; + *out++ = '\\'; + } + + /* Add the closing quote for this argument. */ + if(flags & Shell_Flag_WatcomQuote) + { + *out++ = '\''; + if(isUnix) + { + *out++ = '"'; + } + } + else + { + *out++ = '"'; + } + } + + /* Store a terminating null without incrementing. */ + *out = 0; + + return out; +} + +/*--------------------------------------------------------------------------*/ +char* cmOutputConverter::Shell_GetArgumentForWindows(const char* in, + char* out, int flags) +{ + return Shell__GetArgument(in, out, 0, flags); +} + +/*--------------------------------------------------------------------------*/ +char* cmOutputConverter::Shell_GetArgumentForUnix(const char* in, + char* out, int flags) +{ + return Shell__GetArgument(in, out, 1, flags); +} + +/*--------------------------------------------------------------------------*/ +int cmOutputConverter::Shell_GetArgumentSizeForWindows(const char* in, + int flags) +{ + return Shell__GetArgumentSize(in, 0, flags); +} + +/*--------------------------------------------------------------------------*/ +int cmOutputConverter::Shell_GetArgumentSizeForUnix(const char* in, + int flags) +{ + return Shell__GetArgumentSize(in, 1, flags); +} diff --git a/Source/cmOutputConverter.h b/Source/cmOutputConverter.h index 8739b979f..ed7739edf 100644 --- a/Source/cmOutputConverter.h +++ b/Source/cmOutputConverter.h @@ -64,6 +64,63 @@ public: void SetLinkScriptShell(bool linkScriptShell); + /** + * Flags to pass to Shell_GetArgumentForWindows or + * Shell_GetArgumentForUnix. These modify the generated + * quoting and escape sequences to work under alternative + * environments. + */ + enum Shell_Flag_e + { + /** The target shell is in a makefile. */ + Shell_Flag_Make = (1<<0), + + /** The target shell is in a VS project file. Do not use with + Shell_Flag_Make. */ + Shell_Flag_VSIDE = (1<<1), + + /** In a windows shell the argument is being passed to "echo". */ + Shell_Flag_EchoWindows = (1<<2), + + /** The target shell is in a Watcom WMake makefile. */ + Shell_Flag_WatcomWMake = (1<<3), + + /** The target shell is in a MinGW Make makefile. */ + Shell_Flag_MinGWMake = (1<<4), + + /** The target shell is in a NMake makefile. */ + Shell_Flag_NMake = (1<<5), + + /** Make variable reference syntax $(MAKEVAR) should not be escaped + to allow a build tool to replace it. Replacement values + containing spaces, quotes, backslashes, or other + non-alphanumeric characters that have significance to some makes + or shells produce undefined behavior. */ + Shell_Flag_AllowMakeVariables = (1<<6), + + /** The target shell quoting uses extra single Quotes for Watcom tools. */ + Shell_Flag_WatcomQuote = (1<<7) + }; + + /** + * Transform the given command line argument for use in a Windows or + * Unix shell. Returns a pointer to the end of the command line + * argument in the provided output buffer. Flags may be passed to + * modify the generated quoting and escape sequences to work under + * alternative environments. + */ + static char* Shell_GetArgumentForWindows(const char* in, char* out, + int flags); + static char* Shell_GetArgumentForUnix(const char* in, char* out, int flags); + + /** + * Compute the size of the buffer required to store the output from + * Shell_GetArgumentForWindows or Shell_GetArgumentForUnix. The flags + * passed must be identical between the two calls. + */ + static int Shell_GetArgumentSizeForWindows(const char* in, int flags); + static int Shell_GetArgumentSizeForUnix(const char* in, int flags); + std::string EscapeForShell(const std::string& str, bool makeVars = false, bool forEcho = false, @@ -102,6 +159,19 @@ private: std::string const& result, OutputFormat format) const; + static int Shell__CharIsWhitespace(char c); + static int Shell__CharNeedsQuotesOnUnix(char c); + static int Shell__CharNeedsQuotesOnWindows(char c); + static int Shell__CharNeedsQuotes(char c, int isUnix, int flags); + static int Shell__CharIsMakeVariableName(char c); + static const char* Shell__SkipMakeVariables(const char* c); + static int Shell__ArgumentNeedsQuotes(const char* in, + int isUnix, int flags); + static int Shell__GetArgumentSize(const char* in, + int isUnix, int flags); + static char* Shell__GetArgument(const char* in, char* out, + int isUnix, int flags); + private: cmState::Snapshot StateSnapshot; diff --git a/Source/cmVisualStudioGeneratorOptions.cxx b/Source/cmVisualStudioGeneratorOptions.cxx index c028ab716..abd350e4a 100644 --- a/Source/cmVisualStudioGeneratorOptions.cxx +++ b/Source/cmVisualStudioGeneratorOptions.cxx @@ -1,7 +1,6 @@ #include "cmVisualStudioGeneratorOptions.h" #include "cmOutputConverter.h" #include "cmSystemTools.h" -#include #include "cmVisualStudio10TargetGenerator.h" static @@ -249,8 +248,8 @@ void cmVisualStudioGeneratorOptions::StoreUnknownFlag(const char* flag) this->FlagString += cmOutputConverter::EscapeWindowsShellArgument( flag, - cmsysSystem_Shell_Flag_AllowMakeVariables | - cmsysSystem_Shell_Flag_VSIDE); + cmOutputConverter::Shell_Flag_AllowMakeVariables | + cmOutputConverter::Shell_Flag_VSIDE); } //---------------------------------------------------------------------------- diff --git a/Source/kwsys/System.c b/Source/kwsys/System.c index 1ee26fac5..ccc7e8164 100644 --- a/Source/kwsys/System.c +++ b/Source/kwsys/System.c @@ -20,8 +20,8 @@ #include /* ptrdiff_t */ #include /* malloc, free */ -#include /* strlen */ -#include /* isalpha */ +#include /* memcpy */ +#include /* isspace */ #include @@ -31,587 +31,6 @@ typedef ptrdiff_t kwsysSystem_ptrdiff_t; typedef int kwsysSystem_ptrdiff_t; #endif -/* - -Notes: - -Make variable replacements open a can of worms. Sometimes they should -be quoted and sometimes not. Sometimes their replacement values are -already quoted. - -VS variables cause problems. In order to pass the referenced value -with spaces the reference must be quoted. If the variable value ends -in a backslash then it will escape the ending quote! In order to make -the ending backslash appear we need this: - - "$(InputDir)\" - -However if there is not a trailing backslash then this will put a -quote in the value so we need: - - "$(InputDir)" - -Make variable references are platform specific so we should probably -just NOT quote them and let the listfile author deal with it. - -*/ - -/* -TODO: For windows echo: - -To display a pipe (|) or redirection character (< or >) when using the -echo command, use a caret character immediately before the pipe or -redirection character (for example, ^>, ^<, or ^| ). If you need to -use the caret character itself (^), use two in a row (^^). -*/ - -/*--------------------------------------------------------------------------*/ -static int kwsysSystem_Shell__CharIsWhitespace(char c) -{ - return ((c == ' ') || (c == '\t')); -} - -/*--------------------------------------------------------------------------*/ -static int kwsysSystem_Shell__CharNeedsQuotesOnUnix(char c) -{ - return ((c == '\'') || (c == '`') || (c == ';') || (c == '#') || - (c == '&') || (c == '$') || (c == '(') || (c == ')') || - (c == '~') || (c == '<') || (c == '>') || (c == '|') || - (c == '*') || (c == '^') || (c == '\\')); -} - -/*--------------------------------------------------------------------------*/ -static int kwsysSystem_Shell__CharNeedsQuotesOnWindows(char c) -{ - return ((c == '\'') || (c == '#') || (c == '&') || - (c == '<') || (c == '>') || (c == '|') || (c == '^')); -} - -/*--------------------------------------------------------------------------*/ -static int kwsysSystem_Shell__CharNeedsQuotes(char c, int isUnix, int flags) -{ - /* On Windows the built-in command shell echo never needs quotes. */ - if(!isUnix && (flags & kwsysSystem_Shell_Flag_EchoWindows)) - { - return 0; - } - - /* On all platforms quotes are needed to preserve whitespace. */ - if(kwsysSystem_Shell__CharIsWhitespace(c)) - { - return 1; - } - - if(isUnix) - { - /* On UNIX several special characters need quotes to preserve them. */ - if(kwsysSystem_Shell__CharNeedsQuotesOnUnix(c)) - { - return 1; - } - } - else - { - /* On Windows several special characters need quotes to preserve them. */ - if(kwsysSystem_Shell__CharNeedsQuotesOnWindows(c)) - { - return 1; - } - } - return 0; -} - -/*--------------------------------------------------------------------------*/ -static int kwsysSystem_Shell__CharIsMakeVariableName(char c) -{ - return c && (c == '_' || isalpha(((int)c))); -} - -/*--------------------------------------------------------------------------*/ -static const char* kwsysSystem_Shell__SkipMakeVariables(const char* c) -{ - while(*c == '$' && *(c+1) == '(') - { - const char* skip = c+2; - while(kwsysSystem_Shell__CharIsMakeVariableName(*skip)) - { - ++skip; - } - if(*skip == ')') - { - c = skip+1; - } - else - { - break; - } - } - return c; -} - -/* -Allowing make variable replacements opens a can of worms. Sometimes -they should be quoted and sometimes not. Sometimes their replacement -values are already quoted or contain escapes. - -Some Visual Studio variables cause problems. In order to pass the -referenced value with spaces the reference must be quoted. If the -variable value ends in a backslash then it will escape the ending -quote! In order to make the ending backslash appear we need this: - - "$(InputDir)\" - -However if there is not a trailing backslash then this will put a -quote in the value so we need: - - "$(InputDir)" - -This macro decides whether we quote an argument just because it -contains a make variable reference. This should be replaced with a -flag later when we understand applications of this better. -*/ -#define KWSYS_SYSTEM_SHELL_QUOTE_MAKE_VARIABLES 0 - -/*--------------------------------------------------------------------------*/ -static int kwsysSystem_Shell__ArgumentNeedsQuotes(const char* in, int isUnix, - int flags) -{ - /* The empty string needs quotes. */ - if(!*in) - { - return 1; - } - - /* Scan the string for characters that require quoting. */ - { - const char* c; - for(c=in; *c; ++c) - { - /* Look for $(MAKEVAR) syntax if requested. */ - if(flags & kwsysSystem_Shell_Flag_AllowMakeVariables) - { -#if KWSYS_SYSTEM_SHELL_QUOTE_MAKE_VARIABLES - const char* skip = kwsysSystem_Shell__SkipMakeVariables(c); - if(skip != c) - { - /* We need to quote make variable references to preserve the - string with contents substituted in its place. */ - return 1; - } -#else - /* Skip over the make variable references if any are present. */ - c = kwsysSystem_Shell__SkipMakeVariables(c); - - /* Stop if we have reached the end of the string. */ - if(!*c) - { - break; - } -#endif - } - - /* Check whether this character needs quotes. */ - if(kwsysSystem_Shell__CharNeedsQuotes(*c, isUnix, flags)) - { - return 1; - } - } - } - - /* On Windows some single character arguments need quotes. */ - if(!isUnix && *in && !*(in+1)) - { - char c = *in; - if((c == '?') || (c == '&') || (c == '^') || (c == '|') || (c == '#')) - { - return 1; - } - } - - return 0; -} - -/*--------------------------------------------------------------------------*/ -static int kwsysSystem_Shell__GetArgumentSize(const char* in, - int isUnix, int flags) -{ - /* Start with the length of the original argument, plus one for - either a terminating null or a separating space. */ - int size = (int)strlen(in) + 1; - - /* String iterator. */ - const char* c; - - /* Keep track of how many backslashes have been encountered in a row. */ - int windows_backslashes = 0; - - /* Scan the string for characters that require escaping or quoting. */ - for(c=in; *c; ++c) - { - /* Look for $(MAKEVAR) syntax if requested. */ - if(flags & kwsysSystem_Shell_Flag_AllowMakeVariables) - { - /* Skip over the make variable references if any are present. */ - c = kwsysSystem_Shell__SkipMakeVariables(c); - - /* Stop if we have reached the end of the string. */ - if(!*c) - { - break; - } - } - - /* Check whether this character needs escaping for the shell. */ - if(isUnix) - { - /* On Unix a few special characters need escaping even inside a - quoted argument. */ - if(*c == '\\' || *c == '"' || *c == '`' || *c == '$') - { - /* This character needs a backslash to escape it. */ - ++size; - } - } - else if(flags & kwsysSystem_Shell_Flag_EchoWindows) - { - /* On Windows the built-in command shell echo never needs escaping. */ - } - else - { - /* On Windows only backslashes and double-quotes need escaping. */ - if(*c == '\\') - { - /* Found a backslash. It may need to be escaped later. */ - ++windows_backslashes; - } - else if(*c == '"') - { - /* Found a double-quote. We need to escape it and all - immediately preceding backslashes. */ - size += windows_backslashes + 1; - windows_backslashes = 0; - } - else - { - /* Found another character. This eliminates the possibility - that any immediately preceding backslashes will be - escaped. */ - windows_backslashes = 0; - } - } - - /* Check whether this character needs escaping for a make tool. */ - if(*c == '$') - { - if(flags & kwsysSystem_Shell_Flag_Make) - { - /* In Makefiles a dollar is written $$ so we need one extra - character. */ - ++size; - } - else if(flags & kwsysSystem_Shell_Flag_VSIDE) - { - /* In a VS IDE a dollar is written "$" so we need two extra - characters. */ - size += 2; - } - } - else if(*c == '#') - { - if((flags & kwsysSystem_Shell_Flag_Make) && - (flags & kwsysSystem_Shell_Flag_WatcomWMake)) - { - /* In Watcom WMake makefiles a pound is written $# so we need - one extra character. */ - ++size; - } - } - else if(*c == '%') - { - if((flags & kwsysSystem_Shell_Flag_VSIDE) || - ((flags & kwsysSystem_Shell_Flag_Make) && - ((flags & kwsysSystem_Shell_Flag_MinGWMake) || - (flags & kwsysSystem_Shell_Flag_NMake)))) - { - /* In the VS IDE, NMake, or MinGW make a percent is written %% - so we need one extra characters. */ - size += 1; - } - } - else if(*c == ';') - { - if(flags & kwsysSystem_Shell_Flag_VSIDE) - { - /* In a VS IDE a semicolon is written ";" so we need two extra - characters. */ - size += 2; - } - } - } - - /* Check whether the argument needs surrounding quotes. */ - if(kwsysSystem_Shell__ArgumentNeedsQuotes(in, isUnix, flags)) - { - /* Surrounding quotes are needed. Allocate space for them. */ - if((flags & kwsysSystem_Shell_Flag_WatcomQuote) && (isUnix)) - { - size += 2; - } - size += 2; - - /* We must escape all ending backslashes when quoting on windows. */ - size += windows_backslashes; - } - - return size; -} - -/*--------------------------------------------------------------------------*/ -static char* kwsysSystem_Shell__GetArgument(const char* in, char* out, - int isUnix, int flags) -{ - /* String iterator. */ - const char* c; - - /* Keep track of how many backslashes have been encountered in a row. */ - int windows_backslashes = 0; - - /* Whether the argument must be quoted. */ - int needQuotes = kwsysSystem_Shell__ArgumentNeedsQuotes(in, isUnix, flags); - if(needQuotes) - { - /* Add the opening quote for this argument. */ - if(flags & kwsysSystem_Shell_Flag_WatcomQuote) - { - if(isUnix) - { - *out++ = '"'; - } - *out++ = '\''; - } - else - { - *out++ = '"'; - } - } - - /* Scan the string for characters that require escaping or quoting. */ - for(c=in; *c; ++c) - { - /* Look for $(MAKEVAR) syntax if requested. */ - if(flags & kwsysSystem_Shell_Flag_AllowMakeVariables) - { - const char* skip = kwsysSystem_Shell__SkipMakeVariables(c); - if(skip != c) - { - /* Copy to the end of the make variable references. */ - while(c != skip) - { - *out++ = *c++; - } - - /* The make variable reference eliminates any escaping needed - for preceding backslashes. */ - windows_backslashes = 0; - - /* Stop if we have reached the end of the string. */ - if(!*c) - { - break; - } - } - } - - /* Check whether this character needs escaping for the shell. */ - if(isUnix) - { - /* On Unix a few special characters need escaping even inside a - quoted argument. */ - if(*c == '\\' || *c == '"' || *c == '`' || *c == '$') - { - /* This character needs a backslash to escape it. */ - *out++ = '\\'; - } - } - else if(flags & kwsysSystem_Shell_Flag_EchoWindows) - { - /* On Windows the built-in command shell echo never needs escaping. */ - } - else - { - /* On Windows only backslashes and double-quotes need escaping. */ - if(*c == '\\') - { - /* Found a backslash. It may need to be escaped later. */ - ++windows_backslashes; - } - else if(*c == '"') - { - /* Found a double-quote. Escape all immediately preceding - backslashes. */ - while(windows_backslashes > 0) - { - --windows_backslashes; - *out++ = '\\'; - } - - /* Add the backslash to escape the double-quote. */ - *out++ = '\\'; - } - else - { - /* We encountered a normal character. This eliminates any - escaping needed for preceding backslashes. */ - windows_backslashes = 0; - } - } - - /* Check whether this character needs escaping for a make tool. */ - if(*c == '$') - { - if(flags & kwsysSystem_Shell_Flag_Make) - { - /* In Makefiles a dollar is written $$. The make tool will - replace it with just $ before passing it to the shell. */ - *out++ = '$'; - *out++ = '$'; - } - else if(flags & kwsysSystem_Shell_Flag_VSIDE) - { - /* In a VS IDE a dollar is written "$". If this is written in - an un-quoted argument it starts a quoted segment, inserts - the $ and ends the segment. If it is written in a quoted - argument it ends quoting, inserts the $ and restarts - quoting. Either way the $ is isolated from surrounding - text to avoid looking like a variable reference. */ - *out++ = '"'; - *out++ = '$'; - *out++ = '"'; - } - else - { - /* Otherwise a dollar is written just $. */ - *out++ = '$'; - } - } - else if(*c == '#') - { - if((flags & kwsysSystem_Shell_Flag_Make) && - (flags & kwsysSystem_Shell_Flag_WatcomWMake)) - { - /* In Watcom WMake makefiles a pound is written $#. The make - tool will replace it with just # before passing it to the - shell. */ - *out++ = '$'; - *out++ = '#'; - } - else - { - /* Otherwise a pound is written just #. */ - *out++ = '#'; - } - } - else if(*c == '%') - { - if((flags & kwsysSystem_Shell_Flag_VSIDE) || - ((flags & kwsysSystem_Shell_Flag_Make) && - ((flags & kwsysSystem_Shell_Flag_MinGWMake) || - (flags & kwsysSystem_Shell_Flag_NMake)))) - { - /* In the VS IDE, NMake, or MinGW make a percent is written %%. */ - *out++ = '%'; - *out++ = '%'; - } - else - { - /* Otherwise a percent is written just %. */ - *out++ = '%'; - } - } - else if(*c == ';') - { - if(flags & kwsysSystem_Shell_Flag_VSIDE) - { - /* In a VS IDE a semicolon is written ";". If this is written - in an un-quoted argument it starts a quoted segment, - inserts the ; and ends the segment. If it is written in a - quoted argument it ends quoting, inserts the ; and restarts - quoting. Either way the ; is isolated. */ - *out++ = '"'; - *out++ = ';'; - *out++ = '"'; - } - else - { - /* Otherwise a semicolon is written just ;. */ - *out++ = ';'; - } - } - else - { - /* Store this character. */ - *out++ = *c; - } - } - - if(needQuotes) - { - /* Add enough backslashes to escape any trailing ones. */ - while(windows_backslashes > 0) - { - --windows_backslashes; - *out++ = '\\'; - } - - /* Add the closing quote for this argument. */ - if(flags & kwsysSystem_Shell_Flag_WatcomQuote) - { - *out++ = '\''; - if(isUnix) - { - *out++ = '"'; - } - } - else - { - *out++ = '"'; - } - } - - /* Store a terminating null without incrementing. */ - *out = 0; - - return out; -} - -/*--------------------------------------------------------------------------*/ -char* kwsysSystem_Shell_GetArgumentForWindows(const char* in, - char* out, - int flags) -{ - return kwsysSystem_Shell__GetArgument(in, out, 0, flags); -} - -/*--------------------------------------------------------------------------*/ -char* kwsysSystem_Shell_GetArgumentForUnix(const char* in, - char* out, - int flags) -{ - return kwsysSystem_Shell__GetArgument(in, out, 1, flags); -} - -/*--------------------------------------------------------------------------*/ -int kwsysSystem_Shell_GetArgumentSizeForWindows(const char* in, int flags) -{ - return kwsysSystem_Shell__GetArgumentSize(in, 0, flags); -} - -/*--------------------------------------------------------------------------*/ -int kwsysSystem_Shell_GetArgumentSizeForUnix(const char* in, int flags) -{ - return kwsysSystem_Shell__GetArgumentSize(in, 1, flags); -} - /*--------------------------------------------------------------------------*/ static int kwsysSystem__AppendByte(char* local, char** begin, char** end, diff --git a/Source/kwsys/System.h.in b/Source/kwsys/System.h.in index f21bf0dca..3f3d3f4b0 100644 --- a/Source/kwsys/System.h.in +++ b/Source/kwsys/System.h.in @@ -24,28 +24,6 @@ #endif #if !@KWSYS_NAMESPACE@_NAME_IS_KWSYS # define kwsysSystem_Parse_CommandForUnix kwsys_ns(System_Parse_CommandForUnix) -# define kwsysSystem_Shell_GetArgumentForWindows kwsys_ns(System_Shell_GetArgumentForWindows) -# define kwsysSystem_Shell_GetArgumentForUnix kwsys_ns(System_Shell_GetArgumentForUnix) -# define kwsysSystem_Shell_GetArgumentSizeForWindows kwsys_ns(System_Shell_GetArgumentSizeForWindows) -# define kwsysSystem_Shell_GetArgumentSizeForUnix kwsys_ns(System_Shell_GetArgumentSizeForUnix) -# define kwsysSystem_Shell_Flag_e kwsys_ns(System_Shell_Flag_e) -# define kwsysSystem_Shell_Flag_Make kwsys_ns(System_Shell_Flag_Make) -# define kwsysSystem_Shell_Flag_VSIDE kwsys_ns(System_Shell_Flag_VSIDE) -# define kwsysSystem_Shell_Flag_EchoWindows kwsys_ns(System_Shell_Flag_EchoWindows) -# define kwsysSystem_Shell_Flag_WatcomWMake kwsys_ns(System_Shell_Flag_WatcomWMake) -# define kwsysSystem_Shell_Flag_MinGWMake kwsys_ns(System_Shell_Flag_MinGWMake) -# define kwsysSystem_Shell_Flag_NMake kwsys_ns(System_Shell_Flag_NMake) -# define kwsysSystem_Shell_Flag_AllowMakeVariables kwsys_ns(System_Shell_Flag_AllowMakeVariables) -# define kwsysSystem_Shell_Flag_WatcomQuote kwsys_ns(System_Shell_Flag_WatcomQuote) -#endif - -#ifdef __VMS -#define @KWSYS_NAMESPACE@System_Shell_GetArgumentForUnix \ - @KWSYS_NAMESPACE@System_Shell_UnixGA -#define @KWSYS_NAMESPACE@System_Shell_GetArgumentSizeForUnix \ - @KWSYS_NAMESPACE@System_Shell_UnixGAS -#define @KWSYS_NAMESPACE@System_Shell_GetArgumentForWindows \ - @KWSYS_NAMESPACE@System_Shell_WindowsGA #endif #if defined(__cplusplus) @@ -53,69 +31,6 @@ extern "C" { #endif -/** - * Transform the given command line argument for use in a Windows or - * Unix shell. Returns a pointer to the end of the command line - * argument in the provided output buffer. Flags may be passed to - * modify the generated quoting and escape sequences to work under - * alternative environments. - */ -kwsysEXPORT char* kwsysSystem_Shell_GetArgumentForWindows(const char* in, - char* out, - int flags); -kwsysEXPORT char* kwsysSystem_Shell_GetArgumentForUnix(const char* in, - char* out, - int flags); - -/** - * Compute the size of the buffer required to store the output from - * kwsysSystem_Shell_GetArgumentForWindows or - * kwsysSystem_Shell_GetArgumentForUnix. The flags passed must be - * identical between the two calls. - */ -kwsysEXPORT int kwsysSystem_Shell_GetArgumentSizeForWindows(const char* in, - int flags); -kwsysEXPORT int kwsysSystem_Shell_GetArgumentSizeForUnix(const char* in, - int flags); - -/** - * Flags to pass to kwsysSystem_Shell_GetArgumentForWindows or - * kwsysSystem_Shell_GetArgumentForUnix. These modify the generated - * quoting and escape sequences to work under alternative - * environments. - */ -enum kwsysSystem_Shell_Flag_e -{ - /** The target shell is in a makefile. */ - kwsysSystem_Shell_Flag_Make = (1<<0), - - /** The target shell is in a VS project file. Do not use with - Shell_Flag_Make. */ - kwsysSystem_Shell_Flag_VSIDE = (1<<1), - - /** In a windows shell the argument is being passed to "echo". */ - kwsysSystem_Shell_Flag_EchoWindows = (1<<2), - - /** The target shell is in a Watcom WMake makefile. */ - kwsysSystem_Shell_Flag_WatcomWMake = (1<<3), - - /** The target shell is in a MinGW Make makefile. */ - kwsysSystem_Shell_Flag_MinGWMake = (1<<4), - - /** The target shell is in a NMake makefile. */ - kwsysSystem_Shell_Flag_NMake = (1<<5), - - /** Make variable reference syntax $(MAKEVAR) should not be escaped - to allow a build tool to replace it. Replacement values - containing spaces, quotes, backslashes, or other - non-alphanumeric characters that have significance to some makes - or shells produce undefined behavior. */ - kwsysSystem_Shell_Flag_AllowMakeVariables = (1<<6), - - /** The target shell quoting uses extra single Quotes for Watcom tools. */ - kwsysSystem_Shell_Flag_WatcomQuote = (1<<7) -}; - /** * Parse a unix-style command line string into separate arguments. * @@ -148,19 +63,6 @@ kwsysEXPORT char** kwsysSystem_Parse_CommandForUnix(const char* command, # undef kwsysEXPORT # if !defined(KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS # undef kwsysSystem_Parse_CommandForUnix -# undef kwsysSystem_Shell_GetArgumentForWindows -# undef kwsysSystem_Shell_GetArgumentForUnix -# undef kwsysSystem_Shell_GetArgumentSizeForWindows -# undef kwsysSystem_Shell_GetArgumentSizeForUnix -# undef kwsysSystem_Shell_Flag_e -# undef kwsysSystem_Shell_Flag_Make -# undef kwsysSystem_Shell_Flag_VSIDE -# undef kwsysSystem_Shell_Flag_EchoWindows -# undef kwsysSystem_Shell_Flag_WatcomWMake -# undef kwsysSystem_Shell_Flag_MinGWMake -# undef kwsysSystem_Shell_Flag_NMake -# undef kwsysSystem_Shell_Flag_AllowMakeVariables -# undef kwsysSystem_Shell_Flag_WatcomQuote # endif #endif From d3d4d6275a2fdcc735da44d99a37644d90dd8338 Mon Sep 17 00:00:00 2001 From: Roger Leigh Date: Wed, 8 Jul 2015 17:29:10 +0000 Subject: [PATCH 0281/1048] FindXercesC: Find versioned library on Windows --- Modules/FindXercesC.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/FindXercesC.cmake b/Modules/FindXercesC.cmake index 5a8ea9de2..984f1b9f6 100644 --- a/Modules/FindXercesC.cmake +++ b/Modules/FindXercesC.cmake @@ -62,7 +62,7 @@ find_path(XercesC_INCLUDE_DIR mark_as_advanced(XercesC_INCLUDE_DIR) # Find all XercesC libraries -find_library(XercesC_LIBRARY "xerces-c" +find_library(XercesC_LIBRARY NAMES "xerces-c" "xerces-c_3" DOC "Xerces-C++ libraries") mark_as_advanced(XercesC_LIBRARY) From a672b16a3a528d6dbfcba7758a798eeb87bd57ee Mon Sep 17 00:00:00 2001 From: Markus Grech Date: Wed, 8 Jul 2015 18:20:58 +0200 Subject: [PATCH 0282/1048] Eclipse: Fix paths in target links on cygwin Add a missing GetEclipsePath call to fix generation of incorrect paths for target links in Eclipse CDT generator which caused Eclipse to be unable to open files through such links. Without this the generator would generate invalid links for source files under "[Targets]", making Eclipse unable to open them. The old links looked like "C:/cygdrive/c/...", while new links correctly are "C:/...". --- Source/cmExtraEclipseCDT4Generator.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index a81e53cb4..44bf586ef 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -598,7 +598,8 @@ void cmExtraEclipseCDT4Generator::CreateLinksForTargets( linkName4 += "/"; linkName4 += cmSystemTools::GetFilenameName(fullPath); this->AppendLinkedResource(fout, linkName4, - fullPath, LinkToFile); + this->GetEclipsePath(fullPath), + LinkToFile); } } } From aa550e04f3e3a44db9ba02649f3b15929f3226a6 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Thu, 9 Jul 2015 00:01:06 -0400 Subject: [PATCH 0283/1048] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 1348c2789..eadcb9e13 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 3) -set(CMake_VERSION_PATCH 20150708) +set(CMake_VERSION_PATCH 20150709) #set(CMake_VERSION_RC 1) From 748f1eaee3b834008837d0b43d23ee8b052e9403 Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Wed, 8 Jul 2015 10:49:22 +0200 Subject: [PATCH 0284/1048] FindIce: create imported targets for components --- Modules/FindIce.cmake | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Modules/FindIce.cmake b/Modules/FindIce.cmake index c88c1b849..6a06e2f58 100644 --- a/Modules/FindIce.cmake +++ b/Modules/FindIce.cmake @@ -433,13 +433,21 @@ if(Ice_FOUND) set(_Ice_component_cache "Ice_${_Ice_component_upcase}_LIBRARY") set(_Ice_component_lib "Ice_${_Ice_component_upcase}_LIBRARIES") set(_Ice_component_found "${_Ice_component_upcase}_FOUND") + set(_Ice_imported_target "Ice::${_Ice_component}") if(${_Ice_component_found}) set("${_Ice_component_lib}" "${${_Ice_component_cache}}") + if(NOT TARGET ${_Ice_imported_target}) + add_library(${_Ice_imported_target} UNKNOWN IMPORTED) + set_target_properties(${_Ice_imported_target} PROPERTIES + IMPORTED_LOCATION "${${_Ice_component_cache}}" + INTERFACE_INCLUDE_DIRECTORIES "${Ice_INCLUDE_DIR}") + endif() endif() unset(_Ice_component_upcase) unset(_Ice_component_cache) unset(_Ice_component_lib) unset(_Ice_component_found) + unset(_Ice_imported_target) endforeach() endif() From cd4d2e9c79356be9ec6a0fe2b3ec3731254bb9ef Mon Sep 17 00:00:00 2001 From: Roger Leigh Date: Thu, 9 Jul 2015 10:55:09 +0100 Subject: [PATCH 0285/1048] FindIce: document imported targets --- Modules/FindIce.cmake | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Modules/FindIce.cmake b/Modules/FindIce.cmake index 6a06e2f58..3fa6cab4d 100644 --- a/Modules/FindIce.cmake +++ b/Modules/FindIce.cmake @@ -20,6 +20,13 @@ # Ice_SLICE_DIRS - the directories containing the Ice slice interface # definitions # +# Imported targets:: +# +# Ice:: +# +# Where ```` is the name of an Ice component, for example +# ``Ice::Glacier2``. +# # Ice slice programs are reported in:: # # Ice_SLICE2CPP_EXECUTABLE - path to slice2cpp executable From 228643af6d8c0e29735c3fdf7b25c161a11a68c9 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 8 Jul 2015 09:25:02 -0400 Subject: [PATCH 0286/1048] AppleClang: Use modern C++14 standard flags for Apple Clang 6.1 The Apple Clang 6.1 compiler that comes with Xcode 6.3 is aware of the modern -std=c++14 and -std=gnu++14 flags, so use them instead of the "1y" flags. Suggested-by: darkapostle@rule506.net --- Modules/Compiler/AppleClang-CXX.cmake | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Modules/Compiler/AppleClang-CXX.cmake b/Modules/Compiler/AppleClang-CXX.cmake index 5194da4b8..1ba8a7743 100644 --- a/Modules/Compiler/AppleClang-CXX.cmake +++ b/Modules/Compiler/AppleClang-CXX.cmake @@ -13,7 +13,10 @@ if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.0) set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++11") endif() -if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.1) +if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.1) + set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++14") + set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++14") +elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.1) # AppleClang 5.0 knows this flag, but does not set a __cplusplus macro greater than 201103L set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++1y") set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++1y") From 889b22e2cab163be390d7856ef2939b9e2143ad3 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 9 Jul 2015 09:48:15 -0400 Subject: [PATCH 0287/1048] Help: Add notes for topic 'FindIce-imported-targets' --- Help/release/dev/FindIce-imported-targets.rst | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 Help/release/dev/FindIce-imported-targets.rst diff --git a/Help/release/dev/FindIce-imported-targets.rst b/Help/release/dev/FindIce-imported-targets.rst new file mode 100644 index 000000000..7e1b2f42d --- /dev/null +++ b/Help/release/dev/FindIce-imported-targets.rst @@ -0,0 +1,4 @@ +FindIce-imported-targets +------------------------ + +* The :module:`FindIce` module now provides imported targets. From 001f9b361711b479ee0d530056e44b7444edfcff Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 7 Jul 2015 16:37:56 -0400 Subject: [PATCH 0288/1048] Add common base classes to Makefile and Ninja generators Provide a place to move functionality common to both. --- Source/CMakeLists.txt | 6 +++++ Source/cmCommonTargetGenerator.cxx | 20 ++++++++++++++++ Source/cmCommonTargetGenerator.h | 27 +++++++++++++++++++++ Source/cmGlobalCommonGenerator.cxx | 21 ++++++++++++++++ Source/cmGlobalCommonGenerator.h | 27 +++++++++++++++++++++ Source/cmGlobalNinjaGenerator.cxx | 2 +- Source/cmGlobalNinjaGenerator.h | 4 ++-- Source/cmGlobalUnixMakefileGenerator3.cxx | 2 +- Source/cmGlobalUnixMakefileGenerator3.h | 4 ++-- Source/cmLocalCommonGenerator.cxx | 23 ++++++++++++++++++ Source/cmLocalCommonGenerator.h | 29 +++++++++++++++++++++++ Source/cmLocalNinjaGenerator.cxx | 2 +- Source/cmLocalNinjaGenerator.h | 4 ++-- Source/cmLocalUnixMakefileGenerator3.cxx | 2 +- Source/cmLocalUnixMakefileGenerator3.h | 4 ++-- Source/cmMakefileTargetGenerator.cxx | 3 ++- Source/cmMakefileTargetGenerator.h | 4 +++- Source/cmNinjaTargetGenerator.cxx | 2 +- Source/cmNinjaTargetGenerator.h | 4 +++- bootstrap | 3 +++ 20 files changed, 177 insertions(+), 16 deletions(-) create mode 100644 Source/cmCommonTargetGenerator.cxx create mode 100644 Source/cmCommonTargetGenerator.h create mode 100644 Source/cmGlobalCommonGenerator.cxx create mode 100644 Source/cmGlobalCommonGenerator.h create mode 100644 Source/cmLocalCommonGenerator.cxx create mode 100644 Source/cmLocalCommonGenerator.h diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 694018791..d5fe7d19f 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -165,6 +165,8 @@ set(SRCS cmCommandArgumentLexer.cxx cmCommandArgumentParser.cxx cmCommandArgumentParserHelper.cxx + cmCommonTargetGenerator.cxx + cmCommonTargetGenerator.h cmComputeComponentGraph.cxx cmComputeComponentGraph.h cmComputeLinkDepends.cxx @@ -260,6 +262,8 @@ set(SRCS cmGeneratorExpression.h cmGeneratorTarget.cxx cmGeneratorTarget.h + cmGlobalCommonGenerator.cxx + cmGlobalCommonGenerator.h cmGlobalGenerator.cxx cmGlobalGenerator.h cmGlobalGeneratorFactory.h @@ -285,6 +289,8 @@ set(SRCS cmListFileCache.cxx cmListFileCache.h cmListFileLexer.c + cmLocalCommonGenerator.cxx + cmLocalCommonGenerator.h cmLocalGenerator.cxx cmLocalGenerator.h cmLocalUnixMakefileGenerator3.cxx diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx new file mode 100644 index 000000000..e1f752260 --- /dev/null +++ b/Source/cmCommonTargetGenerator.cxx @@ -0,0 +1,20 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2015 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#include "cmCommonTargetGenerator.h" + +cmCommonTargetGenerator::cmCommonTargetGenerator() +{ +} + +cmCommonTargetGenerator::~cmCommonTargetGenerator() +{ +} diff --git a/Source/cmCommonTargetGenerator.h b/Source/cmCommonTargetGenerator.h new file mode 100644 index 000000000..96f408853 --- /dev/null +++ b/Source/cmCommonTargetGenerator.h @@ -0,0 +1,27 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2015 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#ifndef cmCommonTargetGenerator_h +#define cmCommonTargetGenerator_h + +#include "cmStandardIncludes.h" + +/** \class cmCommonTargetGenerator + * \brief Common infrastructure for Makefile and Ninja per-target generators + */ +class cmCommonTargetGenerator +{ +public: + cmCommonTargetGenerator(); + virtual ~cmCommonTargetGenerator(); +}; + +#endif diff --git a/Source/cmGlobalCommonGenerator.cxx b/Source/cmGlobalCommonGenerator.cxx new file mode 100644 index 000000000..dc8e5a7ff --- /dev/null +++ b/Source/cmGlobalCommonGenerator.cxx @@ -0,0 +1,21 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2015 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#include "cmGlobalCommonGenerator.h" + +cmGlobalCommonGenerator::cmGlobalCommonGenerator(cmake* cm): + cmGlobalGenerator(cm) +{ +} + +cmGlobalCommonGenerator::~cmGlobalCommonGenerator() +{ +} diff --git a/Source/cmGlobalCommonGenerator.h b/Source/cmGlobalCommonGenerator.h new file mode 100644 index 000000000..7bb0e55a0 --- /dev/null +++ b/Source/cmGlobalCommonGenerator.h @@ -0,0 +1,27 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2015 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#ifndef cmGlobalCommonGenerator_h +#define cmGlobalCommonGenerator_h + +#include "cmGlobalGenerator.h" + +/** \class cmGlobalCommonGenerator + * \brief Common infrastructure for Makefile and Ninja global generators. + */ +class cmGlobalCommonGenerator : public cmGlobalGenerator +{ +public: + cmGlobalCommonGenerator(cmake* cm); + ~cmGlobalCommonGenerator(); +}; + +#endif diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 722294b75..b88b8c846 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -505,7 +505,7 @@ void cmGlobalNinjaGenerator::WriteDefault(std::ostream& os, cmGlobalNinjaGenerator::cmGlobalNinjaGenerator(cmake* cm) - : cmGlobalGenerator(cm) + : cmGlobalCommonGenerator(cm) , BuildFileStream(0) , RulesFileStream(0) , CompileCommandsStream(0) diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index ffd1cdcb3..2a749c1f7 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -13,7 +13,7 @@ #ifndef cmGlobalNinjaGenerator_h # define cmGlobalNinjaGenerator_h -# include "cmGlobalGenerator.h" +# include "cmGlobalCommonGenerator.h" # include "cmGlobalGeneratorFactory.h" # include "cmNinjaTypes.h" @@ -42,7 +42,7 @@ class cmGeneratorTarget; * - We extensively use Ninja variable overloading system to minimize the * number of generated rules. */ -class cmGlobalNinjaGenerator : public cmGlobalGenerator +class cmGlobalNinjaGenerator : public cmGlobalCommonGenerator { public: /// The default name of Ninja's build file. Typically: build.ninja. diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index e6a67d32d..42b42d43b 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -21,7 +21,7 @@ #include "cmAlgorithms.h" cmGlobalUnixMakefileGenerator3::cmGlobalUnixMakefileGenerator3(cmake* cm) - : cmGlobalGenerator(cm) + : cmGlobalCommonGenerator(cm) { // This type of makefile always requires unix style paths this->ForceUnixPaths = true; diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h index 14adf2e46..fc53fa802 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.h +++ b/Source/cmGlobalUnixMakefileGenerator3.h @@ -12,7 +12,7 @@ #ifndef cmGlobalUnixMakefileGenerator3_h #define cmGlobalUnixMakefileGenerator3_h -#include "cmGlobalGenerator.h" +#include "cmGlobalCommonGenerator.h" #include "cmGlobalGeneratorFactory.h" class cmGeneratedFileStream; @@ -51,7 +51,7 @@ class cmLocalUnixMakefileGenerator3; */ -class cmGlobalUnixMakefileGenerator3 : public cmGlobalGenerator +class cmGlobalUnixMakefileGenerator3 : public cmGlobalCommonGenerator { public: cmGlobalUnixMakefileGenerator3(cmake* cm); diff --git a/Source/cmLocalCommonGenerator.cxx b/Source/cmLocalCommonGenerator.cxx new file mode 100644 index 000000000..0b266f8ff --- /dev/null +++ b/Source/cmLocalCommonGenerator.cxx @@ -0,0 +1,23 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2015 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#include "cmLocalCommonGenerator.h" + +cmLocalCommonGenerator::cmLocalCommonGenerator(cmGlobalGenerator* gg, + cmLocalGenerator* parent, + cmState::Snapshot snapshot): + cmLocalGenerator(gg, parent, snapshot) +{ +} + +cmLocalCommonGenerator::~cmLocalCommonGenerator() +{ +} diff --git a/Source/cmLocalCommonGenerator.h b/Source/cmLocalCommonGenerator.h new file mode 100644 index 000000000..c897e498e --- /dev/null +++ b/Source/cmLocalCommonGenerator.h @@ -0,0 +1,29 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2015 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#ifndef cmLocalCommonGenerator_h +#define cmLocalCommonGenerator_h + +#include "cmLocalGenerator.h" + +/** \class cmLocalCommonGenerator + * \brief Common infrastructure for Makefile and Ninja local generators. + */ +class cmLocalCommonGenerator: public cmLocalGenerator +{ +public: + cmLocalCommonGenerator(cmGlobalGenerator* gg, + cmLocalGenerator* parent, + cmState::Snapshot snapshot); + ~cmLocalCommonGenerator(); +}; + +#endif diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index 4db36fc5b..e712b4690 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -25,7 +25,7 @@ cmLocalNinjaGenerator::cmLocalNinjaGenerator(cmGlobalGenerator* gg, cmLocalGenerator* parent, cmState::Snapshot snapshot) - : cmLocalGenerator(gg, parent, snapshot) + : cmLocalCommonGenerator(gg, parent, snapshot) , ConfigName("") , HomeRelativeOutputPath("") { diff --git a/Source/cmLocalNinjaGenerator.h b/Source/cmLocalNinjaGenerator.h index ce966fff3..8bc564068 100644 --- a/Source/cmLocalNinjaGenerator.h +++ b/Source/cmLocalNinjaGenerator.h @@ -13,7 +13,7 @@ #ifndef cmLocalNinjaGenerator_h # define cmLocalNinjaGenerator_h -# include "cmLocalGenerator.h" +# include "cmLocalCommonGenerator.h" # include "cmNinjaTypes.h" class cmCustomCommandGenerator; @@ -28,7 +28,7 @@ class cmake; * cmLocalNinjaGenerator produces a local build.ninja file from its * member Makefile. */ -class cmLocalNinjaGenerator : public cmLocalGenerator +class cmLocalNinjaGenerator : public cmLocalCommonGenerator { public: cmLocalNinjaGenerator(cmGlobalGenerator* gg, cmLocalGenerator* parent, diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index e292ba788..e3acbaf25 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -82,7 +82,7 @@ static std::string cmSplitExtension(std::string const& in, std::string& base) cmLocalUnixMakefileGenerator3:: cmLocalUnixMakefileGenerator3(cmGlobalGenerator* gg, cmLocalGenerator* parent, cmState::Snapshot snapshot) - : cmLocalGenerator(gg, parent, snapshot) + : cmLocalCommonGenerator(gg, parent, snapshot) { this->MakefileVariableSize = 0; this->ColorMakefile = false; diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index b097c95ed..70d59decd 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -12,7 +12,7 @@ #ifndef cmLocalUnixMakefileGenerator3_h #define cmLocalUnixMakefileGenerator3_h -#include "cmLocalGenerator.h" +#include "cmLocalCommonGenerator.h" // for cmDepends::DependencyVector #include "cmDepends.h" @@ -31,7 +31,7 @@ class cmSourceFile; * cmLocalUnixMakefileGenerator3 produces a LocalUnix makefile from its * member Makefile. */ -class cmLocalUnixMakefileGenerator3 : public cmLocalGenerator +class cmLocalUnixMakefileGenerator3 : public cmLocalCommonGenerator { public: cmLocalUnixMakefileGenerator3(cmGlobalGenerator* gg, diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 09fad5cdc..2f53899d7 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -33,7 +33,8 @@ #include cmMakefileTargetGenerator::cmMakefileTargetGenerator(cmGeneratorTarget* target) - : OSXBundleGenerator(0) + : cmCommonTargetGenerator() + , OSXBundleGenerator(0) , MacOSXContentGenerator(0) { this->BuildFileStream = 0; diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h index 9182236ef..a4387170b 100644 --- a/Source/cmMakefileTargetGenerator.h +++ b/Source/cmMakefileTargetGenerator.h @@ -12,6 +12,8 @@ #ifndef cmMakefileTargetGenerator_h #define cmMakefileTargetGenerator_h +#include "cmCommonTargetGenerator.h" + #include "cmLocalUnixMakefileGenerator3.h" #include "cmOSXBundleGenerator.h" @@ -30,7 +32,7 @@ class cmSourceFile; * \brief Support Routines for writing makefiles * */ -class cmMakefileTargetGenerator +class cmMakefileTargetGenerator: public cmCommonTargetGenerator { public: // constructor to set the ivars diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index b18f36896..93b3f4ed0 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -58,7 +58,7 @@ cmNinjaTargetGenerator::New(cmGeneratorTarget* target) } cmNinjaTargetGenerator::cmNinjaTargetGenerator(cmGeneratorTarget* target) - : + : cmCommonTargetGenerator(), MacOSXContentGenerator(0), OSXBundleGenerator(0), MacContentFolders(), diff --git a/Source/cmNinjaTargetGenerator.h b/Source/cmNinjaTargetGenerator.h index fc361b2bd..a98f04ee2 100644 --- a/Source/cmNinjaTargetGenerator.h +++ b/Source/cmNinjaTargetGenerator.h @@ -13,6 +13,8 @@ #ifndef cmNinjaTargetGenerator_h #define cmNinjaTargetGenerator_h +#include "cmCommonTargetGenerator.h" + #include "cmStandardIncludes.h" #include "cmNinjaTypes.h" #include "cmLocalNinjaGenerator.h" @@ -26,7 +28,7 @@ class cmMakefile; class cmSourceFile; class cmCustomCommand; -class cmNinjaTargetGenerator +class cmNinjaTargetGenerator: public cmCommonTargetGenerator { public: /// Create a cmNinjaTargetGenerator according to the @a target's type. diff --git a/bootstrap b/bootstrap index 98cdcd0a7..d778bbe2a 100755 --- a/bootstrap +++ b/bootstrap @@ -248,6 +248,7 @@ CMAKE_CXX_SOURCES="\ cmCommandArgumentLexer \ cmCommandArgumentParser \ cmCommandArgumentParserHelper \ + cmCommonTargetGenerator \ cmCPackPropertiesGenerator \ cmDefinitions \ cmDepends \ @@ -276,8 +277,10 @@ CMAKE_CXX_SOURCES="\ cmGeneratorExpressionNode \ cmGeneratorExpressionParser \ cmGeneratorExpression \ + cmGlobalCommonGenerator \ cmGlobalGenerator \ cmInstallDirectoryGenerator \ + cmLocalCommonGenerator \ cmLocalGenerator \ cmInstalledFile \ cmInstallGenerator \ From e7dcdd1011719b031d580d9094ad1f8c4701ef38 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 8 Jul 2015 11:13:11 -0400 Subject: [PATCH 0289/1048] cmCommonTargetGenerator: Adopt basic target generator members De-duplicate the GeneratorTarget, Target, and Makefile members from the local Makefile and Ninja generators. --- Source/cmCommonTargetGenerator.cxx | 13 ++++++++++++- Source/cmCommonTargetGenerator.h | 15 ++++++++++++++- Source/cmMakefileTargetGenerator.cxx | 5 +---- Source/cmMakefileTargetGenerator.h | 3 --- Source/cmNinjaTargetGenerator.cxx | 5 +---- Source/cmNinjaTargetGenerator.h | 3 --- 6 files changed, 28 insertions(+), 16 deletions(-) diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx index e1f752260..9d10e39bd 100644 --- a/Source/cmCommonTargetGenerator.cxx +++ b/Source/cmCommonTargetGenerator.cxx @@ -11,7 +11,18 @@ ============================================================================*/ #include "cmCommonTargetGenerator.h" -cmCommonTargetGenerator::cmCommonTargetGenerator() +#include "cmGeneratorTarget.h" +#include "cmGlobalCommonGenerator.h" +#include "cmLocalCommonGenerator.h" +#include "cmTarget.h" + +cmCommonTargetGenerator::cmCommonTargetGenerator(cmGeneratorTarget* gt) + : GeneratorTarget(gt) + , Target(gt->Target) + , Makefile(gt->Makefile) + , LocalGenerator(static_cast(gt->LocalGenerator)) + , GlobalGenerator(static_cast( + gt->LocalGenerator->GetGlobalGenerator())) { } diff --git a/Source/cmCommonTargetGenerator.h b/Source/cmCommonTargetGenerator.h index 96f408853..e39f2c83e 100644 --- a/Source/cmCommonTargetGenerator.h +++ b/Source/cmCommonTargetGenerator.h @@ -14,14 +14,27 @@ #include "cmStandardIncludes.h" +class cmGeneratorTarget; +class cmGlobalCommonGenerator; +class cmLocalCommonGenerator; +class cmMakefile; +class cmTarget; + /** \class cmCommonTargetGenerator * \brief Common infrastructure for Makefile and Ninja per-target generators */ class cmCommonTargetGenerator { public: - cmCommonTargetGenerator(); + cmCommonTargetGenerator(cmGeneratorTarget* gt); virtual ~cmCommonTargetGenerator(); + +protected: + cmGeneratorTarget* GeneratorTarget; + cmTarget* Target; + cmMakefile* Makefile; + cmLocalCommonGenerator* LocalGenerator; + cmGlobalCommonGenerator* GlobalGenerator; }; #endif diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 2f53899d7..3e45d104b 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -33,7 +33,7 @@ #include cmMakefileTargetGenerator::cmMakefileTargetGenerator(cmGeneratorTarget* target) - : cmCommonTargetGenerator() + : cmCommonTargetGenerator(target) , OSXBundleGenerator(0) , MacOSXContentGenerator(0) { @@ -42,15 +42,12 @@ cmMakefileTargetGenerator::cmMakefileTargetGenerator(cmGeneratorTarget* target) this->FlagFileStream = 0; this->CustomCommandDriver = OnBuild; this->FortranModuleDirectoryComputed = false; - this->Target = target->Target; - this->Makefile = this->Target->GetMakefile(); this->LocalGenerator = static_cast(target->GetLocalGenerator()); this->ConfigName = this->LocalGenerator->ConfigurationName.c_str(); this->GlobalGenerator = static_cast( this->LocalGenerator->GetGlobalGenerator()); - this->GeneratorTarget = target; cmake* cm = this->GlobalGenerator->GetCMakeInstance(); this->NoRuleMessages = false; if(const char* ruleStatus = cm->GetState() diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h index a4387170b..787f2467a 100644 --- a/Source/cmMakefileTargetGenerator.h +++ b/Source/cmMakefileTargetGenerator.h @@ -175,11 +175,8 @@ protected: virtual void CloseFileStreams(); void RemoveForbiddenFlags(const char* flagVar, const std::string& linkLang, std::string& linkFlags); - cmTarget *Target; - cmGeneratorTarget* GeneratorTarget; cmLocalUnixMakefileGenerator3 *LocalGenerator; cmGlobalUnixMakefileGenerator3 *GlobalGenerator; - cmMakefile *Makefile; std::string ConfigName; enum CustomCommandDriveType { OnBuild, OnDepends, OnUtility }; diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 93b3f4ed0..5ede08af9 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -58,17 +58,14 @@ cmNinjaTargetGenerator::New(cmGeneratorTarget* target) } cmNinjaTargetGenerator::cmNinjaTargetGenerator(cmGeneratorTarget* target) - : cmCommonTargetGenerator(), + : cmCommonTargetGenerator(target), MacOSXContentGenerator(0), OSXBundleGenerator(0), MacContentFolders(), - Target(target->Target), - Makefile(target->Makefile), LocalGenerator( static_cast(target->GetLocalGenerator())), Objects() { - this->GeneratorTarget = target; MacOSXContentGenerator = new MacOSXContentGeneratorType(this); } diff --git a/Source/cmNinjaTargetGenerator.h b/Source/cmNinjaTargetGenerator.h index a98f04ee2..87ba17fb6 100644 --- a/Source/cmNinjaTargetGenerator.h +++ b/Source/cmNinjaTargetGenerator.h @@ -152,9 +152,6 @@ protected: cmNinjaVars& vars); private: - cmTarget* Target; - cmGeneratorTarget* GeneratorTarget; - cmMakefile* Makefile; cmLocalNinjaGenerator* LocalGenerator; /// List of object files for this target. cmNinjaDeps Objects; From a4a2518dd47bd37f2204a0209c2eeb632d191d1e Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 8 Jul 2015 11:21:55 -0400 Subject: [PATCH 0290/1048] cmLocalUnixMakefileGenerator3: Provide GetConfigName() accessor Rename internal member from ConfigurationName to ConfigName to match the ninja generator. --- Source/cmGlobalUnixMakefileGenerator3.cxx | 6 +++--- Source/cmLocalUnixMakefileGenerator3.cxx | 14 +++++++------- Source/cmLocalUnixMakefileGenerator3.h | 3 ++- Source/cmMakefileTargetGenerator.cxx | 12 ++++++------ 4 files changed, 18 insertions(+), 17 deletions(-) diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 42b42d43b..c5fca9195 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -483,7 +483,7 @@ cmGlobalUnixMakefileGenerator3 if((!check_all || !gtarget->GetPropertyAsBool("EXCLUDE_FROM_ALL")) && (!check_relink || gtarget->Target - ->NeedRelinkBeforeInstall(lg->ConfigurationName))) + ->NeedRelinkBeforeInstall(lg->GetConfigName()))) { std::string tname = lg->GetRelativeTargetDirectory(*gtarget->Target); tname += "/"; @@ -692,7 +692,7 @@ cmGlobalUnixMakefileGenerator3 // Add a local name for the rule to relink the target before // installation. if(gtarget->Target - ->NeedRelinkBeforeInstall(lg->ConfigurationName)) + ->NeedRelinkBeforeInstall(lg->GetConfigName())) { makeTargetName = lg->GetRelativeTargetDirectory(*gtarget->Target); makeTargetName += "/preinstall"; @@ -865,7 +865,7 @@ cmGlobalUnixMakefileGenerator3 // Add rules to prepare the target for installation. if(gtarget->Target - ->NeedRelinkBeforeInstall(lg->ConfigurationName)) + ->NeedRelinkBeforeInstall(lg->GetConfigName())) { localName = lg->GetRelativeTargetDirectory(*gtarget->Target); localName += "/preinstall"; diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index e3acbaf25..1c6bd7cff 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -104,12 +104,12 @@ void cmLocalUnixMakefileGenerator3::Generate() if(const char* config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE")) { // Use the build type given by the user. - this->ConfigurationName = config; + this->ConfigName = config; } else { // No configuration type given. - this->ConfigurationName = ""; + this->ConfigName = ""; } // Record whether some options are enabled to avoid checking many @@ -497,7 +497,7 @@ void cmLocalUnixMakefileGenerator3 // Add a local name for the rule to relink the target before // installation. if(t->second->Target - ->NeedRelinkBeforeInstall(this->ConfigurationName)) + ->NeedRelinkBeforeInstall(this->ConfigName)) { makeTargetName = this->GetRelativeTargetDirectory(*t->second->Target); makeTargetName += "/preinstall"; @@ -1017,7 +1017,7 @@ cmLocalUnixMakefileGenerator3 for(std::vector::const_iterator i = ccs.begin(); i != ccs.end(); ++i) { - cmCustomCommandGenerator ccg(*i, this->ConfigurationName, + cmCustomCommandGenerator ccg(*i, this->ConfigName, this->Makefile); this->AppendCustomDepend(depends, ccg); } @@ -1034,7 +1034,7 @@ cmLocalUnixMakefileGenerator3 { // Lookup the real name of the dependency in case it is a CMake target. std::string dep; - if(this->GetRealDependency(*d, this->ConfigurationName, + if(this->GetRealDependency(*d, this->ConfigName, dep)) { depends.push_back(dep); @@ -1053,7 +1053,7 @@ cmLocalUnixMakefileGenerator3 for(std::vector::const_iterator i = ccs.begin(); i != ccs.end(); ++i) { - cmCustomCommandGenerator ccg(*i, this->ConfigurationName, + cmCustomCommandGenerator ccg(*i, this->ConfigName, this->Makefile); this->AppendCustomCommand(commands, ccg, target, true, relative); } @@ -2043,7 +2043,7 @@ void cmLocalUnixMakefileGenerator3 // Build a list of preprocessor definitions for the target. std::set defines; this->AddCompileDefinitions(defines, &target, - this->ConfigurationName, l->first); + this->ConfigName, l->first); if(!defines.empty()) { cmakefileStream diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index 70d59decd..ed77a5fd5 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -46,6 +46,7 @@ public: */ virtual void Generate(); + std::string const& GetConfigName() { return this->ConfigName; } // this returns the relative path between the HomeOutputDirectory and this // local generators StartOutputDirectory @@ -253,7 +254,7 @@ private: ImplicitDependTargetMap ImplicitDepends; - std::string ConfigurationName; + std::string ConfigName; std::string HomeRelativeOutputPath; diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 3e45d104b..33713815e 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -44,7 +44,7 @@ cmMakefileTargetGenerator::cmMakefileTargetGenerator(cmGeneratorTarget* target) this->FortranModuleDirectoryComputed = false; this->LocalGenerator = static_cast(target->GetLocalGenerator()); - this->ConfigName = this->LocalGenerator->ConfigurationName.c_str(); + this->ConfigName = this->LocalGenerator->GetConfigName().c_str(); this->GlobalGenerator = static_cast( this->LocalGenerator->GetGlobalGenerator()); @@ -337,7 +337,7 @@ std::string cmMakefileTargetGenerator::GetDefines(const std::string &l) // Add preprocessor definitions for this target and configuration. this->LocalGenerator->AddCompileDefinitions(defines, this->Target, - this->LocalGenerator->ConfigurationName, l); + this->LocalGenerator->GetConfigName(), l); std::string definesString; this->LocalGenerator->JoinDefines(defines, definesString, lang); @@ -565,7 +565,7 @@ cmMakefileTargetGenerator this->LocalGenerator->AppendFlags(flags, langFlags); std::string configUpper = - cmSystemTools::UpperCase(this->LocalGenerator->ConfigurationName); + cmSystemTools::UpperCase(this->LocalGenerator->GetConfigName()); // Add Fortran format flags. if(lang == "Fortran") @@ -1156,7 +1156,7 @@ void cmMakefileTargetGenerator::WriteTargetDependRules() << "# Targets to which this target links.\n" << "set(CMAKE_TARGET_LINKED_INFO_FILES\n"; std::set emitted; - const char* cfg = this->LocalGenerator->ConfigurationName.c_str(); + const char* cfg = this->LocalGenerator->GetConfigName().c_str(); if(cmComputeLinkInformation* cli = this->Target->GetLinkInformation(cfg)) { cmComputeLinkInformation::ItemVector const& items = cli->GetItems(); @@ -1597,7 +1597,7 @@ std::string cmMakefileTargetGenerator::GetFrameworkFlags(std::string const& l) } std::string flags; - const char* cfg = this->LocalGenerator->ConfigurationName.c_str(); + const char* cfg = this->LocalGenerator->GetConfigName().c_str(); if(cmComputeLinkInformation* cli = this->Target->GetLinkInformation(cfg)) { std::vector const& frameworks = cli->GetFrameworkPaths(); @@ -1627,7 +1627,7 @@ void cmMakefileTargetGenerator } // Loop over all library dependencies. - const char* cfg = this->LocalGenerator->ConfigurationName.c_str(); + const char* cfg = this->LocalGenerator->GetConfigName().c_str(); if(cmComputeLinkInformation* cli = this->Target->GetLinkInformation(cfg)) { std::vector const& libDeps = cli->GetDepends(); From 9d41f6d87b28c46d8a6d52f2de91976819e6b4d0 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 8 Jul 2015 11:27:22 -0400 Subject: [PATCH 0291/1048] cmLocalCommonGenerator: Adopt ConfigName member De-duplicate the member from the local Makefile and Ninja generators. --- Source/cmLocalCommonGenerator.cxx | 17 +++++++++++++++++ Source/cmLocalCommonGenerator.h | 6 ++++++ Source/cmLocalNinjaGenerator.cxx | 17 ----------------- Source/cmLocalNinjaGenerator.h | 6 ------ Source/cmLocalUnixMakefileGenerator3.cxx | 12 +----------- Source/cmLocalUnixMakefileGenerator3.h | 4 ---- 6 files changed, 24 insertions(+), 38 deletions(-) diff --git a/Source/cmLocalCommonGenerator.cxx b/Source/cmLocalCommonGenerator.cxx index 0b266f8ff..45834467f 100644 --- a/Source/cmLocalCommonGenerator.cxx +++ b/Source/cmLocalCommonGenerator.cxx @@ -11,6 +11,8 @@ ============================================================================*/ #include "cmLocalCommonGenerator.h" +#include "cmMakefile.h" + cmLocalCommonGenerator::cmLocalCommonGenerator(cmGlobalGenerator* gg, cmLocalGenerator* parent, cmState::Snapshot snapshot): @@ -21,3 +23,18 @@ cmLocalCommonGenerator::cmLocalCommonGenerator(cmGlobalGenerator* gg, cmLocalCommonGenerator::~cmLocalCommonGenerator() { } + +void cmLocalCommonGenerator::SetConfigName() +{ + // Store the configuration name that will be generated. + if(const char* config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE")) + { + // Use the build type given by the user. + this->ConfigName = config; + } + else + { + // No configuration type given. + this->ConfigName = ""; + } +} diff --git a/Source/cmLocalCommonGenerator.h b/Source/cmLocalCommonGenerator.h index c897e498e..c18ec167c 100644 --- a/Source/cmLocalCommonGenerator.h +++ b/Source/cmLocalCommonGenerator.h @@ -24,6 +24,12 @@ public: cmLocalGenerator* parent, cmState::Snapshot snapshot); ~cmLocalCommonGenerator(); + + std::string const& GetConfigName() { return this->ConfigName; } + +protected: + void SetConfigName(); + std::string ConfigName; }; #endif diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index e712b4690..a293d061c 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -26,7 +26,6 @@ cmLocalNinjaGenerator::cmLocalNinjaGenerator(cmGlobalGenerator* gg, cmLocalGenerator* parent, cmState::Snapshot snapshot) : cmLocalCommonGenerator(gg, parent, snapshot) - , ConfigName("") , HomeRelativeOutputPath("") { this->TargetImplib = "$TARGET_IMPLIB"; @@ -261,22 +260,6 @@ void cmLocalNinjaGenerator::WriteNinjaFilesInclusion(std::ostream& os) os << "\n"; } -void cmLocalNinjaGenerator::SetConfigName() -{ - // Store the configuration name that will be generated. - if(const char* config = - this->GetMakefile()->GetDefinition("CMAKE_BUILD_TYPE")) - { - // Use the build type given by the user. - this->ConfigName = config; - } - else - { - // No configuration type given. - this->ConfigName = ""; - } -} - //---------------------------------------------------------------------------- void cmLocalNinjaGenerator::ComputeObjectFilenames( std::map& mapping, diff --git a/Source/cmLocalNinjaGenerator.h b/Source/cmLocalNinjaGenerator.h index 8bc564068..d10be0c5a 100644 --- a/Source/cmLocalNinjaGenerator.h +++ b/Source/cmLocalNinjaGenerator.h @@ -46,9 +46,6 @@ public: const cmake* GetCMakeInstance() const; cmake* GetCMakeInstance(); - std::string const& GetConfigName() const - { return this->ConfigName; } - /// @returns the relative path between the HomeOutputDirectory and this /// local generators StartOutputDirectory. std::string GetHomeRelativeOutputPath() const @@ -110,8 +107,6 @@ private: void WriteProcessedMakefile(std::ostream& os); void WritePools(std::ostream& os); - void SetConfigName(); - void WriteCustomCommandRule(); void WriteCustomCommandBuildStatement(cmCustomCommand const *cc, const cmNinjaDeps& orderOnlyDeps); @@ -120,7 +115,6 @@ private: std::string MakeCustomLauncher(cmCustomCommandGenerator const& ccg); - std::string ConfigName; std::string HomeRelativeOutputPath; typedef std::map > diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 1c6bd7cff..5d17a404a 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -100,17 +100,7 @@ cmLocalUnixMakefileGenerator3::~cmLocalUnixMakefileGenerator3() //---------------------------------------------------------------------------- void cmLocalUnixMakefileGenerator3::Generate() { - // Store the configuration name that will be generated. - if(const char* config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE")) - { - // Use the build type given by the user. - this->ConfigName = config; - } - else - { - // No configuration type given. - this->ConfigName = ""; - } + this->SetConfigName(); // Record whether some options are enabled to avoid checking many // times later. diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index ed77a5fd5..01ac01b7b 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -46,8 +46,6 @@ public: */ virtual void Generate(); - std::string const& GetConfigName() { return this->ConfigName; } - // this returns the relative path between the HomeOutputDirectory and this // local generators StartOutputDirectory const std::string &GetHomeRelativeOutputPath(); @@ -254,8 +252,6 @@ private: ImplicitDependTargetMap ImplicitDepends; - std::string ConfigName; - std::string HomeRelativeOutputPath; struct LocalObjectEntry From abfa5f2d1fac0a55b430e078884ad1ae252d20cd Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 8 Jul 2015 15:02:11 -0400 Subject: [PATCH 0292/1048] cmCommonTargetGenerator: Adopt ConfigName member De-duplicate the member from the Makefile and Ninja target generators. --- Source/cmCommonTargetGenerator.cxx | 6 ++++++ Source/cmCommonTargetGenerator.h | 3 +++ Source/cmMakefileTargetGenerator.cxx | 1 - Source/cmMakefileTargetGenerator.h | 1 - Source/cmNinjaTargetGenerator.cxx | 5 ----- Source/cmNinjaTargetGenerator.h | 2 -- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx index 9d10e39bd..3edeff347 100644 --- a/Source/cmCommonTargetGenerator.cxx +++ b/Source/cmCommonTargetGenerator.cxx @@ -23,9 +23,15 @@ cmCommonTargetGenerator::cmCommonTargetGenerator(cmGeneratorTarget* gt) , LocalGenerator(static_cast(gt->LocalGenerator)) , GlobalGenerator(static_cast( gt->LocalGenerator->GetGlobalGenerator())) + , ConfigName(LocalGenerator->GetConfigName()) { } cmCommonTargetGenerator::~cmCommonTargetGenerator() { } + +std::string const& cmCommonTargetGenerator::GetConfigName() const +{ + return this->ConfigName; +} diff --git a/Source/cmCommonTargetGenerator.h b/Source/cmCommonTargetGenerator.h index e39f2c83e..bf2add39a 100644 --- a/Source/cmCommonTargetGenerator.h +++ b/Source/cmCommonTargetGenerator.h @@ -29,12 +29,15 @@ public: cmCommonTargetGenerator(cmGeneratorTarget* gt); virtual ~cmCommonTargetGenerator(); + std::string const& GetConfigName() const; + protected: cmGeneratorTarget* GeneratorTarget; cmTarget* Target; cmMakefile* Makefile; cmLocalCommonGenerator* LocalGenerator; cmGlobalCommonGenerator* GlobalGenerator; + std::string ConfigName; }; #endif diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 33713815e..5c9402edd 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -44,7 +44,6 @@ cmMakefileTargetGenerator::cmMakefileTargetGenerator(cmGeneratorTarget* target) this->FortranModuleDirectoryComputed = false; this->LocalGenerator = static_cast(target->GetLocalGenerator()); - this->ConfigName = this->LocalGenerator->GetConfigName().c_str(); this->GlobalGenerator = static_cast( this->LocalGenerator->GetGlobalGenerator()); diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h index 787f2467a..2985f4e7c 100644 --- a/Source/cmMakefileTargetGenerator.h +++ b/Source/cmMakefileTargetGenerator.h @@ -177,7 +177,6 @@ protected: std::string& linkFlags); cmLocalUnixMakefileGenerator3 *LocalGenerator; cmGlobalUnixMakefileGenerator3 *GlobalGenerator; - std::string ConfigName; enum CustomCommandDriveType { OnBuild, OnDepends, OnUtility }; CustomCommandDriveType CustomCommandDriver; diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 5ede08af9..152bf7c26 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -89,11 +89,6 @@ cmGlobalNinjaGenerator* cmNinjaTargetGenerator::GetGlobalGenerator() const return this->LocalGenerator->GetGlobalNinjaGenerator(); } -std::string const& cmNinjaTargetGenerator::GetConfigName() const -{ - return this->LocalGenerator->GetConfigName(); -} - std::string cmNinjaTargetGenerator::LanguageCompilerRule( const std::string& lang) const { diff --git a/Source/cmNinjaTargetGenerator.h b/Source/cmNinjaTargetGenerator.h index 87ba17fb6..e4468765d 100644 --- a/Source/cmNinjaTargetGenerator.h +++ b/Source/cmNinjaTargetGenerator.h @@ -67,8 +67,6 @@ protected: cmMakefile* GetMakefile() const { return this->Makefile; } - std::string const& GetConfigName() const; - std::string LanguageCompilerRule(const std::string& lang) const; const char* GetFeature(const std::string& feature); From beee79373222ea01008cd137dd9a3ffa59cbe347 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 8 Jul 2015 14:49:04 -0400 Subject: [PATCH 0293/1048] cmCommonTargetGenerator: Adopt GetFeature and friends De-duplicate the GetFeature, GetFeatureAsBool, and AddFeatureFlags members from the Makefile and Ninja target generators. --- Source/cmCommonTargetGenerator.cxx | 26 ++++++++++++++++++++++++++ Source/cmCommonTargetGenerator.h | 8 ++++++++ Source/cmMakefileTargetGenerator.cxx | 26 -------------------------- Source/cmMakefileTargetGenerator.h | 7 ------- Source/cmNinjaTargetGenerator.cxx | 26 -------------------------- Source/cmNinjaTargetGenerator.h | 4 ---- 6 files changed, 34 insertions(+), 63 deletions(-) diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx index 3edeff347..34982b098 100644 --- a/Source/cmCommonTargetGenerator.cxx +++ b/Source/cmCommonTargetGenerator.cxx @@ -35,3 +35,29 @@ std::string const& cmCommonTargetGenerator::GetConfigName() const { return this->ConfigName; } + +//---------------------------------------------------------------------------- +const char* cmCommonTargetGenerator::GetFeature(const std::string& feature) +{ + return this->GeneratorTarget->GetFeature(feature, this->ConfigName); +} + +//---------------------------------------------------------------------------- +bool cmCommonTargetGenerator::GetFeatureAsBool(const std::string& feature) +{ + return this->GeneratorTarget->GetFeatureAsBool(feature, this->ConfigName); +} + +//---------------------------------------------------------------------------- +void cmCommonTargetGenerator::AddFeatureFlags( + std::string& flags, const std::string& lang + ) +{ + // Add language-specific flags. + this->LocalGenerator->AddLanguageFlags(flags, lang, this->ConfigName); + + if(this->GetFeatureAsBool("INTERPROCEDURAL_OPTIMIZATION")) + { + this->LocalGenerator->AppendFeatureOptions(flags, lang, "IPO"); + } +} diff --git a/Source/cmCommonTargetGenerator.h b/Source/cmCommonTargetGenerator.h index bf2add39a..25d19a0f0 100644 --- a/Source/cmCommonTargetGenerator.h +++ b/Source/cmCommonTargetGenerator.h @@ -32,6 +32,14 @@ public: std::string const& GetConfigName() const; protected: + + // Add language feature flags. + void AddFeatureFlags(std::string& flags, const std::string& lang); + + // Feature query methods. + const char* GetFeature(const std::string& feature); + bool GetFeatureAsBool(const std::string& feature); + cmGeneratorTarget* GeneratorTarget; cmTarget* Target; cmMakefile* Makefile; diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 5c9402edd..42fb89c3b 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -2099,29 +2099,3 @@ void cmMakefileTargetGenerator::AddModuleDefinitionFlag(std::string& flags) flag += (this->LocalGenerator->ConvertToLinkReference(def)); this->LocalGenerator->AppendFlags(flags, flag); } - -//---------------------------------------------------------------------------- -const char* cmMakefileTargetGenerator::GetFeature(const std::string& feature) -{ - return this->GeneratorTarget->GetFeature(feature, this->ConfigName); -} - -//---------------------------------------------------------------------------- -bool cmMakefileTargetGenerator::GetFeatureAsBool(const std::string& feature) -{ - return this->GeneratorTarget->GetFeatureAsBool(feature, this->ConfigName); -} - -//---------------------------------------------------------------------------- -void cmMakefileTargetGenerator::AddFeatureFlags( - std::string& flags, const std::string& lang - ) -{ - // Add language-specific flags. - this->LocalGenerator->AddLanguageFlags(flags, lang, this->ConfigName); - - if(this->GetFeatureAsBool("INTERPROCEDURAL_OPTIMIZATION")) - { - this->LocalGenerator->AppendFeatureOptions(flags, lang, "IPO"); - } -} diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h index 2985f4e7c..541542313 100644 --- a/Source/cmMakefileTargetGenerator.h +++ b/Source/cmMakefileTargetGenerator.h @@ -258,13 +258,6 @@ protected: // Helper to add flag for windows .def file. void AddModuleDefinitionFlag(std::string& flags); - // Add language feature flags. - void AddFeatureFlags(std::string& flags, const std::string& lang); - - // Feature query methods. - const char* GetFeature(const std::string& feature); - bool GetFeatureAsBool(const std::string& feature); - //================================================================== // Convenience routines that do nothing more than forward to // implementaitons diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 152bf7c26..8bc0ad0a9 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -96,32 +96,6 @@ std::string cmNinjaTargetGenerator::LanguageCompilerRule( cmGlobalNinjaGenerator::EncodeRuleName(this->Target->GetName()); } -// TODO: Picked up from cmMakefileTargetGenerator. Refactor it. -const char* cmNinjaTargetGenerator::GetFeature(const std::string& feature) -{ - return this->GeneratorTarget->GetFeature(feature, this->GetConfigName()); -} - -// TODO: Picked up from cmMakefileTargetGenerator. Refactor it. -bool cmNinjaTargetGenerator::GetFeatureAsBool(const std::string& feature) -{ - return this->GeneratorTarget->GetFeatureAsBool(feature, - this->GetConfigName()); -} - -// TODO: Picked up from cmMakefileTargetGenerator. Refactor it. -void cmNinjaTargetGenerator::AddFeatureFlags(std::string& flags, - const std::string& lang) -{ - // Add language-specific flags. - this->LocalGenerator->AddLanguageFlags(flags, lang, this->GetConfigName()); - - if(this->GetFeatureAsBool("INTERPROCEDURAL_OPTIMIZATION")) - { - this->LocalGenerator->AppendFeatureOptions(flags, lang, "IPO"); - } -} - std::string cmNinjaTargetGenerator::OrderDependsTargetForTarget() { diff --git a/Source/cmNinjaTargetGenerator.h b/Source/cmNinjaTargetGenerator.h index e4468765d..639654a75 100644 --- a/Source/cmNinjaTargetGenerator.h +++ b/Source/cmNinjaTargetGenerator.h @@ -69,10 +69,6 @@ protected: std::string LanguageCompilerRule(const std::string& lang) const; - const char* GetFeature(const std::string& feature); - bool GetFeatureAsBool(const std::string& feature); - void AddFeatureFlags(std::string& flags, const std::string& lang); - std::string OrderDependsTargetForTarget(); std::string ComputeOrderDependsForTarget(); From cdb5b65752c5a009ac3bb7425637da808a7a9bca Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 8 Jul 2015 15:24:17 -0400 Subject: [PATCH 0294/1048] cmCommonTargetGenerator: Adopt ModuleDefinitionFile member De-duplicate the ModuleDefinitionFile and AddModuleDefinitionFlag members from the Makefile and Ninja target generators. --- Source/cmCommonTargetGenerator.cxx | 26 ++++++++++++++++++++++ Source/cmCommonTargetGenerator.h | 6 +++++ Source/cmLocalCommonGenerator.h | 4 ++++ Source/cmMakefileTargetGenerator.cxx | 31 ++------------------------ Source/cmMakefileTargetGenerator.h | 3 --- Source/cmNinjaTargetGenerator.cxx | 33 +--------------------------- Source/cmNinjaTargetGenerator.h | 6 ----- 7 files changed, 39 insertions(+), 70 deletions(-) diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx index 34982b098..84a35a829 100644 --- a/Source/cmCommonTargetGenerator.cxx +++ b/Source/cmCommonTargetGenerator.cxx @@ -14,6 +14,7 @@ #include "cmGeneratorTarget.h" #include "cmGlobalCommonGenerator.h" #include "cmLocalCommonGenerator.h" +#include "cmMakefile.h" #include "cmTarget.h" cmCommonTargetGenerator::cmCommonTargetGenerator(cmGeneratorTarget* gt) @@ -24,6 +25,7 @@ cmCommonTargetGenerator::cmCommonTargetGenerator(cmGeneratorTarget* gt) , GlobalGenerator(static_cast( gt->LocalGenerator->GetGlobalGenerator())) , ConfigName(LocalGenerator->GetConfigName()) + , ModuleDefinitionFile(GeneratorTarget->GetModuleDefinitionFile(ConfigName)) { } @@ -61,3 +63,27 @@ void cmCommonTargetGenerator::AddFeatureFlags( this->LocalGenerator->AppendFeatureOptions(flags, lang, "IPO"); } } + +//---------------------------------------------------------------------------- +void cmCommonTargetGenerator::AddModuleDefinitionFlag(std::string& flags) +{ + if(this->ModuleDefinitionFile.empty()) + { + return; + } + + // TODO: Create a per-language flag variable. + const char* defFileFlag = + this->Makefile->GetDefinition("CMAKE_LINK_DEF_FILE_FLAG"); + if(!defFileFlag) + { + return; + } + + // Append the flag and value. Use ConvertToLinkReference to help + // vs6's "cl -link" pass it to the linker. + std::string flag = defFileFlag; + flag += (this->LocalGenerator->ConvertToLinkReference( + this->ModuleDefinitionFile)); + this->LocalGenerator->AppendFlags(flags, flag); +} diff --git a/Source/cmCommonTargetGenerator.h b/Source/cmCommonTargetGenerator.h index 25d19a0f0..deeb5ee99 100644 --- a/Source/cmCommonTargetGenerator.h +++ b/Source/cmCommonTargetGenerator.h @@ -40,12 +40,18 @@ protected: const char* GetFeature(const std::string& feature); bool GetFeatureAsBool(const std::string& feature); + // Helper to add flag for windows .def file. + void AddModuleDefinitionFlag(std::string& flags); + cmGeneratorTarget* GeneratorTarget; cmTarget* Target; cmMakefile* Makefile; cmLocalCommonGenerator* LocalGenerator; cmGlobalCommonGenerator* GlobalGenerator; std::string ConfigName; + + // The windows module definition source file (.def), if any. + std::string ModuleDefinitionFile; }; #endif diff --git a/Source/cmLocalCommonGenerator.h b/Source/cmLocalCommonGenerator.h index c18ec167c..af94cda75 100644 --- a/Source/cmLocalCommonGenerator.h +++ b/Source/cmLocalCommonGenerator.h @@ -14,6 +14,8 @@ #include "cmLocalGenerator.h" +class cmCommonTargetGenerator; + /** \class cmLocalCommonGenerator * \brief Common infrastructure for Makefile and Ninja local generators. */ @@ -30,6 +32,8 @@ public: protected: void SetConfigName(); std::string ConfigName; + + friend class cmCommonTargetGenerator; }; #endif diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 42fb89c3b..fe6b4f69a 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -1668,11 +1668,9 @@ void cmMakefileTargetGenerator this->AppendTargetDepends(depends); // Add a dependency on the link definitions file, if any. - std::string def = this->GeneratorTarget->GetModuleDefinitionFile( - this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE")); - if(!def.empty()) + if(!this->ModuleDefinitionFile.empty()) { - depends.push_back(def); + depends.push_back(this->ModuleDefinitionFile); } // Add user-specified dependencies. @@ -2074,28 +2072,3 @@ void cmMakefileTargetGenerator::AddFortranFlags(std::string& flags) } } } - -//---------------------------------------------------------------------------- -void cmMakefileTargetGenerator::AddModuleDefinitionFlag(std::string& flags) -{ - std::string def = this->GeneratorTarget->GetModuleDefinitionFile( - this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE")); - if(def.empty()) - { - return; - } - - // TODO: Create a per-language flag variable. - const char* defFileFlag = - this->Makefile->GetDefinition("CMAKE_LINK_DEF_FILE_FLAG"); - if(!defFileFlag) - { - return; - } - - // Append the flag and value. Use ConvertToLinkReference to help - // vs6's "cl -link" pass it to the linker. - std::string flag = defFileFlag; - flag += (this->LocalGenerator->ConvertToLinkReference(def)); - this->LocalGenerator->AppendFlags(flags, flag); -} diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h index 541542313..d2d1df964 100644 --- a/Source/cmMakefileTargetGenerator.h +++ b/Source/cmMakefileTargetGenerator.h @@ -255,9 +255,6 @@ protected: // Compute target-specific Fortran language flags. void AddFortranFlags(std::string& flags); - // Helper to add flag for windows .def file. - void AddModuleDefinitionFlag(std::string& flags); - //================================================================== // Convenience routines that do nothing more than forward to // implementaitons diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 8bc0ad0a9..948840aeb 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -244,7 +244,7 @@ cmNinjaDeps cmNinjaTargetGenerator::ComputeLinkDeps() const // Add a dependency on the link definitions file, if any. if(!this->ModuleDefinitionFile.empty()) { - result.push_back(this->ModuleDefinitionFile); + result.push_back(this->ConvertToNinjaPath(this->ModuleDefinitionFile)); } return result; @@ -574,11 +574,6 @@ cmNinjaTargetGenerator { this->WriteObjectBuildStatement(*si, !orderOnlyDeps.empty()); } - std::string def = this->GeneratorTarget->GetModuleDefinitionFile(config); - if(!def.empty()) - { - this->ModuleDefinitionFile = this->ConvertToNinjaPath(def); - } this->GetBuildFileStream() << "\n"; } @@ -728,32 +723,6 @@ cmNinjaTargetGenerator } } -//---------------------------------------------------------------------------- -void -cmNinjaTargetGenerator -::AddModuleDefinitionFlag(std::string& flags) -{ - if(this->ModuleDefinitionFile.empty()) - { - return; - } - - // TODO: Create a per-language flag variable. - const char* defFileFlag = - this->Makefile->GetDefinition("CMAKE_LINK_DEF_FILE_FLAG"); - if(!defFileFlag) - { - return; - } - - // Append the flag and value. Use ConvertToLinkReference to help - // vs6's "cl -link" pass it to the linker. - std::string flag = defFileFlag; - flag += (this->LocalGenerator->ConvertToLinkReference( - this->ModuleDefinitionFile)); - this->LocalGenerator->AppendFlags(flags, flag); -} - void cmNinjaTargetGenerator ::EnsureDirectoryExists(const std::string& path) const diff --git a/Source/cmNinjaTargetGenerator.h b/Source/cmNinjaTargetGenerator.h index 639654a75..ae668dde4 100644 --- a/Source/cmNinjaTargetGenerator.h +++ b/Source/cmNinjaTargetGenerator.h @@ -115,9 +115,6 @@ protected: cmNinjaDeps GetObjects() const { return this->Objects; } - // Helper to add flag for windows .def file. - void AddModuleDefinitionFlag(std::string& flags); - void EnsureDirectoryExists(const std::string& dir) const; void EnsureParentDirectoryExists(const std::string& path) const; @@ -153,9 +150,6 @@ private: typedef std::map LanguageFlagMap; LanguageFlagMap LanguageFlags; - - // The windows module definition source file (.def), if any. - std::string ModuleDefinitionFile; }; #endif // ! cmNinjaTargetGenerator_h From b2f51aef0d518be6be6fba05147dd53125cdb731 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 8 Jul 2015 15:49:03 -0400 Subject: [PATCH 0295/1048] cmCommonTargetGenerator: Adopt Convert method Move it up from cmMakefileTargetGenerator. --- Source/cmCommonTargetGenerator.cxx | 8 ++++++++ Source/cmCommonTargetGenerator.h | 7 +++++++ Source/cmMakefileTargetGenerator.h | 12 ------------ 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx index 84a35a829..f79d99308 100644 --- a/Source/cmCommonTargetGenerator.cxx +++ b/Source/cmCommonTargetGenerator.cxx @@ -38,6 +38,14 @@ std::string const& cmCommonTargetGenerator::GetConfigName() const return this->ConfigName; } +std::string cmCommonTargetGenerator::Convert( + std::string const& source, + cmLocalGenerator::RelativeRoot relative, + cmLocalGenerator::OutputFormat output) +{ + return this->LocalGenerator->Convert(source, relative, output); +} + //---------------------------------------------------------------------------- const char* cmCommonTargetGenerator::GetFeature(const std::string& feature) { diff --git a/Source/cmCommonTargetGenerator.h b/Source/cmCommonTargetGenerator.h index deeb5ee99..f8a7cf39e 100644 --- a/Source/cmCommonTargetGenerator.h +++ b/Source/cmCommonTargetGenerator.h @@ -14,6 +14,8 @@ #include "cmStandardIncludes.h" +#include "cmLocalGenerator.h" + class cmGeneratorTarget; class cmGlobalCommonGenerator; class cmLocalCommonGenerator; @@ -52,6 +54,11 @@ protected: // The windows module definition source file (.def), if any. std::string ModuleDefinitionFile; + + std::string Convert(std::string const& source, + cmLocalGenerator::RelativeRoot relative, + cmLocalGenerator::OutputFormat output = + cmLocalGenerator::UNCHANGED); }; #endif diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h index d2d1df964..09f3c525d 100644 --- a/Source/cmMakefileTargetGenerator.h +++ b/Source/cmMakefileTargetGenerator.h @@ -254,18 +254,6 @@ protected: // Compute target-specific Fortran language flags. void AddFortranFlags(std::string& flags); - - //================================================================== - // Convenience routines that do nothing more than forward to - // implementaitons - std::string Convert(const std::string& source, - cmLocalGenerator::RelativeRoot relative, - cmLocalGenerator::OutputFormat output = - cmLocalGenerator::UNCHANGED) - { - return this->LocalGenerator->Convert(source, relative, output); - } - }; #endif From 0b22c0b815974de148b5fed3a33a3337380347c9 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 8 Jul 2015 15:50:25 -0400 Subject: [PATCH 0296/1048] cmCommonTargetGenerator: Adopt AddFortranFlags and friends Move AddFortranFlags, GetFortranModuleDirectory, and supporting members up from cmMakefileTargetGenerator. --- Source/cmCommonTargetGenerator.cxx | 97 ++++++++++++++++++++++++++++ Source/cmCommonTargetGenerator.h | 8 +++ Source/cmMakefileTargetGenerator.cxx | 96 --------------------------- Source/cmMakefileTargetGenerator.h | 8 --- 4 files changed, 105 insertions(+), 104 deletions(-) diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx index f79d99308..cbcf68251 100644 --- a/Source/cmCommonTargetGenerator.cxx +++ b/Source/cmCommonTargetGenerator.cxx @@ -15,6 +15,7 @@ #include "cmGlobalCommonGenerator.h" #include "cmLocalCommonGenerator.h" #include "cmMakefile.h" +#include "cmSystemTools.h" #include "cmTarget.h" cmCommonTargetGenerator::cmCommonTargetGenerator(cmGeneratorTarget* gt) @@ -26,6 +27,7 @@ cmCommonTargetGenerator::cmCommonTargetGenerator(cmGeneratorTarget* gt) gt->LocalGenerator->GetGlobalGenerator())) , ConfigName(LocalGenerator->GetConfigName()) , ModuleDefinitionFile(GeneratorTarget->GetModuleDefinitionFile(ConfigName)) + , FortranModuleDirectoryComputed(false) { } @@ -95,3 +97,98 @@ void cmCommonTargetGenerator::AddModuleDefinitionFlag(std::string& flags) this->ModuleDefinitionFile)); this->LocalGenerator->AppendFlags(flags, flag); } + +//---------------------------------------------------------------------------- +const char* 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; + } + + // Return the computed directory. + if(this->FortranModuleDirectory.empty()) + { + return 0; + } + else + { + return this->FortranModuleDirectory.c_str(); + } +} + +//---------------------------------------------------------------------------- +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. + const char* mod_dir = this->GetFortranModuleDirectory(); + if(!mod_dir) + { + mod_dir = this->Makefile->GetDefinition("CMAKE_Fortran_MODDIR_DEFAULT"); + } + if(mod_dir) + { + 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); + 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 includes; + const std::string& config = + this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); + this->LocalGenerator->GetIncludeDirectories(includes, + this->GeneratorTarget, + "C", config); + for(std::vector::const_iterator idi = includes.begin(); + idi != includes.end(); ++idi) + { + std::string flg = modpath_flag; + flg += this->Convert(*idi, + cmLocalGenerator::NONE, + cmLocalGenerator::SHELL); + this->LocalGenerator->AppendFlags(flags, flg); + } + } +} diff --git a/Source/cmCommonTargetGenerator.h b/Source/cmCommonTargetGenerator.h index f8a7cf39e..c1c08f606 100644 --- a/Source/cmCommonTargetGenerator.h +++ b/Source/cmCommonTargetGenerator.h @@ -55,6 +55,14 @@ protected: // The windows module definition source file (.def), if any. std::string ModuleDefinitionFile; + // Target-wide Fortran module output directory. + bool FortranModuleDirectoryComputed; + std::string FortranModuleDirectory; + const char* GetFortranModuleDirectory(); + + // Compute target-specific Fortran language flags. + void AddFortranFlags(std::string& flags); + std::string Convert(std::string const& source, cmLocalGenerator::RelativeRoot relative, cmLocalGenerator::OutputFormat output = diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index fe6b4f69a..4c9278a53 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -41,7 +41,6 @@ cmMakefileTargetGenerator::cmMakefileTargetGenerator(cmGeneratorTarget* target) this->InfoFileStream = 0; this->FlagFileStream = 0; this->CustomCommandDriver = OnBuild; - this->FortranModuleDirectoryComputed = false; this->LocalGenerator = static_cast(target->GetLocalGenerator()); this->GlobalGenerator = @@ -1977,98 +1976,3 @@ void cmMakefileTargetGenerator::AddIncludeFlags(std::string& flags, this->LocalGenerator->AppendFlags(flags, includeFlags); } } - -//---------------------------------------------------------------------------- -const char* cmMakefileTargetGenerator::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; - } - - // Return the computed directory. - if(this->FortranModuleDirectory.empty()) - { - return 0; - } - else - { - return this->FortranModuleDirectory.c_str(); - } -} - -//---------------------------------------------------------------------------- -void cmMakefileTargetGenerator::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. - const char* mod_dir = this->GetFortranModuleDirectory(); - if(!mod_dir) - { - mod_dir = this->Makefile->GetDefinition("CMAKE_Fortran_MODDIR_DEFAULT"); - } - if(mod_dir) - { - 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); - 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 includes; - const std::string& config = - this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); - this->LocalGenerator->GetIncludeDirectories(includes, - this->GeneratorTarget, - "C", config); - for(std::vector::const_iterator idi = includes.begin(); - idi != includes.end(); ++idi) - { - std::string flg = modpath_flag; - flg += this->Convert(*idi, - cmLocalGenerator::NONE, - cmLocalGenerator::SHELL); - this->LocalGenerator->AppendFlags(flags, flg); - } - } -} diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h index 09f3c525d..1c02dddd2 100644 --- a/Source/cmMakefileTargetGenerator.h +++ b/Source/cmMakefileTargetGenerator.h @@ -246,14 +246,6 @@ protected: ByLanguageMap FlagsByLanguage; std::string GetDefines(const std::string &l); ByLanguageMap DefinesByLanguage; - - // Target-wide Fortran module output directory. - bool FortranModuleDirectoryComputed; - std::string FortranModuleDirectory; - const char* GetFortranModuleDirectory(); - - // Compute target-specific Fortran language flags. - void AddFortranFlags(std::string& flags); }; #endif From ab8240189dd67cc15c5aed59b8c0ffde99d3b403 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 8 Jul 2015 15:52:42 -0400 Subject: [PATCH 0297/1048] cmCommonTargetGenerator: Adopt AppendFortranFormatFlags Move up from cmMakefileTargetGenerator. --- Source/cmCommonTargetGenerator.cxx | 30 ++++++++++++++++++++++++++++ Source/cmCommonTargetGenerator.h | 4 ++++ Source/cmMakefileTargetGenerator.cxx | 29 --------------------------- Source/cmMakefileTargetGenerator.h | 3 --- 4 files changed, 34 insertions(+), 32 deletions(-) diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx index cbcf68251..c691fa4fd 100644 --- a/Source/cmCommonTargetGenerator.cxx +++ b/Source/cmCommonTargetGenerator.cxx @@ -15,6 +15,7 @@ #include "cmGlobalCommonGenerator.h" #include "cmLocalCommonGenerator.h" #include "cmMakefile.h" +#include "cmSourceFile.h" #include "cmSystemTools.h" #include "cmTarget.h" @@ -192,3 +193,32 @@ void cmCommonTargetGenerator::AddFortranFlags(std::string& flags) } } } + +//---------------------------------------------------------------------------- +void +cmCommonTargetGenerator +::AppendFortranFormatFlags(std::string& flags, cmSourceFile const& source) +{ + const char* srcfmt = source.GetProperty("Fortran_FORMAT"); + cmLocalGenerator::FortranFormat format = + this->LocalGenerator->GetFortranFormat(srcfmt); + if(format == cmLocalGenerator::FortranFormatNone) + { + const char* tgtfmt = this->Target->GetProperty("Fortran_FORMAT"); + format = this->LocalGenerator->GetFortranFormat(tgtfmt); + } + const char* var = 0; + switch (format) + { + case cmLocalGenerator::FortranFormatFixed: + var = "CMAKE_Fortran_FORMAT_FIXED_FLAG"; break; + case cmLocalGenerator::FortranFormatFree: + var = "CMAKE_Fortran_FORMAT_FREE_FLAG"; break; + default: break; + } + if(var) + { + this->LocalGenerator->AppendFlags( + flags, this->Makefile->GetDefinition(var)); + } +} diff --git a/Source/cmCommonTargetGenerator.h b/Source/cmCommonTargetGenerator.h index c1c08f606..0683e3c65 100644 --- a/Source/cmCommonTargetGenerator.h +++ b/Source/cmCommonTargetGenerator.h @@ -20,6 +20,7 @@ class cmGeneratorTarget; class cmGlobalCommonGenerator; class cmLocalCommonGenerator; class cmMakefile; +class cmSourceFile; class cmTarget; /** \class cmCommonTargetGenerator @@ -67,6 +68,9 @@ protected: cmLocalGenerator::RelativeRoot relative, cmLocalGenerator::OutputFormat output = cmLocalGenerator::UNCHANGED); + + void AppendFortranFormatFlags(std::string& flags, + cmSourceFile const& source); }; #endif diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 4c9278a53..e4ae67745 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -504,35 +504,6 @@ void cmMakefileTargetGenerator srcFullPath.c_str()); } -//---------------------------------------------------------------------------- -void -cmMakefileTargetGenerator -::AppendFortranFormatFlags(std::string& flags, cmSourceFile const& source) -{ - const char* srcfmt = source.GetProperty("Fortran_FORMAT"); - cmLocalGenerator::FortranFormat format = - this->LocalGenerator->GetFortranFormat(srcfmt); - if(format == cmLocalGenerator::FortranFormatNone) - { - const char* tgtfmt = this->Target->GetProperty("Fortran_FORMAT"); - format = this->LocalGenerator->GetFortranFormat(tgtfmt); - } - const char* var = 0; - switch (format) - { - case cmLocalGenerator::FortranFormatFixed: - var = "CMAKE_Fortran_FORMAT_FIXED_FLAG"; break; - case cmLocalGenerator::FortranFormatFree: - var = "CMAKE_Fortran_FORMAT_FREE_FLAG"; break; - default: break; - } - if(var) - { - this->LocalGenerator->AppendFlags( - flags, this->Makefile->GetDefinition(var)); - } -} - //---------------------------------------------------------------------------- void cmMakefileTargetGenerator diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h index 1c02dddd2..5bf8ad112 100644 --- a/Source/cmMakefileTargetGenerator.h +++ b/Source/cmMakefileTargetGenerator.h @@ -129,9 +129,6 @@ protected: // Return the a string with -F flags on apple std::string GetFrameworkFlags(std::string const& l); - void AppendFortranFormatFlags(std::string& flags, - cmSourceFile const& source); - // append intertarget dependencies void AppendTargetDepends(std::vector& depends); From 058074d499805aa4579c8986b84459f9993f6fad Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 8 Jul 2015 16:38:49 -0400 Subject: [PATCH 0298/1048] cmCommonTargetGenerator: Adopt GetFrameworkFlags Move the member up from cmMakefileTargetGenerator. --- Source/cmCommonTargetGenerator.cxx | 62 ++++++++++++++++++++++++++++ Source/cmCommonTargetGenerator.h | 3 ++ Source/cmMakefileTargetGenerator.cxx | 61 --------------------------- Source/cmMakefileTargetGenerator.h | 3 -- 4 files changed, 65 insertions(+), 64 deletions(-) diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx index c691fa4fd..afe557cf3 100644 --- a/Source/cmCommonTargetGenerator.cxx +++ b/Source/cmCommonTargetGenerator.cxx @@ -11,6 +11,7 @@ ============================================================================*/ #include "cmCommonTargetGenerator.h" +#include "cmComputeLinkInformation.h" #include "cmGeneratorTarget.h" #include "cmGlobalCommonGenerator.h" #include "cmLocalCommonGenerator.h" @@ -222,3 +223,64 @@ cmCommonTargetGenerator flags, this->Makefile->GetDefinition(var)); } } + +//---------------------------------------------------------------------------- +std::string cmCommonTargetGenerator::GetFrameworkFlags(std::string const& l) +{ + if(!this->Makefile->IsOn("APPLE")) + { + return std::string(); + } + + std::string fwSearchFlagVar = "CMAKE_" + l + "_FRAMEWORK_SEARCH_FLAG"; + const char* fwSearchFlag = + this->Makefile->GetDefinition(fwSearchFlagVar); + if(!(fwSearchFlag && *fwSearchFlag)) + { + return std::string(); + } + + std::set emitted; +#ifdef __APPLE__ /* don't insert this when crosscompiling e.g. to iphone */ + emitted.insert("/System/Library/Frameworks"); +#endif + std::vector includes; + + const std::string& config = + this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); + this->LocalGenerator->GetIncludeDirectories(includes, + this->GeneratorTarget, + "C", config); + // check all include directories for frameworks as this + // will already have added a -F for the framework + for(std::vector::iterator i = includes.begin(); + i != includes.end(); ++i) + { + if(this->Target->NameResolvesToFramework(*i)) + { + std::string frameworkDir = *i; + frameworkDir += "/../"; + frameworkDir = cmSystemTools::CollapseFullPath(frameworkDir); + emitted.insert(frameworkDir); + } + } + + std::string flags; + const char* cfg = this->LocalGenerator->GetConfigName().c_str(); + if(cmComputeLinkInformation* cli = this->Target->GetLinkInformation(cfg)) + { + std::vector const& frameworks = cli->GetFrameworkPaths(); + for(std::vector::const_iterator i = frameworks.begin(); + i != frameworks.end(); ++i) + { + if(emitted.insert(*i).second) + { + flags += fwSearchFlag; + flags += this->LocalGenerator + ->ConvertToOutputFormat(*i, cmLocalGenerator::SHELL); + flags += " "; + } + } + } + return flags; +} diff --git a/Source/cmCommonTargetGenerator.h b/Source/cmCommonTargetGenerator.h index 0683e3c65..644d97245 100644 --- a/Source/cmCommonTargetGenerator.h +++ b/Source/cmCommonTargetGenerator.h @@ -71,6 +71,9 @@ protected: void AppendFortranFormatFlags(std::string& flags, cmSourceFile const& source); + + // Return the a string with -F flags on apple + std::string GetFrameworkFlags(std::string const& l); }; #endif diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index e4ae67745..68137ef6e 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -1524,67 +1524,6 @@ void cmMakefileTargetGenerator::WriteTargetDriverRule( depends, no_commands, true); } -//---------------------------------------------------------------------------- -std::string cmMakefileTargetGenerator::GetFrameworkFlags(std::string const& l) -{ - if(!this->Makefile->IsOn("APPLE")) - { - return std::string(); - } - - std::string fwSearchFlagVar = "CMAKE_" + l + "_FRAMEWORK_SEARCH_FLAG"; - const char* fwSearchFlag = - this->Makefile->GetDefinition(fwSearchFlagVar); - if(!(fwSearchFlag && *fwSearchFlag)) - { - return std::string(); - } - - std::set emitted; -#ifdef __APPLE__ /* don't insert this when crosscompiling e.g. to iphone */ - emitted.insert("/System/Library/Frameworks"); -#endif - std::vector includes; - - const std::string& config = - this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); - this->LocalGenerator->GetIncludeDirectories(includes, - this->GeneratorTarget, - "C", config); - // check all include directories for frameworks as this - // will already have added a -F for the framework - for(std::vector::iterator i = includes.begin(); - i != includes.end(); ++i) - { - if(this->Target->NameResolvesToFramework(*i)) - { - std::string frameworkDir = *i; - frameworkDir += "/../"; - frameworkDir = cmSystemTools::CollapseFullPath(frameworkDir); - emitted.insert(frameworkDir); - } - } - - std::string flags; - const char* cfg = this->LocalGenerator->GetConfigName().c_str(); - if(cmComputeLinkInformation* cli = this->Target->GetLinkInformation(cfg)) - { - std::vector const& frameworks = cli->GetFrameworkPaths(); - for(std::vector::const_iterator i = frameworks.begin(); - i != frameworks.end(); ++i) - { - if(emitted.insert(*i).second) - { - flags += fwSearchFlag; - flags += this->LocalGenerator - ->ConvertToOutputFormat(*i, cmLocalGenerator::SHELL); - flags += " "; - } - } - } - return flags; -} - //---------------------------------------------------------------------------- void cmMakefileTargetGenerator ::AppendTargetDepends(std::vector& depends) diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h index 5bf8ad112..e3e3a133f 100644 --- a/Source/cmMakefileTargetGenerator.h +++ b/Source/cmMakefileTargetGenerator.h @@ -126,9 +126,6 @@ protected: void DriveCustomCommands(std::vector& depends); - // Return the a string with -F flags on apple - std::string GetFrameworkFlags(std::string const& l); - // append intertarget dependencies void AppendTargetDepends(std::vector& depends); From 6a56740e27fe74b757ff48999a2f152816ee8e52 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 9 Jul 2015 09:54:56 -0400 Subject: [PATCH 0299/1048] cmNinjaTargetGenerator: Add Fortran flag generation Make ComputeFlagsForObject consistent with the Makefile generator in regard to Fortran flags. --- Source/cmNinjaTargetGenerator.cxx | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 948840aeb..7d3962a4a 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -110,13 +110,6 @@ std::string cmNinjaTargetGenerator::ComputeFlagsForObject(cmSourceFile const* source, const std::string& language) { - // TODO: Fortran support. - // // Fortran-specific flags computed for this target. - // if(*l == "Fortran") - // { - // this->AddFortranFlags(flags); - // } - bool hasLangCached = this->LanguageFlags.count(language) != 0; std::string& languageFlags = this->LanguageFlags[language]; if(!hasLangCached) @@ -128,6 +121,12 @@ cmNinjaTargetGenerator::ComputeFlagsForObject(cmSourceFile const* source, language, this->GetConfigName()); + // Fortran-specific flags computed for this target. + if(language == "Fortran") + { + this->AddFortranFlags(languageFlags); + } + // Add shared-library flags if needed. this->LocalGenerator->AddCMP0018Flags(languageFlags, this->Target, language, @@ -166,6 +165,12 @@ cmNinjaTargetGenerator::ComputeFlagsForObject(cmSourceFile const* source, std::string flags = languageFlags; + // Add Fortran format flags. + if(language == "Fortran") + { + this->AppendFortranFormatFlags(flags, *source); + } + // Add source file specific flags. this->LocalGenerator->AppendFlags(flags, source->GetProperty("COMPILE_FLAGS")); From 73bfad72d3b9ce021074b612bfa0a24bd6a6b04a Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 9 Jul 2015 09:58:13 -0400 Subject: [PATCH 0300/1048] cmNinjaTargetGenerator: Factor out AddIncludeFlags helper Factor an AddIncludeFlags method out of ComputeFlagsForObject just like cmMakefileTargetGenerator has already. --- Source/cmNinjaTargetGenerator.cxx | 39 ++++++++++++++++++------------- Source/cmNinjaTargetGenerator.h | 2 ++ 2 files changed, 25 insertions(+), 16 deletions(-) diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 7d3962a4a..6ae45a931 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -135,23 +135,8 @@ cmNinjaTargetGenerator::ComputeFlagsForObject(cmSourceFile const* source, this->LocalGenerator->AddVisibilityPresetFlags(languageFlags, this->Target, language); - std::vector includes; - this->LocalGenerator->GetIncludeDirectories(includes, - this->GeneratorTarget, - language, - this->GetConfigName()); // Add include directory flags. - std::string includeFlags = - this->LocalGenerator->GetIncludeFlags(includes, this->GeneratorTarget, - language, - language == "RC" ? true : false, // full include paths for RC - // needed by cmcldeps - false, - this->GetConfigName()); - if (this->GetGlobalGenerator()->IsGCCOnWindows()) - cmSystemTools::ReplaceString(includeFlags, "\\", "/"); - - this->LocalGenerator->AppendFlags(languageFlags, includeFlags); + this->AddIncludeFlags(languageFlags, language); // Append old-style preprocessor definition flags. this->LocalGenerator->AppendFlags(languageFlags, @@ -180,6 +165,28 @@ cmNinjaTargetGenerator::ComputeFlagsForObject(cmSourceFile const* source, return flags; } +void cmNinjaTargetGenerator::AddIncludeFlags(std::string& languageFlags, + std::string const& language) +{ + std::vector includes; + this->LocalGenerator->GetIncludeDirectories(includes, + this->GeneratorTarget, + language, + this->GetConfigName()); + // Add include directory flags. + std::string includeFlags = + this->LocalGenerator->GetIncludeFlags(includes, this->GeneratorTarget, + language, + language == "RC" ? true : false, // full include paths for RC + // needed by cmcldeps + false, + this->GetConfigName()); + if (this->GetGlobalGenerator()->IsGCCOnWindows()) + cmSystemTools::ReplaceString(includeFlags, "\\", "/"); + + this->LocalGenerator->AppendFlags(languageFlags, includeFlags); +} + bool cmNinjaTargetGenerator::NeedDepTypeMSVC(const std::string& lang) const { if (lang == "C" || lang == "CXX") diff --git a/Source/cmNinjaTargetGenerator.h b/Source/cmNinjaTargetGenerator.h index ae668dde4..0cd5e4876 100644 --- a/Source/cmNinjaTargetGenerator.h +++ b/Source/cmNinjaTargetGenerator.h @@ -81,6 +81,8 @@ protected: std::string ComputeFlagsForObject(cmSourceFile const* source, const std::string& language); + void AddIncludeFlags(std::string& flags, std::string const& lang); + std::string ComputeDefines(cmSourceFile const* source, const std::string& language); From 7891f5d7e70e650cac940a4b942390492191e656 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 9 Jul 2015 10:03:42 -0400 Subject: [PATCH 0301/1048] cmMakefileTargetGenerator: Fix comment typo --- Source/cmMakefileTargetGenerator.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 68137ef6e..41457393c 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -306,7 +306,7 @@ std::string cmMakefileTargetGenerator::GetFlags(const std::string &l) this->LocalGenerator-> AppendFlags(flags, this->Makefile->GetDefineFlags()); - // Add include directory flags. + // Add framework directory flags. this->LocalGenerator-> AppendFlags(flags,this->GetFrameworkFlags(l)); From f4875bbdd6cc090f5c79f358c55c8b936c6254fd Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 9 Jul 2015 10:04:01 -0400 Subject: [PATCH 0302/1048] cmNinjaTargetGenerator: Add OX X framework flags Teach ComputeFlagsForObject to add -F flags just like the Makefile generator does. --- Source/cmNinjaTargetGenerator.cxx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 6ae45a931..cd54c4dce 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -142,6 +142,10 @@ cmNinjaTargetGenerator::ComputeFlagsForObject(cmSourceFile const* source, this->LocalGenerator->AppendFlags(languageFlags, this->Makefile->GetDefineFlags()); + // Add framework directory flags. + this->LocalGenerator-> + AppendFlags(languageFlags, this->GetFrameworkFlags(language)); + // Add target-specific flags. this->LocalGenerator->AddCompileOptions(languageFlags, this->Target, language, @@ -160,8 +164,6 @@ cmNinjaTargetGenerator::ComputeFlagsForObject(cmSourceFile const* source, this->LocalGenerator->AppendFlags(flags, source->GetProperty("COMPILE_FLAGS")); - // TODO: Handle Apple frameworks. - return flags; } From 0837538e461cfdbc5c673d7f2bf64f6631099bdf Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 9 Jul 2015 10:05:12 -0400 Subject: [PATCH 0303/1048] cmCommonTargetGenerator: Adopt GetFlags method De-duplicate per-target flag computation in Makefile and Ninja target generators. --- Source/cmCommonTargetGenerator.cxx | 48 ++++++++++++++++++++++++++ Source/cmCommonTargetGenerator.h | 7 ++++ Source/cmMakefileTargetGenerator.cxx | 48 -------------------------- Source/cmMakefileTargetGenerator.h | 3 -- Source/cmNinjaTargetGenerator.cxx | 50 +--------------------------- Source/cmNinjaTargetGenerator.h | 3 -- 6 files changed, 56 insertions(+), 103 deletions(-) diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx index afe557cf3..70e9ce29b 100644 --- a/Source/cmCommonTargetGenerator.cxx +++ b/Source/cmCommonTargetGenerator.cxx @@ -284,3 +284,51 @@ std::string cmCommonTargetGenerator::GetFrameworkFlags(std::string const& l) } return flags; } + +//---------------------------------------------------------------------------- +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->Target, + lang, this->ConfigName); + + this->LocalGenerator->AddVisibilityPresetFlags(flags, this->Target, + lang); + + // Add include directory flags. + this->AddIncludeFlags(flags, lang); + + // Append old-style preprocessor definition flags. + this->LocalGenerator-> + AppendFlags(flags, this->Makefile->GetDefineFlags()); + + // Add framework directory flags. + this->LocalGenerator-> + AppendFlags(flags,this->GetFrameworkFlags(l)); + + // Add target-specific flags. + this->LocalGenerator->AddCompileOptions(flags, this->Target, + lang, this->ConfigName); + + ByLanguageMap::value_type entry(l, flags); + i = this->FlagsByLanguage.insert(entry).first; + } + return i->second; +} diff --git a/Source/cmCommonTargetGenerator.h b/Source/cmCommonTargetGenerator.h index 644d97245..5407c61d6 100644 --- a/Source/cmCommonTargetGenerator.h +++ b/Source/cmCommonTargetGenerator.h @@ -74,6 +74,13 @@ protected: // Return the a string with -F flags on apple std::string GetFrameworkFlags(std::string const& l); + + virtual void AddIncludeFlags(std::string& flags, + std::string const& lang) = 0; + + typedef std::map ByLanguageMap; + std::string GetFlags(const std::string &l); + ByLanguageMap FlagsByLanguage; }; #endif diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 41457393c..10799c6f7 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -272,54 +272,6 @@ void cmMakefileTargetGenerator::WriteCommonCodeRules() << "\n\n"; } -//---------------------------------------------------------------------------- -std::string cmMakefileTargetGenerator::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->Target, - lang, this->ConfigName); - - this->LocalGenerator->AddVisibilityPresetFlags(flags, this->Target, - lang); - - // Add include directory flags. - this->AddIncludeFlags(flags, lang); - - // Append old-style preprocessor definition flags. - this->LocalGenerator-> - AppendFlags(flags, this->Makefile->GetDefineFlags()); - - // Add framework directory flags. - this->LocalGenerator-> - AppendFlags(flags,this->GetFrameworkFlags(l)); - - // Add target-specific flags. - this->LocalGenerator->AddCompileOptions(flags, this->Target, - lang, this->ConfigName); - - ByLanguageMap::value_type entry(l, flags); - i = this->FlagsByLanguage.insert(entry).first; - } - return i->second; -} - std::string cmMakefileTargetGenerator::GetDefines(const std::string &l) { ByLanguageMap::iterator i = this->DefinesByLanguage.find(l); diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h index e3e3a133f..9d05cd5cb 100644 --- a/Source/cmMakefileTargetGenerator.h +++ b/Source/cmMakefileTargetGenerator.h @@ -235,9 +235,6 @@ protected: cmOSXBundleGenerator* OSXBundleGenerator; MacOSXContentGeneratorType* MacOSXContentGenerator; - typedef std::map ByLanguageMap; - std::string GetFlags(const std::string &l); - ByLanguageMap FlagsByLanguage; std::string GetDefines(const std::string &l); ByLanguageMap DefinesByLanguage; }; diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index cd54c4dce..05120dada 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -110,55 +110,7 @@ std::string cmNinjaTargetGenerator::ComputeFlagsForObject(cmSourceFile const* source, const std::string& language) { - bool hasLangCached = this->LanguageFlags.count(language) != 0; - std::string& languageFlags = this->LanguageFlags[language]; - if(!hasLangCached) - { - this->AddFeatureFlags(languageFlags, language); - - this->GetLocalGenerator()->AddArchitectureFlags(languageFlags, - this->GeneratorTarget, - language, - this->GetConfigName()); - - // Fortran-specific flags computed for this target. - if(language == "Fortran") - { - this->AddFortranFlags(languageFlags); - } - - // Add shared-library flags if needed. - this->LocalGenerator->AddCMP0018Flags(languageFlags, this->Target, - language, - this->GetConfigName()); - - this->LocalGenerator->AddVisibilityPresetFlags(languageFlags, this->Target, - language); - - // Add include directory flags. - this->AddIncludeFlags(languageFlags, language); - - // Append old-style preprocessor definition flags. - this->LocalGenerator->AppendFlags(languageFlags, - this->Makefile->GetDefineFlags()); - - // Add framework directory flags. - this->LocalGenerator-> - AppendFlags(languageFlags, this->GetFrameworkFlags(language)); - - // Add target-specific flags. - this->LocalGenerator->AddCompileOptions(languageFlags, this->Target, - language, - this->GetConfigName()); - } - - std::string flags = languageFlags; - - // Add Fortran format flags. - if(language == "Fortran") - { - this->AppendFortranFormatFlags(flags, *source); - } + std::string flags = this->GetFlags(language); // Add source file specific flags. this->LocalGenerator->AppendFlags(flags, diff --git a/Source/cmNinjaTargetGenerator.h b/Source/cmNinjaTargetGenerator.h index 0cd5e4876..89124316d 100644 --- a/Source/cmNinjaTargetGenerator.h +++ b/Source/cmNinjaTargetGenerator.h @@ -149,9 +149,6 @@ private: /// List of object files for this target. cmNinjaDeps Objects; std::vector CustomCommands; - - typedef std::map LanguageFlagMap; - LanguageFlagMap LanguageFlags; }; #endif // ! cmNinjaTargetGenerator_h From eacacacdceb4a259ba76edb2219c7f8e6cb3f47e Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 9 Jul 2015 10:10:25 -0400 Subject: [PATCH 0304/1048] cmCommonTargetGenerator: Adopt GetDefines method Move the member up from cmMakefileTargetGenerator so it can be re-used later by cmNinjaTargetGenerator. --- Source/cmCommonTargetGenerator.cxx | 26 ++++++++++++++++++++++++++ Source/cmCommonTargetGenerator.h | 2 ++ Source/cmMakefileTargetGenerator.cxx | 26 -------------------------- Source/cmMakefileTargetGenerator.h | 3 --- 4 files changed, 28 insertions(+), 29 deletions(-) diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx index 70e9ce29b..ce351eea9 100644 --- a/Source/cmCommonTargetGenerator.cxx +++ b/Source/cmCommonTargetGenerator.cxx @@ -332,3 +332,29 @@ std::string cmCommonTargetGenerator::GetFlags(const std::string &l) } return i->second; } + +std::string cmCommonTargetGenerator::GetDefines(const std::string &l) +{ + ByLanguageMap::iterator i = this->DefinesByLanguage.find(l); + if (i == this->DefinesByLanguage.end()) + { + std::set defines; + const char *lang = l.c_str(); + // Add the export symbol definition for shared library objects. + if(const char* exportMacro = this->Target->GetExportMacro()) + { + this->LocalGenerator->AppendDefines(defines, exportMacro); + } + + // Add preprocessor definitions for this target and configuration. + this->LocalGenerator->AddCompileDefinitions(defines, this->Target, + this->LocalGenerator->GetConfigName(), l); + + std::string definesString; + this->LocalGenerator->JoinDefines(defines, definesString, lang); + + ByLanguageMap::value_type entry(l, definesString); + i = this->DefinesByLanguage.insert(entry).first; + } + return i->second; +} diff --git a/Source/cmCommonTargetGenerator.h b/Source/cmCommonTargetGenerator.h index 5407c61d6..e184dba31 100644 --- a/Source/cmCommonTargetGenerator.h +++ b/Source/cmCommonTargetGenerator.h @@ -81,6 +81,8 @@ protected: typedef std::map ByLanguageMap; std::string GetFlags(const std::string &l); ByLanguageMap FlagsByLanguage; + std::string GetDefines(const std::string &l); + ByLanguageMap DefinesByLanguage; }; #endif diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 10799c6f7..ef4bbbe97 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -272,32 +272,6 @@ void cmMakefileTargetGenerator::WriteCommonCodeRules() << "\n\n"; } -std::string cmMakefileTargetGenerator::GetDefines(const std::string &l) -{ - ByLanguageMap::iterator i = this->DefinesByLanguage.find(l); - if (i == this->DefinesByLanguage.end()) - { - std::set defines; - const char *lang = l.c_str(); - // Add the export symbol definition for shared library objects. - if(const char* exportMacro = this->Target->GetExportMacro()) - { - this->LocalGenerator->AppendDefines(defines, exportMacro); - } - - // Add preprocessor definitions for this target and configuration. - this->LocalGenerator->AddCompileDefinitions(defines, this->Target, - this->LocalGenerator->GetConfigName(), l); - - std::string definesString; - this->LocalGenerator->JoinDefines(defines, definesString, lang); - - ByLanguageMap::value_type entry(l, definesString); - i = this->DefinesByLanguage.insert(entry).first; - } - return i->second; -} - void cmMakefileTargetGenerator::WriteTargetLanguageFlags() { // write language flags for target diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h index 9d05cd5cb..b8856724b 100644 --- a/Source/cmMakefileTargetGenerator.h +++ b/Source/cmMakefileTargetGenerator.h @@ -234,9 +234,6 @@ protected: std::set MacContentFolders; cmOSXBundleGenerator* OSXBundleGenerator; MacOSXContentGeneratorType* MacOSXContentGenerator; - - std::string GetDefines(const std::string &l); - ByLanguageMap DefinesByLanguage; }; #endif From fed5eb5b0e0e955bf01351b93c43cc248fd9f5ed Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 9 Jul 2015 10:15:08 -0400 Subject: [PATCH 0305/1048] cmNinjaTargetGenerator: Use GetDefines method Simplify the per-source ComputeDefines implementation by getting target-wide defines from GetDefines. Technically this changes behavior by no-longer de-duplicating/sorting defines from both the target and the source, but this makes it consistent with the Makefile generator. It may also later help move target-wide defines into per-target compilation rules. --- Source/cmNinjaTargetGenerator.cxx | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 05120dada..a72bc7284 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -163,16 +163,6 @@ cmNinjaTargetGenerator:: ComputeDefines(cmSourceFile const* source, const std::string& language) { std::set defines; - - // Add the export symbol definition for shared library objects. - if(const char* exportMacro = this->Target->GetExportMacro()) - { - this->LocalGenerator->AppendDefines(defines, exportMacro); - } - - // Add preprocessor definitions for this target and configuration. - this->LocalGenerator->AddCompileDefinitions(defines, this->Target, - this->GetConfigName(), language); this->LocalGenerator->AppendDefines (defines, source->GetProperty("COMPILE_DEFINITIONS")); @@ -184,7 +174,7 @@ ComputeDefines(cmSourceFile const* source, const std::string& language) source->GetProperty(defPropName)); } - std::string definesString; + std::string definesString = this->GetDefines(language); this->LocalGenerator->JoinDefines(defines, definesString, language); From 9a1ef0dcfd5284801033c4915d58a856fbe29625 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 9 Jul 2015 11:25:30 -0400 Subject: [PATCH 0306/1048] Help: Improve OUTPUT_NAME documentation formatting Also link to its variants. --- Help/prop_tgt/CONFIG_OUTPUT_NAME.rst | 5 +++-- Help/prop_tgt/OUTPUT_NAME.rst | 10 ++++++++++ Help/prop_tgt/OUTPUT_NAME_CONFIG.rst | 3 ++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/Help/prop_tgt/CONFIG_OUTPUT_NAME.rst b/Help/prop_tgt/CONFIG_OUTPUT_NAME.rst index f2c875ef5..a61c70295 100644 --- a/Help/prop_tgt/CONFIG_OUTPUT_NAME.rst +++ b/Help/prop_tgt/CONFIG_OUTPUT_NAME.rst @@ -2,6 +2,7 @@ -------------------- Old per-configuration target file base name. +Use :prop_tgt:`OUTPUT_NAME_` instead. -This is a configuration-specific version of OUTPUT_NAME. Use -OUTPUT_NAME_ instead. +This is a configuration-specific version of the :prop_tgt:`OUTPUT_NAME` +target property. diff --git a/Help/prop_tgt/OUTPUT_NAME.rst b/Help/prop_tgt/OUTPUT_NAME.rst index 97bf01094..24e57cdc9 100644 --- a/Help/prop_tgt/OUTPUT_NAME.rst +++ b/Help/prop_tgt/OUTPUT_NAME.rst @@ -6,3 +6,13 @@ Output name for target files. This sets the base name for output files created for an executable or library target. If not set, the logical target name is used by default. + +See also the variants: + +* :prop_tgt:`OUTPUT_NAME_` +* :prop_tgt:`ARCHIVE_OUTPUT_NAME_` +* :prop_tgt:`ARCHIVE_OUTPUT_NAME` +* :prop_tgt:`LIBRARY_OUTPUT_NAME_` +* :prop_tgt:`LIBRARY_OUTPUT_NAME` +* :prop_tgt:`RUNTIME_OUTPUT_NAME_` +* :prop_tgt:`RUNTIME_OUTPUT_NAME` diff --git a/Help/prop_tgt/OUTPUT_NAME_CONFIG.rst b/Help/prop_tgt/OUTPUT_NAME_CONFIG.rst index 7bfbcbccf..41b782f98 100644 --- a/Help/prop_tgt/OUTPUT_NAME_CONFIG.rst +++ b/Help/prop_tgt/OUTPUT_NAME_CONFIG.rst @@ -3,4 +3,5 @@ OUTPUT_NAME_ Per-configuration target file base name. -This is the configuration-specific version of OUTPUT_NAME. +This is the configuration-specific version of the :prop_tgt:`OUTPUT_NAME` +target property. From 809159c9b7f7cfcb2addeaf968ef2dba740c3606 Mon Sep 17 00:00:00 2001 From: Robert Goulet Date: Wed, 8 Jul 2015 16:53:38 -0400 Subject: [PATCH 0307/1048] Add generator expression support to OUTPUT_NAME target property --- Help/prop_tgt/OUTPUT_NAME.rst | 3 +++ Help/release/dev/OUTPUT_NAME-genex.rst | 5 +++++ Source/cmTarget.cxx | 16 +++++++++++++--- Tests/ExportImport/Export/CMakeLists.txt | 10 ++++++++-- Tests/ExportImport/Export/testLib7.c | 1 + Tests/ExportImport/Import/A/CMakeLists.txt | 2 ++ Tests/ExportImport/Import/A/imp_testExe1.c | 3 ++- 7 files changed, 34 insertions(+), 6 deletions(-) create mode 100644 Help/release/dev/OUTPUT_NAME-genex.rst create mode 100644 Tests/ExportImport/Export/testLib7.c diff --git a/Help/prop_tgt/OUTPUT_NAME.rst b/Help/prop_tgt/OUTPUT_NAME.rst index 24e57cdc9..f1bdb7c88 100644 --- a/Help/prop_tgt/OUTPUT_NAME.rst +++ b/Help/prop_tgt/OUTPUT_NAME.rst @@ -7,6 +7,9 @@ This sets the base name for output files created for an executable or library target. If not set, the logical target name is used by default. +Contents of ``OUTPUT_NAME`` and the variants listed below may use +:manual:`generator expressions `. + See also the variants: * :prop_tgt:`OUTPUT_NAME_` diff --git a/Help/release/dev/OUTPUT_NAME-genex.rst b/Help/release/dev/OUTPUT_NAME-genex.rst new file mode 100644 index 000000000..0a3982099 --- /dev/null +++ b/Help/release/dev/OUTPUT_NAME-genex.rst @@ -0,0 +1,5 @@ +OUTPUT_NAME-genex +----------------- + +* The :prop_tgt:`OUTPUT_NAME` target property and its variants learned to + support :manual:`generator expressions `. diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 3353fbd4a..2b73e6f09 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -4597,15 +4597,25 @@ std::string cmTarget::GetOutputName(const std::string& config, // OUTPUT_NAME props.push_back("OUTPUT_NAME"); + std::string outName; for(std::vector::const_iterator i = props.begin(); i != props.end(); ++i) { - if(const char* outName = this->GetProperty(*i)) + if (const char* outNameProp = this->GetProperty(*i)) { - return outName; + outName = outNameProp; + break; } } - return this->GetName(); + + if (outName.empty()) + { + outName = this->GetName(); + } + + cmGeneratorExpression ge; + cmsys::auto_ptr cge = ge.Parse(outName); + return cge->Evaluate(this->Makefile, config); } //---------------------------------------------------------------------------- diff --git a/Tests/ExportImport/Export/CMakeLists.txt b/Tests/ExportImport/Export/CMakeLists.txt index 0df42d982..df3f178e1 100644 --- a/Tests/ExportImport/Export/CMakeLists.txt +++ b/Tests/ExportImport/Export/CMakeLists.txt @@ -73,6 +73,12 @@ install(TARGETS testLibPerConfigDest EXPORT exp DESTINATION lib/$<$>:$>$<$>>:NoConfig> ) +# Test OUTPUT_NAME properties with generator expressions +add_library(testLib7 STATIC testLib7.c) +set_property(TARGET testLib7 PROPERTY OUTPUT_NAME_DEBUG testLib7D-$) +set_property(TARGET testLib7 PROPERTY OUTPUT_NAME_RELEASE testLib7R-$) +set_property(TARGET testLib7 PROPERTY OUTPUT_NAME testLib7-$) + # Work-around: Visual Studio 6 does not support per-target object files. set(VS6) if("${CMAKE_GENERATOR}" MATCHES "Visual Studio 6") @@ -446,7 +452,7 @@ install( TARGETS testExe1 testLib1 testLib2 testExe2 testLib3 testLib4 testExe3 testExe2lib testLib4lib testLib4libdbg testLib4libopt - testLib6 + testLib6 testLib7 testLibCycleA testLibCycleB cmp0022NEW cmp0022OLD systemlib @@ -505,7 +511,7 @@ export(TARGETS testExe1 testLib1 testLib2 testLib3 NAMESPACE bld_ FILE ExportBuildTree.cmake ) -export(TARGETS testExe2 testLib4 testLib5 testLib6 testExe3 testExe2lib +export(TARGETS testExe2 testLib4 testLib5 testLib6 testLib7 testExe3 testExe2lib testLib4lib testLib4libdbg testLib4libopt testLibCycleA testLibCycleB testLibPerConfigDest diff --git a/Tests/ExportImport/Export/testLib7.c b/Tests/ExportImport/Export/testLib7.c new file mode 100644 index 000000000..7acae9eb1 --- /dev/null +++ b/Tests/ExportImport/Export/testLib7.c @@ -0,0 +1 @@ +int testLib7(void) { return 0; } diff --git a/Tests/ExportImport/Import/A/CMakeLists.txt b/Tests/ExportImport/Import/A/CMakeLists.txt index 17d983a75..a74bad102 100644 --- a/Tests/ExportImport/Import/A/CMakeLists.txt +++ b/Tests/ExportImport/Import/A/CMakeLists.txt @@ -33,6 +33,7 @@ target_link_libraries(imp_testExe1 exp_testLib4 exp_testLib5 exp_testLib6 + exp_testLib7 exp_testLibCycleA exp_testLibPerConfigDest ) @@ -66,6 +67,7 @@ target_link_libraries(imp_testExe1b bld_testLib4 bld_testLib5 bld_testLib6 + bld_testLib7 bld_testLibCycleA bld_testLibPerConfigDest ) diff --git a/Tests/ExportImport/Import/A/imp_testExe1.c b/Tests/ExportImport/Import/A/imp_testExe1.c index 150fcef3e..56cdd2c0a 100644 --- a/Tests/ExportImport/Import/A/imp_testExe1.c +++ b/Tests/ExportImport/Import/A/imp_testExe1.c @@ -6,6 +6,7 @@ extern int testLib4(); extern int testLib4lib(); extern int testLib5(); extern int testLib6(); +extern int testLib7(); extern int testLibCycleA1(); extern int testLibPerConfigDest(); @@ -21,7 +22,7 @@ extern testLib4libcfg(void); int main() { return (testLib2() + generated_by_testExe1() + testLib3() + testLib4() - + testLib5() + testLib6() + testLibCycleA1() + + testLib5() + testLib6() + testLib7() + testLibCycleA1() + testLibPerConfigDest() + generated_by_testExe3() + testLib4lib() + testLib4libcfg()); } From 9a271e13236d81b79e3e367a6898e09d3dcf28d0 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 9 Jul 2015 13:00:33 -0400 Subject: [PATCH 0308/1048] cmQtAutoGenerators: Fix rcc invocation for Qt 5.0 and 5.1 (#15644) In commit v3.2.0-rc1~480^2 (QtAutogen: Regenerate qrc files if their input changes, 2014-09-17) we added use of the rcc "--list" option. Prior to Qt 5.2 this option was called just "-list", and the older name is still supported by the newer tools. Use the older name of the option for compatibility with Qt 5.0 and 5.1. --- Source/cmQtAutoGenerators.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index cbb06cde3..c4b0aa401 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -190,7 +190,7 @@ std::string cmQtAutoGenerators::ListQt5RccInputs(cmSourceFile* sf, std::vector command; command.push_back(rccCommand); - command.push_back("--list"); + command.push_back("-list"); std::string absFile = cmsys::SystemTools::GetRealPath( sf->GetFullPath()); From 9f9d26465fec48f9fe3310079c2414b314feaab1 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Fri, 10 Jul 2015 00:01:06 -0400 Subject: [PATCH 0309/1048] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index eadcb9e13..c79f13ab8 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 3) -set(CMake_VERSION_PATCH 20150709) +set(CMake_VERSION_PATCH 20150710) #set(CMake_VERSION_RC 1) From abeee541133d9fa73a55386aadd94aebe0cdbb92 Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Wed, 8 Jul 2015 09:08:57 -0400 Subject: [PATCH 0310/1048] KWSys 2015-07-08 (d3ba91e1) Extract upstream KWSys using the following shell commands. $ git archive --prefix=upstream-kwsys/ d3ba91e1 | tar x $ git shortlog --no-merges --abbrev=8 --format='%h %s' 8504e845..d3ba91e1 Brad King (1): d3ba91e1 System: Drop Shell_* APIs --- System.c | 585 +--------------------------------------------------- System.h.in | 98 --------- 2 files changed, 2 insertions(+), 681 deletions(-) diff --git a/System.c b/System.c index 1ee26fac5..ccc7e8164 100644 --- a/System.c +++ b/System.c @@ -20,8 +20,8 @@ #include /* ptrdiff_t */ #include /* malloc, free */ -#include /* strlen */ -#include /* isalpha */ +#include /* memcpy */ +#include /* isspace */ #include @@ -31,587 +31,6 @@ typedef ptrdiff_t kwsysSystem_ptrdiff_t; typedef int kwsysSystem_ptrdiff_t; #endif -/* - -Notes: - -Make variable replacements open a can of worms. Sometimes they should -be quoted and sometimes not. Sometimes their replacement values are -already quoted. - -VS variables cause problems. In order to pass the referenced value -with spaces the reference must be quoted. If the variable value ends -in a backslash then it will escape the ending quote! In order to make -the ending backslash appear we need this: - - "$(InputDir)\" - -However if there is not a trailing backslash then this will put a -quote in the value so we need: - - "$(InputDir)" - -Make variable references are platform specific so we should probably -just NOT quote them and let the listfile author deal with it. - -*/ - -/* -TODO: For windows echo: - -To display a pipe (|) or redirection character (< or >) when using the -echo command, use a caret character immediately before the pipe or -redirection character (for example, ^>, ^<, or ^| ). If you need to -use the caret character itself (^), use two in a row (^^). -*/ - -/*--------------------------------------------------------------------------*/ -static int kwsysSystem_Shell__CharIsWhitespace(char c) -{ - return ((c == ' ') || (c == '\t')); -} - -/*--------------------------------------------------------------------------*/ -static int kwsysSystem_Shell__CharNeedsQuotesOnUnix(char c) -{ - return ((c == '\'') || (c == '`') || (c == ';') || (c == '#') || - (c == '&') || (c == '$') || (c == '(') || (c == ')') || - (c == '~') || (c == '<') || (c == '>') || (c == '|') || - (c == '*') || (c == '^') || (c == '\\')); -} - -/*--------------------------------------------------------------------------*/ -static int kwsysSystem_Shell__CharNeedsQuotesOnWindows(char c) -{ - return ((c == '\'') || (c == '#') || (c == '&') || - (c == '<') || (c == '>') || (c == '|') || (c == '^')); -} - -/*--------------------------------------------------------------------------*/ -static int kwsysSystem_Shell__CharNeedsQuotes(char c, int isUnix, int flags) -{ - /* On Windows the built-in command shell echo never needs quotes. */ - if(!isUnix && (flags & kwsysSystem_Shell_Flag_EchoWindows)) - { - return 0; - } - - /* On all platforms quotes are needed to preserve whitespace. */ - if(kwsysSystem_Shell__CharIsWhitespace(c)) - { - return 1; - } - - if(isUnix) - { - /* On UNIX several special characters need quotes to preserve them. */ - if(kwsysSystem_Shell__CharNeedsQuotesOnUnix(c)) - { - return 1; - } - } - else - { - /* On Windows several special characters need quotes to preserve them. */ - if(kwsysSystem_Shell__CharNeedsQuotesOnWindows(c)) - { - return 1; - } - } - return 0; -} - -/*--------------------------------------------------------------------------*/ -static int kwsysSystem_Shell__CharIsMakeVariableName(char c) -{ - return c && (c == '_' || isalpha(((int)c))); -} - -/*--------------------------------------------------------------------------*/ -static const char* kwsysSystem_Shell__SkipMakeVariables(const char* c) -{ - while(*c == '$' && *(c+1) == '(') - { - const char* skip = c+2; - while(kwsysSystem_Shell__CharIsMakeVariableName(*skip)) - { - ++skip; - } - if(*skip == ')') - { - c = skip+1; - } - else - { - break; - } - } - return c; -} - -/* -Allowing make variable replacements opens a can of worms. Sometimes -they should be quoted and sometimes not. Sometimes their replacement -values are already quoted or contain escapes. - -Some Visual Studio variables cause problems. In order to pass the -referenced value with spaces the reference must be quoted. If the -variable value ends in a backslash then it will escape the ending -quote! In order to make the ending backslash appear we need this: - - "$(InputDir)\" - -However if there is not a trailing backslash then this will put a -quote in the value so we need: - - "$(InputDir)" - -This macro decides whether we quote an argument just because it -contains a make variable reference. This should be replaced with a -flag later when we understand applications of this better. -*/ -#define KWSYS_SYSTEM_SHELL_QUOTE_MAKE_VARIABLES 0 - -/*--------------------------------------------------------------------------*/ -static int kwsysSystem_Shell__ArgumentNeedsQuotes(const char* in, int isUnix, - int flags) -{ - /* The empty string needs quotes. */ - if(!*in) - { - return 1; - } - - /* Scan the string for characters that require quoting. */ - { - const char* c; - for(c=in; *c; ++c) - { - /* Look for $(MAKEVAR) syntax if requested. */ - if(flags & kwsysSystem_Shell_Flag_AllowMakeVariables) - { -#if KWSYS_SYSTEM_SHELL_QUOTE_MAKE_VARIABLES - const char* skip = kwsysSystem_Shell__SkipMakeVariables(c); - if(skip != c) - { - /* We need to quote make variable references to preserve the - string with contents substituted in its place. */ - return 1; - } -#else - /* Skip over the make variable references if any are present. */ - c = kwsysSystem_Shell__SkipMakeVariables(c); - - /* Stop if we have reached the end of the string. */ - if(!*c) - { - break; - } -#endif - } - - /* Check whether this character needs quotes. */ - if(kwsysSystem_Shell__CharNeedsQuotes(*c, isUnix, flags)) - { - return 1; - } - } - } - - /* On Windows some single character arguments need quotes. */ - if(!isUnix && *in && !*(in+1)) - { - char c = *in; - if((c == '?') || (c == '&') || (c == '^') || (c == '|') || (c == '#')) - { - return 1; - } - } - - return 0; -} - -/*--------------------------------------------------------------------------*/ -static int kwsysSystem_Shell__GetArgumentSize(const char* in, - int isUnix, int flags) -{ - /* Start with the length of the original argument, plus one for - either a terminating null or a separating space. */ - int size = (int)strlen(in) + 1; - - /* String iterator. */ - const char* c; - - /* Keep track of how many backslashes have been encountered in a row. */ - int windows_backslashes = 0; - - /* Scan the string for characters that require escaping or quoting. */ - for(c=in; *c; ++c) - { - /* Look for $(MAKEVAR) syntax if requested. */ - if(flags & kwsysSystem_Shell_Flag_AllowMakeVariables) - { - /* Skip over the make variable references if any are present. */ - c = kwsysSystem_Shell__SkipMakeVariables(c); - - /* Stop if we have reached the end of the string. */ - if(!*c) - { - break; - } - } - - /* Check whether this character needs escaping for the shell. */ - if(isUnix) - { - /* On Unix a few special characters need escaping even inside a - quoted argument. */ - if(*c == '\\' || *c == '"' || *c == '`' || *c == '$') - { - /* This character needs a backslash to escape it. */ - ++size; - } - } - else if(flags & kwsysSystem_Shell_Flag_EchoWindows) - { - /* On Windows the built-in command shell echo never needs escaping. */ - } - else - { - /* On Windows only backslashes and double-quotes need escaping. */ - if(*c == '\\') - { - /* Found a backslash. It may need to be escaped later. */ - ++windows_backslashes; - } - else if(*c == '"') - { - /* Found a double-quote. We need to escape it and all - immediately preceding backslashes. */ - size += windows_backslashes + 1; - windows_backslashes = 0; - } - else - { - /* Found another character. This eliminates the possibility - that any immediately preceding backslashes will be - escaped. */ - windows_backslashes = 0; - } - } - - /* Check whether this character needs escaping for a make tool. */ - if(*c == '$') - { - if(flags & kwsysSystem_Shell_Flag_Make) - { - /* In Makefiles a dollar is written $$ so we need one extra - character. */ - ++size; - } - else if(flags & kwsysSystem_Shell_Flag_VSIDE) - { - /* In a VS IDE a dollar is written "$" so we need two extra - characters. */ - size += 2; - } - } - else if(*c == '#') - { - if((flags & kwsysSystem_Shell_Flag_Make) && - (flags & kwsysSystem_Shell_Flag_WatcomWMake)) - { - /* In Watcom WMake makefiles a pound is written $# so we need - one extra character. */ - ++size; - } - } - else if(*c == '%') - { - if((flags & kwsysSystem_Shell_Flag_VSIDE) || - ((flags & kwsysSystem_Shell_Flag_Make) && - ((flags & kwsysSystem_Shell_Flag_MinGWMake) || - (flags & kwsysSystem_Shell_Flag_NMake)))) - { - /* In the VS IDE, NMake, or MinGW make a percent is written %% - so we need one extra characters. */ - size += 1; - } - } - else if(*c == ';') - { - if(flags & kwsysSystem_Shell_Flag_VSIDE) - { - /* In a VS IDE a semicolon is written ";" so we need two extra - characters. */ - size += 2; - } - } - } - - /* Check whether the argument needs surrounding quotes. */ - if(kwsysSystem_Shell__ArgumentNeedsQuotes(in, isUnix, flags)) - { - /* Surrounding quotes are needed. Allocate space for them. */ - if((flags & kwsysSystem_Shell_Flag_WatcomQuote) && (isUnix)) - { - size += 2; - } - size += 2; - - /* We must escape all ending backslashes when quoting on windows. */ - size += windows_backslashes; - } - - return size; -} - -/*--------------------------------------------------------------------------*/ -static char* kwsysSystem_Shell__GetArgument(const char* in, char* out, - int isUnix, int flags) -{ - /* String iterator. */ - const char* c; - - /* Keep track of how many backslashes have been encountered in a row. */ - int windows_backslashes = 0; - - /* Whether the argument must be quoted. */ - int needQuotes = kwsysSystem_Shell__ArgumentNeedsQuotes(in, isUnix, flags); - if(needQuotes) - { - /* Add the opening quote for this argument. */ - if(flags & kwsysSystem_Shell_Flag_WatcomQuote) - { - if(isUnix) - { - *out++ = '"'; - } - *out++ = '\''; - } - else - { - *out++ = '"'; - } - } - - /* Scan the string for characters that require escaping or quoting. */ - for(c=in; *c; ++c) - { - /* Look for $(MAKEVAR) syntax if requested. */ - if(flags & kwsysSystem_Shell_Flag_AllowMakeVariables) - { - const char* skip = kwsysSystem_Shell__SkipMakeVariables(c); - if(skip != c) - { - /* Copy to the end of the make variable references. */ - while(c != skip) - { - *out++ = *c++; - } - - /* The make variable reference eliminates any escaping needed - for preceding backslashes. */ - windows_backslashes = 0; - - /* Stop if we have reached the end of the string. */ - if(!*c) - { - break; - } - } - } - - /* Check whether this character needs escaping for the shell. */ - if(isUnix) - { - /* On Unix a few special characters need escaping even inside a - quoted argument. */ - if(*c == '\\' || *c == '"' || *c == '`' || *c == '$') - { - /* This character needs a backslash to escape it. */ - *out++ = '\\'; - } - } - else if(flags & kwsysSystem_Shell_Flag_EchoWindows) - { - /* On Windows the built-in command shell echo never needs escaping. */ - } - else - { - /* On Windows only backslashes and double-quotes need escaping. */ - if(*c == '\\') - { - /* Found a backslash. It may need to be escaped later. */ - ++windows_backslashes; - } - else if(*c == '"') - { - /* Found a double-quote. Escape all immediately preceding - backslashes. */ - while(windows_backslashes > 0) - { - --windows_backslashes; - *out++ = '\\'; - } - - /* Add the backslash to escape the double-quote. */ - *out++ = '\\'; - } - else - { - /* We encountered a normal character. This eliminates any - escaping needed for preceding backslashes. */ - windows_backslashes = 0; - } - } - - /* Check whether this character needs escaping for a make tool. */ - if(*c == '$') - { - if(flags & kwsysSystem_Shell_Flag_Make) - { - /* In Makefiles a dollar is written $$. The make tool will - replace it with just $ before passing it to the shell. */ - *out++ = '$'; - *out++ = '$'; - } - else if(flags & kwsysSystem_Shell_Flag_VSIDE) - { - /* In a VS IDE a dollar is written "$". If this is written in - an un-quoted argument it starts a quoted segment, inserts - the $ and ends the segment. If it is written in a quoted - argument it ends quoting, inserts the $ and restarts - quoting. Either way the $ is isolated from surrounding - text to avoid looking like a variable reference. */ - *out++ = '"'; - *out++ = '$'; - *out++ = '"'; - } - else - { - /* Otherwise a dollar is written just $. */ - *out++ = '$'; - } - } - else if(*c == '#') - { - if((flags & kwsysSystem_Shell_Flag_Make) && - (flags & kwsysSystem_Shell_Flag_WatcomWMake)) - { - /* In Watcom WMake makefiles a pound is written $#. The make - tool will replace it with just # before passing it to the - shell. */ - *out++ = '$'; - *out++ = '#'; - } - else - { - /* Otherwise a pound is written just #. */ - *out++ = '#'; - } - } - else if(*c == '%') - { - if((flags & kwsysSystem_Shell_Flag_VSIDE) || - ((flags & kwsysSystem_Shell_Flag_Make) && - ((flags & kwsysSystem_Shell_Flag_MinGWMake) || - (flags & kwsysSystem_Shell_Flag_NMake)))) - { - /* In the VS IDE, NMake, or MinGW make a percent is written %%. */ - *out++ = '%'; - *out++ = '%'; - } - else - { - /* Otherwise a percent is written just %. */ - *out++ = '%'; - } - } - else if(*c == ';') - { - if(flags & kwsysSystem_Shell_Flag_VSIDE) - { - /* In a VS IDE a semicolon is written ";". If this is written - in an un-quoted argument it starts a quoted segment, - inserts the ; and ends the segment. If it is written in a - quoted argument it ends quoting, inserts the ; and restarts - quoting. Either way the ; is isolated. */ - *out++ = '"'; - *out++ = ';'; - *out++ = '"'; - } - else - { - /* Otherwise a semicolon is written just ;. */ - *out++ = ';'; - } - } - else - { - /* Store this character. */ - *out++ = *c; - } - } - - if(needQuotes) - { - /* Add enough backslashes to escape any trailing ones. */ - while(windows_backslashes > 0) - { - --windows_backslashes; - *out++ = '\\'; - } - - /* Add the closing quote for this argument. */ - if(flags & kwsysSystem_Shell_Flag_WatcomQuote) - { - *out++ = '\''; - if(isUnix) - { - *out++ = '"'; - } - } - else - { - *out++ = '"'; - } - } - - /* Store a terminating null without incrementing. */ - *out = 0; - - return out; -} - -/*--------------------------------------------------------------------------*/ -char* kwsysSystem_Shell_GetArgumentForWindows(const char* in, - char* out, - int flags) -{ - return kwsysSystem_Shell__GetArgument(in, out, 0, flags); -} - -/*--------------------------------------------------------------------------*/ -char* kwsysSystem_Shell_GetArgumentForUnix(const char* in, - char* out, - int flags) -{ - return kwsysSystem_Shell__GetArgument(in, out, 1, flags); -} - -/*--------------------------------------------------------------------------*/ -int kwsysSystem_Shell_GetArgumentSizeForWindows(const char* in, int flags) -{ - return kwsysSystem_Shell__GetArgumentSize(in, 0, flags); -} - -/*--------------------------------------------------------------------------*/ -int kwsysSystem_Shell_GetArgumentSizeForUnix(const char* in, int flags) -{ - return kwsysSystem_Shell__GetArgumentSize(in, 1, flags); -} - /*--------------------------------------------------------------------------*/ static int kwsysSystem__AppendByte(char* local, char** begin, char** end, diff --git a/System.h.in b/System.h.in index f21bf0dca..3f3d3f4b0 100644 --- a/System.h.in +++ b/System.h.in @@ -24,28 +24,6 @@ #endif #if !@KWSYS_NAMESPACE@_NAME_IS_KWSYS # define kwsysSystem_Parse_CommandForUnix kwsys_ns(System_Parse_CommandForUnix) -# define kwsysSystem_Shell_GetArgumentForWindows kwsys_ns(System_Shell_GetArgumentForWindows) -# define kwsysSystem_Shell_GetArgumentForUnix kwsys_ns(System_Shell_GetArgumentForUnix) -# define kwsysSystem_Shell_GetArgumentSizeForWindows kwsys_ns(System_Shell_GetArgumentSizeForWindows) -# define kwsysSystem_Shell_GetArgumentSizeForUnix kwsys_ns(System_Shell_GetArgumentSizeForUnix) -# define kwsysSystem_Shell_Flag_e kwsys_ns(System_Shell_Flag_e) -# define kwsysSystem_Shell_Flag_Make kwsys_ns(System_Shell_Flag_Make) -# define kwsysSystem_Shell_Flag_VSIDE kwsys_ns(System_Shell_Flag_VSIDE) -# define kwsysSystem_Shell_Flag_EchoWindows kwsys_ns(System_Shell_Flag_EchoWindows) -# define kwsysSystem_Shell_Flag_WatcomWMake kwsys_ns(System_Shell_Flag_WatcomWMake) -# define kwsysSystem_Shell_Flag_MinGWMake kwsys_ns(System_Shell_Flag_MinGWMake) -# define kwsysSystem_Shell_Flag_NMake kwsys_ns(System_Shell_Flag_NMake) -# define kwsysSystem_Shell_Flag_AllowMakeVariables kwsys_ns(System_Shell_Flag_AllowMakeVariables) -# define kwsysSystem_Shell_Flag_WatcomQuote kwsys_ns(System_Shell_Flag_WatcomQuote) -#endif - -#ifdef __VMS -#define @KWSYS_NAMESPACE@System_Shell_GetArgumentForUnix \ - @KWSYS_NAMESPACE@System_Shell_UnixGA -#define @KWSYS_NAMESPACE@System_Shell_GetArgumentSizeForUnix \ - @KWSYS_NAMESPACE@System_Shell_UnixGAS -#define @KWSYS_NAMESPACE@System_Shell_GetArgumentForWindows \ - @KWSYS_NAMESPACE@System_Shell_WindowsGA #endif #if defined(__cplusplus) @@ -53,69 +31,6 @@ extern "C" { #endif -/** - * Transform the given command line argument for use in a Windows or - * Unix shell. Returns a pointer to the end of the command line - * argument in the provided output buffer. Flags may be passed to - * modify the generated quoting and escape sequences to work under - * alternative environments. - */ -kwsysEXPORT char* kwsysSystem_Shell_GetArgumentForWindows(const char* in, - char* out, - int flags); -kwsysEXPORT char* kwsysSystem_Shell_GetArgumentForUnix(const char* in, - char* out, - int flags); - -/** - * Compute the size of the buffer required to store the output from - * kwsysSystem_Shell_GetArgumentForWindows or - * kwsysSystem_Shell_GetArgumentForUnix. The flags passed must be - * identical between the two calls. - */ -kwsysEXPORT int kwsysSystem_Shell_GetArgumentSizeForWindows(const char* in, - int flags); -kwsysEXPORT int kwsysSystem_Shell_GetArgumentSizeForUnix(const char* in, - int flags); - -/** - * Flags to pass to kwsysSystem_Shell_GetArgumentForWindows or - * kwsysSystem_Shell_GetArgumentForUnix. These modify the generated - * quoting and escape sequences to work under alternative - * environments. - */ -enum kwsysSystem_Shell_Flag_e -{ - /** The target shell is in a makefile. */ - kwsysSystem_Shell_Flag_Make = (1<<0), - - /** The target shell is in a VS project file. Do not use with - Shell_Flag_Make. */ - kwsysSystem_Shell_Flag_VSIDE = (1<<1), - - /** In a windows shell the argument is being passed to "echo". */ - kwsysSystem_Shell_Flag_EchoWindows = (1<<2), - - /** The target shell is in a Watcom WMake makefile. */ - kwsysSystem_Shell_Flag_WatcomWMake = (1<<3), - - /** The target shell is in a MinGW Make makefile. */ - kwsysSystem_Shell_Flag_MinGWMake = (1<<4), - - /** The target shell is in a NMake makefile. */ - kwsysSystem_Shell_Flag_NMake = (1<<5), - - /** Make variable reference syntax $(MAKEVAR) should not be escaped - to allow a build tool to replace it. Replacement values - containing spaces, quotes, backslashes, or other - non-alphanumeric characters that have significance to some makes - or shells produce undefined behavior. */ - kwsysSystem_Shell_Flag_AllowMakeVariables = (1<<6), - - /** The target shell quoting uses extra single Quotes for Watcom tools. */ - kwsysSystem_Shell_Flag_WatcomQuote = (1<<7) -}; - /** * Parse a unix-style command line string into separate arguments. * @@ -148,19 +63,6 @@ kwsysEXPORT char** kwsysSystem_Parse_CommandForUnix(const char* command, # undef kwsysEXPORT # if !defined(KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS # undef kwsysSystem_Parse_CommandForUnix -# undef kwsysSystem_Shell_GetArgumentForWindows -# undef kwsysSystem_Shell_GetArgumentForUnix -# undef kwsysSystem_Shell_GetArgumentSizeForWindows -# undef kwsysSystem_Shell_GetArgumentSizeForUnix -# undef kwsysSystem_Shell_Flag_e -# undef kwsysSystem_Shell_Flag_Make -# undef kwsysSystem_Shell_Flag_VSIDE -# undef kwsysSystem_Shell_Flag_EchoWindows -# undef kwsysSystem_Shell_Flag_WatcomWMake -# undef kwsysSystem_Shell_Flag_MinGWMake -# undef kwsysSystem_Shell_Flag_NMake -# undef kwsysSystem_Shell_Flag_AllowMakeVariables -# undef kwsysSystem_Shell_Flag_WatcomQuote # endif #endif From fbd7fd0f84cc73565ccc58f74691d5c89544eb29 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 10 Jul 2015 14:02:05 -0400 Subject: [PATCH 0311/1048] Utilities/Release: Update to openssl-1.0.2d Update the prebuilt binary build configurations for machines where we build our own OpenSSL library to use a newer version. --- Utilities/Release/linux64_release.cmake | 6 +++--- Utilities/Release/magrathea_release.cmake | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Utilities/Release/linux64_release.cmake b/Utilities/Release/linux64_release.cmake index 265e0d7f7..2cd5dfc18 100644 --- a/Utilities/Release/linux64_release.cmake +++ b/Utilities/Release/linux64_release.cmake @@ -11,9 +11,9 @@ CURSES_LIBRARY:FILEPATH=/home/kitware/ncurses-5.9/lib/libncurses.a CURSES_INCLUDE_PATH:PATH=/home/kitware/ncurses-5.9/include FORM_LIBRARY:FILEPATH=/home/kitware/ncurses-5.9/lib/libform.a CMAKE_USE_OPENSSL:BOOL=ON -OPENSSL_CRYPTO_LIBRARY:FILEPATH=/home/kitware/openssl-1.0.2c/lib/libcrypto.a -OPENSSL_INCLUDE_DIR:PATH=/home/kitware/openssl-1.0.2c/include -OPENSSL_SSL_LIBRARY:FILEPATH=/home/kitware/openssl-1.0.2c/lib/libssl.a +OPENSSL_CRYPTO_LIBRARY:FILEPATH=/home/kitware/openssl-1.0.2d/lib/libcrypto.a +OPENSSL_INCLUDE_DIR:PATH=/home/kitware/openssl-1.0.2d/include +OPENSSL_SSL_LIBRARY:FILEPATH=/home/kitware/openssl-1.0.2d/lib/libssl.a CPACK_SYSTEM_NAME:STRING=Linux-x86_64 BUILD_QtDialog:BOOL:=TRUE CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL:BOOL=TRUE diff --git a/Utilities/Release/magrathea_release.cmake b/Utilities/Release/magrathea_release.cmake index 79fa319e3..b0e0a3add 100644 --- a/Utilities/Release/magrathea_release.cmake +++ b/Utilities/Release/magrathea_release.cmake @@ -11,9 +11,9 @@ CURSES_LIBRARY:FILEPATH=/usr/i686-gcc-332s/lib/libncurses.a CURSES_INCLUDE_PATH:PATH=/usr/i686-gcc-332s/include/ncurses FORM_LIBRARY:FILEPATH=/usr/i686-gcc-332s/lib/libform.a CMAKE_USE_OPENSSL:BOOL=ON -OPENSSL_CRYPTO_LIBRARY:FILEPATH=/home/kitware/openssl-1.0.2c/lib/libcrypto.a -OPENSSL_INCLUDE_DIR:PATH=/home/kitware/openssl-1.0.2c/include -OPENSSL_SSL_LIBRARY:FILEPATH=/home/kitware/openssl-1.0.2c/lib/libssl.a +OPENSSL_CRYPTO_LIBRARY:FILEPATH=/home/kitware/openssl-1.0.2d/lib/libcrypto.a +OPENSSL_INCLUDE_DIR:PATH=/home/kitware/openssl-1.0.2d/include +OPENSSL_SSL_LIBRARY:FILEPATH=/home/kitware/openssl-1.0.2d/lib/libssl.a CPACK_SYSTEM_NAME:STRING=Linux-i386 BUILD_QtDialog:BOOL:=TRUE CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL:BOOL=TRUE From b1e43a5647a978fc60b7845d85ebe000fa9f5d3b Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sat, 11 Jul 2015 00:01:05 -0400 Subject: [PATCH 0312/1048] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index c79f13ab8..fd67f6143 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 3) -set(CMake_VERSION_PATCH 20150710) +set(CMake_VERSION_PATCH 20150711) #set(CMake_VERSION_RC 1) From e3f5e5d5b401c377719b89cb86c65131315a2582 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sun, 12 Jul 2015 00:01:04 -0400 Subject: [PATCH 0313/1048] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index fd67f6143..85a248a91 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 3) -set(CMake_VERSION_PATCH 20150711) +set(CMake_VERSION_PATCH 20150712) #set(CMake_VERSION_RC 1) From c8f46af11b43719281a375ef7841830756022d76 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Mon, 13 Jul 2015 00:01:05 -0400 Subject: [PATCH 0314/1048] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 85a248a91..b3827501a 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 3) -set(CMake_VERSION_PATCH 20150712) +set(CMake_VERSION_PATCH 20150713) #set(CMake_VERSION_RC 1) From 38ddabb194ec6b0ab19dcfac27378c6e91cbde02 Mon Sep 17 00:00:00 2001 From: Roger Leigh Date: Mon, 13 Jul 2015 12:00:12 +0100 Subject: [PATCH 0315/1048] FindXercesC: Also search for xerces-c_2 (#15648) This is the previous stable release name used on Windows. --- Modules/FindXercesC.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/FindXercesC.cmake b/Modules/FindXercesC.cmake index 984f1b9f6..fd0b9926b 100644 --- a/Modules/FindXercesC.cmake +++ b/Modules/FindXercesC.cmake @@ -62,7 +62,7 @@ find_path(XercesC_INCLUDE_DIR mark_as_advanced(XercesC_INCLUDE_DIR) # Find all XercesC libraries -find_library(XercesC_LIBRARY NAMES "xerces-c" "xerces-c_3" +find_library(XercesC_LIBRARY NAMES "xerces-c" "xerces-c_3" "xerces-c_2" DOC "Xerces-C++ libraries") mark_as_advanced(XercesC_LIBRARY) From dc822da8158af5b568ca01fbb519d7170553376a Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Fri, 10 Jul 2015 09:36:55 -0400 Subject: [PATCH 0316/1048] KWSys 2015-07-10 (c9336bcf) Extract upstream KWSys using the following shell commands. $ git archive --prefix=upstream-kwsys/ c9336bcf | tar x $ git shortlog --no-merges --abbrev=8 --format='%h %s' d3ba91e1..c9336bcf Brad King (2): 86a24794 SystemTools: Fix GetActualCaseForPath drive letter case handling c9336bcf SystemTools: Optimize GetActualCaseForPath memoization --- SystemTools.cxx | 55 +++++++++++++++++++++++++++++++++------------- SystemTools.hxx.in | 6 ++++- 2 files changed, 45 insertions(+), 16 deletions(-) diff --git a/SystemTools.cxx b/SystemTools.cxx index fed1c9c38..345225940 100644 --- a/SystemTools.cxx +++ b/SystemTools.cxx @@ -385,6 +385,26 @@ class SystemToolsTranslationMap : { }; +#ifdef _WIN32 +struct SystemToolsPathCaseCmp +{ + bool operator()(kwsys_stl::string const& l, kwsys_stl::string const& r) const + { +# ifdef _MSC_VER + return _stricmp(l.c_str(), r.c_str()) < 0; +# elif defined(__GNUC__) + return strcasecmp(l.c_str(), r.c_str()) < 0; +# else + return SystemTools::Strucmp(l.c_str(), r.c_str()) < 0; +# endif + } +}; + +class SystemToolsPathCaseMap: + public kwsys_stl::map {}; +#endif + // adds the elements of the env variable path to the arg passed in void SystemTools::GetPath(kwsys_stl::vector& path, const char* env) { @@ -3690,6 +3710,11 @@ static int GetCasePathName(const kwsys_stl::string & pathIn, // Start with root component. kwsys_stl::vector::size_type idx = 0; casePath = path_components[idx++]; + // make sure drive letter is always upper case + if(casePath.size() > 1 && casePath[1] == ':') + { + casePath[0] = toupper(casePath[0]); + } const char* sep = ""; // If network path, fill casePath with server/share so FindFirstFile @@ -3745,27 +3770,21 @@ kwsys_stl::string SystemTools::GetActualCaseForPath(const kwsys_stl::string& p) #ifndef _WIN32 return p; #else - kwsys_stl::string casePath = p; - // make sure drive letter is always upper case - if(casePath.size() > 1 && casePath[1] == ':') - { - casePath[0] = toupper(casePath[0]); - } - // Check to see if actual case has already been called - // for this path, and the result is stored in the LongPathMap - SystemToolsTranslationMap::iterator i = - SystemTools::LongPathMap->find(casePath); - if(i != SystemTools::LongPathMap->end()) + // for this path, and the result is stored in the PathCaseMap + SystemToolsPathCaseMap::iterator i = + SystemTools::PathCaseMap->find(p); + if(i != SystemTools::PathCaseMap->end()) { return i->second; } + kwsys_stl::string casePath; int len = GetCasePathName(p, casePath); if(len == 0 || len > MAX_PATH+1) { return p; } - (*SystemTools::LongPathMap)[p] = casePath; + (*SystemTools::PathCaseMap)[p] = casePath; return casePath; #endif } @@ -5139,7 +5158,9 @@ bool SystemTools::ParseURL( const kwsys_stl::string& URL, // necessary. static unsigned int SystemToolsManagerCount; SystemToolsTranslationMap *SystemTools::TranslationMap; -SystemToolsTranslationMap *SystemTools::LongPathMap; +#ifdef _WIN32 +SystemToolsPathCaseMap *SystemTools::PathCaseMap; +#endif #ifdef __CYGWIN__ SystemToolsTranslationMap *SystemTools::Cyg2Win32Map; #endif @@ -5187,7 +5208,9 @@ void SystemTools::ClassInitialize() #endif // Allocate the translation map first. SystemTools::TranslationMap = new SystemToolsTranslationMap; - SystemTools::LongPathMap = new SystemToolsTranslationMap; +#ifdef _WIN32 + SystemTools::PathCaseMap = new SystemToolsPathCaseMap; +#endif #ifdef __CYGWIN__ SystemTools::Cyg2Win32Map = new SystemToolsTranslationMap; #endif @@ -5244,7 +5267,9 @@ void SystemTools::ClassInitialize() void SystemTools::ClassFinalize() { delete SystemTools::TranslationMap; - delete SystemTools::LongPathMap; +#ifdef _WIN32 + delete SystemTools::PathCaseMap; +#endif #ifdef __CYGWIN__ delete SystemTools::Cyg2Win32Map; #endif diff --git a/SystemTools.hxx.in b/SystemTools.hxx.in index 93cde0261..78991414e 100644 --- a/SystemTools.hxx.in +++ b/SystemTools.hxx.in @@ -54,6 +54,8 @@ namespace @KWSYS_NAMESPACE@ { class SystemToolsTranslationMap; +class SystemToolsPathCaseMap; + /** \class SystemToolsManager * \brief Use to make sure SystemTools is initialized before it is used * and is the last static object destroyed @@ -944,7 +946,9 @@ private: * Each time 'dir' will be found it will be replace by 'refdir' */ static SystemToolsTranslationMap *TranslationMap; - static SystemToolsTranslationMap *LongPathMap; +#ifdef _WIN32 + static SystemToolsPathCaseMap *PathCaseMap; +#endif #ifdef __CYGWIN__ static SystemToolsTranslationMap *Cyg2Win32Map; #endif From 80d75246d475865210aa5bc09e0824b230cd074d Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 10 Jul 2015 09:04:58 -0400 Subject: [PATCH 0317/1048] cmNinjaTargetGenerator: Restore addition of Fortran format flags Restore call to AppendFortranFormatFlags accidentally dropped by commit 0837538e (cmCommonTargetGenerator: Adopt GetFlags method, 2015-07-09). It was added originally by commit 6a56740e (cmNinjaTargetGenerator: Add Fortran flag generation, 2015-07-09). --- Source/cmNinjaTargetGenerator.cxx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index a72bc7284..43b9139d9 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -112,6 +112,12 @@ cmNinjaTargetGenerator::ComputeFlagsForObject(cmSourceFile const* source, { std::string flags = this->GetFlags(language); + // Add Fortran format flags. + if(language == "Fortran") + { + this->AppendFortranFormatFlags(flags, *source); + } + // Add source file specific flags. this->LocalGenerator->AppendFlags(flags, source->GetProperty("COMPILE_FLAGS")); From 6f94b03c976088d177891ff69a9fad88de42e420 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 13 Jul 2015 10:27:14 -0400 Subject: [PATCH 0318/1048] Place before consistently across compilers Update our values for CMAKE__COMPILE_OBJECT, CMAKE__CREATE_ASSEMBLY_SOURCE, and CMAKE__CREATE_PREPROCESSED_SOURCE to place before consistently across supported compilers. We already do this for most compilers, so update the rest for consistency. --- Modules/CMakeRCInformation.cmake | 2 +- Modules/Platform/CYGWIN-windres.cmake | 2 +- Modules/Platform/Windows-Embarcadero.cmake | 4 ++-- Modules/Platform/Windows-MSVC.cmake | 6 +++--- Modules/Platform/Windows-wcl386.cmake | 8 ++++---- Modules/Platform/Windows-windres.cmake | 2 +- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Modules/CMakeRCInformation.cmake b/Modules/CMakeRCInformation.cmake index 6bb2636f1..27bb4167a 100644 --- a/Modules/CMakeRCInformation.cmake +++ b/Modules/CMakeRCInformation.cmake @@ -44,7 +44,7 @@ set(CMAKE_INCLUDE_FLAG_RC "-I") # compile a Resource file into an object file if(NOT CMAKE_RC_COMPILE_OBJECT) set(CMAKE_RC_COMPILE_OBJECT - " /fo ") + " /fo ") endif() mark_as_advanced( diff --git a/Modules/Platform/CYGWIN-windres.cmake b/Modules/Platform/CYGWIN-windres.cmake index 01d6be3df..c082b5db4 100644 --- a/Modules/Platform/CYGWIN-windres.cmake +++ b/Modules/Platform/CYGWIN-windres.cmake @@ -1 +1 @@ -set(CMAKE_RC_COMPILE_OBJECT " -O coff ") +set(CMAKE_RC_COMPILE_OBJECT " -O coff ") diff --git a/Modules/Platform/Windows-Embarcadero.cmake b/Modules/Platform/Windows-Embarcadero.cmake index 58ef3ca58..04f6bc21a 100644 --- a/Modules/Platform/Windows-Embarcadero.cmake +++ b/Modules/Platform/Windows-Embarcadero.cmake @@ -90,7 +90,7 @@ macro(__embarcadero_language lang) # place outside the response file because Borland refuses # to parse quotes from the response file. set(CMAKE_${lang}_COMPILE_OBJECT - " ${_tR} -DWIN32 -o ${_COMPILE_${lang}} " + " ${_tR} -DWIN32 -o ${_COMPILE_${lang}} " ) set(CMAKE_${lang}_LINK_EXECUTABLE @@ -101,7 +101,7 @@ macro(__embarcadero_language lang) # place outside the response file because Borland refuses # to parse quotes from the response file. set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE - "cpp32 -DWIN32 -o ${_COMPILE_${lang}} " + "cpp32 -DWIN32 -o ${_COMPILE_${lang}} " ) # Borland >= 5.6 allows -P option for cpp32, <= 5.5 does not diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake index f72a7f2f3..b1e38cf77 100644 --- a/Modules/Platform/Windows-MSVC.cmake +++ b/Modules/Platform/Windows-MSVC.cmake @@ -284,11 +284,11 @@ macro(__windows_compiler_msvc lang) set(CMAKE_${lang}_CREATE_STATIC_LIBRARY " /lib ${CMAKE_CL_NOLOGO} /out: ") set(CMAKE_${lang}_COMPILE_OBJECT - " ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} /Fo /Fd${_FS_${lang}} -c ${CMAKE_END_TEMP_FILE}") + " ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} /Fo /Fd${_FS_${lang}} -c ${CMAKE_END_TEMP_FILE}") set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE - " > ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} -E ${CMAKE_END_TEMP_FILE}") + " > ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} -E ${CMAKE_END_TEMP_FILE}") set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE - " ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} /FoNUL /FAs /Fa /c ${CMAKE_END_TEMP_FILE}") + " ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} /FoNUL /FAs /Fa /c ${CMAKE_END_TEMP_FILE}") set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_OBJECTS 1) set(CMAKE_${lang}_LINK_EXECUTABLE diff --git a/Modules/Platform/Windows-wcl386.cmake b/Modules/Platform/Windows-wcl386.cmake index 88f9bf712..d532566aa 100644 --- a/Modules/Platform/Windows-wcl386.cmake +++ b/Modules/Platform/Windows-wcl386.cmake @@ -58,19 +58,19 @@ set(CMAKE_CXX_LINK_EXECUTABLE ${CMAKE_C_LINK_EXECUTABLE}) # compile a C++ file into an object file set(CMAKE_CXX_COMPILE_OBJECT - " ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} -d+ -fo -c -cc++ ${CMAKE_END_TEMP_FILE}") + " ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} -d+ -fo -c -cc++ ${CMAKE_END_TEMP_FILE}") # compile a C file into an object file set(CMAKE_C_COMPILE_OBJECT - " ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} -d+ -fo -c -cc ${CMAKE_END_TEMP_FILE}") + " ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} -d+ -fo -c -cc ${CMAKE_END_TEMP_FILE}") # preprocess a C source file set(CMAKE_C_CREATE_PREPROCESSED_SOURCE - " ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} -d+ -fo -pl -cc ${CMAKE_END_TEMP_FILE}") + " ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} -d+ -fo -pl -cc ${CMAKE_END_TEMP_FILE}") # preprocess a C++ source file set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE - " ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} -d+ -fo -pl -cc++ ${CMAKE_END_TEMP_FILE}") + " ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} -d+ -fo -pl -cc++ ${CMAKE_END_TEMP_FILE}") set(CMAKE_CXX_CREATE_SHARED_LIBRARY "wlink ${CMAKE_START_TEMP_FILE} ${CMAKE_WLINK_QUIET} name option implib= file {} ${CMAKE_END_TEMP_FILE}") diff --git a/Modules/Platform/Windows-windres.cmake b/Modules/Platform/Windows-windres.cmake index 01d6be3df..c082b5db4 100644 --- a/Modules/Platform/Windows-windres.cmake +++ b/Modules/Platform/Windows-windres.cmake @@ -1 +1 @@ -set(CMAKE_RC_COMPILE_OBJECT " -O coff ") +set(CMAKE_RC_COMPILE_OBJECT " -O coff ") From c736de7b284ecc93bac48106e88417e0e6c92ad6 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 13 Jul 2015 10:35:04 -0400 Subject: [PATCH 0319/1048] Factor an placeholder out of in rule variables Teach the Makefile and Ninja generators to substitute for an placeholder instead of putting -I in . Update our values for CMAKE__COMPILE_OBJECT, CMAKE__CREATE_ASSEMBLY_SOURCE, and CMAKE__CREATE_PREPROCESSED_SOURCE to place just before . --- Modules/CMakeASMInformation.cmake | 2 +- Modules/CMakeASM_MASMInformation.cmake | 2 +- Modules/CMakeCInformation.cmake | 2 +- Modules/CMakeCXXInformation.cmake | 2 +- Modules/CMakeFortranInformation.cmake | 2 +- Modules/CMakeRCInformation.cmake | 2 +- Modules/Compiler/GNU.cmake | 4 ++-- Modules/Compiler/HP-C.cmake | 4 ++-- Modules/Compiler/HP-CXX.cmake | 4 ++-- Modules/Compiler/HP-Fortran.cmake | 4 ++-- Modules/Compiler/IAR-ASM.cmake | 2 +- Modules/Compiler/IAR-C.cmake | 6 +++--- Modules/Compiler/IAR-CXX.cmake | 6 +++--- Modules/Compiler/Intel-C.cmake | 4 ++-- Modules/Compiler/Intel-CXX.cmake | 4 ++-- Modules/Compiler/Intel-Fortran.cmake | 4 ++-- Modules/Compiler/PGI.cmake | 4 ++-- Modules/Compiler/QCC-CXX.cmake | 2 +- Modules/Compiler/SunPro-C.cmake | 4 ++-- Modules/Compiler/SunPro-CXX.cmake | 4 ++-- Modules/Compiler/SunPro-Fortran.cmake | 4 ++-- Modules/Compiler/TI-ASM.cmake | 2 +- Modules/Compiler/TI-C.cmake | 6 +++--- Modules/Compiler/TI-CXX.cmake | 6 +++--- Modules/Compiler/XL-CXX.cmake | 2 +- Modules/Compiler/XL.cmake | 4 ++-- Modules/Platform/BlueGeneQ-base.cmake | 4 ++-- Modules/Platform/CYGWIN-windres.cmake | 2 +- Modules/Platform/Darwin-NAG-Fortran.cmake | 2 +- Modules/Platform/Generic-SDCC-C.cmake | 2 +- Modules/Platform/HP-UX-HP-C.cmake | 6 +++--- Modules/Platform/HP-UX-HP-CXX.cmake | 4 ++-- Modules/Platform/HP-UX-HP-Fortran.cmake | 4 ++-- Modules/Platform/IRIX64.cmake | 8 ++++---- Modules/Platform/Windows-Embarcadero.cmake | 4 ++-- Modules/Platform/Windows-MSVC.cmake | 6 +++--- Modules/Platform/Windows-wcl386.cmake | 8 ++++---- Modules/Platform/Windows-windres.cmake | 2 +- Source/cmCommonTargetGenerator.cxx | 16 +++++++++++++--- Source/cmCommonTargetGenerator.h | 2 ++ Source/cmLocalGenerator.cxx | 4 ++++ Source/cmLocalGenerator.h | 1 + Source/cmMakefileTargetGenerator.cxx | 9 +++++++++ Source/cmNinjaTargetGenerator.cxx | 3 +++ 44 files changed, 104 insertions(+), 75 deletions(-) diff --git a/Modules/CMakeASMInformation.cmake b/Modules/CMakeASMInformation.cmake index 62ef972a3..0e547c467 100644 --- a/Modules/CMakeASMInformation.cmake +++ b/Modules/CMakeASMInformation.cmake @@ -108,7 +108,7 @@ mark_as_advanced(CMAKE_ASM${ASM_DIALECT}_FLAGS if(NOT CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT) - set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT " -o -c ") + set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT " -o -c ") endif() if(NOT CMAKE_ASM${ASM_DIALECT}_CREATE_STATIC_LIBRARY) diff --git a/Modules/CMakeASM_MASMInformation.cmake b/Modules/CMakeASM_MASMInformation.cmake index 972883cdf..bd76b9842 100644 --- a/Modules/CMakeASM_MASMInformation.cmake +++ b/Modules/CMakeASM_MASMInformation.cmake @@ -18,7 +18,7 @@ set(ASM_DIALECT "_MASM") set(CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS asm) -set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT " /c /Fo ") +set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT " /c /Fo ") include(CMakeASMInformation) set(ASM_DIALECT) diff --git a/Modules/CMakeCInformation.cmake b/Modules/CMakeCInformation.cmake index 332b26ee2..7bcbb19d8 100644 --- a/Modules/CMakeCInformation.cmake +++ b/Modules/CMakeCInformation.cmake @@ -187,7 +187,7 @@ endif() # compile a C file into an object file if(NOT CMAKE_C_COMPILE_OBJECT) set(CMAKE_C_COMPILE_OBJECT - " -o -c ") + " -o -c ") endif() if(NOT CMAKE_C_LINK_EXECUTABLE) diff --git a/Modules/CMakeCXXInformation.cmake b/Modules/CMakeCXXInformation.cmake index 72b2857db..1aac9d3f1 100644 --- a/Modules/CMakeCXXInformation.cmake +++ b/Modules/CMakeCXXInformation.cmake @@ -278,7 +278,7 @@ endif() # compile a C++ file into an object file if(NOT CMAKE_CXX_COMPILE_OBJECT) set(CMAKE_CXX_COMPILE_OBJECT - " -o -c ") + " -o -c ") endif() if(NOT CMAKE_CXX_LINK_EXECUTABLE) diff --git a/Modules/CMakeFortranInformation.cmake b/Modules/CMakeFortranInformation.cmake index d6382078b..835ffcf67 100644 --- a/Modules/CMakeFortranInformation.cmake +++ b/Modules/CMakeFortranInformation.cmake @@ -207,7 +207,7 @@ endif() # (put -o after -c to workaround bug in at least one mpif77 wrapper) if(NOT CMAKE_Fortran_COMPILE_OBJECT) set(CMAKE_Fortran_COMPILE_OBJECT - " -c -o ") + " -c -o ") endif() # link a fortran program diff --git a/Modules/CMakeRCInformation.cmake b/Modules/CMakeRCInformation.cmake index 27bb4167a..94abd4be8 100644 --- a/Modules/CMakeRCInformation.cmake +++ b/Modules/CMakeRCInformation.cmake @@ -44,7 +44,7 @@ set(CMAKE_INCLUDE_FLAG_RC "-I") # compile a Resource file into an object file if(NOT CMAKE_RC_COMPILE_OBJECT) set(CMAKE_RC_COMPILE_OBJECT - " /fo ") + " /fo ") endif() mark_as_advanced( diff --git a/Modules/Compiler/GNU.cmake b/Modules/Compiler/GNU.cmake index f01255cf6..764fbf990 100644 --- a/Modules/Compiler/GNU.cmake +++ b/Modules/Compiler/GNU.cmake @@ -50,8 +50,8 @@ macro(__compiler_gnu lang) set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "-Os -DNDEBUG") set(CMAKE_${lang}_FLAGS_RELEASE_INIT "-O3 -DNDEBUG") set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "-O2 -g -DNDEBUG") - set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE " -E > ") - set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE " -S -o ") + set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE " -E > ") + set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE " -S -o ") if(NOT APPLE) set(CMAKE_INCLUDE_SYSTEM_FLAG_${lang} "-isystem ") endif() diff --git a/Modules/Compiler/HP-C.cmake b/Modules/Compiler/HP-C.cmake index 6dddcbae1..b42ba2be8 100644 --- a/Modules/Compiler/HP-C.cmake +++ b/Modules/Compiler/HP-C.cmake @@ -1,4 +1,4 @@ set(CMAKE_C_VERBOSE_FLAG "-v") -set(CMAKE_C_CREATE_ASSEMBLY_SOURCE " -S -o ") -set(CMAKE_C_CREATE_PREPROCESSED_SOURCE " -E > ") +set(CMAKE_C_CREATE_ASSEMBLY_SOURCE " -S -o ") +set(CMAKE_C_CREATE_PREPROCESSED_SOURCE " -E > ") diff --git a/Modules/Compiler/HP-CXX.cmake b/Modules/Compiler/HP-CXX.cmake index 6411dac6b..7548754d3 100644 --- a/Modules/Compiler/HP-CXX.cmake +++ b/Modules/Compiler/HP-CXX.cmake @@ -1,7 +1,7 @@ set(CMAKE_CXX_VERBOSE_FLAG "-v") -set(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE " -S -o ") -set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE " -E > ") +set(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE " -S -o ") +set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE " -E > ") # HP aCC since version 3.80 supports the flag +hpxstd98 to get ANSI C++98 # template support. It is known that version 6.25 doesn't need that flag. diff --git a/Modules/Compiler/HP-Fortran.cmake b/Modules/Compiler/HP-Fortran.cmake index ad821ab7d..a6ca2c2b8 100644 --- a/Modules/Compiler/HP-Fortran.cmake +++ b/Modules/Compiler/HP-Fortran.cmake @@ -2,5 +2,5 @@ set(CMAKE_Fortran_VERBOSE_FLAG "-v") set(CMAKE_Fortran_FORMAT_FIXED_FLAG "+source=fixed") set(CMAKE_Fortran_FORMAT_FREE_FLAG "+source=free") -set(CMAKE_Fortran_CREATE_ASSEMBLY_SOURCE " -S -o ") -set(CMAKE_Fortran_CREATE_PREPROCESSED_SOURCE " -E > ") +set(CMAKE_Fortran_CREATE_ASSEMBLY_SOURCE " -S -o ") +set(CMAKE_Fortran_CREATE_PREPROCESSED_SOURCE " -E > ") diff --git a/Modules/Compiler/IAR-ASM.cmake b/Modules/Compiler/IAR-ASM.cmake index 66fb052df..844c30e50 100644 --- a/Modules/Compiler/IAR-ASM.cmake +++ b/Modules/Compiler/IAR-ASM.cmake @@ -2,7 +2,7 @@ include(Compiler/IAR) -set(CMAKE_ASM_COMPILE_OBJECT " -o ") +set(CMAKE_ASM_COMPILE_OBJECT " -o ") if("${IAR_TARGET_ARCHITECTURE}" STREQUAL "ARM") set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s;asm;msa) diff --git a/Modules/Compiler/IAR-C.cmake b/Modules/Compiler/IAR-C.cmake index da29447c4..d2c7df9ed 100644 --- a/Modules/Compiler/IAR-C.cmake +++ b/Modules/Compiler/IAR-C.cmake @@ -3,9 +3,9 @@ include(Compiler/IAR) -set(CMAKE_C_COMPILE_OBJECT " -o ") -set(CMAKE_C_CREATE_PREPROCESSED_SOURCE " --preprocess=cnl ") -set(CMAKE_C_CREATE_ASSEMBLY_SOURCE " -lAH -o .dummy") +set(CMAKE_C_COMPILE_OBJECT " -o ") +set(CMAKE_C_CREATE_PREPROCESSED_SOURCE " --preprocess=cnl ") +set(CMAKE_C_CREATE_ASSEMBLY_SOURCE " -lAH -o .dummy") # The toolchains for ARM and AVR are quite different: if("${IAR_TARGET_ARCHITECTURE}" STREQUAL "ARM") diff --git a/Modules/Compiler/IAR-CXX.cmake b/Modules/Compiler/IAR-CXX.cmake index eae9d1b77..03ecdf1d8 100644 --- a/Modules/Compiler/IAR-CXX.cmake +++ b/Modules/Compiler/IAR-CXX.cmake @@ -2,10 +2,10 @@ include(Compiler/IAR) -set(CMAKE_CXX_COMPILE_OBJECT " -o ") +set(CMAKE_CXX_COMPILE_OBJECT " -o ") -set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE " --preprocess=cnl ") -set(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE " -lAH -o .dummy") +set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE " --preprocess=cnl ") +set(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE " -lAH -o .dummy") diff --git a/Modules/Compiler/Intel-C.cmake b/Modules/Compiler/Intel-C.cmake index 1d651e368..dfba4b2ce 100644 --- a/Modules/Compiler/Intel-C.cmake +++ b/Modules/Compiler/Intel-C.cmake @@ -8,5 +8,5 @@ set(CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-O2 -g -DNDEBUG") set(CMAKE_DEPFILE_FLAGS_C "-MMD -MT -MF ") -set(CMAKE_C_CREATE_PREPROCESSED_SOURCE " -E > ") -set(CMAKE_C_CREATE_ASSEMBLY_SOURCE " -S -o ") +set(CMAKE_C_CREATE_PREPROCESSED_SOURCE " -E > ") +set(CMAKE_C_CREATE_ASSEMBLY_SOURCE " -S -o ") diff --git a/Modules/Compiler/Intel-CXX.cmake b/Modules/Compiler/Intel-CXX.cmake index 020e862c6..794769527 100644 --- a/Modules/Compiler/Intel-CXX.cmake +++ b/Modules/Compiler/Intel-CXX.cmake @@ -8,5 +8,5 @@ set(CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-O2 -g -DNDEBUG") set(CMAKE_DEPFILE_FLAGS_CXX "-MMD -MT -MF ") -set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE " -E > ") -set(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE " -S -o ") +set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE " -E > ") +set(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE " -S -o ") diff --git a/Modules/Compiler/Intel-Fortran.cmake b/Modules/Compiler/Intel-Fortran.cmake index 9ebac5a17..671d284dd 100644 --- a/Modules/Compiler/Intel-Fortran.cmake +++ b/Modules/Compiler/Intel-Fortran.cmake @@ -8,5 +8,5 @@ set(CMAKE_Fortran_VERBOSE_FLAG "-v") set(CMAKE_Fortran_FORMAT_FIXED_FLAG "-fixed") set(CMAKE_Fortran_FORMAT_FREE_FLAG "-free") -set(CMAKE_Fortran_CREATE_PREPROCESSED_SOURCE " -E > ") -set(CMAKE_Fortran_CREATE_ASSEMBLY_SOURCE " -S -o ") +set(CMAKE_Fortran_CREATE_PREPROCESSED_SOURCE " -E > ") +set(CMAKE_Fortran_CREATE_ASSEMBLY_SOURCE " -S -o ") diff --git a/Modules/Compiler/PGI.cmake b/Modules/Compiler/PGI.cmake index 162e3c9b8..797945f9a 100644 --- a/Modules/Compiler/PGI.cmake +++ b/Modules/Compiler/PGI.cmake @@ -30,6 +30,6 @@ macro(__compiler_pgi lang) set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "-O2 -gopt") # Preprocessing and assembly rules. - set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE " -E > ") - set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE " -S -o ") + set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE " -E > ") + set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE " -S -o ") endmacro() diff --git a/Modules/Compiler/QCC-CXX.cmake b/Modules/Compiler/QCC-CXX.cmake index a676bbedb..e86d1fa47 100644 --- a/Modules/Compiler/QCC-CXX.cmake +++ b/Modules/Compiler/QCC-CXX.cmake @@ -4,7 +4,7 @@ __compiler_qcc(CXX) # If the toolchain uses qcc for CMAKE_CXX_COMPILER instead of QCC, the # default for the driver is not c++. set(CMAKE_CXX_COMPILE_OBJECT - " -lang-c++ -o -c ") + " -lang-c++ -o -c ") set(CMAKE_CXX_LINK_EXECUTABLE " -lang-c++ -o ") diff --git a/Modules/Compiler/SunPro-C.cmake b/Modules/Compiler/SunPro-C.cmake index 92252cb13..c4529833d 100644 --- a/Modules/Compiler/SunPro-C.cmake +++ b/Modules/Compiler/SunPro-C.cmake @@ -22,5 +22,5 @@ foreach(type SHARED_LIBRARY SHARED_MODULE EXE) set(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Bdynamic") endforeach() -set(CMAKE_C_CREATE_PREPROCESSED_SOURCE " -E > ") -set(CMAKE_C_CREATE_ASSEMBLY_SOURCE " -S -o ") +set(CMAKE_C_CREATE_PREPROCESSED_SOURCE " -E > ") +set(CMAKE_C_CREATE_ASSEMBLY_SOURCE " -S -o ") diff --git a/Modules/Compiler/SunPro-CXX.cmake b/Modules/Compiler/SunPro-CXX.cmake index 022b4d4ae..e0c02d933 100644 --- a/Modules/Compiler/SunPro-CXX.cmake +++ b/Modules/Compiler/SunPro-CXX.cmake @@ -22,8 +22,8 @@ foreach(type SHARED_LIBRARY SHARED_MODULE EXE) set(CMAKE_${type}_LINK_DYNAMIC_CXX_FLAGS "-Bdynamic") endforeach() -set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE " -E > ") -set(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE " -S -o ") +set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE " -E > ") +set(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE " -S -o ") # Create archives with "CC -xar" in case user adds "-instances=extern" # so that template instantiations are available to archive members. diff --git a/Modules/Compiler/SunPro-Fortran.cmake b/Modules/Compiler/SunPro-Fortran.cmake index 196aae49a..610e19176 100644 --- a/Modules/Compiler/SunPro-Fortran.cmake +++ b/Modules/Compiler/SunPro-Fortran.cmake @@ -18,5 +18,5 @@ set(CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT "-g -xO2 -DNDEBUG") set(CMAKE_Fortran_MODDIR_FLAG "-moddir=") set(CMAKE_Fortran_MODPATH_FLAG "-M") -set(CMAKE_Fortran_CREATE_PREPROCESSED_SOURCE " -F -o ") -set(CMAKE_Fortran_CREATE_ASSEMBLY_SOURCE " -S -o ") +set(CMAKE_Fortran_CREATE_PREPROCESSED_SOURCE " -F -o ") +set(CMAKE_Fortran_CREATE_ASSEMBLY_SOURCE " -S -o ") diff --git a/Modules/Compiler/TI-ASM.cmake b/Modules/Compiler/TI-ASM.cmake index e097626b6..a566d70e1 100644 --- a/Modules/Compiler/TI-ASM.cmake +++ b/Modules/Compiler/TI-ASM.cmake @@ -2,7 +2,7 @@ set(CMAKE_LIBRARY_PATH_FLAG "--search_path=") set(CMAKE_LINK_LIBRARY_FLAG "--library=") set(CMAKE_INCLUDE_FLAG_ASM "--include_path=") -set(CMAKE_ASM_COMPILE_OBJECT " --compile_only --asm_file= --output_file=") +set(CMAKE_ASM_COMPILE_OBJECT " --compile_only --asm_file= --output_file=") set(CMAKE_ASM_LINK_EXECUTABLE " --run_linker --output_file= ") set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS asm;s;abs) diff --git a/Modules/Compiler/TI-C.cmake b/Modules/Compiler/TI-C.cmake index b5809942e..479666c72 100644 --- a/Modules/Compiler/TI-C.cmake +++ b/Modules/Compiler/TI-C.cmake @@ -2,9 +2,9 @@ set(CMAKE_LIBRARY_PATH_FLAG "--search_path=") set(CMAKE_LINK_LIBRARY_FLAG "--library=") set(CMAKE_INCLUDE_FLAG_C "--include_path=") -set(CMAKE_C_CREATE_ASSEMBLY_SOURCE " --compile_only --skip_assembler --c_file= --output_file=") -set(CMAKE_C_CREATE_PREPROCESSED_SOURCE " --preproc_only --c_file= --output_file=") +set(CMAKE_C_CREATE_ASSEMBLY_SOURCE " --compile_only --skip_assembler --c_file= --output_file=") +set(CMAKE_C_CREATE_PREPROCESSED_SOURCE " --preproc_only --c_file= --output_file=") -set(CMAKE_C_COMPILE_OBJECT " --compile_only --c_file= --output_file=") +set(CMAKE_C_COMPILE_OBJECT " --compile_only --c_file= --output_file=") set(CMAKE_C_ARCHIVE_CREATE " -r ") set(CMAKE_C_LINK_EXECUTABLE " --run_linker --output_file= --map_file=.map ") diff --git a/Modules/Compiler/TI-CXX.cmake b/Modules/Compiler/TI-CXX.cmake index 8cf5ac37e..4104c3b18 100644 --- a/Modules/Compiler/TI-CXX.cmake +++ b/Modules/Compiler/TI-CXX.cmake @@ -2,9 +2,9 @@ set(CMAKE_LIBRARY_PATH_FLAG "--search_path=") set(CMAKE_LINK_LIBRARY_FLAG "--library=") set(CMAKE_INCLUDE_FLAG_CXX "--include_path=") -set(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE " --compile_only --skip_assembler --cpp_file= --output_file=") -set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE " --preproc_only --cpp_file= --output_file=") +set(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE " --compile_only --skip_assembler --cpp_file= --output_file=") +set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE " --preproc_only --cpp_file= --output_file=") -set(CMAKE_CXX_COMPILE_OBJECT " --compile_only --cpp_file= --output_file=") +set(CMAKE_CXX_COMPILE_OBJECT " --compile_only --cpp_file= --output_file=") set(CMAKE_CXX_ARCHIVE_CREATE " -r ") set(CMAKE_CXX_LINK_EXECUTABLE " --run_linker --output_file= --map_file=.map ") diff --git a/Modules/Compiler/XL-CXX.cmake b/Modules/Compiler/XL-CXX.cmake index 6c842cd77..41372c15b 100644 --- a/Modules/Compiler/XL-CXX.cmake +++ b/Modules/Compiler/XL-CXX.cmake @@ -8,4 +8,4 @@ set(CMAKE_CXX_FLAGS_MINSIZEREL_INIT "${CMAKE_CXX_FLAGS_MINSIZEREL_INIT} -DNDEBUG set(CMAKE_CXX_FLAGS_INIT "-qthreaded -qhalt=e") set(CMAKE_CXX_COMPILE_OBJECT - " -+ -o -c ") + " -+ -o -c ") diff --git a/Modules/Compiler/XL.cmake b/Modules/Compiler/XL.cmake index 7bf5020ac..bf4f5541c 100644 --- a/Modules/Compiler/XL.cmake +++ b/Modules/Compiler/XL.cmake @@ -33,8 +33,8 @@ macro(__compiler_xl lang) set(CMAKE_${lang}_FLAGS_RELEASE_INIT "-O") set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "-O") set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "-g") - set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE " -E > ") - set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE " -S -o ") + set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE " -E > ") + set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE " -S -o ") # CMAKE_XL_CreateExportList is part of the AIX XL compilers but not the linux ones. # If we found the tool, we'll use it to create exports, otherwise stick with the regular diff --git a/Modules/Platform/BlueGeneQ-base.cmake b/Modules/Platform/BlueGeneQ-base.cmake index fa8dc521b..9372166e8 100644 --- a/Modules/Platform/BlueGeneQ-base.cmake +++ b/Modules/Platform/BlueGeneQ-base.cmake @@ -112,8 +112,8 @@ macro(__BlueGeneQ_common_setup compiler_id lang) foreach(dir ${CMAKE_SYSTEM_INCLUDE_PATH}) set(BGQ_SYSTEM_INCLUDES "${BGQ_SYSTEM_INCLUDES} -I${dir}") endforeach() - set(CMAKE_C_COMPILE_OBJECT " ${BGQ_SYSTEM_INCLUDES} -o -c ") - set(CMAKE_CXX_COMPILE_OBJECT " ${BGQ_SYSTEM_INCLUDES} -o -c ") + set(CMAKE_C_COMPILE_OBJECT " ${BGQ_SYSTEM_INCLUDES} -o -c ") + set(CMAKE_CXX_COMPILE_OBJECT " ${BGQ_SYSTEM_INCLUDES} -o -c ") # # Code below does setup for shared libraries. That this is done diff --git a/Modules/Platform/CYGWIN-windres.cmake b/Modules/Platform/CYGWIN-windres.cmake index c082b5db4..7d787dddf 100644 --- a/Modules/Platform/CYGWIN-windres.cmake +++ b/Modules/Platform/CYGWIN-windres.cmake @@ -1 +1 @@ -set(CMAKE_RC_COMPILE_OBJECT " -O coff ") +set(CMAKE_RC_COMPILE_OBJECT " -O coff ") diff --git a/Modules/Platform/Darwin-NAG-Fortran.cmake b/Modules/Platform/Darwin-NAG-Fortran.cmake index 4c28e625c..e3ac9b51f 100644 --- a/Modules/Platform/Darwin-NAG-Fortran.cmake +++ b/Modules/Platform/Darwin-NAG-Fortran.cmake @@ -16,7 +16,7 @@ set(CMAKE_Fortran_VERBOSE_FLAG "-Wl,-v") # Runs gcc under the hood. # Need -fpp explicitly on case-insensitive filesystem. set(CMAKE_Fortran_COMPILE_OBJECT - " -fpp -o -c ") + " -fpp -o -c ") set(CMAKE_Fortran_OSX_COMPATIBILITY_VERSION_FLAG "-Wl,-compatibility_version -Wl,") set(CMAKE_Fortran_OSX_CURRENT_VERSION_FLAG "-Wl,-current_version -Wl,") diff --git a/Modules/Platform/Generic-SDCC-C.cmake b/Modules/Platform/Generic-SDCC-C.cmake index 588bf32d9..a1ca81243 100644 --- a/Modules/Platform/Generic-SDCC-C.cmake +++ b/Modules/Platform/Generic-SDCC-C.cmake @@ -38,7 +38,7 @@ if(NOT DEFINED CMAKE_EXE_LINKER_FLAGS_INIT) endif() # compile a C file into an object file -set(CMAKE_C_COMPILE_OBJECT " -o -c ") +set(CMAKE_C_COMPILE_OBJECT " -o -c ") # link object files to an executable set(CMAKE_C_LINK_EXECUTABLE " --out-fmt-ihx -o ") diff --git a/Modules/Platform/HP-UX-HP-C.cmake b/Modules/Platform/HP-UX-HP-C.cmake index 100093590..7610383d3 100644 --- a/Modules/Platform/HP-UX-HP-C.cmake +++ b/Modules/Platform/HP-UX-HP-C.cmake @@ -1,6 +1,6 @@ include(Platform/HP-UX-HP) __hpux_compiler_hp(C) -set(CMAKE_C_CREATE_PREPROCESSED_SOURCE " -E > ") -set(CMAKE_C_CREATE_ASSEMBLY_SOURCE " -S -o ") -set(CMAKE_C_COMPILE_OBJECT " -Aa -Ae -o -c ") +set(CMAKE_C_CREATE_PREPROCESSED_SOURCE " -E > ") +set(CMAKE_C_CREATE_ASSEMBLY_SOURCE " -S -o ") +set(CMAKE_C_COMPILE_OBJECT " -Aa -Ae -o -c ") diff --git a/Modules/Platform/HP-UX-HP-CXX.cmake b/Modules/Platform/HP-UX-HP-CXX.cmake index dfa1e4e45..6d90191cb 100644 --- a/Modules/Platform/HP-UX-HP-CXX.cmake +++ b/Modules/Platform/HP-UX-HP-CXX.cmake @@ -1,9 +1,9 @@ include(Platform/HP-UX-HP) __hpux_compiler_hp(CXX) -set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE " -E > ") +set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE " -E > ") set(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE - " -S " + " -S " "mv `basename \"\" | sed 's/\\.[^./]*$$//'`.s " "rm -f `basename \"\" | sed 's/\\.[^./]*$$//'`.o" ) diff --git a/Modules/Platform/HP-UX-HP-Fortran.cmake b/Modules/Platform/HP-UX-HP-Fortran.cmake index e5c5d10ea..12007e422 100644 --- a/Modules/Platform/HP-UX-HP-Fortran.cmake +++ b/Modules/Platform/HP-UX-HP-Fortran.cmake @@ -1,5 +1,5 @@ include(Platform/HP-UX-HP) __hpux_compiler_hp(Fortran) -set(CMAKE_Fortran_CREATE_PREPROCESSED_SOURCE " -E > ") -set(CMAKE_Fortran_CREATE_ASSEMBLY_SOURCE " -S -o ") +set(CMAKE_Fortran_CREATE_PREPROCESSED_SOURCE " -E > ") +set(CMAKE_Fortran_CREATE_ASSEMBLY_SOURCE " -S -o ") diff --git a/Modules/Platform/IRIX64.cmake b/Modules/Platform/IRIX64.cmake index 5acbd81fa..ee9b96e89 100644 --- a/Modules/Platform/IRIX64.cmake +++ b/Modules/Platform/IRIX64.cmake @@ -44,17 +44,17 @@ endif() include(Platform/UnixPaths) if(NOT CMAKE_COMPILER_IS_GNUCC) - set (CMAKE_C_CREATE_PREPROCESSED_SOURCE " -E > ") + set (CMAKE_C_CREATE_PREPROCESSED_SOURCE " -E > ") set (CMAKE_C_CREATE_ASSEMBLY_SOURCE - " -S " + " -S " "mv `basename \"\" | sed 's/\\.[^./]*$$//'`.s " ) endif() if(NOT CMAKE_COMPILER_IS_GNUCXX) - set (CMAKE_CXX_CREATE_PREPROCESSED_SOURCE " -E > ") + set (CMAKE_CXX_CREATE_PREPROCESSED_SOURCE " -E > ") set (CMAKE_CXX_CREATE_ASSEMBLY_SOURCE - " -S " + " -S " "mv `basename \"\" | sed 's/\\.[^./]*$$//'`.s " ) endif() diff --git a/Modules/Platform/Windows-Embarcadero.cmake b/Modules/Platform/Windows-Embarcadero.cmake index 04f6bc21a..5295a48e6 100644 --- a/Modules/Platform/Windows-Embarcadero.cmake +++ b/Modules/Platform/Windows-Embarcadero.cmake @@ -90,7 +90,7 @@ macro(__embarcadero_language lang) # place outside the response file because Borland refuses # to parse quotes from the response file. set(CMAKE_${lang}_COMPILE_OBJECT - " ${_tR} -DWIN32 -o ${_COMPILE_${lang}} " + " ${_tR} -DWIN32 -o ${_COMPILE_${lang}} " ) set(CMAKE_${lang}_LINK_EXECUTABLE @@ -101,7 +101,7 @@ macro(__embarcadero_language lang) # place outside the response file because Borland refuses # to parse quotes from the response file. set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE - "cpp32 -DWIN32 -o ${_COMPILE_${lang}} " + "cpp32 -DWIN32 -o ${_COMPILE_${lang}} " ) # Borland >= 5.6 allows -P option for cpp32, <= 5.5 does not diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake index b1e38cf77..94470c3c4 100644 --- a/Modules/Platform/Windows-MSVC.cmake +++ b/Modules/Platform/Windows-MSVC.cmake @@ -284,11 +284,11 @@ macro(__windows_compiler_msvc lang) set(CMAKE_${lang}_CREATE_STATIC_LIBRARY " /lib ${CMAKE_CL_NOLOGO} /out: ") set(CMAKE_${lang}_COMPILE_OBJECT - " ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} /Fo /Fd${_FS_${lang}} -c ${CMAKE_END_TEMP_FILE}") + " ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} /Fo /Fd${_FS_${lang}} -c ${CMAKE_END_TEMP_FILE}") set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE - " > ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} -E ${CMAKE_END_TEMP_FILE}") + " > ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} -E ${CMAKE_END_TEMP_FILE}") set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE - " ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} /FoNUL /FAs /Fa /c ${CMAKE_END_TEMP_FILE}") + " ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} /FoNUL /FAs /Fa /c ${CMAKE_END_TEMP_FILE}") set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_OBJECTS 1) set(CMAKE_${lang}_LINK_EXECUTABLE diff --git a/Modules/Platform/Windows-wcl386.cmake b/Modules/Platform/Windows-wcl386.cmake index d532566aa..3bc54449e 100644 --- a/Modules/Platform/Windows-wcl386.cmake +++ b/Modules/Platform/Windows-wcl386.cmake @@ -58,19 +58,19 @@ set(CMAKE_CXX_LINK_EXECUTABLE ${CMAKE_C_LINK_EXECUTABLE}) # compile a C++ file into an object file set(CMAKE_CXX_COMPILE_OBJECT - " ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} -d+ -fo -c -cc++ ${CMAKE_END_TEMP_FILE}") + " ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} -d+ -fo -c -cc++ ${CMAKE_END_TEMP_FILE}") # compile a C file into an object file set(CMAKE_C_COMPILE_OBJECT - " ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} -d+ -fo -c -cc ${CMAKE_END_TEMP_FILE}") + " ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} -d+ -fo -c -cc ${CMAKE_END_TEMP_FILE}") # preprocess a C source file set(CMAKE_C_CREATE_PREPROCESSED_SOURCE - " ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} -d+ -fo -pl -cc ${CMAKE_END_TEMP_FILE}") + " ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} -d+ -fo -pl -cc ${CMAKE_END_TEMP_FILE}") # preprocess a C++ source file set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE - " ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} -d+ -fo -pl -cc++ ${CMAKE_END_TEMP_FILE}") + " ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} -d+ -fo -pl -cc++ ${CMAKE_END_TEMP_FILE}") set(CMAKE_CXX_CREATE_SHARED_LIBRARY "wlink ${CMAKE_START_TEMP_FILE} ${CMAKE_WLINK_QUIET} name option implib= file {} ${CMAKE_END_TEMP_FILE}") diff --git a/Modules/Platform/Windows-windres.cmake b/Modules/Platform/Windows-windres.cmake index c082b5db4..7d787dddf 100644 --- a/Modules/Platform/Windows-windres.cmake +++ b/Modules/Platform/Windows-windres.cmake @@ -1 +1 @@ -set(CMAKE_RC_COMPILE_OBJECT " -O coff ") +set(CMAKE_RC_COMPILE_OBJECT " -O coff ") diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx index ce351eea9..2225fdc4e 100644 --- a/Source/cmCommonTargetGenerator.cxx +++ b/Source/cmCommonTargetGenerator.cxx @@ -312,9 +312,6 @@ std::string cmCommonTargetGenerator::GetFlags(const std::string &l) this->LocalGenerator->AddVisibilityPresetFlags(flags, this->Target, lang); - // Add include directory flags. - this->AddIncludeFlags(flags, lang); - // Append old-style preprocessor definition flags. this->LocalGenerator-> AppendFlags(flags, this->Makefile->GetDefineFlags()); @@ -358,3 +355,16 @@ std::string cmCommonTargetGenerator::GetDefines(const std::string &l) } return i->second; } + +std::string cmCommonTargetGenerator::GetIncludes(std::string const& l) +{ + ByLanguageMap::iterator i = this->IncludesByLanguage.find(l); + if (i == this->IncludesByLanguage.end()) + { + std::string includes; + this->AddIncludeFlags(includes, l); + ByLanguageMap::value_type entry(l, includes); + i = this->IncludesByLanguage.insert(entry).first; + } + return i->second; +} diff --git a/Source/cmCommonTargetGenerator.h b/Source/cmCommonTargetGenerator.h index e184dba31..5451a5aec 100644 --- a/Source/cmCommonTargetGenerator.h +++ b/Source/cmCommonTargetGenerator.h @@ -83,6 +83,8 @@ protected: ByLanguageMap FlagsByLanguage; std::string GetDefines(const std::string &l); ByLanguageMap DefinesByLanguage; + std::string GetIncludes(std::string const& l); + ByLanguageMap IncludesByLanguage; }; #endif diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index e1702535f..5c9ee0ec9 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -766,6 +766,10 @@ cmLocalGenerator::ExpandRuleVariable(std::string const& variable, { return replaceValues.Defines; } + if(replaceValues.Includes && variable == "INCLUDES") + { + return replaceValues.Includes; + } if(replaceValues.TargetPDB ) { if(variable == "TARGET_PDB") diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 98f4d3a22..2dfe825e8 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -230,6 +230,7 @@ public: const char* LinkFlags; const char* LanguageCompileFlags; const char* Defines; + const char* Includes; const char* RuleLauncher; const char* DependencyFile; const char* FilterPrefix; diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index ef4bbbe97..9cac5bdc8 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -295,11 +295,14 @@ void cmMakefileTargetGenerator::WriteTargetLanguageFlags() { std::string flags = this->GetFlags(*l); std::string defines = this->GetDefines(*l); + std::string includes = this->GetIncludes(*l); // Escape comment characters so they do not terminate assignment. cmSystemTools::ReplaceString(flags, "#", "\\#"); cmSystemTools::ReplaceString(defines, "#", "\\#"); + cmSystemTools::ReplaceString(includes, "#", "\\#"); *this->FlagFileStream << *l << "_FLAGS = " << flags << "\n\n"; *this->FlagFileStream << *l << "_DEFINES = " << defines << "\n\n"; + *this->FlagFileStream << *l << "_INCLUDES = " << includes << "\n\n"; } } @@ -611,6 +614,9 @@ cmMakefileTargetGenerator vars.Defines = definesString.c_str(); + std::string const includesString = "$(" + lang + "_INCLUDES)"; + vars.Includes = includesString.c_str(); + // At the moment, it is assumed that C, C++, and Fortran have both // assembly and preprocessor capabilities. The same is true for the // ability to export compile commands @@ -643,6 +649,9 @@ cmMakefileTargetGenerator std::string langDefines = std::string("$(") + lang + "_DEFINES)"; compileCommand.replace(compileCommand.find(langDefines), langDefines.size(), this->GetDefines(lang)); + std::string langIncludes = std::string("$(") + lang + "_INCLUDES)"; + compileCommand.replace(compileCommand.find(langIncludes), + langIncludes.size(), this->GetIncludes(lang)); this->GlobalGenerator->AddCXXCompileCommand( source.GetFullPath(), workingDirectory, compileCommand); } diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index a72bc7284..3441149ab 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -315,6 +315,7 @@ cmNinjaTargetGenerator vars.Source = "$in"; vars.Object = "$out"; vars.Defines = "$DEFINES"; + vars.Includes = "$INCLUDES"; vars.TargetPDB = "$TARGET_PDB"; vars.TargetCompilePDB = "$TARGET_COMPILE_PDB"; vars.ObjectDir = "$OBJECT_DIR"; @@ -592,6 +593,7 @@ cmNinjaTargetGenerator cmNinjaVars vars; vars["FLAGS"] = this->ComputeFlagsForObject(source, language); vars["DEFINES"] = this->ComputeDefines(source, language); + vars["INCLUDES"] = this->GetIncludes(language); if (!this->NeedDepTypeMSVC(language)) { vars["DEP_FILE"] = cmGlobalNinjaGenerator::EncodeDepfileSpace(objectFileName + ".d"); @@ -637,6 +639,7 @@ cmNinjaTargetGenerator compileObjectVars.ObjectFileDir = objectFileDir.c_str(); compileObjectVars.Flags = vars["FLAGS"].c_str(); compileObjectVars.Defines = vars["DEFINES"].c_str(); + compileObjectVars.Includes = vars["INCLUDES"].c_str(); // Rule for compiling object file. std::string compileCmdVar = "CMAKE_"; From e6cf1c489cbebf41524de389895c58bc644fd7f8 Mon Sep 17 00:00:00 2001 From: Zack Galbreath Date: Mon, 13 Jul 2015 11:56:06 -0400 Subject: [PATCH 0320/1048] ctest_coverage: Always do coverage for CTEST_EXTRA_COVERAGE_GLOB Do not ignore a coverage request if CTEST_EXTRA_COVERAGE_GLOB was specified. Prior to this change, if no lines of code were covered by any tests then CTest would neglect to generate a Coverage.xml file. This change allows us to report uncovered files for a project with no tests. --- Source/CTest/cmCTestCoverageHandler.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx index f92f19ad8..6369e173f 100644 --- a/Source/CTest/cmCTestCoverageHandler.cxx +++ b/Source/CTest/cmCTestCoverageHandler.cxx @@ -446,7 +446,7 @@ int cmCTestCoverageHandler::ProcessHandler() } std::set uncovered = this->FindUncoveredFiles(&cont); - if ( file_count == 0 ) + if (file_count == 0 && this->ExtraCoverageGlobs.empty()) { cmCTestOptionalLog(this->CTest, WARNING, " Cannot find any coverage files. Ignoring Coverage request." From 860c2055e5a0b700f25fbf63f64d29443d889f0b Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Tue, 14 Jul 2015 00:01:05 -0400 Subject: [PATCH 0321/1048] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index b3827501a..e91166f10 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 3) -set(CMake_VERSION_PATCH 20150713) +set(CMake_VERSION_PATCH 20150714) #set(CMake_VERSION_RC 1) From 0699e0d3e4305fc4e615c36b831d0171c2f8c757 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 14 Jul 2015 09:29:10 -0400 Subject: [PATCH 0322/1048] Tests: Move CTestTestConfigFileInBuildDir into RunCMake.ctest_start Subsume the CTestTestConfigFileInBuildDir test cases into the RunCMake.ctest_start test as new cases to avoid infrastructure duplication. This also avoids using REGEX_ESCAPE_STRING to try to regex-match full paths. --- Tests/CMakeLists.txt | 33 ------------------- .../CMakeLists.txt | 3 -- .../CTestConfig.cmake | 7 ---- .../test1.cmake.in | 19 ----------- .../test2.cmake.in | 19 ----------- .../ctest_start/ConfigInBuild-stdout.txt | 7 ++++ .../ctest_start/ConfigInSource-stdout.txt | 7 ++++ Tests/RunCMake/ctest_start/RunCMakeTest.cmake | 13 ++++++++ 8 files changed, 27 insertions(+), 81 deletions(-) delete mode 100644 Tests/CTestTestConfigFileInBuildDir/CMakeLists.txt delete mode 100644 Tests/CTestTestConfigFileInBuildDir/CTestConfig.cmake delete mode 100644 Tests/CTestTestConfigFileInBuildDir/test1.cmake.in delete mode 100644 Tests/CTestTestConfigFileInBuildDir/test2.cmake.in create mode 100644 Tests/RunCMake/ctest_start/ConfigInBuild-stdout.txt create mode 100644 Tests/RunCMake/ctest_start/ConfigInSource-stdout.txt diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 8de1c79d3..d95a5f494 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -17,8 +17,6 @@ macro(ADD_TEST_MACRO NAME COMMAND) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/${dir}") endmacro() -include(${CMAKE_CURRENT_SOURCE_DIR}/RegexEscapeString.cmake) - include(${CMAKE_CURRENT_SOURCE_DIR}/CheckFortran.cmake) # Fake a user home directory to avoid polluting the real one. @@ -2430,37 +2428,6 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release set_tests_properties(CTestTestEmptyBinaryDirectory PROPERTIES PASS_REGULAR_EXPRESSION "TEST_SUCCESS") - configure_file( - "${CMake_SOURCE_DIR}/Tests/CTestTestConfigFileInBuildDir/test1.cmake.in" - "${CMake_BINARY_DIR}/Tests/CTestTestConfigFileInBuildDir1/test1.cmake" - @ONLY ESCAPE_QUOTES) - add_test(CTestTestConfigFileInBuildDir1 ${CMAKE_CTEST_COMMAND} - -S "${CMake_BINARY_DIR}/Tests/CTestTestConfigFileInBuildDir1/test1.cmake" -V - --output-log "${CMake_BINARY_DIR}/Tests/CTestTestConfigFileInBuildDir1/testOut1.log" - ) - REGEX_ESCAPE_STRING(CTEST_TEST_ESCAPED_SOURCE_DIR "${CMake_SOURCE_DIR}") - set_tests_properties(CTestTestConfigFileInBuildDir1 PROPERTIES DEPENDS CTestTestNoBuild - PASS_REGULAR_EXPRESSION - "Reading ctest configuration file: ${CTEST_TEST_ESCAPED_SOURCE_DIR}.Tests.CTestTestConfigFileInBuildDir.CTestConfig.cmake") - - configure_file( - "${CMake_SOURCE_DIR}/Tests/CTestTestConfigFileInBuildDir/test2.cmake.in" - "${CMake_BINARY_DIR}/Tests/CTestTestConfigFileInBuildDir2/test2.cmake" - @ONLY ESCAPE_QUOTES) - configure_file( - "${CMake_SOURCE_DIR}/Tests/CTestTestConfigFileInBuildDir/CTestConfig.cmake" - "${CMake_BINARY_DIR}/Tests/CTestTestConfigFileInBuildDir2/CTestConfig.cmake" - @ONLY ESCAPE_QUOTES COPYONLY) - add_test(CTestTestConfigFileInBuildDir2 ${CMAKE_CTEST_COMMAND} - -S "${CMake_BINARY_DIR}/Tests/CTestTestConfigFileInBuildDir2/test2.cmake" -V - --output-log "${CMake_BINARY_DIR}/Tests/CTestTestConfigFileInBuildDir2/testOut2.log" - ) - REGEX_ESCAPE_STRING(CTEST_TEST_ESCAPED_BINARY_DIR "${CMake_BINARY_DIR}") - set_tests_properties(CTestTestConfigFileInBuildDir2 PROPERTIES DEPENDS CTestTestNoBuild - REQUIRED_FILES ${CMake_BINARY_DIR}/Tests/CTestTestConfigFileInBuildDir2/CTestConfig.cmake - PASS_REGULAR_EXPRESSION - "Reading ctest configuration file: ${CTEST_TEST_ESCAPED_BINARY_DIR}.Tests.CTestTestConfigFileInBuildDir2.CTestConfig.cmake") - # test coverage for mumps # create a MumpsCoverage dir in the binary tree under Testing to # avoid the .NoDartCoverage files in the cmake testing tree diff --git a/Tests/CTestTestConfigFileInBuildDir/CMakeLists.txt b/Tests/CTestTestConfigFileInBuildDir/CMakeLists.txt deleted file mode 100644 index 3c53e6623..000000000 --- a/Tests/CTestTestConfigFileInBuildDir/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -cmake_minimum_required(VERSION 2.8) -project(CTestTestConfigFileInBuildDir) -include(CTest) diff --git a/Tests/CTestTestConfigFileInBuildDir/CTestConfig.cmake b/Tests/CTestTestConfigFileInBuildDir/CTestConfig.cmake deleted file mode 100644 index 4458348af..000000000 --- a/Tests/CTestTestConfigFileInBuildDir/CTestConfig.cmake +++ /dev/null @@ -1,7 +0,0 @@ -set(CTEST_PROJECT_NAME "CTestTestConfigFileInBuildDir") -set(CTEST_NIGHTLY_START_TIME "01:00:00 UTC") -set(CTEST_DART_SERVER_VERSION "2") -set(CTEST_DROP_METHOD "http") -set(CTEST_DROP_SITE "open.cdash.org") -set(CTEST_DROP_LOCATION "/submit.php?project=PublicDashboard") -set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestConfigFileInBuildDir/test1.cmake.in b/Tests/CTestTestConfigFileInBuildDir/test1.cmake.in deleted file mode 100644 index 6d29af7ae..000000000 --- a/Tests/CTestTestConfigFileInBuildDir/test1.cmake.in +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8) - -# Settings: -set(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") -set(CTEST_SITE "@SITE@") -set(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-ConfigFileInBuildDir1") - -set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestConfigFileInBuildDir") -set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestConfigFileInBuildDir1") -set(CTEST_CVS_COMMAND "@CVSCOMMAND@") -set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") -set(CTEST_CMAKE_GENERATOR_PLATFORM "@CMAKE_GENERATOR_PLATFORM@") -set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_GENERATOR_TOOLSET@") -set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") -set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") -set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") - -CTEST_START(Experimental) -CTEST_CONFIGURE(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) diff --git a/Tests/CTestTestConfigFileInBuildDir/test2.cmake.in b/Tests/CTestTestConfigFileInBuildDir/test2.cmake.in deleted file mode 100644 index fb298d471..000000000 --- a/Tests/CTestTestConfigFileInBuildDir/test2.cmake.in +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8) - -# Settings: -set(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") -set(CTEST_SITE "@SITE@") -set(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-ConfigFileInBuildDir2") - -set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestConfigFileInBuildDir") -set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestConfigFileInBuildDir2") -set(CTEST_CVS_COMMAND "@CVSCOMMAND@") -set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") -set(CTEST_CMAKE_GENERATOR_PLATFORM "@CMAKE_GENERATOR_PLATFORM@") -set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_GENERATOR_TOOLSET@") -set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") -set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") -set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") - -CTEST_START(Experimental) -CTEST_CONFIGURE(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) diff --git a/Tests/RunCMake/ctest_start/ConfigInBuild-stdout.txt b/Tests/RunCMake/ctest_start/ConfigInBuild-stdout.txt new file mode 100644 index 000000000..7e94b8a12 --- /dev/null +++ b/Tests/RunCMake/ctest_start/ConfigInBuild-stdout.txt @@ -0,0 +1,7 @@ +Run dashboard with model Experimental + Source directory: .*/Tests/RunCMake/ctest_start/ConfigInBuild + Build directory: .*/Tests/RunCMake/ctest_start/ConfigInBuild-build + Reading ctest configuration file: .*/Tests/RunCMake/ctest_start/ConfigInBuild-build/CTestConfig.cmake + Site: test-site + Build name: test-build-name + Use Experimental tag: [0-9-]+ diff --git a/Tests/RunCMake/ctest_start/ConfigInSource-stdout.txt b/Tests/RunCMake/ctest_start/ConfigInSource-stdout.txt new file mode 100644 index 000000000..c3903726a --- /dev/null +++ b/Tests/RunCMake/ctest_start/ConfigInSource-stdout.txt @@ -0,0 +1,7 @@ +Run dashboard with model Experimental + Source directory: .*/Tests/RunCMake/ctest_start/ConfigInSource + Build directory: .*/Tests/RunCMake/ctest_start/ConfigInSource-build + Reading ctest configuration file: .*/Tests/RunCMake/ctest_start/ConfigInSource/CTestConfig.cmake + Site: test-site + Build name: test-build-name + Use Experimental tag: [0-9-]+ diff --git a/Tests/RunCMake/ctest_start/RunCMakeTest.cmake b/Tests/RunCMake/ctest_start/RunCMakeTest.cmake index f765a0f5f..d630a7904 100644 --- a/Tests/RunCMake/ctest_start/RunCMakeTest.cmake +++ b/Tests/RunCMake/ctest_start/RunCMakeTest.cmake @@ -8,3 +8,16 @@ function(run_ctest_start CASE_NAME) endfunction() run_ctest_start(StartQuiet Experimental QUIET) + +run_ctest_start(ConfigInSource Experimental) + +function(run_ConfigInBuild) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/ConfigInBuild-build) + set(RunCMake_TEST_NO_CLEAN 1) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + configure_file(${RunCMake_SOURCE_DIR}/CTestConfig.cmake.in + ${RunCMake_BINARY_DIR}/ConfigInBuild-build/CTestConfig.cmake @ONLY) + run_ctest_start(ConfigInBuild Experimental) +endfunction() +run_ConfigInBuild() From e5ca59b456d3a1a51d0b5387ec9d04a51beaa0be Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 14 Jul 2015 09:41:05 -0400 Subject: [PATCH 0323/1048] Tests: Move command failure cases into RunCMake infrastructure Move failure cases from the CMake.{If,List,While,GetProperty} tests over to the RunCMake.{if,list,while,get_property} tests to use the more modern infrastructure. This also avoids using REGEX_ESCAPE_STRING to try to regex-match full paths. --- Tests/CMakeTests/GetPropertyTest.cmake.in | 96 ------------------- Tests/CMakeTests/IfTest.cmake.in | 11 --- Tests/CMakeTests/ListTest.cmake.in | 53 ---------- Tests/CMakeTests/WhileTest.cmake.in | 40 -------- Tests/RegexEscapeString.cmake | 4 - Tests/RunCMake/CMakeLists.txt | 1 + .../get_property/BadArgument-result.txt | 1 + .../get_property/BadArgument-stderr.txt | 4 + .../get_property/BadArgument.cmake} | 0 .../get_property/BadDirectory-result.txt | 1 + .../get_property/BadDirectory-stderr.txt | 6 ++ .../get_property/BadDirectory.cmake} | 0 .../RunCMake/get_property/BadScope-result.txt | 1 + .../RunCMake/get_property/BadScope-stderr.txt | 5 + .../get_property/BadScope.cmake} | 0 .../get_property/BadTarget-result.txt | 1 + .../get_property/BadTarget-stderr.txt | 5 + .../get_property/BadTarget.cmake} | 0 .../RunCMake/get_property/BadTest-result.txt | 1 + .../RunCMake/get_property/BadTest-stderr.txt | 4 + .../get_property/BadTest.cmake} | 0 .../get_property/GlobalName-result.txt | 1 + .../get_property/GlobalName-stderr.txt | 4 + .../get_property/GlobalName.cmake} | 0 .../get_property/MissingArgument-result.txt | 1 + .../get_property/MissingArgument-stderr.txt | 4 + .../get_property/MissingArgument.cmake} | 0 .../RunCMake/get_property/NoCache-result.txt | 1 + .../RunCMake/get_property/NoCache-stderr.txt | 4 + .../get_property/NoCache.cmake} | 0 .../get_property/NoProperty-result.txt | 1 + .../get_property/NoProperty-stderr.txt | 4 + .../get_property/NoProperty.cmake} | 0 .../RunCMake/get_property/NoSource-result.txt | 1 + .../RunCMake/get_property/NoSource-stderr.txt | 4 + .../get_property/NoSource.cmake} | 0 .../RunCMake/get_property/NoTarget-result.txt | 1 + .../RunCMake/get_property/NoTarget-stderr.txt | 4 + .../get_property/NoTarget.cmake} | 0 Tests/RunCMake/get_property/NoTest-result.txt | 1 + Tests/RunCMake/get_property/NoTest-stderr.txt | 4 + .../get_property/NoTest.cmake} | 0 .../RunCMake/get_property/RunCMakeTest.cmake | 14 +++ .../get_property/VariableName-result.txt | 1 + .../get_property/VariableName-stderr.txt | 4 + .../get_property/VariableName.cmake} | 0 Tests/RunCMake/if/InvalidArgument1-result.txt | 1 + Tests/RunCMake/if/InvalidArgument1-stderr.txt | 8 ++ .../if/InvalidArgument1.cmake} | 0 Tests/RunCMake/if/RunCMakeTest.cmake | 1 + .../RunCMake/list/GET-CMP0007-WARN-stderr.txt | 8 ++ .../list/GET-CMP0007-WARN.cmake} | 1 + .../RunCMake/list/GET-InvalidIndex-result.txt | 1 + .../RunCMake/list/GET-InvalidIndex-stderr.txt | 4 + .../list/GET-InvalidIndex.cmake} | 0 .../list/INSERT-InvalidIndex-result.txt | 1 + .../list/INSERT-InvalidIndex-stderr.txt | 4 + .../list/INSERT-InvalidIndex.cmake} | 0 .../list/InvalidSubcommand-result.txt | 1 + .../list/InvalidSubcommand-stderr.txt | 4 + .../list/InvalidSubcommand.cmake} | 0 .../list/LENGTH-TooManyArguments-result.txt | 1 + .../list/LENGTH-TooManyArguments-stderr.txt | 4 + .../list/LENGTH-TooManyArguments.cmake} | 0 Tests/RunCMake/list/NoArguments-result.txt | 1 + Tests/RunCMake/list/NoArguments-stderr.txt | 4 + .../list/NoArguments.cmake} | 0 .../list/REMOVE_AT-InvalidIndex-result.txt | 1 + .../list/REMOVE_AT-InvalidIndex-stderr.txt | 4 + .../list/REMOVE_AT-InvalidIndex.cmake} | 0 .../list/REMOVE_AT-NotList-result.txt | 1 + .../list/REMOVE_AT-NotList-stderr.txt | 4 + .../list/REMOVE_AT-NotList.cmake} | 0 .../list/REMOVE_DUPLICATES-NotList-result.txt | 1 + .../list/REMOVE_DUPLICATES-NotList-stderr.txt | 4 + .../list/REMOVE_DUPLICATES-NotList.cmake} | 0 ...OVE_DUPLICATES-TooManyArguments-result.txt | 1 + ...OVE_DUPLICATES-TooManyArguments-stderr.txt | 4 + .../REMOVE_DUPLICATES-TooManyArguments.cmake} | 0 .../list/REMOVE_ITEM-NotList-result.txt | 1 + .../list/REMOVE_ITEM-NotList-stderr.txt | 4 + .../list/REMOVE_ITEM-NotList.cmake} | 0 .../RunCMake/list/REVERSE-NotList-result.txt | 1 + .../RunCMake/list/REVERSE-NotList-stderr.txt | 4 + .../list/REVERSE-NotList.cmake} | 0 .../list/REVERSE-TooManyArguments-result.txt | 1 + .../list/REVERSE-TooManyArguments-stderr.txt | 4 + .../list/REVERSE-TooManyArguments.cmake} | 0 Tests/RunCMake/list/RunCMakeTest.cmake | 19 ++++ Tests/RunCMake/list/SORT-NotList-result.txt | 1 + Tests/RunCMake/list/SORT-NotList-stderr.txt | 4 + .../list/SORT-NotList.cmake} | 0 .../list/SORT-TooManyArguments-result.txt | 1 + .../list/SORT-TooManyArguments-stderr.txt | 4 + .../list/SORT-TooManyArguments.cmake} | 0 Tests/RunCMake/while/CMakeLists.txt | 3 + Tests/RunCMake/while/EndAlone-result.txt | 1 + Tests/RunCMake/while/EndAlone-stderr.txt | 5 + .../while/EndAlone.cmake} | 0 Tests/RunCMake/while/EndAloneArgs-result.txt | 1 + Tests/RunCMake/while/EndAloneArgs-stderr.txt | 5 + .../while/EndAloneArgs.cmake} | 0 Tests/RunCMake/while/EndMismatch-stderr.txt | 13 +++ .../while/EndMismatch.cmake} | 0 Tests/RunCMake/while/EndMissing-result.txt | 1 + Tests/RunCMake/while/EndMissing-stderr.txt | 6 ++ .../while/EndMissing.cmake} | 0 .../RunCMake/while/MissingArgument-result.txt | 1 + .../RunCMake/while/MissingArgument-stderr.txt | 4 + .../while/MissingArgument.cmake} | 0 Tests/RunCMake/while/RunCMakeTest.cmake | 7 ++ 111 files changed, 239 insertions(+), 204 deletions(-) delete mode 100644 Tests/RegexEscapeString.cmake create mode 100644 Tests/RunCMake/get_property/BadArgument-result.txt create mode 100644 Tests/RunCMake/get_property/BadArgument-stderr.txt rename Tests/{CMakeTests/GetProperty-Bad-Argument.cmake => RunCMake/get_property/BadArgument.cmake} (100%) create mode 100644 Tests/RunCMake/get_property/BadDirectory-result.txt create mode 100644 Tests/RunCMake/get_property/BadDirectory-stderr.txt rename Tests/{CMakeTests/GetProperty-Bad-Directory.cmake => RunCMake/get_property/BadDirectory.cmake} (100%) create mode 100644 Tests/RunCMake/get_property/BadScope-result.txt create mode 100644 Tests/RunCMake/get_property/BadScope-stderr.txt rename Tests/{CMakeTests/GetProperty-Bad-Scope.cmake => RunCMake/get_property/BadScope.cmake} (100%) create mode 100644 Tests/RunCMake/get_property/BadTarget-result.txt create mode 100644 Tests/RunCMake/get_property/BadTarget-stderr.txt rename Tests/{CMakeTests/GetProperty-Bad-Target.cmake => RunCMake/get_property/BadTarget.cmake} (100%) create mode 100644 Tests/RunCMake/get_property/BadTest-result.txt create mode 100644 Tests/RunCMake/get_property/BadTest-stderr.txt rename Tests/{CMakeTests/GetProperty-Bad-Test.cmake => RunCMake/get_property/BadTest.cmake} (100%) create mode 100644 Tests/RunCMake/get_property/GlobalName-result.txt create mode 100644 Tests/RunCMake/get_property/GlobalName-stderr.txt rename Tests/{CMakeTests/GetProperty-Global-Name.cmake => RunCMake/get_property/GlobalName.cmake} (100%) create mode 100644 Tests/RunCMake/get_property/MissingArgument-result.txt create mode 100644 Tests/RunCMake/get_property/MissingArgument-stderr.txt rename Tests/{CMakeTests/GetProperty-Missing-Argument.cmake => RunCMake/get_property/MissingArgument.cmake} (100%) create mode 100644 Tests/RunCMake/get_property/NoCache-result.txt create mode 100644 Tests/RunCMake/get_property/NoCache-stderr.txt rename Tests/{CMakeTests/GetProperty-No-Cache.cmake => RunCMake/get_property/NoCache.cmake} (100%) create mode 100644 Tests/RunCMake/get_property/NoProperty-result.txt create mode 100644 Tests/RunCMake/get_property/NoProperty-stderr.txt rename Tests/{CMakeTests/GetProperty-No-Property.cmake => RunCMake/get_property/NoProperty.cmake} (100%) create mode 100644 Tests/RunCMake/get_property/NoSource-result.txt create mode 100644 Tests/RunCMake/get_property/NoSource-stderr.txt rename Tests/{CMakeTests/GetProperty-No-Source.cmake => RunCMake/get_property/NoSource.cmake} (100%) create mode 100644 Tests/RunCMake/get_property/NoTarget-result.txt create mode 100644 Tests/RunCMake/get_property/NoTarget-stderr.txt rename Tests/{CMakeTests/GetProperty-No-Target.cmake => RunCMake/get_property/NoTarget.cmake} (100%) create mode 100644 Tests/RunCMake/get_property/NoTest-result.txt create mode 100644 Tests/RunCMake/get_property/NoTest-stderr.txt rename Tests/{CMakeTests/GetProperty-No-Test.cmake => RunCMake/get_property/NoTest.cmake} (100%) create mode 100644 Tests/RunCMake/get_property/VariableName-result.txt create mode 100644 Tests/RunCMake/get_property/VariableName-stderr.txt rename Tests/{CMakeTests/GetProperty-Variable-Name.cmake => RunCMake/get_property/VariableName.cmake} (100%) create mode 100644 Tests/RunCMake/if/InvalidArgument1-result.txt create mode 100644 Tests/RunCMake/if/InvalidArgument1-stderr.txt rename Tests/{CMakeTests/If-Invalid-Argument.cmake => RunCMake/if/InvalidArgument1.cmake} (100%) create mode 100644 Tests/RunCMake/list/GET-CMP0007-WARN-stderr.txt rename Tests/{CMakeTests/List-Get-CMP0007-Warn.cmake => RunCMake/list/GET-CMP0007-WARN.cmake} (86%) create mode 100644 Tests/RunCMake/list/GET-InvalidIndex-result.txt create mode 100644 Tests/RunCMake/list/GET-InvalidIndex-stderr.txt rename Tests/{CMakeTests/List-Get-Invalid-Index.cmake => RunCMake/list/GET-InvalidIndex.cmake} (100%) create mode 100644 Tests/RunCMake/list/INSERT-InvalidIndex-result.txt create mode 100644 Tests/RunCMake/list/INSERT-InvalidIndex-stderr.txt rename Tests/{CMakeTests/List-Insert-Invalid-Index.cmake => RunCMake/list/INSERT-InvalidIndex.cmake} (100%) create mode 100644 Tests/RunCMake/list/InvalidSubcommand-result.txt create mode 100644 Tests/RunCMake/list/InvalidSubcommand-stderr.txt rename Tests/{CMakeTests/List-Invalid-Subcommand.cmake => RunCMake/list/InvalidSubcommand.cmake} (100%) create mode 100644 Tests/RunCMake/list/LENGTH-TooManyArguments-result.txt create mode 100644 Tests/RunCMake/list/LENGTH-TooManyArguments-stderr.txt rename Tests/{CMakeTests/List-Length-Too-Many-Arguments.cmake => RunCMake/list/LENGTH-TooManyArguments.cmake} (100%) create mode 100644 Tests/RunCMake/list/NoArguments-result.txt create mode 100644 Tests/RunCMake/list/NoArguments-stderr.txt rename Tests/{CMakeTests/List-No-Arguments.cmake => RunCMake/list/NoArguments.cmake} (100%) create mode 100644 Tests/RunCMake/list/REMOVE_AT-InvalidIndex-result.txt create mode 100644 Tests/RunCMake/list/REMOVE_AT-InvalidIndex-stderr.txt rename Tests/{CMakeTests/List-Remove_At-Invalid-Index.cmake => RunCMake/list/REMOVE_AT-InvalidIndex.cmake} (100%) create mode 100644 Tests/RunCMake/list/REMOVE_AT-NotList-result.txt create mode 100644 Tests/RunCMake/list/REMOVE_AT-NotList-stderr.txt rename Tests/{CMakeTests/List-Remove_At-Nonexistent-List.cmake => RunCMake/list/REMOVE_AT-NotList.cmake} (100%) create mode 100644 Tests/RunCMake/list/REMOVE_DUPLICATES-NotList-result.txt create mode 100644 Tests/RunCMake/list/REMOVE_DUPLICATES-NotList-stderr.txt rename Tests/{CMakeTests/List-Remove_Duplicates-Nonexistent-List.cmake => RunCMake/list/REMOVE_DUPLICATES-NotList.cmake} (100%) create mode 100644 Tests/RunCMake/list/REMOVE_DUPLICATES-TooManyArguments-result.txt create mode 100644 Tests/RunCMake/list/REMOVE_DUPLICATES-TooManyArguments-stderr.txt rename Tests/{CMakeTests/List-Remove_Duplicates-Too-Many-Arguments.cmake => RunCMake/list/REMOVE_DUPLICATES-TooManyArguments.cmake} (100%) create mode 100644 Tests/RunCMake/list/REMOVE_ITEM-NotList-result.txt create mode 100644 Tests/RunCMake/list/REMOVE_ITEM-NotList-stderr.txt rename Tests/{CMakeTests/List-Remove_Item-Nonexistent-List.cmake => RunCMake/list/REMOVE_ITEM-NotList.cmake} (100%) create mode 100644 Tests/RunCMake/list/REVERSE-NotList-result.txt create mode 100644 Tests/RunCMake/list/REVERSE-NotList-stderr.txt rename Tests/{CMakeTests/List-Reverse-Nonexistent-List.cmake => RunCMake/list/REVERSE-NotList.cmake} (100%) create mode 100644 Tests/RunCMake/list/REVERSE-TooManyArguments-result.txt create mode 100644 Tests/RunCMake/list/REVERSE-TooManyArguments-stderr.txt rename Tests/{CMakeTests/List-Reverse-Too-Many-Arguments.cmake => RunCMake/list/REVERSE-TooManyArguments.cmake} (100%) create mode 100644 Tests/RunCMake/list/SORT-NotList-result.txt create mode 100644 Tests/RunCMake/list/SORT-NotList-stderr.txt rename Tests/{CMakeTests/List-Sort-Nonexistent-List.cmake => RunCMake/list/SORT-NotList.cmake} (100%) create mode 100644 Tests/RunCMake/list/SORT-TooManyArguments-result.txt create mode 100644 Tests/RunCMake/list/SORT-TooManyArguments-stderr.txt rename Tests/{CMakeTests/List-Sort-Too-Many-Arguments.cmake => RunCMake/list/SORT-TooManyArguments.cmake} (100%) create mode 100644 Tests/RunCMake/while/CMakeLists.txt create mode 100644 Tests/RunCMake/while/EndAlone-result.txt create mode 100644 Tests/RunCMake/while/EndAlone-stderr.txt rename Tests/{CMakeTests/While-Endwhile-Alone.cmake => RunCMake/while/EndAlone.cmake} (100%) create mode 100644 Tests/RunCMake/while/EndAloneArgs-result.txt create mode 100644 Tests/RunCMake/while/EndAloneArgs-stderr.txt rename Tests/{CMakeTests/While-Endwhile-Alone-Args.cmake => RunCMake/while/EndAloneArgs.cmake} (100%) create mode 100644 Tests/RunCMake/while/EndMismatch-stderr.txt rename Tests/{CMakeTests/While-Endwhile-Mismatch.cmake => RunCMake/while/EndMismatch.cmake} (100%) create mode 100644 Tests/RunCMake/while/EndMissing-result.txt create mode 100644 Tests/RunCMake/while/EndMissing-stderr.txt rename Tests/{CMakeTests/While-Missing-Endwhile.cmake => RunCMake/while/EndMissing.cmake} (100%) create mode 100644 Tests/RunCMake/while/MissingArgument-result.txt create mode 100644 Tests/RunCMake/while/MissingArgument-stderr.txt rename Tests/{CMakeTests/While-Missing-Argument.cmake => RunCMake/while/MissingArgument.cmake} (100%) create mode 100644 Tests/RunCMake/while/RunCMakeTest.cmake diff --git a/Tests/CMakeTests/GetPropertyTest.cmake.in b/Tests/CMakeTests/GetPropertyTest.cmake.in index e99193eb1..1ad895657 100644 --- a/Tests/CMakeTests/GetPropertyTest.cmake.in +++ b/Tests/CMakeTests/GetPropertyTest.cmake.in @@ -1,5 +1,3 @@ -include("@CMAKE_CURRENT_SOURCE_DIR@/CheckCMakeTest.cmake") - get_property(FOO_BRIEF GLOBAL PROPERTY FOO BRIEF_DOCS) get_property(FOO_FULL GLOBAL PROPERTY FOO FULL_DOCS) @@ -16,97 +14,3 @@ get_property(result VARIABLE PROPERTY test_var) if(NOT result STREQUAL "alpha") message(SEND_ERROR "bad value of VARIABLE PROPERTY test_var: got '${result}' instead of 'alpha'") endif() - -include("@CMAKE_CURRENT_SOURCE_DIR@/../RegexEscapeString.cmake") -REGEX_ESCAPE_STRING(CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR "@CMAKE_CURRENT_SOURCE_DIR@") - -set(Missing-Argument-RESULT 1) -set(Missing-Argument-STDERR ".*CMake Error at (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?GetProperty-Missing-Argument.cmake:1 \\(get_property\\):.*get_property called with incorrect number of arguments.*") - -check_cmake_test(GetProperty - Missing-Argument -) - -set(Bad-Scope-RESULT 1) -set(Bad-Scope-STDERR ".*CMake Error at (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?GetProperty-Bad-Scope.cmake:1 \\(get_property\\):.*get_property given invalid scope FOO\\..*") - -check_cmake_test(GetProperty - Bad-Scope -) - -set(Bad-Argument-RESULT 1) -set(Bad-Argument-STDERR ".*CMake Error at (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?GetProperty-Bad-Argument.cmake:1 \\(get_property\\):.*get_property given invalid argument \"FOO\"\\..*") - -check_cmake_test(GetProperty - Bad-Argument -) - -set(No-Property-RESULT 1) -set(No-Property-STDERR ".*CMake Error at (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?GetProperty-No-Property.cmake:1 \\(get_property\\):.*get_property not given a PROPERTY argument\\..*") - -check_cmake_test(GetProperty - No-Property -) - -set(Global-Name-RESULT 1) -set(Global-Name-STDERR ".*CMake Error at (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?GetProperty-Global-Name.cmake:1 \\(get_property\\):.*get_property given name for GLOBAL scope\\..*") - -check_cmake_test(GetProperty - Global-Name -) - -set(Bad-Directory-RESULT 1) -set(Bad-Directory-STDERR ".*CMake Error at (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?GetProperty-Bad-Directory.cmake:1 \\(get_property\\):.*get_property DIRECTORY scope provided but requested directory was not.*found\\..*") - -check_cmake_test(GetProperty - Bad-Directory -) - -set(No-Target-RESULT 1) -set(No-Target-STDERR ".*CMake Error at (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?GetProperty-No-Target.cmake:1 \\(get_property\\):.*get_property not given name for TARGET scope\\..*") - -check_cmake_test(GetProperty - No-Target -) - -set(Bad-Target-RESULT 1) -set(Bad-Target-STDERR ".*CMake Error at (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?GetProperty-Bad-Target.cmake:1 \\(get_property\\):.*get_property could not find TARGET FOO\\..*") - -check_cmake_test(GetProperty - Bad-Target -) - -set(No-Source-RESULT 1) -set(No-Source-STDERR ".*CMake Error at (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?GetProperty-No-Source.cmake:1 \\(get_property\\):.*get_property not given name for SOURCE scope\\..*") - -check_cmake_test(GetProperty - No-Source -) - -set(No-Test-RESULT 1) -set(No-Test-STDERR ".*CMake Error at (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?GetProperty-No-Test.cmake:1 \\(get_property\\):.*get_property not given name for TEST scope\\..*") - -check_cmake_test(GetProperty - No-Test -) - -set(Bad-Test-RESULT 1) -set(Bad-Test-STDERR ".*CMake Error at (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?GetProperty-Bad-Test.cmake:1 \\(get_property\\):.*get_property given TEST name that does not exist: FOO.*") - -check_cmake_test(GetProperty - Bad-Test -) - -set(Variable-Name-RESULT 1) -set(Variable-Name-STDERR ".*CMake Error at (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?GetProperty-Variable-Name.cmake:1 \\(get_property\\):.*get_property given name for VARIABLE scope\\..*") - -check_cmake_test(GetProperty - Variable-Name -) - -set(No-Cache-RESULT 1) -set(No-Cache-STDERR ".*CMake Error at (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?GetProperty-No-Cache.cmake:1 \\(get_property\\):.*get_property not given name for CACHE scope\\..*") - -check_cmake_test(GetProperty - No-Cache -) diff --git a/Tests/CMakeTests/IfTest.cmake.in b/Tests/CMakeTests/IfTest.cmake.in index 74b8e32b5..e5211b4fa 100644 --- a/Tests/CMakeTests/IfTest.cmake.in +++ b/Tests/CMakeTests/IfTest.cmake.in @@ -7,9 +7,6 @@ foreach(_arg "" 0 1 2 ${TRUE_NAMES} ${FALSE_NAMES}) set(VAR_${_arg} "${_arg}") endforeach() -include("@CMAKE_CURRENT_SOURCE_DIR@/../RegexEscapeString.cmake") -REGEX_ESCAPE_STRING(CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR "@CMAKE_CURRENT_SOURCE_DIR@") - macro(test_vars _old) # Variables set to false or not set. foreach(_var "" 0 ${FALSE_NAMES} UNDEFINED) @@ -159,11 +156,3 @@ foreach(_bad 2x -2x) endforeach() test_vars("") - -set(Invalid-Argument-RESULT 1) -set(Invalid-Argument-STDERR ".*CMake Error at (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?If-Invalid-Argument.cmake:1 \\(if\\):.*Unknown arguments specified.*") - -include("@CMAKE_CURRENT_SOURCE_DIR@/CheckCMakeTest.cmake") -check_cmake_test(If - Invalid-Argument -) diff --git a/Tests/CMakeTests/ListTest.cmake.in b/Tests/CMakeTests/ListTest.cmake.in index 77c34a9c4..76f5e4f6a 100644 --- a/Tests/CMakeTests/ListTest.cmake.in +++ b/Tests/CMakeTests/ListTest.cmake.in @@ -1,8 +1,5 @@ include("@CMAKE_CURRENT_SOURCE_DIR@/CheckCMakeTest.cmake") -include("@CMAKE_CURRENT_SOURCE_DIR@/../RegexEscapeString.cmake") -REGEX_ESCAPE_STRING(CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR "@CMAKE_CURRENT_SOURCE_DIR@") - macro(TEST command expected) if("x${result}" STREQUAL "x${expected}") #message("TEST \"${command}\" success: \"${result}\" expected: \"${expected}\"") @@ -103,9 +100,6 @@ TEST("REVERSE empty result" "") list(SORT result) TEST("SORT empty result" "") -set(No-Arguments-RESULT 1) -set(No-Arguments-STDERR ".*CMake Error at (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?List-No-Arguments.cmake:1 \\(list\\):.*list must be called with at least two arguments.*") - # these trigger top-level condition foreach(cmd IN ITEMS Append Find Get Insert Length Reverse Remove_At Remove_Duplicates Remove_Item Sort) set(${cmd}-No-Arguments-RESULT 1) @@ -132,53 +126,6 @@ foreach(cmd IN ITEMS Find Get Insert Length Remove_At Remove_Item) check_cmake_test_single(List "${cmd}-List-Only" "${_test_file_name}") endforeach() -set(Length-Too-Many-Arguments-RESULT 1) -set(Length-Too-Many-Arguments-STDERR ".*CMake Error at (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?List-Length-Too-Many-Arguments.cmake:1 \\(list\\):.*list sub-command LENGTH requires two arguments.*") - -set(Reverse-Too-Many-Arguments-RESULT 1) -set(Reverse-Too-Many-Arguments-STDERR ".*CMake Error at (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?List-Reverse-Too-Many-Arguments.cmake:1 \\(list\\):.*list sub-command REVERSE only takes one argument.*") - -set(Remove_Duplicates-Too-Many-Arguments-RESULT 1) -set(Remove_Duplicates-Too-Many-Arguments-STDERR ".*CMake Error at (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?List-Remove_Duplicates-Too-Many-Arguments.cmake:1 \\(list\\):.*list sub-command REMOVE_DUPLICATES only takes one argument.*") - -set(Sort-Too-Many-Arguments-RESULT 1) -set(Sort-Too-Many-Arguments-STDERR ".*CMake Error at (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?List-Sort-Too-Many-Arguments.cmake:1 \\(list\\):.*list sub-command SORT only takes one argument.*") - -set(Invalid-Subcommand-RESULT 1) -set(Invalid-Subcommand-STDERR ".*CMake Error at (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?List-Invalid-Subcommand.cmake:1 \\(list\\):.*list does not recognize sub-command NO_SUCH_SUBCOMMAND.*") - -foreach(cmd Get Insert Remove_At) - set(${cmd}-Invalid-Index-RESULT 1) - set(${cmd}-Invalid-Index-STDERR ".*CMake Error at (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?List-${cmd}-Invalid-Index.cmake:2 \\(list\\):.*list index: 3 out of range \\(-3, 2\\).*") -endforeach() - -foreach(cmd Remove_Item Reverse Remove_Duplicates Sort Remove_At) - string(TOUPPER ${cmd} Cmd) - set(${cmd}-Nonexistent-List-RESULT 1) - set(${cmd}-Nonexistent-List-STDERR ".*CMake Error at (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?List-${cmd}-Nonexistent-List.cmake:2 \\(list\\):.*sub-command ${Cmd} requires list to be present.*") -endforeach() - -set(Get-CMP0007-Warn-RESULT 0) -set(Get-CMP0007-Warn-STDERR ".*CMake Warning \\(dev\\) at (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?List-Get-CMP0007-Warn.cmake:3 \\(list\\):.*Policy CMP0007 is not set:.*") - -check_cmake_test(List - No-Arguments - Length-Too-Many-Arguments - Reverse-Too-Many-Arguments - Remove_Duplicates-Too-Many-Arguments - Sort-Too-Many-Arguments - Invalid-Subcommand - Get-Invalid-Index - Insert-Invalid-Index - Remove_Item-Nonexistent-List - Reverse-Nonexistent-List - Remove_Duplicates-Nonexistent-List - Sort-Nonexistent-List - Remove_At-Nonexistent-List - Remove_At-Invalid-Index - Get-CMP0007-Warn -) - set(thelist "" NEW OLD) foreach (_pol ${thelist}) diff --git a/Tests/CMakeTests/WhileTest.cmake.in b/Tests/CMakeTests/WhileTest.cmake.in index d4cf7d7dc..cc22978ce 100644 --- a/Tests/CMakeTests/WhileTest.cmake.in +++ b/Tests/CMakeTests/WhileTest.cmake.in @@ -1,9 +1,6 @@ set(NUMBERS "") set(COUNT 0) -include("@CMAKE_CURRENT_SOURCE_DIR@/../RegexEscapeString.cmake") -REGEX_ESCAPE_STRING(CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR "@CMAKE_CURRENT_SOURCE_DIR@") - while(COUNT LESS 200) set(NUMBERS "${NUMBERS} ${COUNT}") set(COUNT "2${COUNT}") @@ -18,40 +15,3 @@ endwhile() if(NOT NUMBERS STREQUAL " 0 3 30 20 3 30") message(SEND_ERROR "while loop nesting error, result: '${NUMBERS}'") endif() - - -set(Missing-Argument-RESULT 1) -set(Missing-Argument-STDERR ".*CMake Error at (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?While-Missing-Argument.cmake:1 \\(while\\):.*while called with incorrect number of arguments.*") - -include("@CMAKE_CURRENT_SOURCE_DIR@/CheckCMakeTest.cmake") -check_cmake_test(While - Missing-Argument -) - -set(Missing-Endwhile-RESULT 1) -set(Missing-Endwhile-STDERR ".*CMake Error in (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?While-Missing-Endwhile.cmake:.*A logical block opening on the line.*(${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?While-Missing-Endwhile.cmake:1 \\(while\\).*is not closed\\..*") - -check_cmake_test(While - Missing-Endwhile -) - -set(Endwhile-Mismatch-RESULT 0) -set(Endwhile-Mismatch-STDERR ".*CMake Warning \\(dev\\) in (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?While-Endwhile-Mismatch.cmake:.*A logical block opening on the line.*(${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?While-Endwhile-Mismatch.cmake:1 \\(while\\).*with mis-matching arguments\\..*") - -check_cmake_test(While - Endwhile-Mismatch -) - -set(Endwhile-Alone-RESULT 1) -set(Endwhile-Alone-STDERR ".*CMake Error at (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?While-Endwhile-Alone.cmake:1 \\(endwhile\\):.*An ENDWHILE command was found outside of a proper WHILE ENDWHILE.*structure\\.\n.*$") - -check_cmake_test(While - Endwhile-Alone -) - -set(Endwhile-Alone-Args-RESULT 1) -set(Endwhile-Alone-Args-STDERR ".*CMake Error at (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?While-Endwhile-Alone-Args.cmake:1 \\(endwhile\\):.*An ENDWHILE command was found outside of a proper WHILE ENDWHILE.*structure\\. Or its arguments did not.*$") - -check_cmake_test(While - Endwhile-Alone-Args -) diff --git a/Tests/RegexEscapeString.cmake b/Tests/RegexEscapeString.cmake deleted file mode 100644 index 92aed17b1..000000000 --- a/Tests/RegexEscapeString.cmake +++ /dev/null @@ -1,4 +0,0 @@ -macro(REGEX_ESCAPE_STRING _OUT _IN) - # Escape special regex metacharacters with a backslash - string(REGEX REPLACE "([$^.[|*+?()]|])" "\\\\\\1" ${_OUT} "${_IN}") -endmacro() diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index b90eff65e..3746a7c21 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -191,6 +191,7 @@ add_RunCMake_test(try_compile) add_RunCMake_test(try_run) add_RunCMake_test(set) add_RunCMake_test(variable_watch) +add_RunCMake_test(while) add_RunCMake_test(CMP0004) add_RunCMake_test(TargetPolicies) add_RunCMake_test(alias_targets) diff --git a/Tests/RunCMake/get_property/BadArgument-result.txt b/Tests/RunCMake/get_property/BadArgument-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/get_property/BadArgument-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/get_property/BadArgument-stderr.txt b/Tests/RunCMake/get_property/BadArgument-stderr.txt new file mode 100644 index 000000000..37c44775c --- /dev/null +++ b/Tests/RunCMake/get_property/BadArgument-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at BadArgument.cmake:1 \(get_property\): + get_property given invalid argument "FOO". +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/CMakeTests/GetProperty-Bad-Argument.cmake b/Tests/RunCMake/get_property/BadArgument.cmake similarity index 100% rename from Tests/CMakeTests/GetProperty-Bad-Argument.cmake rename to Tests/RunCMake/get_property/BadArgument.cmake diff --git a/Tests/RunCMake/get_property/BadDirectory-result.txt b/Tests/RunCMake/get_property/BadDirectory-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/get_property/BadDirectory-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/get_property/BadDirectory-stderr.txt b/Tests/RunCMake/get_property/BadDirectory-stderr.txt new file mode 100644 index 000000000..98464f8dc --- /dev/null +++ b/Tests/RunCMake/get_property/BadDirectory-stderr.txt @@ -0,0 +1,6 @@ +^CMake Error at BadDirectory.cmake:1 \(get_property\): + get_property DIRECTORY scope provided but requested directory was not + found. This could be because the directory argument was invalid or, it is + valid but has not been processed yet. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/CMakeTests/GetProperty-Bad-Directory.cmake b/Tests/RunCMake/get_property/BadDirectory.cmake similarity index 100% rename from Tests/CMakeTests/GetProperty-Bad-Directory.cmake rename to Tests/RunCMake/get_property/BadDirectory.cmake diff --git a/Tests/RunCMake/get_property/BadScope-result.txt b/Tests/RunCMake/get_property/BadScope-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/get_property/BadScope-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/get_property/BadScope-stderr.txt b/Tests/RunCMake/get_property/BadScope-stderr.txt new file mode 100644 index 000000000..4cc32c87b --- /dev/null +++ b/Tests/RunCMake/get_property/BadScope-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error at BadScope.cmake:1 \(get_property\): + get_property given invalid scope FOO. Valid scopes are GLOBAL, DIRECTORY, + TARGET, SOURCE, TEST, VARIABLE, CACHE, INSTALL. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/CMakeTests/GetProperty-Bad-Scope.cmake b/Tests/RunCMake/get_property/BadScope.cmake similarity index 100% rename from Tests/CMakeTests/GetProperty-Bad-Scope.cmake rename to Tests/RunCMake/get_property/BadScope.cmake diff --git a/Tests/RunCMake/get_property/BadTarget-result.txt b/Tests/RunCMake/get_property/BadTarget-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/get_property/BadTarget-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/get_property/BadTarget-stderr.txt b/Tests/RunCMake/get_property/BadTarget-stderr.txt new file mode 100644 index 000000000..45a0df6c9 --- /dev/null +++ b/Tests/RunCMake/get_property/BadTarget-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error at BadTarget.cmake:1 \(get_property\): + get_property could not find TARGET FOO. Perhaps it has not yet been + created. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/CMakeTests/GetProperty-Bad-Target.cmake b/Tests/RunCMake/get_property/BadTarget.cmake similarity index 100% rename from Tests/CMakeTests/GetProperty-Bad-Target.cmake rename to Tests/RunCMake/get_property/BadTarget.cmake diff --git a/Tests/RunCMake/get_property/BadTest-result.txt b/Tests/RunCMake/get_property/BadTest-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/get_property/BadTest-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/get_property/BadTest-stderr.txt b/Tests/RunCMake/get_property/BadTest-stderr.txt new file mode 100644 index 000000000..819c0704a --- /dev/null +++ b/Tests/RunCMake/get_property/BadTest-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at BadTest.cmake:1 \(get_property\): + get_property given TEST name that does not exist: FOO +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/CMakeTests/GetProperty-Bad-Test.cmake b/Tests/RunCMake/get_property/BadTest.cmake similarity index 100% rename from Tests/CMakeTests/GetProperty-Bad-Test.cmake rename to Tests/RunCMake/get_property/BadTest.cmake diff --git a/Tests/RunCMake/get_property/GlobalName-result.txt b/Tests/RunCMake/get_property/GlobalName-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/get_property/GlobalName-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/get_property/GlobalName-stderr.txt b/Tests/RunCMake/get_property/GlobalName-stderr.txt new file mode 100644 index 000000000..a7d4971c2 --- /dev/null +++ b/Tests/RunCMake/get_property/GlobalName-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at GlobalName.cmake:1 \(get_property\): + get_property given name for GLOBAL scope. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/CMakeTests/GetProperty-Global-Name.cmake b/Tests/RunCMake/get_property/GlobalName.cmake similarity index 100% rename from Tests/CMakeTests/GetProperty-Global-Name.cmake rename to Tests/RunCMake/get_property/GlobalName.cmake diff --git a/Tests/RunCMake/get_property/MissingArgument-result.txt b/Tests/RunCMake/get_property/MissingArgument-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/get_property/MissingArgument-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/get_property/MissingArgument-stderr.txt b/Tests/RunCMake/get_property/MissingArgument-stderr.txt new file mode 100644 index 000000000..87227127a --- /dev/null +++ b/Tests/RunCMake/get_property/MissingArgument-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at MissingArgument.cmake:1 \(get_property\): + get_property called with incorrect number of arguments +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/CMakeTests/GetProperty-Missing-Argument.cmake b/Tests/RunCMake/get_property/MissingArgument.cmake similarity index 100% rename from Tests/CMakeTests/GetProperty-Missing-Argument.cmake rename to Tests/RunCMake/get_property/MissingArgument.cmake diff --git a/Tests/RunCMake/get_property/NoCache-result.txt b/Tests/RunCMake/get_property/NoCache-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/get_property/NoCache-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/get_property/NoCache-stderr.txt b/Tests/RunCMake/get_property/NoCache-stderr.txt new file mode 100644 index 000000000..defafb62d --- /dev/null +++ b/Tests/RunCMake/get_property/NoCache-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at NoCache.cmake:1 \(get_property\): + get_property not given name for CACHE scope. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/CMakeTests/GetProperty-No-Cache.cmake b/Tests/RunCMake/get_property/NoCache.cmake similarity index 100% rename from Tests/CMakeTests/GetProperty-No-Cache.cmake rename to Tests/RunCMake/get_property/NoCache.cmake diff --git a/Tests/RunCMake/get_property/NoProperty-result.txt b/Tests/RunCMake/get_property/NoProperty-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/get_property/NoProperty-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/get_property/NoProperty-stderr.txt b/Tests/RunCMake/get_property/NoProperty-stderr.txt new file mode 100644 index 000000000..0ef147fdb --- /dev/null +++ b/Tests/RunCMake/get_property/NoProperty-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at NoProperty.cmake:1 \(get_property\): + get_property not given a PROPERTY argument. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/CMakeTests/GetProperty-No-Property.cmake b/Tests/RunCMake/get_property/NoProperty.cmake similarity index 100% rename from Tests/CMakeTests/GetProperty-No-Property.cmake rename to Tests/RunCMake/get_property/NoProperty.cmake diff --git a/Tests/RunCMake/get_property/NoSource-result.txt b/Tests/RunCMake/get_property/NoSource-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/get_property/NoSource-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/get_property/NoSource-stderr.txt b/Tests/RunCMake/get_property/NoSource-stderr.txt new file mode 100644 index 000000000..59fd0add7 --- /dev/null +++ b/Tests/RunCMake/get_property/NoSource-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at NoSource.cmake:1 \(get_property\): + get_property not given name for SOURCE scope. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/CMakeTests/GetProperty-No-Source.cmake b/Tests/RunCMake/get_property/NoSource.cmake similarity index 100% rename from Tests/CMakeTests/GetProperty-No-Source.cmake rename to Tests/RunCMake/get_property/NoSource.cmake diff --git a/Tests/RunCMake/get_property/NoTarget-result.txt b/Tests/RunCMake/get_property/NoTarget-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/get_property/NoTarget-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/get_property/NoTarget-stderr.txt b/Tests/RunCMake/get_property/NoTarget-stderr.txt new file mode 100644 index 000000000..a0e1a9440 --- /dev/null +++ b/Tests/RunCMake/get_property/NoTarget-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at NoTarget.cmake:1 \(get_property\): + get_property not given name for TARGET scope. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/CMakeTests/GetProperty-No-Target.cmake b/Tests/RunCMake/get_property/NoTarget.cmake similarity index 100% rename from Tests/CMakeTests/GetProperty-No-Target.cmake rename to Tests/RunCMake/get_property/NoTarget.cmake diff --git a/Tests/RunCMake/get_property/NoTest-result.txt b/Tests/RunCMake/get_property/NoTest-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/get_property/NoTest-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/get_property/NoTest-stderr.txt b/Tests/RunCMake/get_property/NoTest-stderr.txt new file mode 100644 index 000000000..c90a0ffc2 --- /dev/null +++ b/Tests/RunCMake/get_property/NoTest-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at NoTest.cmake:1 \(get_property\): + get_property not given name for TEST scope. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/CMakeTests/GetProperty-No-Test.cmake b/Tests/RunCMake/get_property/NoTest.cmake similarity index 100% rename from Tests/CMakeTests/GetProperty-No-Test.cmake rename to Tests/RunCMake/get_property/NoTest.cmake diff --git a/Tests/RunCMake/get_property/RunCMakeTest.cmake b/Tests/RunCMake/get_property/RunCMakeTest.cmake index e420b5b13..00eef34c0 100644 --- a/Tests/RunCMake/get_property/RunCMakeTest.cmake +++ b/Tests/RunCMake/get_property/RunCMakeTest.cmake @@ -8,3 +8,17 @@ run_cmake(source_properties) run_cmake(target_properties) run_cmake(test_properties) run_cmake(DebugConfigurations) + +run_cmake(MissingArgument) +run_cmake(GlobalName) +run_cmake(BadTest) +run_cmake(BadTarget) +run_cmake(BadScope) +run_cmake(BadDirectory) +run_cmake(BadArgument) +run_cmake(VariableName) +run_cmake(NoTest) +run_cmake(NoTarget) +run_cmake(NoSource) +run_cmake(NoProperty) +run_cmake(NoCache) diff --git a/Tests/RunCMake/get_property/VariableName-result.txt b/Tests/RunCMake/get_property/VariableName-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/get_property/VariableName-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/get_property/VariableName-stderr.txt b/Tests/RunCMake/get_property/VariableName-stderr.txt new file mode 100644 index 000000000..e9f382759 --- /dev/null +++ b/Tests/RunCMake/get_property/VariableName-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at VariableName.cmake:1 \(get_property\): + get_property given name for VARIABLE scope. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/CMakeTests/GetProperty-Variable-Name.cmake b/Tests/RunCMake/get_property/VariableName.cmake similarity index 100% rename from Tests/CMakeTests/GetProperty-Variable-Name.cmake rename to Tests/RunCMake/get_property/VariableName.cmake diff --git a/Tests/RunCMake/if/InvalidArgument1-result.txt b/Tests/RunCMake/if/InvalidArgument1-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/if/InvalidArgument1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/if/InvalidArgument1-stderr.txt b/Tests/RunCMake/if/InvalidArgument1-stderr.txt new file mode 100644 index 000000000..bf2a994e1 --- /dev/null +++ b/Tests/RunCMake/if/InvalidArgument1-stderr.txt @@ -0,0 +1,8 @@ +^CMake Error at InvalidArgument1.cmake:1 \(if\): + if given arguments: + + "NOT" "foo" "bar" "STREQUAL" "foo bar" + + Unknown arguments specified +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/CMakeTests/If-Invalid-Argument.cmake b/Tests/RunCMake/if/InvalidArgument1.cmake similarity index 100% rename from Tests/CMakeTests/If-Invalid-Argument.cmake rename to Tests/RunCMake/if/InvalidArgument1.cmake diff --git a/Tests/RunCMake/if/RunCMakeTest.cmake b/Tests/RunCMake/if/RunCMakeTest.cmake index b5546a7ee..2c0c4d7fc 100644 --- a/Tests/RunCMake/if/RunCMakeTest.cmake +++ b/Tests/RunCMake/if/RunCMakeTest.cmake @@ -1,5 +1,6 @@ include(RunCMake) +run_cmake(InvalidArgument1) run_cmake(IsDirectory) run_cmake(IsDirectoryLong) run_cmake(elseif-message) diff --git a/Tests/RunCMake/list/GET-CMP0007-WARN-stderr.txt b/Tests/RunCMake/list/GET-CMP0007-WARN-stderr.txt new file mode 100644 index 000000000..a0f883780 --- /dev/null +++ b/Tests/RunCMake/list/GET-CMP0007-WARN-stderr.txt @@ -0,0 +1,8 @@ +^CMake Warning \(dev\) at GET-CMP0007-WARN.cmake:4 \(list\): + Policy CMP0007 is not set: list command no longer ignores empty elements. + Run "cmake --help-policy CMP0007" for policy details. Use the cmake_policy + command to set the policy and suppress this warning. List has value = + \[;NEW;OLD\]. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it.$ diff --git a/Tests/CMakeTests/List-Get-CMP0007-Warn.cmake b/Tests/RunCMake/list/GET-CMP0007-WARN.cmake similarity index 86% rename from Tests/CMakeTests/List-Get-CMP0007-Warn.cmake rename to Tests/RunCMake/list/GET-CMP0007-WARN.cmake index 0a9264fdc..833f35204 100644 --- a/Tests/CMakeTests/List-Get-CMP0007-Warn.cmake +++ b/Tests/RunCMake/list/GET-CMP0007-WARN.cmake @@ -1,3 +1,4 @@ +cmake_policy(VERSION 2.4) set(thelist "" NEW OLD) list(GET thelist 1 thevalue) diff --git a/Tests/RunCMake/list/GET-InvalidIndex-result.txt b/Tests/RunCMake/list/GET-InvalidIndex-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/list/GET-InvalidIndex-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/GET-InvalidIndex-stderr.txt b/Tests/RunCMake/list/GET-InvalidIndex-stderr.txt new file mode 100644 index 000000000..0409464be --- /dev/null +++ b/Tests/RunCMake/list/GET-InvalidIndex-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at GET-InvalidIndex.cmake:2 \(list\): + list index: 3 out of range \(-3, 2\) +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/CMakeTests/List-Get-Invalid-Index.cmake b/Tests/RunCMake/list/GET-InvalidIndex.cmake similarity index 100% rename from Tests/CMakeTests/List-Get-Invalid-Index.cmake rename to Tests/RunCMake/list/GET-InvalidIndex.cmake diff --git a/Tests/RunCMake/list/INSERT-InvalidIndex-result.txt b/Tests/RunCMake/list/INSERT-InvalidIndex-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/list/INSERT-InvalidIndex-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/INSERT-InvalidIndex-stderr.txt b/Tests/RunCMake/list/INSERT-InvalidIndex-stderr.txt new file mode 100644 index 000000000..6e15c0b43 --- /dev/null +++ b/Tests/RunCMake/list/INSERT-InvalidIndex-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at INSERT-InvalidIndex.cmake:2 \(list\): + list index: 3 out of range \(-3, 2\) +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/CMakeTests/List-Insert-Invalid-Index.cmake b/Tests/RunCMake/list/INSERT-InvalidIndex.cmake similarity index 100% rename from Tests/CMakeTests/List-Insert-Invalid-Index.cmake rename to Tests/RunCMake/list/INSERT-InvalidIndex.cmake diff --git a/Tests/RunCMake/list/InvalidSubcommand-result.txt b/Tests/RunCMake/list/InvalidSubcommand-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/list/InvalidSubcommand-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/InvalidSubcommand-stderr.txt b/Tests/RunCMake/list/InvalidSubcommand-stderr.txt new file mode 100644 index 000000000..74703d249 --- /dev/null +++ b/Tests/RunCMake/list/InvalidSubcommand-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at InvalidSubcommand.cmake:1 \(list\): + list does not recognize sub-command NO_SUCH_SUBCOMMAND +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/CMakeTests/List-Invalid-Subcommand.cmake b/Tests/RunCMake/list/InvalidSubcommand.cmake similarity index 100% rename from Tests/CMakeTests/List-Invalid-Subcommand.cmake rename to Tests/RunCMake/list/InvalidSubcommand.cmake diff --git a/Tests/RunCMake/list/LENGTH-TooManyArguments-result.txt b/Tests/RunCMake/list/LENGTH-TooManyArguments-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/list/LENGTH-TooManyArguments-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/LENGTH-TooManyArguments-stderr.txt b/Tests/RunCMake/list/LENGTH-TooManyArguments-stderr.txt new file mode 100644 index 000000000..239e70874 --- /dev/null +++ b/Tests/RunCMake/list/LENGTH-TooManyArguments-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at LENGTH-TooManyArguments.cmake:1 \(list\): + list sub-command LENGTH requires two arguments. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/CMakeTests/List-Length-Too-Many-Arguments.cmake b/Tests/RunCMake/list/LENGTH-TooManyArguments.cmake similarity index 100% rename from Tests/CMakeTests/List-Length-Too-Many-Arguments.cmake rename to Tests/RunCMake/list/LENGTH-TooManyArguments.cmake diff --git a/Tests/RunCMake/list/NoArguments-result.txt b/Tests/RunCMake/list/NoArguments-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/list/NoArguments-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/NoArguments-stderr.txt b/Tests/RunCMake/list/NoArguments-stderr.txt new file mode 100644 index 000000000..6fdf9cc0b --- /dev/null +++ b/Tests/RunCMake/list/NoArguments-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at NoArguments.cmake:1 \(list\): + list must be called with at least two arguments. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/CMakeTests/List-No-Arguments.cmake b/Tests/RunCMake/list/NoArguments.cmake similarity index 100% rename from Tests/CMakeTests/List-No-Arguments.cmake rename to Tests/RunCMake/list/NoArguments.cmake diff --git a/Tests/RunCMake/list/REMOVE_AT-InvalidIndex-result.txt b/Tests/RunCMake/list/REMOVE_AT-InvalidIndex-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/list/REMOVE_AT-InvalidIndex-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/REMOVE_AT-InvalidIndex-stderr.txt b/Tests/RunCMake/list/REMOVE_AT-InvalidIndex-stderr.txt new file mode 100644 index 000000000..6f5887538 --- /dev/null +++ b/Tests/RunCMake/list/REMOVE_AT-InvalidIndex-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at REMOVE_AT-InvalidIndex.cmake:2 \(list\): + list index: 3 out of range \(-3, 2\) +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/CMakeTests/List-Remove_At-Invalid-Index.cmake b/Tests/RunCMake/list/REMOVE_AT-InvalidIndex.cmake similarity index 100% rename from Tests/CMakeTests/List-Remove_At-Invalid-Index.cmake rename to Tests/RunCMake/list/REMOVE_AT-InvalidIndex.cmake diff --git a/Tests/RunCMake/list/REMOVE_AT-NotList-result.txt b/Tests/RunCMake/list/REMOVE_AT-NotList-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/list/REMOVE_AT-NotList-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/REMOVE_AT-NotList-stderr.txt b/Tests/RunCMake/list/REMOVE_AT-NotList-stderr.txt new file mode 100644 index 000000000..d6e8d85f5 --- /dev/null +++ b/Tests/RunCMake/list/REMOVE_AT-NotList-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at REMOVE_AT-NotList.cmake:2 \(list\): + list sub-command REMOVE_AT requires list to be present. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/CMakeTests/List-Remove_At-Nonexistent-List.cmake b/Tests/RunCMake/list/REMOVE_AT-NotList.cmake similarity index 100% rename from Tests/CMakeTests/List-Remove_At-Nonexistent-List.cmake rename to Tests/RunCMake/list/REMOVE_AT-NotList.cmake diff --git a/Tests/RunCMake/list/REMOVE_DUPLICATES-NotList-result.txt b/Tests/RunCMake/list/REMOVE_DUPLICATES-NotList-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/list/REMOVE_DUPLICATES-NotList-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/REMOVE_DUPLICATES-NotList-stderr.txt b/Tests/RunCMake/list/REMOVE_DUPLICATES-NotList-stderr.txt new file mode 100644 index 000000000..96f3446ff --- /dev/null +++ b/Tests/RunCMake/list/REMOVE_DUPLICATES-NotList-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at REMOVE_DUPLICATES-NotList.cmake:2 \(list\): + list sub-command REMOVE_DUPLICATES requires list to be present. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/CMakeTests/List-Remove_Duplicates-Nonexistent-List.cmake b/Tests/RunCMake/list/REMOVE_DUPLICATES-NotList.cmake similarity index 100% rename from Tests/CMakeTests/List-Remove_Duplicates-Nonexistent-List.cmake rename to Tests/RunCMake/list/REMOVE_DUPLICATES-NotList.cmake diff --git a/Tests/RunCMake/list/REMOVE_DUPLICATES-TooManyArguments-result.txt b/Tests/RunCMake/list/REMOVE_DUPLICATES-TooManyArguments-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/list/REMOVE_DUPLICATES-TooManyArguments-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/REMOVE_DUPLICATES-TooManyArguments-stderr.txt b/Tests/RunCMake/list/REMOVE_DUPLICATES-TooManyArguments-stderr.txt new file mode 100644 index 000000000..f5c871111 --- /dev/null +++ b/Tests/RunCMake/list/REMOVE_DUPLICATES-TooManyArguments-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at REMOVE_DUPLICATES-TooManyArguments.cmake:1 \(list\): + list sub-command REMOVE_DUPLICATES only takes one argument. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/CMakeTests/List-Remove_Duplicates-Too-Many-Arguments.cmake b/Tests/RunCMake/list/REMOVE_DUPLICATES-TooManyArguments.cmake similarity index 100% rename from Tests/CMakeTests/List-Remove_Duplicates-Too-Many-Arguments.cmake rename to Tests/RunCMake/list/REMOVE_DUPLICATES-TooManyArguments.cmake diff --git a/Tests/RunCMake/list/REMOVE_ITEM-NotList-result.txt b/Tests/RunCMake/list/REMOVE_ITEM-NotList-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/list/REMOVE_ITEM-NotList-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/REMOVE_ITEM-NotList-stderr.txt b/Tests/RunCMake/list/REMOVE_ITEM-NotList-stderr.txt new file mode 100644 index 000000000..c32a4c055 --- /dev/null +++ b/Tests/RunCMake/list/REMOVE_ITEM-NotList-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at REMOVE_ITEM-NotList.cmake:2 \(list\): + list sub-command REMOVE_ITEM requires list to be present. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/CMakeTests/List-Remove_Item-Nonexistent-List.cmake b/Tests/RunCMake/list/REMOVE_ITEM-NotList.cmake similarity index 100% rename from Tests/CMakeTests/List-Remove_Item-Nonexistent-List.cmake rename to Tests/RunCMake/list/REMOVE_ITEM-NotList.cmake diff --git a/Tests/RunCMake/list/REVERSE-NotList-result.txt b/Tests/RunCMake/list/REVERSE-NotList-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/list/REVERSE-NotList-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/REVERSE-NotList-stderr.txt b/Tests/RunCMake/list/REVERSE-NotList-stderr.txt new file mode 100644 index 000000000..e9dcc06b3 --- /dev/null +++ b/Tests/RunCMake/list/REVERSE-NotList-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at REVERSE-NotList.cmake:2 \(list\): + list sub-command REVERSE requires list to be present. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/CMakeTests/List-Reverse-Nonexistent-List.cmake b/Tests/RunCMake/list/REVERSE-NotList.cmake similarity index 100% rename from Tests/CMakeTests/List-Reverse-Nonexistent-List.cmake rename to Tests/RunCMake/list/REVERSE-NotList.cmake diff --git a/Tests/RunCMake/list/REVERSE-TooManyArguments-result.txt b/Tests/RunCMake/list/REVERSE-TooManyArguments-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/list/REVERSE-TooManyArguments-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/REVERSE-TooManyArguments-stderr.txt b/Tests/RunCMake/list/REVERSE-TooManyArguments-stderr.txt new file mode 100644 index 000000000..7dabd9d3c --- /dev/null +++ b/Tests/RunCMake/list/REVERSE-TooManyArguments-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at REVERSE-TooManyArguments.cmake:1 \(list\): + list sub-command REVERSE only takes one argument. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/CMakeTests/List-Reverse-Too-Many-Arguments.cmake b/Tests/RunCMake/list/REVERSE-TooManyArguments.cmake similarity index 100% rename from Tests/CMakeTests/List-Reverse-Too-Many-Arguments.cmake rename to Tests/RunCMake/list/REVERSE-TooManyArguments.cmake diff --git a/Tests/RunCMake/list/RunCMakeTest.cmake b/Tests/RunCMake/list/RunCMakeTest.cmake index 555051de0..25d6a0367 100644 --- a/Tests/RunCMake/list/RunCMakeTest.cmake +++ b/Tests/RunCMake/list/RunCMakeTest.cmake @@ -3,3 +3,22 @@ include(RunCMake) run_cmake(EmptyGet0) run_cmake(EmptyRemoveAt0) run_cmake(EmptyInsert-1) + +run_cmake(NoArguments) +run_cmake(InvalidSubcommand) +run_cmake(GET-CMP0007-WARN) + +run_cmake(GET-InvalidIndex) +run_cmake(INSERT-InvalidIndex) +run_cmake(REMOVE_AT-InvalidIndex) + +run_cmake(LENGTH-TooManyArguments) +run_cmake(REMOVE_DUPLICATES-TooManyArguments) +run_cmake(REVERSE-TooManyArguments) +run_cmake(SORT-TooManyArguments) + +run_cmake(REMOVE_AT-NotList) +run_cmake(REMOVE_DUPLICATES-NotList) +run_cmake(REMOVE_ITEM-NotList) +run_cmake(REVERSE-NotList) +run_cmake(SORT-NotList) diff --git a/Tests/RunCMake/list/SORT-NotList-result.txt b/Tests/RunCMake/list/SORT-NotList-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/list/SORT-NotList-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/SORT-NotList-stderr.txt b/Tests/RunCMake/list/SORT-NotList-stderr.txt new file mode 100644 index 000000000..396c5b57d --- /dev/null +++ b/Tests/RunCMake/list/SORT-NotList-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at SORT-NotList.cmake:2 \(list\): + list sub-command SORT requires list to be present. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/CMakeTests/List-Sort-Nonexistent-List.cmake b/Tests/RunCMake/list/SORT-NotList.cmake similarity index 100% rename from Tests/CMakeTests/List-Sort-Nonexistent-List.cmake rename to Tests/RunCMake/list/SORT-NotList.cmake diff --git a/Tests/RunCMake/list/SORT-TooManyArguments-result.txt b/Tests/RunCMake/list/SORT-TooManyArguments-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/list/SORT-TooManyArguments-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/SORT-TooManyArguments-stderr.txt b/Tests/RunCMake/list/SORT-TooManyArguments-stderr.txt new file mode 100644 index 000000000..d3fad6068 --- /dev/null +++ b/Tests/RunCMake/list/SORT-TooManyArguments-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at SORT-TooManyArguments.cmake:1 \(list\): + list sub-command SORT only takes one argument. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/CMakeTests/List-Sort-Too-Many-Arguments.cmake b/Tests/RunCMake/list/SORT-TooManyArguments.cmake similarity index 100% rename from Tests/CMakeTests/List-Sort-Too-Many-Arguments.cmake rename to Tests/RunCMake/list/SORT-TooManyArguments.cmake diff --git a/Tests/RunCMake/while/CMakeLists.txt b/Tests/RunCMake/while/CMakeLists.txt new file mode 100644 index 000000000..12cd3c775 --- /dev/null +++ b/Tests/RunCMake/while/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8.4) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/while/EndAlone-result.txt b/Tests/RunCMake/while/EndAlone-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/while/EndAlone-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/while/EndAlone-stderr.txt b/Tests/RunCMake/while/EndAlone-stderr.txt new file mode 100644 index 000000000..cd9868722 --- /dev/null +++ b/Tests/RunCMake/while/EndAlone-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error at EndAlone.cmake:1 \(endwhile\): + endwhile An ENDWHILE command was found outside of a proper WHILE ENDWHILE + structure. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/CMakeTests/While-Endwhile-Alone.cmake b/Tests/RunCMake/while/EndAlone.cmake similarity index 100% rename from Tests/CMakeTests/While-Endwhile-Alone.cmake rename to Tests/RunCMake/while/EndAlone.cmake diff --git a/Tests/RunCMake/while/EndAloneArgs-result.txt b/Tests/RunCMake/while/EndAloneArgs-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/while/EndAloneArgs-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/while/EndAloneArgs-stderr.txt b/Tests/RunCMake/while/EndAloneArgs-stderr.txt new file mode 100644 index 000000000..a8c043d0f --- /dev/null +++ b/Tests/RunCMake/while/EndAloneArgs-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error at EndAloneArgs.cmake:1 \(endwhile\): + endwhile An ENDWHILE command was found outside of a proper WHILE ENDWHILE + structure. Or its arguments did not match the opening WHILE command. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/CMakeTests/While-Endwhile-Alone-Args.cmake b/Tests/RunCMake/while/EndAloneArgs.cmake similarity index 100% rename from Tests/CMakeTests/While-Endwhile-Alone-Args.cmake rename to Tests/RunCMake/while/EndAloneArgs.cmake diff --git a/Tests/RunCMake/while/EndMismatch-stderr.txt b/Tests/RunCMake/while/EndMismatch-stderr.txt new file mode 100644 index 000000000..d7439e8fc --- /dev/null +++ b/Tests/RunCMake/while/EndMismatch-stderr.txt @@ -0,0 +1,13 @@ +^CMake Warning \(dev\) at EndMismatch.cmake:3 \(include\): + A logical block opening on the line + + .*/Tests/RunCMake/while/EndMismatch.cmake:1 \(while\) + + closes on the line + + .*/Tests/RunCMake/while/EndMismatch.cmake:2 \(endwhile\) + + with mis-matching arguments. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it.$ diff --git a/Tests/CMakeTests/While-Endwhile-Mismatch.cmake b/Tests/RunCMake/while/EndMismatch.cmake similarity index 100% rename from Tests/CMakeTests/While-Endwhile-Mismatch.cmake rename to Tests/RunCMake/while/EndMismatch.cmake diff --git a/Tests/RunCMake/while/EndMissing-result.txt b/Tests/RunCMake/while/EndMissing-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/while/EndMissing-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/while/EndMissing-stderr.txt b/Tests/RunCMake/while/EndMissing-stderr.txt new file mode 100644 index 000000000..099a8b273 --- /dev/null +++ b/Tests/RunCMake/while/EndMissing-stderr.txt @@ -0,0 +1,6 @@ +^CMake Error at CMakeLists.txt:3 \(include\): + A logical block opening on the line + + .*/Tests/RunCMake/while/EndMissing.cmake:1 \(while\) + + is not closed.$ diff --git a/Tests/CMakeTests/While-Missing-Endwhile.cmake b/Tests/RunCMake/while/EndMissing.cmake similarity index 100% rename from Tests/CMakeTests/While-Missing-Endwhile.cmake rename to Tests/RunCMake/while/EndMissing.cmake diff --git a/Tests/RunCMake/while/MissingArgument-result.txt b/Tests/RunCMake/while/MissingArgument-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/while/MissingArgument-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/while/MissingArgument-stderr.txt b/Tests/RunCMake/while/MissingArgument-stderr.txt new file mode 100644 index 000000000..7ff0971f4 --- /dev/null +++ b/Tests/RunCMake/while/MissingArgument-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at MissingArgument.cmake:1 \(while\): + while called with incorrect number of arguments +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/CMakeTests/While-Missing-Argument.cmake b/Tests/RunCMake/while/MissingArgument.cmake similarity index 100% rename from Tests/CMakeTests/While-Missing-Argument.cmake rename to Tests/RunCMake/while/MissingArgument.cmake diff --git a/Tests/RunCMake/while/RunCMakeTest.cmake b/Tests/RunCMake/while/RunCMakeTest.cmake new file mode 100644 index 000000000..7da80ace3 --- /dev/null +++ b/Tests/RunCMake/while/RunCMakeTest.cmake @@ -0,0 +1,7 @@ +include(RunCMake) + +run_cmake(MissingArgument) +run_cmake(EndMissing) +run_cmake(EndMismatch) +run_cmake(EndAlone) +run_cmake(EndAloneArgs) From d560b46f5232f84476d68d96d44e5e755d391090 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 14 Jul 2015 13:55:09 -0400 Subject: [PATCH 0324/1048] CMakeGenericSystem: Recognize Watcom WMake generator as Makefile generator --- Modules/CMakeGenericSystem.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/CMakeGenericSystem.cmake b/Modules/CMakeGenericSystem.cmake index 8a14aea60..730e78062 100644 --- a/Modules/CMakeGenericSystem.cmake +++ b/Modules/CMakeGenericSystem.cmake @@ -44,7 +44,7 @@ set (CMAKE_SKIP_INSTALL_RPATH "NO" CACHE BOOL set(CMAKE_VERBOSE_MAKEFILE FALSE CACHE BOOL "If this value is on, makefiles will be generated without the .SILENT directive, and all commands will be echoed to the console during the make. This is useful for debugging only. With Visual Studio IDE projects all commands are done without /nologo.") -if(CMAKE_GENERATOR MATCHES "Makefiles") +if(CMAKE_GENERATOR MATCHES "Make") set(CMAKE_COLOR_MAKEFILE ON CACHE BOOL "Enable/Disable color output during build." ) From 1d3984780df87c6963b0aae1c392a570c890161b Mon Sep 17 00:00:00 2001 From: Michael Ensslin Date: Fri, 10 Jul 2015 18:14:47 +0200 Subject: [PATCH 0325/1048] Makefile: Optionally disable target completion messages in build output Add a TARGET_MESSAGES property to control whether Makefile targets print the "Built target " completion messages. Default to ON to preserve existing behavior. --- Help/manual/cmake-properties.7.rst | 1 + Help/prop_gbl/TARGET_MESSAGES.rst | 20 +++++++++++++++++++ Help/release/dev/makefile-target-messages.rst | 6 ++++++ Modules/CMakeGenericSystem.cmake | 3 +++ Source/cmGlobalUnixMakefileGenerator3.cxx | 16 +++++++++++++-- 5 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 Help/prop_gbl/TARGET_MESSAGES.rst create mode 100644 Help/release/dev/makefile-target-messages.rst diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index b767ed624..671d8936c 100644 --- a/Help/manual/cmake-properties.7.rst +++ b/Help/manual/cmake-properties.7.rst @@ -40,6 +40,7 @@ Properties of Global Scope /prop_gbl/RULE_LAUNCH_LINK /prop_gbl/RULE_MESSAGES /prop_gbl/TARGET_ARCHIVES_MAY_BE_SHARED_LIBS + /prop_gbl/TARGET_MESSAGES /prop_gbl/TARGET_SUPPORTS_SHARED_LIBS /prop_gbl/USE_FOLDERS diff --git a/Help/prop_gbl/TARGET_MESSAGES.rst b/Help/prop_gbl/TARGET_MESSAGES.rst new file mode 100644 index 000000000..275b0741d --- /dev/null +++ b/Help/prop_gbl/TARGET_MESSAGES.rst @@ -0,0 +1,20 @@ +TARGET_MESSAGES +--------------- + +Specify whether to report the completion of each target. + +This property specifies whether :ref:`Makefile Generators` should +add a progress message describing that each target has been completed. +If the property is not set the default is ``ON``. Set the property +to ``OFF`` to disable target completion messages. + +This option is intended to reduce build output when little or no +work needs to be done to bring the build tree up to date. + +If a ``CMAKE_TARGET_MESSAGES`` cache entry exists its value +initializes the value of this property. + +Non-Makefile generators currently ignore this property. + +See the counterpart property :prop_gbl:`RULE_MESSAGES` to disable +everything except for target completion messages. diff --git a/Help/release/dev/makefile-target-messages.rst b/Help/release/dev/makefile-target-messages.rst new file mode 100644 index 000000000..3d2cd9b12 --- /dev/null +++ b/Help/release/dev/makefile-target-messages.rst @@ -0,0 +1,6 @@ +makefile-target-messages +------------------------ + +* A :prop_gbl:`TARGET_MESSAGES` global property was added to tell the + :ref:`Makefile Generators` whether to generate commands to print output + after each target is completed. diff --git a/Modules/CMakeGenericSystem.cmake b/Modules/CMakeGenericSystem.cmake index 730e78062..5ae757d69 100644 --- a/Modules/CMakeGenericSystem.cmake +++ b/Modules/CMakeGenericSystem.cmake @@ -52,6 +52,9 @@ if(CMAKE_GENERATOR MATCHES "Make") if(DEFINED CMAKE_RULE_MESSAGES) set_property(GLOBAL PROPERTY RULE_MESSAGES ${CMAKE_RULE_MESSAGES}) endif() + if(DEFINED CMAKE_TARGET_MESSAGES) + set_property(GLOBAL PROPERTY TARGET_MESSAGES ${CMAKE_TARGET_MESSAGES}) + endif() if(CMAKE_GENERATOR MATCHES "Unix Makefiles") set(CMAKE_EXPORT_COMPILE_COMMANDS OFF CACHE BOOL "Enable/Disable output of compile commands during generation." diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index c5fca9195..edf27052a 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -801,8 +801,20 @@ cmGlobalUnixMakefileGenerator3 } progress.Arg = progressArg.str(); } - lg->AppendEcho(commands, "Built target " + name, - cmLocalUnixMakefileGenerator3::EchoNormal, &progress); + + bool targetMessages = true; + if (const char* tgtMsg = this->GetCMakeInstance() + ->GetState() + ->GetGlobalProperty("TARGET_MESSAGES")) + { + targetMessages = cmSystemTools::IsOn(tgtMsg); + } + + if (targetMessages) + { + lg->AppendEcho(commands, "Built target " + name, + cmLocalUnixMakefileGenerator3::EchoNormal, &progress); + } this->AppendGlobalTargetDepends(depends, gtarget); lg->WriteMakeRule(ruleFileStream, "All Build rule for target.", From f0cad1939f10ccdcf1b5e8ad150b7e10471f92a3 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 14 Jul 2015 13:31:21 -0400 Subject: [PATCH 0326/1048] Tests: Add test for TARGET_MESSAGES global property --- Tests/RunCMake/CMakeLists.txt | 3 +++ Tests/RunCMake/Make/CMakeLists.txt | 3 +++ Tests/RunCMake/Make/RunCMakeTest.cmake | 17 +++++++++++++++++ .../Make/TargetMessages-OFF-build-stdout.txt | 5 +++++ Tests/RunCMake/Make/TargetMessages-OFF.cmake | 2 ++ .../Make/TargetMessages-ON-build-stdout.txt | 8 ++++++++ Tests/RunCMake/Make/TargetMessages-ON.cmake | 2 ++ .../TargetMessages-VAR-OFF-build-stdout.txt | 5 +++++ .../RunCMake/Make/TargetMessages-VAR-OFF.cmake | 1 + .../Make/TargetMessages-VAR-ON-build-stdout.txt | 8 ++++++++ Tests/RunCMake/Make/TargetMessages-VAR-ON.cmake | 1 + 11 files changed, 55 insertions(+) create mode 100644 Tests/RunCMake/Make/CMakeLists.txt create mode 100644 Tests/RunCMake/Make/RunCMakeTest.cmake create mode 100644 Tests/RunCMake/Make/TargetMessages-OFF-build-stdout.txt create mode 100644 Tests/RunCMake/Make/TargetMessages-OFF.cmake create mode 100644 Tests/RunCMake/Make/TargetMessages-ON-build-stdout.txt create mode 100644 Tests/RunCMake/Make/TargetMessages-ON.cmake create mode 100644 Tests/RunCMake/Make/TargetMessages-VAR-OFF-build-stdout.txt create mode 100644 Tests/RunCMake/Make/TargetMessages-VAR-OFF.cmake create mode 100644 Tests/RunCMake/Make/TargetMessages-VAR-ON-build-stdout.txt create mode 100644 Tests/RunCMake/Make/TargetMessages-VAR-ON.cmake diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index b90eff65e..4ddd30ea6 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -103,6 +103,9 @@ add_RunCMake_test(CMP0055) add_RunCMake_test(CMP0057) add_RunCMake_test(CMP0059) add_RunCMake_test(CMP0060) +if(CMAKE_GENERATOR MATCHES "Make") + add_RunCMake_test(Make) +endif() if(CMAKE_GENERATOR STREQUAL "Ninja") add_RunCMake_test(Ninja) endif() diff --git a/Tests/RunCMake/Make/CMakeLists.txt b/Tests/RunCMake/Make/CMakeLists.txt new file mode 100644 index 000000000..74b3ff8de --- /dev/null +++ b/Tests/RunCMake/Make/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.3) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/Make/RunCMakeTest.cmake b/Tests/RunCMake/Make/RunCMakeTest.cmake new file mode 100644 index 000000000..c6bbd03c0 --- /dev/null +++ b/Tests/RunCMake/Make/RunCMakeTest.cmake @@ -0,0 +1,17 @@ +include(RunCMake) + +function(run_TargetMessages case) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/TargetMessages-${case}-build) + set(RunCMake_TEST_NO_CLEAN 1) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + set(RunCMake_TEST_OPTIONS "${ARGN}") + run_cmake(TargetMessages-${case}) + run_cmake_command(TargetMessages-${case}-build ${CMAKE_COMMAND} --build .) +endfunction() + +run_TargetMessages(ON) +run_TargetMessages(OFF) + +run_TargetMessages(VAR-ON -DCMAKE_TARGET_MESSAGES=ON) +run_TargetMessages(VAR-OFF -DCMAKE_TARGET_MESSAGES=OFF) diff --git a/Tests/RunCMake/Make/TargetMessages-OFF-build-stdout.txt b/Tests/RunCMake/Make/TargetMessages-OFF-build-stdout.txt new file mode 100644 index 000000000..77a582a68 --- /dev/null +++ b/Tests/RunCMake/Make/TargetMessages-OFF-build-stdout.txt @@ -0,0 +1,5 @@ +^(([^B]|B[^u]|Bu[^i]|Bui[^l]|Buil[^t]|Built[^ ])[^ +]* +)*Scanning dependencies of target CustomTarget( +([^B]|B[^u]|Bu[^i]|Bui[^l]|Buil[^t]|Built[^ ])[^ +]*)*$ diff --git a/Tests/RunCMake/Make/TargetMessages-OFF.cmake b/Tests/RunCMake/Make/TargetMessages-OFF.cmake new file mode 100644 index 000000000..8f5d52cca --- /dev/null +++ b/Tests/RunCMake/Make/TargetMessages-OFF.cmake @@ -0,0 +1,2 @@ +set_property(GLOBAL PROPERTY TARGET_MESSAGES OFF) +add_custom_target(CustomTarget ALL) diff --git a/Tests/RunCMake/Make/TargetMessages-ON-build-stdout.txt b/Tests/RunCMake/Make/TargetMessages-ON-build-stdout.txt new file mode 100644 index 000000000..a827624bc --- /dev/null +++ b/Tests/RunCMake/Make/TargetMessages-ON-build-stdout.txt @@ -0,0 +1,8 @@ +^(([^B]|B[^u]|Bu[^i]|Bui[^l]|Buil[^t]|Built[^ ])[^ +]* +)*Scanning dependencies of target CustomTarget( +([^B]|B[^u]|Bu[^i]|Bui[^l]|Buil[^t]|Built[^ ])[^ +]*)* +Built target CustomTarget( +([^B]|B[^u]|Bu[^i]|Bui[^l]|Buil[^t]|Built[^ ])[^ +]*)*$ diff --git a/Tests/RunCMake/Make/TargetMessages-ON.cmake b/Tests/RunCMake/Make/TargetMessages-ON.cmake new file mode 100644 index 000000000..e0a5f2b3f --- /dev/null +++ b/Tests/RunCMake/Make/TargetMessages-ON.cmake @@ -0,0 +1,2 @@ +set_property(GLOBAL PROPERTY TARGET_MESSAGES ON) +add_custom_target(CustomTarget ALL) diff --git a/Tests/RunCMake/Make/TargetMessages-VAR-OFF-build-stdout.txt b/Tests/RunCMake/Make/TargetMessages-VAR-OFF-build-stdout.txt new file mode 100644 index 000000000..77a582a68 --- /dev/null +++ b/Tests/RunCMake/Make/TargetMessages-VAR-OFF-build-stdout.txt @@ -0,0 +1,5 @@ +^(([^B]|B[^u]|Bu[^i]|Bui[^l]|Buil[^t]|Built[^ ])[^ +]* +)*Scanning dependencies of target CustomTarget( +([^B]|B[^u]|Bu[^i]|Bui[^l]|Buil[^t]|Built[^ ])[^ +]*)*$ diff --git a/Tests/RunCMake/Make/TargetMessages-VAR-OFF.cmake b/Tests/RunCMake/Make/TargetMessages-VAR-OFF.cmake new file mode 100644 index 000000000..f27813230 --- /dev/null +++ b/Tests/RunCMake/Make/TargetMessages-VAR-OFF.cmake @@ -0,0 +1 @@ +add_custom_target(CustomTarget ALL) diff --git a/Tests/RunCMake/Make/TargetMessages-VAR-ON-build-stdout.txt b/Tests/RunCMake/Make/TargetMessages-VAR-ON-build-stdout.txt new file mode 100644 index 000000000..a827624bc --- /dev/null +++ b/Tests/RunCMake/Make/TargetMessages-VAR-ON-build-stdout.txt @@ -0,0 +1,8 @@ +^(([^B]|B[^u]|Bu[^i]|Bui[^l]|Buil[^t]|Built[^ ])[^ +]* +)*Scanning dependencies of target CustomTarget( +([^B]|B[^u]|Bu[^i]|Bui[^l]|Buil[^t]|Built[^ ])[^ +]*)* +Built target CustomTarget( +([^B]|B[^u]|Bu[^i]|Bui[^l]|Buil[^t]|Built[^ ])[^ +]*)*$ diff --git a/Tests/RunCMake/Make/TargetMessages-VAR-ON.cmake b/Tests/RunCMake/Make/TargetMessages-VAR-ON.cmake new file mode 100644 index 000000000..f27813230 --- /dev/null +++ b/Tests/RunCMake/Make/TargetMessages-VAR-ON.cmake @@ -0,0 +1 @@ +add_custom_target(CustomTarget ALL) From 8c0afaf45098dccaee51b50b40593ffb67c3e42a Mon Sep 17 00:00:00 2001 From: Mikhail Filimonov Date: Thu, 25 Jun 2015 20:15:06 +0300 Subject: [PATCH 0327/1048] VS: Add more Nsight Tegra generator Android property settings Extend the Nsight Tegra project generator to add bunch of properties with the backing variables to fine-tune the generated projects. Add target properties that map to all "Configuration" PropertyGroups for each configuration: * ANDROID_ARCH * ANDROID_STL_TYPE Add target properties that map to the AntBuild section of vcxproj files: * ANDROID_ANT_ADDITIONAL_OPTIONS * ANDROID_ASSETS_DIRECTORIES * ANDROID_JAR_DEPENDENCIES * ANDROID_JAR_DIRECTORIES * ANDROID_JAVA_SOURCE_DIR * ANDROID_NATIVE_LIB_DEPENDENCIES * ANDROID_NATIVE_LIB_DIRECTORIES * ANDROID_PROCESS_MAX * ANDROID_PROGUARD * ANDROID_PROGUARD_CONFIG_PATH * ANDROID_SECURE_PROPS_PATH * ANDROID_SKIP_ANT_STEP Reviewed-by: Dmitry Polyanitsa --- Help/manual/cmake-properties.7.rst | 14 ++ Help/manual/cmake-toolchains.7.rst | 22 ++- Help/manual/cmake-variables.7.rst | 14 ++ .../ANDROID_ANT_ADDITIONAL_OPTIONS.rst | 8 + Help/prop_tgt/ANDROID_ARCH.rst | 17 +++ Help/prop_tgt/ANDROID_ASSETS_DIRECTORIES.rst | 9 ++ Help/prop_tgt/ANDROID_JAR_DEPENDENCIES.rst | 7 + Help/prop_tgt/ANDROID_JAR_DIRECTORIES.rst | 14 ++ Help/prop_tgt/ANDROID_JAVA_SOURCE_DIR.rst | 8 + .../ANDROID_NATIVE_LIB_DEPENDENCIES.rst | 14 ++ .../ANDROID_NATIVE_LIB_DIRECTORIES.rst | 16 ++ Help/prop_tgt/ANDROID_PROCESS_MAX.rst | 8 + Help/prop_tgt/ANDROID_PROGUARD.rst | 9 ++ .../prop_tgt/ANDROID_PROGUARD_CONFIG_PATH.rst | 9 ++ Help/prop_tgt/ANDROID_SECURE_PROPS_PATH.rst | 8 + Help/prop_tgt/ANDROID_SKIP_ANT_STEP.rst | 6 + Help/prop_tgt/ANDROID_STL_TYPE.rst | 15 ++ .../dev/vs-nsight-tegra-attributes.rst | 21 +++ .../CMAKE_ANDROID_ANT_ADDITIONAL_OPTIONS.rst | 5 + Help/variable/CMAKE_ANDROID_ARCH.rst | 5 + .../CMAKE_ANDROID_ASSETS_DIRECTORIES.rst | 5 + .../CMAKE_ANDROID_JAR_DEPENDENCIES.rst | 5 + .../CMAKE_ANDROID_JAR_DIRECTORIES.rst | 5 + .../CMAKE_ANDROID_JAVA_SOURCE_DIR.rst | 5 + .../CMAKE_ANDROID_NATIVE_LIB_DEPENDENCIES.rst | 5 + .../CMAKE_ANDROID_NATIVE_LIB_DIRECTORIES.rst | 5 + Help/variable/CMAKE_ANDROID_PROCESS_MAX.rst | 5 + Help/variable/CMAKE_ANDROID_PROGUARD.rst | 5 + .../CMAKE_ANDROID_PROGUARD_CONFIG_PATH.rst | 5 + .../CMAKE_ANDROID_SECURE_PROPS_PATH.rst | 5 + Help/variable/CMAKE_ANDROID_SKIP_ANT_STEP.rst | 5 + Help/variable/CMAKE_ANDROID_STL_TYPE.rst | 5 + Source/cmTarget.cxx | 14 ++ Source/cmVisualStudio10TargetGenerator.cxx | 141 +++++++++++++++++- Tests/VSNsightTegra/CMakeLists.txt | 19 ++- Tests/VSNsightTegra/proguard-android.txt | 57 +++++++ 36 files changed, 510 insertions(+), 10 deletions(-) create mode 100644 Help/prop_tgt/ANDROID_ANT_ADDITIONAL_OPTIONS.rst create mode 100644 Help/prop_tgt/ANDROID_ARCH.rst create mode 100644 Help/prop_tgt/ANDROID_ASSETS_DIRECTORIES.rst create mode 100644 Help/prop_tgt/ANDROID_JAR_DEPENDENCIES.rst create mode 100644 Help/prop_tgt/ANDROID_JAR_DIRECTORIES.rst create mode 100644 Help/prop_tgt/ANDROID_JAVA_SOURCE_DIR.rst create mode 100644 Help/prop_tgt/ANDROID_NATIVE_LIB_DEPENDENCIES.rst create mode 100644 Help/prop_tgt/ANDROID_NATIVE_LIB_DIRECTORIES.rst create mode 100644 Help/prop_tgt/ANDROID_PROCESS_MAX.rst create mode 100644 Help/prop_tgt/ANDROID_PROGUARD.rst create mode 100644 Help/prop_tgt/ANDROID_PROGUARD_CONFIG_PATH.rst create mode 100644 Help/prop_tgt/ANDROID_SECURE_PROPS_PATH.rst create mode 100644 Help/prop_tgt/ANDROID_SKIP_ANT_STEP.rst create mode 100644 Help/prop_tgt/ANDROID_STL_TYPE.rst create mode 100644 Help/release/dev/vs-nsight-tegra-attributes.rst create mode 100644 Help/variable/CMAKE_ANDROID_ANT_ADDITIONAL_OPTIONS.rst create mode 100644 Help/variable/CMAKE_ANDROID_ARCH.rst create mode 100644 Help/variable/CMAKE_ANDROID_ASSETS_DIRECTORIES.rst create mode 100644 Help/variable/CMAKE_ANDROID_JAR_DEPENDENCIES.rst create mode 100644 Help/variable/CMAKE_ANDROID_JAR_DIRECTORIES.rst create mode 100644 Help/variable/CMAKE_ANDROID_JAVA_SOURCE_DIR.rst create mode 100644 Help/variable/CMAKE_ANDROID_NATIVE_LIB_DEPENDENCIES.rst create mode 100644 Help/variable/CMAKE_ANDROID_NATIVE_LIB_DIRECTORIES.rst create mode 100644 Help/variable/CMAKE_ANDROID_PROCESS_MAX.rst create mode 100644 Help/variable/CMAKE_ANDROID_PROGUARD.rst create mode 100644 Help/variable/CMAKE_ANDROID_PROGUARD_CONFIG_PATH.rst create mode 100644 Help/variable/CMAKE_ANDROID_SECURE_PROPS_PATH.rst create mode 100644 Help/variable/CMAKE_ANDROID_SKIP_ANT_STEP.rst create mode 100644 Help/variable/CMAKE_ANDROID_STL_TYPE.rst create mode 100644 Tests/VSNsightTegra/proguard-android.txt diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index b767ed624..910d8b940 100644 --- a/Help/manual/cmake-properties.7.rst +++ b/Help/manual/cmake-properties.7.rst @@ -85,9 +85,23 @@ Properties on Targets :maxdepth: 1 /prop_tgt/ALIASED_TARGET + /prop_tgt/ANDROID_ANT_ADDITIONAL_OPTIONS /prop_tgt/ANDROID_API /prop_tgt/ANDROID_API_MIN + /prop_tgt/ANDROID_ARCH + /prop_tgt/ANDROID_ASSETS_DIRECTORIES /prop_tgt/ANDROID_GUI + /prop_tgt/ANDROID_JAR_DEPENDENCIES + /prop_tgt/ANDROID_JAR_DIRECTORIES + /prop_tgt/ANDROID_JAVA_SOURCE_DIR + /prop_tgt/ANDROID_NATIVE_LIB_DEPENDENCIES + /prop_tgt/ANDROID_NATIVE_LIB_DIRECTORIES + /prop_tgt/ANDROID_PROCESS_MAX + /prop_tgt/ANDROID_PROGUARD + /prop_tgt/ANDROID_PROGUARD_CONFIG_PATH + /prop_tgt/ANDROID_SECURE_PROPS_PATH + /prop_tgt/ANDROID_SKIP_ANT_STEP + /prop_tgt/ANDROID_STL_TYPE /prop_tgt/ARCHIVE_OUTPUT_DIRECTORY_CONFIG /prop_tgt/ARCHIVE_OUTPUT_DIRECTORY /prop_tgt/ARCHIVE_OUTPUT_NAME_CONFIG diff --git a/Help/manual/cmake-toolchains.7.rst b/Help/manual/cmake-toolchains.7.rst index 054438dd6..a06dce7cd 100644 --- a/Help/manual/cmake-toolchains.7.rst +++ b/Help/manual/cmake-toolchains.7.rst @@ -256,6 +256,22 @@ like this: The :variable:`CMAKE_GENERATOR_TOOLSET` may be set to select the Nsight Tegra "Toolchain Version" value. -See the :prop_tgt:`ANDROID_API_MIN`, :prop_tgt:`ANDROID_API` -and :prop_tgt:`ANDROID_GUI` target properties to configure -targets within the project. +See also target properties: + +* :prop_tgt:`ANDROID_ANT_ADDITIONAL_OPTIONS` +* :prop_tgt:`ANDROID_API_MIN` +* :prop_tgt:`ANDROID_API` +* :prop_tgt:`ANDROID_ARCH` +* :prop_tgt:`ANDROID_ASSETS_DIRECTORIES` +* :prop_tgt:`ANDROID_GUI` +* :prop_tgt:`ANDROID_JAR_DEPENDENCIES` +* :prop_tgt:`ANDROID_JAR_DIRECTORIES` +* :prop_tgt:`ANDROID_JAVA_SOURCE_DIR` +* :prop_tgt:`ANDROID_NATIVE_LIB_DEPENDENCIES` +* :prop_tgt:`ANDROID_NATIVE_LIB_DIRECTORIES` +* :prop_tgt:`ANDROID_PROCESS_MAX` +* :prop_tgt:`ANDROID_PROGUARD_CONFIG_PATH` +* :prop_tgt:`ANDROID_PROGUARD` +* :prop_tgt:`ANDROID_SECURE_PROPS_PATH` +* :prop_tgt:`ANDROID_SKIP_ANT_STEP` +* :prop_tgt:`ANDROID_STL_TYPE` diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index f54436a43..35a67c355 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -213,9 +213,23 @@ Variables that Control the Build .. toctree:: :maxdepth: 1 + /variable/CMAKE_ANDROID_ANT_ADDITIONAL_OPTIONS /variable/CMAKE_ANDROID_API /variable/CMAKE_ANDROID_API_MIN + /variable/CMAKE_ANDROID_ARCH + /variable/CMAKE_ANDROID_ASSETS_DIRECTORIES /variable/CMAKE_ANDROID_GUI + /variable/CMAKE_ANDROID_JAR_DEPENDENCIES + /variable/CMAKE_ANDROID_JAR_DIRECTORIES + /variable/CMAKE_ANDROID_JAVA_SOURCE_DIR + /variable/CMAKE_ANDROID_NATIVE_LIB_DEPENDENCIES + /variable/CMAKE_ANDROID_NATIVE_LIB_DIRECTORIES + /variable/CMAKE_ANDROID_PROCESS_MAX + /variable/CMAKE_ANDROID_PROGUARD + /variable/CMAKE_ANDROID_PROGUARD_CONFIG_PATH + /variable/CMAKE_ANDROID_SECURE_PROPS_PATH + /variable/CMAKE_ANDROID_SKIP_ANT_STEP + /variable/CMAKE_ANDROID_STL_TYPE /variable/CMAKE_ARCHIVE_OUTPUT_DIRECTORY /variable/CMAKE_ARCHIVE_OUTPUT_DIRECTORY_CONFIG /variable/CMAKE_AUTOMOC_MOC_OPTIONS diff --git a/Help/prop_tgt/ANDROID_ANT_ADDITIONAL_OPTIONS.rst b/Help/prop_tgt/ANDROID_ANT_ADDITIONAL_OPTIONS.rst new file mode 100644 index 000000000..af6b40587 --- /dev/null +++ b/Help/prop_tgt/ANDROID_ANT_ADDITIONAL_OPTIONS.rst @@ -0,0 +1,8 @@ +ANDROID_ANT_ADDITIONAL_OPTIONS +------------------------------ + +Set the additional options for Android Ant build system. This is +a string value containing all command line options for the Ant build. +This property is initialized by the value of the +:variable:`CMAKE_ANDROID_ANT_ADDITIONAL_OPTIONS` variable if it is +set when a target is created. diff --git a/Help/prop_tgt/ANDROID_ARCH.rst b/Help/prop_tgt/ANDROID_ARCH.rst new file mode 100644 index 000000000..5477fb598 --- /dev/null +++ b/Help/prop_tgt/ANDROID_ARCH.rst @@ -0,0 +1,17 @@ +ANDROID_ARCH +------------ + +Set the Android target architecture. + +This is a string property that could be set to the one of +the following values: + +* ``armv7-a``: "ARMv7-A (armv7-a)" +* ``armv7-a-hard``: "ARMv7-A, hard-float ABI (armv7-a)" +* ``arm64-v8a``: "ARMv8-A, 64bit (arm64-v8a)" +* ``x86``: "x86 (x86)" +* ``x86_64``: "x86_64 (x86_64)" + +This property is initialized by the value of the +:variable:`CMAKE_ANDROID_ARCH` variable if it is set +when a target is created. diff --git a/Help/prop_tgt/ANDROID_ASSETS_DIRECTORIES.rst b/Help/prop_tgt/ANDROID_ASSETS_DIRECTORIES.rst new file mode 100644 index 000000000..764a58244 --- /dev/null +++ b/Help/prop_tgt/ANDROID_ASSETS_DIRECTORIES.rst @@ -0,0 +1,9 @@ +ANDROID_ASSETS_DIRECTORIES +-------------------------- + +Set the Android assets directories to copy into the main assets +folder before build. This a string property that contains the +directory paths separated by semicolon. +This property is initialized by the value of the +:variable:`CMAKE_ANDROID_ASSETS_DIRECTORIES` variable if it is set when +a target is created. diff --git a/Help/prop_tgt/ANDROID_JAR_DEPENDENCIES.rst b/Help/prop_tgt/ANDROID_JAR_DEPENDENCIES.rst new file mode 100644 index 000000000..42937c1b4 --- /dev/null +++ b/Help/prop_tgt/ANDROID_JAR_DEPENDENCIES.rst @@ -0,0 +1,7 @@ +ANDROID_JAR_DEPENDENCIES +------------------------ + +Set the Android property that specifies JAR dependencies. +This is a string value property. This property is initialized +by the value of the :variable:`CMAKE_ANDROID_JAR_DEPENDENCIES` +variable if it is set when a target is created. diff --git a/Help/prop_tgt/ANDROID_JAR_DIRECTORIES.rst b/Help/prop_tgt/ANDROID_JAR_DIRECTORIES.rst new file mode 100644 index 000000000..54f0a8ff7 --- /dev/null +++ b/Help/prop_tgt/ANDROID_JAR_DIRECTORIES.rst @@ -0,0 +1,14 @@ +ANDROID_JAR_DIRECTORIES +----------------------- + +Set the Android property that specifies directories to search for +the JAR libraries. + +This a string property that contains the directory paths separated by +semicolons. This property is initialized by the value of the +:variable:`CMAKE_ANDROID_JAR_DIRECTORIES` variable if it is set when +a target is created. + +Contents of ``ANDROID_JAR_DIRECTORIES`` may use "generator expressions" +with the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)` +manual for available expressions. diff --git a/Help/prop_tgt/ANDROID_JAVA_SOURCE_DIR.rst b/Help/prop_tgt/ANDROID_JAVA_SOURCE_DIR.rst new file mode 100644 index 000000000..90ef1ce93 --- /dev/null +++ b/Help/prop_tgt/ANDROID_JAVA_SOURCE_DIR.rst @@ -0,0 +1,8 @@ +ANDROID_JAVA_SOURCE_DIR +----------------------- + +Set the Android property that defines the Java source code root directories. +This a string property that contains the directory paths separated by semicolon. +This property is initialized by the value of the +:variable:`CMAKE_ANDROID_JAVA_SOURCE_DIR` variable if it is set +when a target is created. diff --git a/Help/prop_tgt/ANDROID_NATIVE_LIB_DEPENDENCIES.rst b/Help/prop_tgt/ANDROID_NATIVE_LIB_DEPENDENCIES.rst new file mode 100644 index 000000000..759a37b06 --- /dev/null +++ b/Help/prop_tgt/ANDROID_NATIVE_LIB_DEPENDENCIES.rst @@ -0,0 +1,14 @@ +ANDROID_NATIVE_LIB_DEPENDENCIES +------------------------------- + +Set the Android property that specifies the .so dependencies. +This is a string property. + +This property is initialized by the value of the +:variable:`CMAKE_ANDROID_NATIVE_LIB_DEPENDENCIES` variable if it is set +when a target is created. + +Contents of ``ANDROID_NATIVE_LIB_DEPENDENCIES`` may use +"generator expressions" with the syntax ``$<...>``. See the +:manual:`cmake-generator-expressions(7)` manual for +available expressions. diff --git a/Help/prop_tgt/ANDROID_NATIVE_LIB_DIRECTORIES.rst b/Help/prop_tgt/ANDROID_NATIVE_LIB_DIRECTORIES.rst new file mode 100644 index 000000000..bc673804d --- /dev/null +++ b/Help/prop_tgt/ANDROID_NATIVE_LIB_DIRECTORIES.rst @@ -0,0 +1,16 @@ +ANDROID_NATIVE_LIB_DIRECTORIES +------------------------------ + +Set the Android property that specifies directories to search for the +.so libraries. + +This a string property that contains the directory paths separated +by semicolons. + +This property is initialized by the value of the +:variable:`CMAKE_ANDROID_NATIVE_LIB_DIRECTORIES` variable if it is set when a +target is created. + +Contents of ``ANDROID_NATIVE_LIB_DIRECTORIES`` may use "generator expressions" +with the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)` +manual for available expressions. diff --git a/Help/prop_tgt/ANDROID_PROCESS_MAX.rst b/Help/prop_tgt/ANDROID_PROCESS_MAX.rst new file mode 100644 index 000000000..847acae5b --- /dev/null +++ b/Help/prop_tgt/ANDROID_PROCESS_MAX.rst @@ -0,0 +1,8 @@ +ANDROID_PROCESS_MAX +------------------- + +Set the Android property that defines the maximum number of a +parallel Android NDK compiler processes (e.g. ``4``). +This property is initialized by the value of the +:variable:`CMAKE_ANDROID_PROCESS_MAX` variable if it is set +when a target is created. diff --git a/Help/prop_tgt/ANDROID_PROGUARD.rst b/Help/prop_tgt/ANDROID_PROGUARD.rst new file mode 100644 index 000000000..dafc51ee5 --- /dev/null +++ b/Help/prop_tgt/ANDROID_PROGUARD.rst @@ -0,0 +1,9 @@ +ANDROID_PROGUARD +---------------- + +When this property is set to true that enables the ProGuard tool to shrink, +optimize, and obfuscate the code by removing unused code and renaming +classes, fields, and methods with semantically obscure names. +This property is initialized by the value of the +:variable:`CMAKE_ANDROID_PROGUARD` variable if it is set +when a target is created. diff --git a/Help/prop_tgt/ANDROID_PROGUARD_CONFIG_PATH.rst b/Help/prop_tgt/ANDROID_PROGUARD_CONFIG_PATH.rst new file mode 100644 index 000000000..0e929d16a --- /dev/null +++ b/Help/prop_tgt/ANDROID_PROGUARD_CONFIG_PATH.rst @@ -0,0 +1,9 @@ +ANDROID_PROGUARD_CONFIG_PATH +---------------------------- + +Set the Android property that specifies the location of the ProGuard +config file. Leave empty to use the default one. +This a string property that contains the path to ProGuard config file. +This property is initialized by the value of the +:variable:`CMAKE_ANDROID_PROGUARD_CONFIG_PATH` variable if it is set +when a target is created. diff --git a/Help/prop_tgt/ANDROID_SECURE_PROPS_PATH.rst b/Help/prop_tgt/ANDROID_SECURE_PROPS_PATH.rst new file mode 100644 index 000000000..9533f1a70 --- /dev/null +++ b/Help/prop_tgt/ANDROID_SECURE_PROPS_PATH.rst @@ -0,0 +1,8 @@ +ANDROID_SECURE_PROPS_PATH +------------------------- + +Set the Android property that states the location of the secure properties file. +This is a string property that contains the file path. +This property is initialized by the value of the +:variable:`CMAKE_ANDROID_SECURE_PROPS_PATH` variable +if it is set when a target is created. diff --git a/Help/prop_tgt/ANDROID_SKIP_ANT_STEP.rst b/Help/prop_tgt/ANDROID_SKIP_ANT_STEP.rst new file mode 100644 index 000000000..636189656 --- /dev/null +++ b/Help/prop_tgt/ANDROID_SKIP_ANT_STEP.rst @@ -0,0 +1,6 @@ +ANDROID_SKIP_ANT_STEP +--------------------- + +Set the Android property that defines whether or not to skip the Ant build step. +This is a boolean property initialized by the value of the +:variable:`CMAKE_ANDROID_SKIP_ANT_STEP` variable if it is set when a target is created. diff --git a/Help/prop_tgt/ANDROID_STL_TYPE.rst b/Help/prop_tgt/ANDROID_STL_TYPE.rst new file mode 100644 index 000000000..7256e266c --- /dev/null +++ b/Help/prop_tgt/ANDROID_STL_TYPE.rst @@ -0,0 +1,15 @@ +ANDROID_STL_TYPE +---------------- + +Set the Android property that defines the type of STL support for the project. +This is a string property that could set to the one of the following values: +``none`` e.g. "No C++ Support" +``system`` e.g. "Minimal C++ without STL" +``gabi++_static`` e.g. "GAbi++ Static" +``gabi++_shared`` e.g. "GAbi++ Shared" +``gnustl_static`` e.g. "GNU libstdc++ Static" +``gnustl_shared`` e.g. "GNU libstdc++ Shared" +``stlport_static`` e.g. "STLport Static" +``stlport_shared`` e.g. "STLport Shared" +This property is initialized by the value of the +variable:`CMAKE_ANDROID_STL_TYPE` variable if it is set when a target is created. diff --git a/Help/release/dev/vs-nsight-tegra-attributes.rst b/Help/release/dev/vs-nsight-tegra-attributes.rst new file mode 100644 index 000000000..7ebea33d5 --- /dev/null +++ b/Help/release/dev/vs-nsight-tegra-attributes.rst @@ -0,0 +1,21 @@ +vs-nsight-tegra-attributes +-------------------------- + +* :ref:`Visual Studio Generators` learned to support additonal + target properties to customize projects for NVIDIA Nsight + Tegra Visual Studio Edition: + + * :prop_tgt:`ANDROID_ANT_ADDITIONAL_OPTIONS` + * :prop_tgt:`ANDROID_ARCH` + * :prop_tgt:`ANDROID_ASSETS_DIRECTORIES` + * :prop_tgt:`ANDROID_JAR_DEPENDENCIES` + * :prop_tgt:`ANDROID_JAR_DIRECTORIES` + * :prop_tgt:`ANDROID_JAVA_SOURCE_DIR` + * :prop_tgt:`ANDROID_NATIVE_LIB_DEPENDENCIES` + * :prop_tgt:`ANDROID_NATIVE_LIB_DIRECTORIES` + * :prop_tgt:`ANDROID_PROCESS_MAX` + * :prop_tgt:`ANDROID_PROGUARD` + * :prop_tgt:`ANDROID_PROGUARD_CONFIG_PATH` + * :prop_tgt:`ANDROID_SECURE_PROPS_PATH` + * :prop_tgt:`ANDROID_SKIP_ANT_STEP` + * :prop_tgt:`ANDROID_STL_TYPE` diff --git a/Help/variable/CMAKE_ANDROID_ANT_ADDITIONAL_OPTIONS.rst b/Help/variable/CMAKE_ANDROID_ANT_ADDITIONAL_OPTIONS.rst new file mode 100644 index 000000000..8862ba91d --- /dev/null +++ b/Help/variable/CMAKE_ANDROID_ANT_ADDITIONAL_OPTIONS.rst @@ -0,0 +1,5 @@ +CMAKE_ANDROID_ANT_ADDITIONAL_OPTIONS +------------------------------------ + +Default value for the :prop_tgt:`ANDROID_ANT_ADDITIONAL_OPTIONS` target property. +See that target property for additional information. diff --git a/Help/variable/CMAKE_ANDROID_ARCH.rst b/Help/variable/CMAKE_ANDROID_ARCH.rst new file mode 100644 index 000000000..8fbb46d53 --- /dev/null +++ b/Help/variable/CMAKE_ANDROID_ARCH.rst @@ -0,0 +1,5 @@ +CMAKE_ANDROID_ARCH +------------------ + +Default value for the :prop_tgt:`ANDROID_ARCH` target property. +See that target property for additional information. diff --git a/Help/variable/CMAKE_ANDROID_ASSETS_DIRECTORIES.rst b/Help/variable/CMAKE_ANDROID_ASSETS_DIRECTORIES.rst new file mode 100644 index 000000000..c372fe449 --- /dev/null +++ b/Help/variable/CMAKE_ANDROID_ASSETS_DIRECTORIES.rst @@ -0,0 +1,5 @@ +CMAKE_ANDROID_ASSETS_DIRECTORIES +-------------------------------- + +Default value for the :prop_tgt:`ANDROID_ASSETS_DIRECTORIES` target property. +See that target property for additional information. diff --git a/Help/variable/CMAKE_ANDROID_JAR_DEPENDENCIES.rst b/Help/variable/CMAKE_ANDROID_JAR_DEPENDENCIES.rst new file mode 100644 index 000000000..451a92960 --- /dev/null +++ b/Help/variable/CMAKE_ANDROID_JAR_DEPENDENCIES.rst @@ -0,0 +1,5 @@ +CMAKE_ANDROID_JAR_DEPENDENCIES +------------------------------ + +Default value for the :prop_tgt:`ANDROID_JAR_DEPENDENCIES` target property. +See that target property for additional information. diff --git a/Help/variable/CMAKE_ANDROID_JAR_DIRECTORIES.rst b/Help/variable/CMAKE_ANDROID_JAR_DIRECTORIES.rst new file mode 100644 index 000000000..af83e3430 --- /dev/null +++ b/Help/variable/CMAKE_ANDROID_JAR_DIRECTORIES.rst @@ -0,0 +1,5 @@ +CMAKE_ANDROID_JAR_DIRECTORIES +----------------------------- + +Default value for the :prop_tgt:`ANDROID_JAR_DIRECTORIES` target property. +See that target property for additional information. diff --git a/Help/variable/CMAKE_ANDROID_JAVA_SOURCE_DIR.rst b/Help/variable/CMAKE_ANDROID_JAVA_SOURCE_DIR.rst new file mode 100644 index 000000000..3dc05e05e --- /dev/null +++ b/Help/variable/CMAKE_ANDROID_JAVA_SOURCE_DIR.rst @@ -0,0 +1,5 @@ +CMAKE_ANDROID_JAVA_SOURCE_DIR +----------------------------- + +Default value for the :prop_tgt:`ANDROID_JAVA_SOURCE_DIR` target property. +See that target property for additional information. diff --git a/Help/variable/CMAKE_ANDROID_NATIVE_LIB_DEPENDENCIES.rst b/Help/variable/CMAKE_ANDROID_NATIVE_LIB_DEPENDENCIES.rst new file mode 100644 index 000000000..52e60b142 --- /dev/null +++ b/Help/variable/CMAKE_ANDROID_NATIVE_LIB_DEPENDENCIES.rst @@ -0,0 +1,5 @@ +CMAKE_ANDROID_NATIVE_LIB_DEPENDENCIES +------------------------------------- + +Default value for the :prop_tgt:`ANDROID_NATIVE_LIB_DEPENDENCIES` target property. +See that target property for additional information. diff --git a/Help/variable/CMAKE_ANDROID_NATIVE_LIB_DIRECTORIES.rst b/Help/variable/CMAKE_ANDROID_NATIVE_LIB_DIRECTORIES.rst new file mode 100644 index 000000000..8480575f5 --- /dev/null +++ b/Help/variable/CMAKE_ANDROID_NATIVE_LIB_DIRECTORIES.rst @@ -0,0 +1,5 @@ +CMAKE_ANDROID_NATIVE_LIB_DIRECTORIES +------------------------------------ + +Default value for the :prop_tgt:`ANDROID_NATIVE_LIB_DIRECTORIES` target property. +See that target property for additional information. diff --git a/Help/variable/CMAKE_ANDROID_PROCESS_MAX.rst b/Help/variable/CMAKE_ANDROID_PROCESS_MAX.rst new file mode 100644 index 000000000..19fb527f7 --- /dev/null +++ b/Help/variable/CMAKE_ANDROID_PROCESS_MAX.rst @@ -0,0 +1,5 @@ +CMAKE_ANDROID_PROCESS_MAX +------------------------- + +Default value for the :prop_tgt:`ANDROID_PROCESS_MAX` target property. +See that target property for additional information. diff --git a/Help/variable/CMAKE_ANDROID_PROGUARD.rst b/Help/variable/CMAKE_ANDROID_PROGUARD.rst new file mode 100644 index 000000000..b8fdd46cc --- /dev/null +++ b/Help/variable/CMAKE_ANDROID_PROGUARD.rst @@ -0,0 +1,5 @@ +CMAKE_ANDROID_PROGUARD +---------------------- + +Default value for the :prop_tgt:`ANDROID_PROGUARD` target property. +See that target property for additional information. diff --git a/Help/variable/CMAKE_ANDROID_PROGUARD_CONFIG_PATH.rst b/Help/variable/CMAKE_ANDROID_PROGUARD_CONFIG_PATH.rst new file mode 100644 index 000000000..8dea00907 --- /dev/null +++ b/Help/variable/CMAKE_ANDROID_PROGUARD_CONFIG_PATH.rst @@ -0,0 +1,5 @@ +CMAKE_ANDROID_PROGUARD_CONFIG_PATH +---------------------------------- + +Default value for the :prop_tgt:`ANDROID_PROGUARD_CONFIG_PATH` target property. +See that target property for additional information. diff --git a/Help/variable/CMAKE_ANDROID_SECURE_PROPS_PATH.rst b/Help/variable/CMAKE_ANDROID_SECURE_PROPS_PATH.rst new file mode 100644 index 000000000..69a4d0b56 --- /dev/null +++ b/Help/variable/CMAKE_ANDROID_SECURE_PROPS_PATH.rst @@ -0,0 +1,5 @@ +CMAKE_ANDROID_SECURE_PROPS_PATH +------------------------------- + +Default value for the :prop_tgt:`ANDROID_SECURE_PROPS_PATH` target property. +See that target property for additional information. diff --git a/Help/variable/CMAKE_ANDROID_SKIP_ANT_STEP.rst b/Help/variable/CMAKE_ANDROID_SKIP_ANT_STEP.rst new file mode 100644 index 000000000..0a96df9fa --- /dev/null +++ b/Help/variable/CMAKE_ANDROID_SKIP_ANT_STEP.rst @@ -0,0 +1,5 @@ +CMAKE_ANDROID_SKIP_ANT_STEP +--------------------------- + +Default value for the :prop_tgt:`ANDROID_SKIP_ANT_STEP` target property. +See that target property for additional information. diff --git a/Help/variable/CMAKE_ANDROID_STL_TYPE.rst b/Help/variable/CMAKE_ANDROID_STL_TYPE.rst new file mode 100644 index 000000000..766b2c8fd --- /dev/null +++ b/Help/variable/CMAKE_ANDROID_STL_TYPE.rst @@ -0,0 +1,5 @@ +CMAKE_ANDROID_STL_TYPE +---------------------- + +Default value for the :prop_tgt:`ANDROID_STL_TYPE` target property. +See that target property for additional information. diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 2b73e6f09..0303f1e4b 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -297,6 +297,20 @@ void cmTarget::SetMakefile(cmMakefile* mf) { this->SetPropertyDefault("ANDROID_API", 0); this->SetPropertyDefault("ANDROID_API_MIN", 0); + this->SetPropertyDefault("ANDROID_ARCH", 0); + this->SetPropertyDefault("ANDROID_STL_TYPE", 0); + this->SetPropertyDefault("ANDROID_SKIP_ANT_STEP", 0); + this->SetPropertyDefault("ANDROID_PROCESS_MAX", 0); + this->SetPropertyDefault("ANDROID_PROGUARD", 0); + this->SetPropertyDefault("ANDROID_PROGUARD_CONFIG_PATH", 0); + this->SetPropertyDefault("ANDROID_SECURE_PROPS_PATH", 0); + this->SetPropertyDefault("ANDROID_NATIVE_LIB_DIRECTORIES", 0); + this->SetPropertyDefault("ANDROID_NATIVE_LIB_DEPENDENCIES", 0); + this->SetPropertyDefault("ANDROID_JAVA_SOURCE_DIR", 0); + this->SetPropertyDefault("ANDROID_JAR_DIRECTORIES", 0); + this->SetPropertyDefault("ANDROID_JAR_DEPENDENCIES", 0); + this->SetPropertyDefault("ANDROID_ASSETS_DIRECTORIES", 0); + this->SetPropertyDefault("ANDROID_ANT_ADDITIONAL_OPTIONS", 0); this->SetPropertyDefault("INSTALL_NAME_DIR", 0); this->SetPropertyDefault("INSTALL_RPATH", ""); this->SetPropertyDefault("INSTALL_RPATH_USE_LINK_PATH", "OFF"); diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index a2f9bcabe..67d52b8d1 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -324,12 +324,22 @@ void cmVisualStudio10TargetGenerator::Generate() if(this->NsightTegra) { this->WriteString("\n", 1); - if(this->NsightTegraVersion[0] >= 2) + const int nsightTegraMajorVersion = this->NsightTegraVersion[0]; + const int nsightTegraMinorVersion = this->NsightTegraVersion[1]; + if (nsightTegraMajorVersion >= 2) { - // Nsight Tegra 2.0 uses project revision 9. - this->WriteString("" - "9" - "\n", 2); + this->WriteString("", 2); + if (nsightTegraMajorVersion > 3 || + (nsightTegraMajorVersion == 3 && nsightTegraMinorVersion >= 1)) + { + (*this->BuildFileStream) << "11"; + } + else + { + // Nsight Tegra 2.0 uses project revision 9. + (*this->BuildFileStream) << "9"; + } + (*this->BuildFileStream) << "\n"; // Tell newer versions to upgrade silently when loading. this->WriteString("" "true" @@ -787,6 +797,20 @@ void cmVisualStudio10TargetGenerator (*this->BuildFileStream ) << "android-" << cmVS10EscapeXML(api) << "\n"; } + + if(const char* cpuArch = this->Target->GetProperty("ANDROID_ARCH")) + { + this->WriteString("", 2); + (*this->BuildFileStream) << cmVS10EscapeXML(cpuArch) << + "\n"; + } + + if(const char* stlType = this->Target->GetProperty("ANDROID_STL_TYPE")) + { + this->WriteString("", 2); + (*this->BuildFileStream) << cmVS10EscapeXML(stlType) << + "\n"; + } } void cmVisualStudio10TargetGenerator::WriteCustomCommands() @@ -1978,6 +2002,17 @@ void cmVisualStudio10TargetGenerator::WriteClOptions( clOptions.OutputPreprocessorDefinitions(*this->BuildFileStream, " ", "\n", "CXX"); + if(this->NsightTegra) + { + if(const char* processMax = + this->Target->GetProperty("ANDROID_PROCESS_MAX")) + { + this->WriteString("", 3); + *this->BuildFileStream << cmVS10EscapeXML(processMax) << + "\n"; + } + } + if(this->MSTools) { this->WriteString("$(IntDir)\n", 3); @@ -2170,7 +2205,7 @@ cmVisualStudio10TargetGenerator::WriteLibOptions(std::string const& config) //---------------------------------------------------------------------------- void cmVisualStudio10TargetGenerator::WriteAntBuildOptions( - std::string const&) + std::string const& configName) { // Look through the sources for AndroidManifest.xml and use // its location as the root source directory. @@ -2200,6 +2235,92 @@ void cmVisualStudio10TargetGenerator::WriteAntBuildOptions( cmVS10EscapeXML(antBuildPath) << "\n"; } + if (this->Target->GetPropertyAsBool("ANDROID_SKIP_ANT_STEP")) + { + this->WriteString("true\n", 3); + } + + if (this->Target->GetPropertyAsBool("ANDROID_PROGUARD")) + { + this->WriteString("true\n", 3); + } + + if (const char* proGuardConfigLocation = + this->Target->GetProperty("ANDROID_PROGUARD_CONFIG_PATH")) + { + this->WriteString("", 3); + (*this->BuildFileStream) << cmVS10EscapeXML(proGuardConfigLocation) << + "\n"; + } + + if (const char* securePropertiesLocation = + this->Target->GetProperty("ANDROID_SECURE_PROPS_PATH")) + { + this->WriteString("", 3); + (*this->BuildFileStream) << cmVS10EscapeXML(securePropertiesLocation) << + "\n"; + } + + if (const char* nativeLibDirectoriesExpression = + this->Target->GetProperty("ANDROID_NATIVE_LIB_DIRECTORIES")) + { + cmGeneratorExpression ge; + cmsys::auto_ptr cge = + ge.Parse(nativeLibDirectoriesExpression); + std::string nativeLibDirs = cge->Evaluate(this->Makefile, configName); + this->WriteString("", 3); + (*this->BuildFileStream) << cmVS10EscapeXML(nativeLibDirs) << + "\n"; + } + + if (const char* nativeLibDependenciesExpression = + this->Target->GetProperty("ANDROID_NATIVE_LIB_DEPENDENCIES")) + { + cmGeneratorExpression ge; + cmsys::auto_ptr cge = + ge.Parse(nativeLibDependenciesExpression); + std::string nativeLibDeps = cge->Evaluate(this->Makefile, configName); + this->WriteString("", 3); + (*this->BuildFileStream) << cmVS10EscapeXML(nativeLibDeps) << + "\n"; + } + + if (const char* javaSourceDir = + this->Target->GetProperty("ANDROID_JAVA_SOURCE_DIR")) + { + this->WriteString("", 3); + (*this->BuildFileStream) << cmVS10EscapeXML(javaSourceDir) << + "\n"; + } + + if (const char* jarDirectoriesExpression = + this->Target->GetProperty("ANDROID_JAR_DIRECTORIES")) + { + cmGeneratorExpression ge; + cmsys::auto_ptr cge = + ge.Parse(jarDirectoriesExpression); + std::string jarDirectories = cge->Evaluate(this->Makefile, configName); + this->WriteString("", 3); + (*this->BuildFileStream) << cmVS10EscapeXML(jarDirectories) << + "\n"; + } + + if (const char* jarDeps = + this->Target->GetProperty("ANDROID_JAR_DEPENDENCIES")) + { + this->WriteString("", 3); + (*this->BuildFileStream) << cmVS10EscapeXML(jarDeps) << + "\n"; + } + + if (const char* assetsDirectories = + this->Target->GetProperty("ANDROID_ASSETS_DIRECTORIES")) + { + this->WriteString("", 3); + (*this->BuildFileStream) << cmVS10EscapeXML(assetsDirectories) << + "\n"; + } + { std::string manifest_xml = rootDir + "/AndroidManifest.xml"; this->ConvertToWindowsSlash(manifest_xml); @@ -2208,6 +2329,14 @@ void cmVisualStudio10TargetGenerator::WriteAntBuildOptions( cmVS10EscapeXML(manifest_xml) << "\n"; } + if (const char* antAdditionalOptions = + this->Target->GetProperty("ANDROID_ANT_ADDITIONAL_OPTIONS")) + { + this->WriteString("", 3); + (*this->BuildFileStream) << cmVS10EscapeXML(antAdditionalOptions) << + " %(AdditionalOptions)\n"; + } + this->WriteString("\n", 2); } diff --git a/Tests/VSNsightTegra/CMakeLists.txt b/Tests/VSNsightTegra/CMakeLists.txt index 10f55d972..61a04fdd3 100644 --- a/Tests/VSNsightTegra/CMakeLists.txt +++ b/Tests/VSNsightTegra/CMakeLists.txt @@ -1,10 +1,16 @@ -cmake_minimum_required(VERSION 3.0) +cmake_minimum_required(VERSION 3.3) project(VSNsightTegra C CXX) +set(CMAKE_ANDROID_ARCH armv7-a-hard) +set(CMAKE_ANDROID_STL_TYPE stlport_shared) set(CMAKE_ANDROID_API_MIN 9) set(CMAKE_ANDROID_API 15) set(CMAKE_ANDROID_GUI 1) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin") +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib") +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib") + set(FIRST_C_FILES jni/first.c jni/first.h @@ -38,3 +44,14 @@ add_executable(twolib-second target_include_directories(twolib-second PUBLIC jni) target_link_libraries(twolib-second twolib-first) target_link_libraries(twolib-second m) # test linking to library by name + +set_property(TARGET twolib-second PROPERTY C_STANDARD 11) +set_target_properties(twolib-second PROPERTIES ANDROID_SKIP_ANT_STEP 1) +set_target_properties(twolib-second PROPERTIES ANDROID_PROGUARD 1) +set_target_properties(twolib-second PROPERTIES ANDROID_PROGUARD_CONFIG_PATH proguard-android.txt) +set_target_properties(twolib-second PROPERTIES ANDROID_SECURE_PROPS_PATH /definitely/insecure) + +set_property(TARGET twolib-second PROPERTY ANDROID_NATIVE_LIB_DIRECTORIES $) +set_property(TARGET twolib-second PROPERTY ANDROID_NATIVE_LIB_DEPENDENCIES $) + +set_property(TARGET twolib-second PROPERTY ANDROID_JAR_DIRECTORIES $) diff --git a/Tests/VSNsightTegra/proguard-android.txt b/Tests/VSNsightTegra/proguard-android.txt new file mode 100644 index 000000000..fe73baeb5 --- /dev/null +++ b/Tests/VSNsightTegra/proguard-android.txt @@ -0,0 +1,57 @@ +# This is a configuration file for ProGuard. +# http://proguard.sourceforge.net/index.html#manual/usage.html + +-dontusemixedcaseclassnames +-dontskipnonpubliclibraryclasses +-verbose + +# Optimization is turned off by default. Dex does not like code run +# through the ProGuard optimize and preverify steps (and performs some +# of these optimizations on its own). +-dontoptimize +-dontpreverify +# Note that if you want to enable optimization, you cannot just +# include optimization flags in your own project configuration file; +# instead you will need to point to the +# "proguard-android-optimize.txt" file instead of this one from your +# project.properties file. + +-keepattributes *Annotation* +-keep public class com.google.vending.licensing.ILicensingService +-keep public class com.android.vending.licensing.ILicensingService + +# For native methods, see http://proguard.sourceforge.net/manual/examples.html#native +-keepclasseswithmembernames class * { + native ; +} + +# keep setters in Views so that animations can still work. +# see http://proguard.sourceforge.net/manual/examples.html#beans +-keepclassmembers public class * extends android.view.View { + void set*(***); + *** get*(); +} + +# We want to keep methods in Activity that could be used in the XML attribute onClick +-keepclassmembers class * extends android.app.Activity { + public void *(android.view.View); +} + +# For enumeration classes, see http://proguard.sourceforge.net/manual/examples.html#enumerations +-keepclassmembers enum * { + public static **[] values(); + public static ** valueOf(java.lang.String); +} + +-keep class * implements android.os.Parcelable { + public static final android.os.Parcelable$Creator *; +} + +-keepclassmembers class **.R$* { + public static ; +} + +# The support library contains references to newer platform versions. +# Don't warn about those in case this app is linking against an older +# platform version. We know about them, and they are safe. +-dontwarn android.support.** From 606b29d427c362bfcb222c5063dfb629ee27c0d9 Mon Sep 17 00:00:00 2001 From: Stanimir Kabaivanov Date: Tue, 14 Jul 2015 14:31:13 -0400 Subject: [PATCH 0328/1048] Add EUROS RTOS platform description file Add a basic platform module for EUROS RTOS (euros-embedded.com). Co-Author: Gerhard Gappmeier --- Modules/Platform/Euros.cmake | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 Modules/Platform/Euros.cmake diff --git a/Modules/Platform/Euros.cmake b/Modules/Platform/Euros.cmake new file mode 100644 index 000000000..4c7b18277 --- /dev/null +++ b/Modules/Platform/Euros.cmake @@ -0,0 +1,19 @@ +# Support for EUROS RTOS (euros-embedded.com) +set(CMAKE_LINK_LIBRARY_SUFFIX "") +set(CMAKE_STATIC_LIBRARY_PREFIX "") +set(CMAKE_STATIC_LIBRARY_SUFFIX ".lib") +set(CMAKE_SHARED_LIBRARY_PREFIX "") +set(CMAKE_SHARED_LIBRARY_SUFFIX ".lib") +set(CMAKE_EXECUTABLE_SUFFIX ".elf") +set(CMAKE_DL_LIBS "") + +set(CMAKE_FIND_LIBRARY_PREFIXES "") +set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib") + +# EUROS RTOS does not support shared libs +set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE) + +set(CMAKE_CXX_LINK_SHARED_LIBRARY ) +set(CMAKE_CXX_LINK_MODULE_LIBRARY ) +set(CMAKE_C_LINK_SHARED_LIBRARY ) +set(CMAKE_C_LINK_MODULE_LIBRARY ) From fe3c6787785f624c6d74c91fa05f11c01d431585 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 14 Jul 2015 14:41:31 -0400 Subject: [PATCH 0329/1048] Help: Link to cmake-properties.7 manual from set_property docs --- Help/command/set_property.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Help/command/set_property.rst b/Help/command/set_property.rst index 62002309c..5ed788e4a 100644 --- a/Help/command/set_property.rst +++ b/Help/command/set_property.rst @@ -64,3 +64,6 @@ property value in the form of a semicolon-separated list. If the value. If the ``APPEND_STRING`` option is given the string is append to any existing property value as string, i.e. it results in a longer string and not a list of strings. + +See the :manual:`cmake-properties(7)` manual for a list of properties +in each scope. From 6b9a7938be3278fd18e73794b51e76a5e1dd6e1d Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 14 Jul 2015 14:42:37 -0400 Subject: [PATCH 0330/1048] Help: Link to cmake-properties.7 manual from set_target_properties docs Drop the partial documentation of properties from the command documentation and reference the main properties manual instead. Otherwise readers may not realize there are many more properties. --- Help/command/set_target_properties.rst | 97 +------------------------- 1 file changed, 3 insertions(+), 94 deletions(-) diff --git a/Help/command/set_target_properties.rst b/Help/command/set_target_properties.rst index 2accfb0a6..b894eace3 100644 --- a/Help/command/set_target_properties.rst +++ b/Help/command/set_target_properties.rst @@ -12,98 +12,7 @@ Targets can have properties that affect how they are built. Set properties on a target. The syntax for the command is to list all the files you want to change, and then provide the values you want to set next. You can use any prop value pair you want and extract it -later with the :command:`get_target_property` command. +later with the :command:`get_property` or :command:`get_target_property` +command. -Properties that affect the name of a target's output file are as -follows. The :prop_tgt:`PREFIX` and :prop_tgt:`SUFFIX` properties -override the default target name prefix (such as "lib") and suffix -(such as ".so"). :prop_tgt:`IMPORT_PREFIX` and -:prop_tgt:`IMPORT_SUFFIX` are the equivalent properties for the import -library corresponding to a DLL (for SHARED library targets). -:prop_tgt:`OUTPUT_NAME` sets the real name of a target when it is built -and can be used to help create two targets of the same name even though -CMake requires unique logical target names. There is also a -:prop_tgt:`_OUTPUT_NAME` that can set the output name on a -per-configuration basis. :prop_tgt:`_POSTFIX` sets a postfix for -the real name of the target when it is built under the configuration named -by ```` (in upper-case, such as "DEBUG_POSTFIX"). The value of this -property is initialized when the target is created to the value of the -variable :variable:`CMAKE__POSTFIX` -(except for executable targets because earlier CMake versions which -did not use this variable for executables). - -The :prop_tgt:`LINK_FLAGS` property can be used to add extra flags to the -link step of a target. :prop_tgt:`LINK_FLAGS_` will add to the -configuration ````, for example, ``DEBUG``, ``RELEASE``, -``MINSIZEREL``,``RELWITHDEBINFO``. :prop_tgt:`DEFINE_SYMBOL` sets the name -of the preprocessor symbol defined when compiling sources in a shared -library. If not set here then it is set to target_EXPORTS by default -(with some substitutions if the target is not a valid C identifier). This -is useful for headers to know whether they are being included from inside -their library or outside to properly setup dllexport/dllimport -decorations. The :prop_tgt:`COMPILE_FLAGS` property sets additional -compiler flags used to build sources within the target. It may also be -used to pass additional preprocessor definitions. - -The :prop_tgt:`LINKER_LANGUAGE` property is used to change the tool used -to link an executable or shared library. The default is set the language to -match the files in the library. ``CXX`` and ``C`` are common values for this -property. - -For shared libraries :prop_tgt:`VERSION` and :prop_tgt:`SOVERSION` can be -used to specify the build version and API version respectively. When -building or installing appropriate symlinks are created if the platform -supports symlinks and the linker supports so-names. If only one of both is -specified the missing is assumed to have the same version number. For -executables :prop_tgt:`VERSION` can be used to specify the build -version. When building or installing appropriate symlinks are created if -the platform supports symlinks. For shared libraries and executables on -Windows the :prop_tgt:`VERSION` attribute is parsed to extract a -"major.minor" version number. These numbers are used as the image -version of the binary. - -There are a few properties used to specify RPATH rules. -:prop_tgt:`INSTALL_RPATH` is a semicolon-separated list specifying the -rpath to use in installed targets (for platforms that support it). -:prop_tgt:`INSTALL_RPATH_USE_LINK_PATH` is a boolean that if set to true -will append directories in the linker search path and outside the project -to the :prop_tgt:`INSTALL_RPATH`. :prop_tgt:`SKIP_BUILD_RPATH` is a boolean -specifying whether to skip automatic generation of an rpath allowing the -target to run from the build tree. :prop_tgt:`BUILD_WITH_INSTALL_RPATH` is -a boolean specifying whether to link the target in the build tree with the -:prop_tgt:`INSTALL_RPATH`. This takes precedence over -:prop_tgt:`SKIP_BUILD_RPATH` and avoids the need for relinking before -installation. :prop_tgt:`INSTALL_NAME_DIR` is a string specifying the -directory portion of the "install_name" field of shared libraries on -Mac OSX to use in the installed targets. When the target is created -the values of the variables :variable:`CMAKE_INSTALL_RPATH`, -:variable:`CMAKE_INSTALL_RPATH_USE_LINK_PATH`, -:variable:`CMAKE_SKIP_BUILD_RPATH`, -:variable:`CMAKE_BUILD_WITH_INSTALL_RPATH`, and -:variable:`CMAKE_INSTALL_NAME_DIR` are used to initialize these properties. - -:prop_tgt:`PROJECT_LABEL` can be used to change the name of the target in -an IDE like visual studio. :prop_tgt:`VS_KEYWORD` can be set to change -the visual studio keyword, for example Qt integration works better if this -is set to ``Qt4VSv1.0``. - -:prop_tgt:`VS_SCC_PROJECTNAME`, :prop_tgt:`VS_SCC_LOCALPATH`, -:prop_tgt:`VS_SCC_PROVIDER` and :prop_tgt:`VS_SCC_AUXPATH` can be set to -add support for source control bindings in a Visual Studio project file. - -:prop_tgt:`VS_GLOBAL_` can be set to add a Visual Studio -project-specific global variable. Qt integration works better if -``VS_GLOBAL_QtVersion`` is set to the Qt version :module:`FindQt4` -found. For example, "4.7.3" - -The :prop_tgt:`PRE_INSTALL_SCRIPT` and :prop_tgt:`POST_INSTALL_SCRIPT` -properties are the old way to specify CMake scripts to run before and -after installing a target. They are used only when the old -:command:`install_targets` command is used to install the target. Use the -:command:`install` command instead. - -The :prop_tgt:`EXCLUDE_FROM_DEFAULT_BUILD` property is used by the visual -studio generators. If it is set to 1 the target will not be part of the -default build when you select "Build Solution". This can also be set -on a per-configuration basis using -:prop_tgt:`EXCLUDE_FROM_DEFAULT_BUILD_`. +See :ref:`Target Properties` for the list of properties known to CMake. From eb8eaaecbe4aaf950a217d53c477461794fe6db8 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 14 Jul 2015 14:57:02 -0400 Subject: [PATCH 0331/1048] Help: Document Apple Framework creation with an example (#15651) --- Help/command/add_library.rst | 2 ++ Help/manual/cmake-buildsystem.7.rst | 16 ++++++++++++++++ Help/manual/cmake-properties.7.rst | 1 + Help/prop_tgt/FRAMEWORK.rst | 4 +++- Help/prop_tgt/FRAMEWORK_VERSION.rst | 5 +++++ 5 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 Help/prop_tgt/FRAMEWORK_VERSION.rst diff --git a/Help/command/add_library.rst b/Help/command/add_library.rst index 7c0620349..fe7735c6b 100644 --- a/Help/command/add_library.rst +++ b/Help/command/add_library.rst @@ -33,6 +33,8 @@ type is ``STATIC`` or ``SHARED`` based on whether the current value of the variable :variable:`BUILD_SHARED_LIBS` is ``ON``. For ``SHARED`` and ``MODULE`` libraries the :prop_tgt:`POSITION_INDEPENDENT_CODE` target property is set to ``ON`` automatically. +A ``SHARED`` library may be marked with the :prop_tgt:`FRAMEWORK` +target property to create an OS X Framework. By default the library file will be created in the build tree directory corresponding to the source tree directory in which the command was diff --git a/Help/manual/cmake-buildsystem.7.rst b/Help/manual/cmake-buildsystem.7.rst index aefdb7144..357aae9f3 100644 --- a/Help/manual/cmake-buildsystem.7.rst +++ b/Help/manual/cmake-buildsystem.7.rst @@ -85,6 +85,22 @@ It is a type which is loaded as a plugin using runtime techniques. add_library(archive MODULE 7z.cpp) +.. _`Apple Frameworks`: + +Apple Frameworks +"""""""""""""""" + +A ``SHARED`` library may be marked with the :prop_tgt:`FRAMEWORK` +target property to create an OS X Framework: + +.. code-block:: cmake + + add_library(MyFramework SHARED MyFramework.cpp) + set_target_properties(MyFramework PROPERTIES + FRAMEWORK 1 + FRAMEWORK_VERSION A + ) + .. _`Object Libraries`: Object Libraries diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index b767ed624..9519046da 100644 --- a/Help/manual/cmake-properties.7.rst +++ b/Help/manual/cmake-properties.7.rst @@ -135,6 +135,7 @@ Properties on Targets /prop_tgt/Fortran_FORMAT /prop_tgt/Fortran_MODULE_DIRECTORY /prop_tgt/FRAMEWORK + /prop_tgt/FRAMEWORK_VERSION /prop_tgt/GENERATOR_FILE_NAME /prop_tgt/GNUtoMS /prop_tgt/HAS_CXX diff --git a/Help/prop_tgt/FRAMEWORK.rst b/Help/prop_tgt/FRAMEWORK.rst index 9f472c025..dcb6d3b97 100644 --- a/Help/prop_tgt/FRAMEWORK.rst +++ b/Help/prop_tgt/FRAMEWORK.rst @@ -6,4 +6,6 @@ This target is a framework on the Mac. If a shared library target has this property set to true it will be built as a framework when built on the mac. It will have the directory structure required for a framework and will be suitable to -be used with the -framework option +be used with the ``-framework`` option + +See also the :prop_tgt:`FRAMEWORK_VERSION` target property. diff --git a/Help/prop_tgt/FRAMEWORK_VERSION.rst b/Help/prop_tgt/FRAMEWORK_VERSION.rst new file mode 100644 index 000000000..bf650a7ff --- /dev/null +++ b/Help/prop_tgt/FRAMEWORK_VERSION.rst @@ -0,0 +1,5 @@ +FRAMEWORK_VERSION +----------------- + +Version of a framework created using the :prop_tgt:`FRAMEWORK` target +property (e.g. ``A``). From 94755bd34ddd79630f4908b8a9a2e7f002f95800 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Wed, 15 Jul 2015 00:01:07 -0400 Subject: [PATCH 0332/1048] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index e91166f10..fa4f95d5e 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 3) -set(CMake_VERSION_PATCH 20150714) +set(CMake_VERSION_PATCH 20150715) #set(CMake_VERSION_RC 1) From 47d1f1189c53f02010d16ef541835c016fd8302d Mon Sep 17 00:00:00 2001 From: Domen Vrankar Date: Mon, 13 Jul 2015 22:21:34 +0200 Subject: [PATCH 0333/1048] Tests/RunCMake/CPack: found files should be preserved Package file names that are found during validation should be preserved in FOUND_FILE_${NO} variables that can be later used in custom VerifyResult scripts. --- Tests/RunCMake/CPack/VerifyResult.cmake | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Tests/RunCMake/CPack/VerifyResult.cmake b/Tests/RunCMake/CPack/VerifyResult.cmake index 809011b5b..e059d9c8e 100644 --- a/Tests/RunCMake/CPack/VerifyResult.cmake +++ b/Tests/RunCMake/CPack/VerifyResult.cmake @@ -15,13 +15,13 @@ include("${src_dir}/${GENERATOR_TYPE}/${RunCMake_TEST}-ExpectedFiles.cmake") if(NOT EXPECTED_FILES_COUNT EQUAL 0) foreach(file_no_ RANGE 1 ${EXPECTED_FILES_COUNT}) - file(GLOB foundFile_ RELATIVE "${bin_dir}" "${EXPECTED_FILE_${file_no_}}") - set(foundFiles_ "${foundFiles_};${foundFile_}") - list(LENGTH foundFile_ foundFilesCount_) + file(GLOB FOUND_FILE_${file_no_} RELATIVE "${bin_dir}" "${EXPECTED_FILE_${file_no_}}") + set(foundFiles_ "${foundFiles_};${FOUND_FILE_${file_no_}}") + list(LENGTH FOUND_FILE_${file_no_} foundFilesCount_) if(foundFilesCount_ EQUAL 1) unset(PACKAGE_CONTENT) - getPackageContent("${bin_dir}/${foundFile_}" "PACKAGE_CONTENT") + getPackageContent("${bin_dir}/${FOUND_FILE_${file_no_}}" "PACKAGE_CONTENT") string(REGEX MATCH "${EXPECTED_FILE_CONTENT_${file_no_}}" expected_content_list "${PACKAGE_CONTENT}") @@ -36,7 +36,7 @@ if(NOT EXPECTED_FILES_COUNT EQUAL 0) message(FATAL_ERROR "Found more than one file for file No. '${file_no_}'!" " Found files count '${foundFilesCount_}'." - " Files: '${foundFile_}'" + " Files: '${FOUND_FILE_${file_no_}}'" "${output_error_message}") endif() endforeach() From 32e9276a086c8ec78d0d6ff15bf576571118c3d7 Mon Sep 17 00:00:00 2001 From: Domen Vrankar Date: Mon, 13 Jul 2015 22:23:22 +0200 Subject: [PATCH 0334/1048] Tests/RunCMake/CPack/DEB: add verifyDebControl Add verifyDebControl helper function for checking of package control files such as preinstall scripts. --- Tests/RunCMake/CPack/DEB/Helpers.cmake | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Tests/RunCMake/CPack/DEB/Helpers.cmake b/Tests/RunCMake/CPack/DEB/Helpers.cmake index 4ed3fbdae..45c85c3a0 100644 --- a/Tests/RunCMake/CPack/DEB/Helpers.cmake +++ b/Tests/RunCMake/CPack/DEB/Helpers.cmake @@ -8,3 +8,21 @@ function(getPackageContent FILE RESULT_VAR) set(${RESULT_VAR} "${package_content_}" PARENT_SCOPE) endfunction() + +function(verifyDebControl FILE PREFIX VERIFY_FILES) + execute_process(COMMAND ${DPKG_EXECUTABLE} --control ${FILE} control_${PREFIX} + ERROR_VARIABLE err_) + + if(err_) + message(FATAL_ERROR "Debian controll verification failed for file: " + "'${FILE}'; error output: '${err_}'") + endif() + + foreach(FILE_ IN LISTS VERIFY_FILES) + file(READ "${CMAKE_CURRENT_BINARY_DIR}/control_${PREFIX}/${FILE_}" content_) + if(NOT content_ MATCHES "${${PREFIX}_${FILE_}}") + message(FATAL_ERROR "Unexpected content in for '${PREFIX}_${FILE_}'!" + " Content: '${content_}'") + endif() + endforeach() +endfunction() From 506f6bc0d269653cbba27257b9fed350365037c3 Mon Sep 17 00:00:00 2001 From: Domen Vrankar Date: Mon, 13 Jul 2015 22:25:44 +0200 Subject: [PATCH 0335/1048] CPack/DEB: Remove duplicate string(TOUPPER) calls We compute _local_component_name the first time we check for CPACK_DEB_PACKAGE_COMPONENT so we can just re-use it later. --- Modules/CPackDeb.cmake | 2 -- 1 file changed, 2 deletions(-) diff --git a/Modules/CPackDeb.cmake b/Modules/CPackDeb.cmake index 09cddcd11..cbb7c3363 100644 --- a/Modules/CPackDeb.cmake +++ b/Modules/CPackDeb.cmake @@ -498,7 +498,6 @@ function(cpack_deb_prepare_package_vars) # if per-component dependency, overrides the global CPACK_DEBIAN_PACKAGE_DEPENDS # automatic dependency discovery will be performed afterwards. if(CPACK_DEB_PACKAGE_COMPONENT) - string(TOUPPER "${CPACK_DEB_PACKAGE_COMPONENT}" _local_component_name) set(_component_depends_var "CPACK_DEBIAN_${_local_component_name}_PACKAGE_DEPENDS") # if set, overrides the global dependency @@ -542,7 +541,6 @@ function(cpack_deb_prepare_package_vars) set(CPACK_DEBIAN_PACKAGE_DESCRIPTION ${CPACK_PACKAGE_DESCRIPTION_SUMMARY}) endif() else() - string(TOUPPER ${CPACK_DEB_PACKAGE_COMPONENT} _local_component_name) set(component_description_var CPACK_COMPONENT_${_local_component_name}_DESCRIPTION) # component description overrides package description From 3e6b2ab6832f77a7e073b55331352a88a5d28488 Mon Sep 17 00:00:00 2001 From: Domen Vrankar Date: Mon, 13 Jul 2015 22:25:44 +0200 Subject: [PATCH 0336/1048] CPack/DEB: component version of PACKAGE_CONTROL_EXTRA Component version of CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA variable. --- Modules/CPackDeb.cmake | 10 +++++++++- .../CPack/DEB/DEB_EXTRA-ExpectedFiles.cmake | 9 +++++++++ .../CPack/DEB/DEB_EXTRA-VerifyResult.cmake | 11 ++++++++++ Tests/RunCMake/CPack/DEB_EXTRA.cmake | 20 +++++++++++++++++++ Tests/RunCMake/CPack/RunCMakeTest.cmake | 1 + 5 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 Tests/RunCMake/CPack/DEB/DEB_EXTRA-ExpectedFiles.cmake create mode 100644 Tests/RunCMake/CPack/DEB/DEB_EXTRA-VerifyResult.cmake create mode 100644 Tests/RunCMake/CPack/DEB_EXTRA.cmake diff --git a/Modules/CPackDeb.cmake b/Modules/CPackDeb.cmake index cbb7c3363..75e996665 100644 --- a/Modules/CPackDeb.cmake +++ b/Modules/CPackDeb.cmake @@ -272,6 +272,7 @@ # # # .. variable:: CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA +# CPACK_DEBIAN__PACKAGE_CONTROL_EXTRA # # This variable allow advanced user to add custom script to the # control.tar.gz. @@ -582,13 +583,20 @@ function(cpack_deb_prepare_package_vars) # - conffiles # - postinst # - postrm - # - prerm" + # - prerm # Usage: # set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA # "${CMAKE_CURRENT_SOURCE_DIR/prerm;${CMAKE_CURRENT_SOURCE_DIR}/postrm") # Are we packaging components ? if(CPACK_DEB_PACKAGE_COMPONENT) + # override values with per component version if set + foreach(VAR_NAME_ "PACKAGE_CONTROL_EXTRA") + if(CPACK_DEBIAN_${_local_component_name}_${VAR_NAME_}) + set(CPACK_DEBIAN_${VAR_NAME_} "${CPACK_DEBIAN_${_local_component_name}_${VAR_NAME_}}") + endif() + endforeach() + set(CPACK_DEB_PACKAGE_COMPONENT_PART_NAME "-${CPACK_DEB_PACKAGE_COMPONENT}") string(TOLOWER "${CPACK_PACKAGE_NAME}${CPACK_DEB_PACKAGE_COMPONENT_PART_NAME}" CPACK_DEBIAN_PACKAGE_NAME) else() diff --git a/Tests/RunCMake/CPack/DEB/DEB_EXTRA-ExpectedFiles.cmake b/Tests/RunCMake/CPack/DEB/DEB_EXTRA-ExpectedFiles.cmake new file mode 100644 index 000000000..2ff679ae8 --- /dev/null +++ b/Tests/RunCMake/CPack/DEB/DEB_EXTRA-ExpectedFiles.cmake @@ -0,0 +1,9 @@ +set(whitespaces_ "[\t\n\r ]*") + +set(EXPECTED_FILES_COUNT "3") +set(EXPECTED_FILE_1 "deb_extra-*-foo.deb") +set(EXPECTED_FILE_CONTENT_1 "^.*/usr/${whitespaces_}.*/usr/foo/${whitespaces_}.*/usr/foo/CMakeLists.txt$") +set(EXPECTED_FILE_2 "deb_extra-*-bar.deb") +set(EXPECTED_FILE_CONTENT_2 "^.*/usr/${whitespaces_}.*/usr/bar/${whitespaces_}.*/usr/bar/CMakeLists.txt$") +set(EXPECTED_FILE_3 "deb_extra-*-bas.deb") +set(EXPECTED_FILE_CONTENT_3 "^.*/usr/${whitespaces_}.*/usr/bas/${whitespaces_}.*/usr/bas/CMakeLists.txt$") diff --git a/Tests/RunCMake/CPack/DEB/DEB_EXTRA-VerifyResult.cmake b/Tests/RunCMake/CPack/DEB/DEB_EXTRA-VerifyResult.cmake new file mode 100644 index 000000000..78b611418 --- /dev/null +++ b/Tests/RunCMake/CPack/DEB/DEB_EXTRA-VerifyResult.cmake @@ -0,0 +1,11 @@ +set(foo_preinst "^echo default_preinst$") +set(foo_prerm "^echo default_prerm$") +verifyDebControl("${FOUND_FILE_1}" "foo" "preinst;prerm") + +set(bar_preinst "^echo bar_preinst$") +set(bar_prerm "^echo bar_prerm$") +verifyDebControl("${FOUND_FILE_2}" "bar" "preinst;prerm") + +set(bas_preinst "^echo default_preinst$") +set(bas_prerm "^echo default_prerm$") +verifyDebControl("${FOUND_FILE_3}" "bas" "preinst;prerm") diff --git a/Tests/RunCMake/CPack/DEB_EXTRA.cmake b/Tests/RunCMake/CPack/DEB_EXTRA.cmake new file mode 100644 index 000000000..46d848d94 --- /dev/null +++ b/Tests/RunCMake/CPack/DEB_EXTRA.cmake @@ -0,0 +1,20 @@ +install(FILES CMakeLists.txt DESTINATION foo COMPONENT foo) +install(FILES CMakeLists.txt DESTINATION bar COMPONENT bar) +install(FILES CMakeLists.txt DESTINATION bas COMPONENT bas) + +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/preinst "echo default_preinst") +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/prerm "echo default_prerm") + +set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA + "${CMAKE_CURRENT_BINARY_DIR}/preinst;${CMAKE_CURRENT_BINARY_DIR}/prerm") + +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/bar/preinst "echo bar_preinst") +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/bar/prerm "echo bar_prerm") + +set(CPACK_DEBIAN_BAR_PACKAGE_CONTROL_EXTRA + "${CMAKE_CURRENT_BINARY_DIR}/bar/preinst;${CMAKE_CURRENT_BINARY_DIR}/bar/prerm") + +set(CPACK_PACKAGE_NAME "deb_extra") +set(CPACK_PACKAGE_CONTACT "someone") + +set(CPACK_DEB_COMPONENT_INSTALL ON) diff --git a/Tests/RunCMake/CPack/RunCMakeTest.cmake b/Tests/RunCMake/CPack/RunCMakeTest.cmake index 308b8ccb3..97ef23828 100644 --- a/Tests/RunCMake/CPack/RunCMakeTest.cmake +++ b/Tests/RunCMake/CPack/RunCMakeTest.cmake @@ -6,3 +6,4 @@ include("${RunCMake_SOURCE_DIR}/CPackTestHelpers.cmake") # args: TEST_NAME "GENERATORS" RUN_CMAKE_BUILD_STEP run_cpack_test(MINIMAL "RPM;DEB" false) run_cpack_test(PARTIALLY_RELOCATABLE_WARNING "RPM" false) +run_cpack_test(DEB_EXTRA "DEB" false) From 651acac3389360b9f03900ed22e91031e6ef9aa3 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Thu, 16 Jul 2015 00:01:05 -0400 Subject: [PATCH 0337/1048] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index fa4f95d5e..9681c6846 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 3) -set(CMake_VERSION_PATCH 20150715) +set(CMake_VERSION_PATCH 20150716) #set(CMake_VERSION_RC 1) From 386e1f796ca622e87f822b71e121c611cc184d47 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Fri, 17 Jul 2015 00:01:04 -0400 Subject: [PATCH 0338/1048] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 9681c6846..afa63577a 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 3) -set(CMake_VERSION_PATCH 20150716) +set(CMake_VERSION_PATCH 20150717) #set(CMake_VERSION_RC 1) From 601ff0ec55517bc2a80e9a8cc2340f1c18b93490 Mon Sep 17 00:00:00 2001 From: Zack Galbreath Date: Tue, 7 Jul 2015 21:50:32 -0400 Subject: [PATCH 0339/1048] CTest: Optionally add a ChangeId attribute on XML Site tags Add variable CTEST_CHANGE_ID to configure the setting. This allows CTest clients to give CDash information about what change is being tested so that CDash can take actions to report the results (e.g. to a pull request page). --- Help/manual/cmake-variables.7.rst | 1 + Help/variable/CTEST_CHANGE_ID.rst | 9 +++++++++ Source/CTest/cmCTestHandlerCommand.cxx | 6 ++++++ Source/cmCTest.cxx | 7 +++++++ Tests/RunCMake/ctest_build/BuildChangeId-check.cmake | 12 ++++++++++++ Tests/RunCMake/ctest_build/RunCMakeTest.cmake | 9 +++++++++ Tests/RunCMake/ctest_test/RunCMakeTest.cmake | 10 ++++++++++ Tests/RunCMake/ctest_test/TestChangeId-check.cmake | 12 ++++++++++++ Tests/RunCMake/ctest_test/test.cmake.in | 1 + 9 files changed, 67 insertions(+) create mode 100644 Help/variable/CTEST_CHANGE_ID.rst create mode 100644 Tests/RunCMake/ctest_build/BuildChangeId-check.cmake create mode 100644 Tests/RunCMake/ctest_test/TestChangeId-check.cmake diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index f54436a43..19d0c68e4 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -351,6 +351,7 @@ Variables for CTest /variable/CTEST_BUILD_NAME /variable/CTEST_BZR_COMMAND /variable/CTEST_BZR_UPDATE_OPTIONS + /variable/CTEST_CHANGE_ID /variable/CTEST_CHECKOUT_COMMAND /variable/CTEST_CONFIGURATION_TYPE /variable/CTEST_CONFIGURE_COMMAND diff --git a/Help/variable/CTEST_CHANGE_ID.rst b/Help/variable/CTEST_CHANGE_ID.rst new file mode 100644 index 000000000..a423f4900 --- /dev/null +++ b/Help/variable/CTEST_CHANGE_ID.rst @@ -0,0 +1,9 @@ +CTEST_CHANGE_ID +--------------- + +Specify the CTest ``ChangeId`` setting +in a :manual:`ctest(1)` dashboard client script. + +This setting allows CTest to pass arbitrary information about this +build up to CDash. One use of this feature is to allow CDash to +post comments on your pull request if anything goes wrong with your build. diff --git a/Source/CTest/cmCTestHandlerCommand.cxx b/Source/CTest/cmCTestHandlerCommand.cxx index 3003e8a1c..3579aee19 100644 --- a/Source/CTest/cmCTestHandlerCommand.cxx +++ b/Source/CTest/cmCTestHandlerCommand.cxx @@ -109,6 +109,12 @@ bool cmCTestHandlerCommand this->Quiet); } + if(const char* changeId = + this->Makefile->GetDefinition("CTEST_CHANGE_ID")) + { + this->CTest->SetCTestConfiguration("ChangeId", changeId, this->Quiet); + } + cmCTestLog(this->CTest, DEBUG, "Initialize handler" << std::endl;); cmCTestGenericHandler* handler = this->InitializeHandler(); if ( !handler ) diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 5676dda7b..f65bd297f 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -1567,6 +1567,13 @@ void cmCTest::StartXML(cmXMLWriter& xml, bool append) xml.Attribute("LogicalProcessorsPerPhysical", info.GetLogicalProcessorsPerPhysical()); xml.Attribute("ProcessorClockFrequency", info.GetProcessorClockFrequency()); + + std::string changeId = this->GetCTestConfiguration("ChangeId"); + if(!changeId.empty()) + { + xml.Attribute("ChangeId", changeId); + } + this->AddSiteProperties(xml); } diff --git a/Tests/RunCMake/ctest_build/BuildChangeId-check.cmake b/Tests/RunCMake/ctest_build/BuildChangeId-check.cmake new file mode 100644 index 000000000..074801f88 --- /dev/null +++ b/Tests/RunCMake/ctest_build/BuildChangeId-check.cmake @@ -0,0 +1,12 @@ +file(GLOB build_xml_file "${RunCMake_TEST_BINARY_DIR}/Testing/*/Build.xml") +if(build_xml_file) + file(READ "${build_xml_file}" build_xml LIMIT 4096) + if(NOT build_xml MATCHES [[ChangeId="<>1"]]) + string(REPLACE "\n" "\n " build_xml " ${build_xml}") + set(RunCMake_TEST_FAILED + "Build.xml does not have expected ChangeId:\n${build_xml}" + ) + endif() +else() + set(RunCMake_TEST_FAILED "Build.xml not found") +endif() diff --git a/Tests/RunCMake/ctest_build/RunCMakeTest.cmake b/Tests/RunCMake/ctest_build/RunCMakeTest.cmake index c6f732c8d..324f25c50 100644 --- a/Tests/RunCMake/ctest_build/RunCMakeTest.cmake +++ b/Tests/RunCMake/ctest_build/RunCMakeTest.cmake @@ -31,3 +31,12 @@ endif() endif() endfunction() run_BuildFailure() + +function(run_BuildChangeId) + set(CASE_TEST_PREFIX_CODE [[ + set(CTEST_CHANGE_ID "<>1") + ]]) + + run_ctest(BuildChangeId) +endfunction() +run_BuildChangeId() diff --git a/Tests/RunCMake/ctest_test/RunCMakeTest.cmake b/Tests/RunCMake/ctest_test/RunCMakeTest.cmake index 21d0447e5..76dc143f3 100644 --- a/Tests/RunCMake/ctest_test/RunCMakeTest.cmake +++ b/Tests/RunCMake/ctest_test/RunCMakeTest.cmake @@ -49,3 +49,13 @@ set(CASE_CTEST_TEST_LOAD "ERR3") run_ctest_test(TestLoadOrder TEST_LOAD "ERR4") unset(ENV{__CTEST_FAKE_LOAD_AVERAGE_FOR_TESTING}) +unset(CASE_CTEST_TEST_LOAD) + +function(run_TestChangeId) + set(CASE_TEST_PREFIX_CODE [[ + set(CTEST_CHANGE_ID "<>1") + ]]) + + run_ctest(TestChangeId) +endfunction() +run_TestChangeId() diff --git a/Tests/RunCMake/ctest_test/TestChangeId-check.cmake b/Tests/RunCMake/ctest_test/TestChangeId-check.cmake new file mode 100644 index 000000000..b9884f1ec --- /dev/null +++ b/Tests/RunCMake/ctest_test/TestChangeId-check.cmake @@ -0,0 +1,12 @@ +file(GLOB test_xml_file "${RunCMake_TEST_BINARY_DIR}/Testing/*/Test.xml") +if(test_xml_file) + file(READ "${test_xml_file}" test_xml LIMIT 4096) + if(NOT test_xml MATCHES [[ChangeId="<>1"]]) + string(REPLACE "\n" "\n " test_xml " ${test_xml}") + set(RunCMake_TEST_FAILED + "Test.xml does not have expected ChangeId:\n${test_xml}" + ) + endif() +else() + set(RunCMake_TEST_FAILED "Test.xml not found") +endif() diff --git a/Tests/RunCMake/ctest_test/test.cmake.in b/Tests/RunCMake/ctest_test/test.cmake.in index a8de6a361..50b936d31 100644 --- a/Tests/RunCMake/ctest_test/test.cmake.in +++ b/Tests/RunCMake/ctest_test/test.cmake.in @@ -1,4 +1,5 @@ cmake_minimum_required(VERSION 3.1) +@CASE_TEST_PREFIX_CODE@ set(CTEST_SITE "test-site") set(CTEST_BUILD_NAME "test-build-name") From 0fcbd704f8da5ef3ddbe9964c9affb14fc16d640 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 17 Jul 2015 11:10:02 -0400 Subject: [PATCH 0340/1048] CMakeExpandImportedTargets: Document as deprecated The module is not needed anymore for try_compile or try_run. It cannot be used with CMP0022 NEW behavior due to generator expressions in INTERFACE_LINK_LIBRARIES, so document it as deprecated. Whatever problems other than try_compile and try_run anyone tried to solve with this module will have to be addressed another way. --- Modules/CMakeExpandImportedTargets.cmake | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/Modules/CMakeExpandImportedTargets.cmake b/Modules/CMakeExpandImportedTargets.cmake index 8ac336465..28f2e468d 100644 --- a/Modules/CMakeExpandImportedTargets.cmake +++ b/Modules/CMakeExpandImportedTargets.cmake @@ -2,6 +2,19 @@ # CMakeExpandImportedTargets # -------------------------- # +# Deprecated. Do not use. +# +# This module was once needed to expand imported targets to the underlying +# libraries they reference on disk for use with the :command:`try_compile` +# and :command:`try_run` commands. These commands now support imported +# libraries in their ``LINK_LIBRARIES`` options (since CMake 2.8.11 +# for :command:`try_compile` and since CMake 3.2 for :command:`try_run`). +# +# This module does not support the policy :policy:`CMP0022` ``NEW`` +# behavior or use of the :prop_tgt:`INTERFACE_LINK_LIBRARIES` property +# because :manual:`generator expressions ` +# cannot be evaluated during configuration. +# # :: # # CMAKE_EXPAND_IMPORTED_TARGETS( LIBRARIES lib1 lib2...libN @@ -14,9 +27,6 @@ # respective configuration of the imported targets if it exists. If no # CONFIGURATION is given, it uses the first configuration from # ${CMAKE_CONFIGURATION_TYPES} if set, otherwise ${CMAKE_BUILD_TYPE}. -# This macro is used by all Check*.cmake files which use try_compile() -# or try_run() and support CMAKE_REQUIRED_LIBRARIES , so that these -# checks support imported targets in CMAKE_REQUIRED_LIBRARIES: # # :: # From f19653eb947c11f452be240d9a9a9daa4cbf635d Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 8 Jul 2015 23:27:04 +0200 Subject: [PATCH 0341/1048] CodeLite: Remove unused code. --- Source/cmExtraCodeLiteGenerator.cxx | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/Source/cmExtraCodeLiteGenerator.cxx b/Source/cmExtraCodeLiteGenerator.cxx index 9705d2bb4..c2cff14a1 100644 --- a/Source/cmExtraCodeLiteGenerator.cxx +++ b/Source/cmExtraCodeLiteGenerator.cxx @@ -141,24 +141,6 @@ void cmExtraCodeLiteGenerator return; } - // figure out the compiler - //std::string compiler = this->GetCBCompilerId(mf); - std::string workspaceSourcePath = mf->GetHomeDirectory(); - std::string workspaceOutputDir = mf->GetHomeOutputDirectory(); - std::vector outputFiles = mf->GetOutputFiles(); - std::string projectName = mf->GetProjectName(); - std::string incDirs; - std::vector incDirsVec = - mf->GetIncludeDirectoriesEntries(); - std::vector::const_iterator iterInc = incDirsVec.begin(); - - //std::cout << "GetIncludeDirectories:" << std::endl; - for(; iterInc != incDirsVec.end(); ++iterInc ) - { - //std::cout << (*ItStrVec) << std::endl; - incDirs += iterInc->Value + " "; - } - //////////////////////////////////// fout << "\n" "GetProjectName() From 12c82fd8c0612b1360627b6717c4d5744abd4fa0 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 8 Jul 2015 00:08:08 +0200 Subject: [PATCH 0342/1048] cmMakefile: Remove dead code. --- Source/cmMakefile.cxx | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 94c77e13e..44dfb8cec 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -4199,16 +4199,6 @@ void cmMakefile::SetProperty(const std::string& prop, const char* value) return; } - if ( prop == "ADDITIONAL_MAKE_CLEAN_FILES" ) - { - // This property is not inherrited - if ( strcmp(this->GetCurrentSourceDirectory(), - this->GetCurrentSourceDirectory()) != 0 ) - { - return; - } - } - this->Properties.SetProperty(prop, value); } From 4dc4570734e70c47c8bb6d658c1014f29068e106 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 8 Jul 2015 00:09:12 +0200 Subject: [PATCH 0343/1048] cmMakefile: Fix indentation. --- Source/cmMakefile.cxx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 44dfb8cec..07c2fd15b 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -4160,10 +4160,10 @@ void cmMakefile::SetProperty(const std::string& prop, const char* value) if (prop == "INCLUDE_DIRECTORIES") { this->IncludeDirectoriesEntries.clear(); - if (!value) - { - return; - } + if (!value) + { + return; + } cmListFileBacktrace lfbt = this->GetBacktrace(); this->IncludeDirectoriesEntries.push_back( cmValueWithOrigin(value, lfbt)); @@ -4172,10 +4172,10 @@ void cmMakefile::SetProperty(const std::string& prop, const char* value) if (prop == "COMPILE_OPTIONS") { this->CompileOptionsEntries.clear(); - if (!value) - { - return; - } + if (!value) + { + return; + } cmListFileBacktrace lfbt = this->GetBacktrace(); this->CompileOptionsEntries.push_back(cmValueWithOrigin(value, lfbt)); return; From fc1c7cf85d045323a38c1de7ada213ecfee542a9 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 8 Jul 2015 23:52:51 +0200 Subject: [PATCH 0344/1048] Genex: Store a backtrace, not a pointer to one. The storage of a pointer means that the ownership and lifetime are externally determined, which is harder to reason about. It also imposes API constraints, requiring APIs to return references to backtraces. This pointer storage was introduced in commit v3.1.0-rc1~425^2~3 (genex: remove the need for backtraces, 2014-05-23). As backtraces are now cheap to copy around, just do that instead. --- Source/cmCustomCommandGenerator.cxx | 2 +- Source/cmFileCommand.cxx | 4 +-- Source/cmGeneratorExpression.cxx | 6 ++-- Source/cmGeneratorExpression.h | 5 +-- .../cmGeneratorExpressionEvaluationFile.cxx | 2 +- Source/cmGeneratorExpressionNode.cxx | 2 +- Source/cmGeneratorTarget.cxx | 2 +- Source/cmInstalledFile.cxx | 4 +-- Source/cmTarget.cxx | 36 +++++++++---------- Source/cmTestGenerator.cxx | 2 +- 10 files changed, 32 insertions(+), 33 deletions(-) diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx index 11308c682..f654eb9e4 100644 --- a/Source/cmCustomCommandGenerator.cxx +++ b/Source/cmCustomCommandGenerator.cxx @@ -21,7 +21,7 @@ cmCustomCommandGenerator::cmCustomCommandGenerator( cmCustomCommand const& cc, const std::string& config, cmMakefile* mf): CC(cc), Config(config), Makefile(mf), OldStyle(cc.GetEscapeOldStyle()), MakeVars(cc.GetEscapeAllowMakeVars()), - GE(new cmGeneratorExpression(&cc.GetBacktrace())), DependsDone(false) + GE(new cmGeneratorExpression(cc.GetBacktrace())), DependsDone(false) { } diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index f740020b2..3d84f3827 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -3565,11 +3565,11 @@ void cmFileCommand::AddEvaluationFile(const std::string &inputName, { cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); - cmGeneratorExpression outputGe(&lfbt); + cmGeneratorExpression outputGe(lfbt); cmsys::auto_ptr outputCge = outputGe.Parse(outputExpr); - cmGeneratorExpression conditionGe(&lfbt); + cmGeneratorExpression conditionGe(lfbt); cmsys::auto_ptr conditionCge = conditionGe.Parse(condition); diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx index 3655a8782..80a4f8179 100644 --- a/Source/cmGeneratorExpression.cxx +++ b/Source/cmGeneratorExpression.cxx @@ -23,7 +23,7 @@ //---------------------------------------------------------------------------- cmGeneratorExpression::cmGeneratorExpression( - cmListFileBacktrace const* backtrace): + const cmListFileBacktrace& backtrace): Backtrace(backtrace) { } @@ -33,9 +33,7 @@ cmsys::auto_ptr cmGeneratorExpression::Parse(std::string const& input) { return cmsys::auto_ptr( - new cmCompiledGeneratorExpression( - this->Backtrace ? *this->Backtrace : cmListFileBacktrace(), - input)); + new cmCompiledGeneratorExpression(this->Backtrace, input)); } //---------------------------------------------------------------------------- diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h index 11c27fdcf..cd19bc014 100644 --- a/Source/cmGeneratorExpression.h +++ b/Source/cmGeneratorExpression.h @@ -42,7 +42,8 @@ class cmGeneratorExpression { public: /** Construct. */ - cmGeneratorExpression(cmListFileBacktrace const* backtrace = NULL); + cmGeneratorExpression( + cmListFileBacktrace const& backtrace = cmListFileBacktrace()); ~cmGeneratorExpression(); cmsys::auto_ptr Parse( @@ -71,7 +72,7 @@ private: cmGeneratorExpression(const cmGeneratorExpression &); void operator=(const cmGeneratorExpression &); - cmListFileBacktrace const* Backtrace; + cmListFileBacktrace Backtrace; }; class cmCompiledGeneratorExpression diff --git a/Source/cmGeneratorExpressionEvaluationFile.cxx b/Source/cmGeneratorExpressionEvaluationFile.cxx index c7269954b..92ff314b8 100644 --- a/Source/cmGeneratorExpressionEvaluationFile.cxx +++ b/Source/cmGeneratorExpressionEvaluationFile.cxx @@ -152,7 +152,7 @@ void cmGeneratorExpressionEvaluationFile::Generate() } cmListFileBacktrace lfbt = this->OutputFileExpr->GetBacktrace(); - cmGeneratorExpression contentGE(&lfbt); + cmGeneratorExpression contentGE(lfbt); cmsys::auto_ptr inputExpression = contentGE.Parse(inputContent); diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index 293eb415d..90c82c263 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -21,7 +21,7 @@ std::string cmGeneratorExpressionNode::EvaluateDependentExpression( cmTarget const* headTarget, cmTarget const* currentTarget, cmGeneratorExpressionDAGChecker *dagChecker) { - cmGeneratorExpression ge(&context->Backtrace); + cmGeneratorExpression ge(context->Backtrace); cmsys::auto_ptr cge = ge.Parse(prop); cge->SetEvaluateForBuildsystem(context->EvaluateForBuildsystem); std::string result = cge->Evaluate(makefile, diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 449455306..e6f7a43df 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -878,7 +878,7 @@ cmTargetTraceDependencies { // Transform command names that reference targets built in this // project to corresponding target-level dependencies. - cmGeneratorExpression ge(&cc.GetBacktrace()); + cmGeneratorExpression ge(cc.GetBacktrace()); // Add target-level dependencies referenced by generator expressions. std::set targets; diff --git a/Source/cmInstalledFile.cxx b/Source/cmInstalledFile.cxx index 8c52b488c..fa5e81528 100644 --- a/Source/cmInstalledFile.cxx +++ b/Source/cmInstalledFile.cxx @@ -44,7 +44,7 @@ cmInstalledFile::Property::~Property() void cmInstalledFile::SetName(cmMakefile* mf, const std::string& name) { cmListFileBacktrace backtrace = mf->GetBacktrace(); - cmGeneratorExpression ge(&backtrace); + cmGeneratorExpression ge(backtrace); this->Name = name; this->NameExpression = ge.Parse(name).release(); @@ -81,7 +81,7 @@ void cmInstalledFile::AppendProperty(cmMakefile const* mf, const std::string& prop, const char* value, bool /*asString*/) { cmListFileBacktrace backtrace = mf->GetBacktrace(); - cmGeneratorExpression ge(&backtrace); + cmGeneratorExpression ge(backtrace); Property& property = this->Properties[prop]; property.ValueExpressions.push_back(ge.Parse(value).release()); diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 0303f1e4b..46e9ed4a1 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -916,7 +916,7 @@ void cmTarget::AddTracedSources(std::vector const& srcs) this->Internal->SourceFilesMap.clear(); this->LinkImplementationLanguageIsContextDependent = true; cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); - cmGeneratorExpression ge(&lfbt); + cmGeneratorExpression ge(lfbt); cmsys::auto_ptr cge = ge.Parse(srcFiles); cge->SetEvaluateForBuildsystem(true); this->Internal->SourceEntries.push_back( @@ -956,7 +956,7 @@ void cmTarget::AddSources(std::vector const& srcs) this->Internal->SourceFilesMap.clear(); this->LinkImplementationLanguageIsContextDependent = true; cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); - cmGeneratorExpression ge(&lfbt); + cmGeneratorExpression ge(lfbt); cmsys::auto_ptr cge = ge.Parse(srcFiles); cge->SetEvaluateForBuildsystem(true); this->Internal->SourceEntries.push_back( @@ -1089,7 +1089,7 @@ cmSourceFile* cmTarget::AddSource(const std::string& src) this->Internal->SourceFilesMap.clear(); this->LinkImplementationLanguageIsContextDependent = true; cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); - cmGeneratorExpression ge(&lfbt); + cmGeneratorExpression ge(lfbt); cmsys::auto_ptr cge = ge.Parse(src); cge->SetEvaluateForBuildsystem(true); this->Internal->SourceEntries.push_back( @@ -1710,7 +1710,7 @@ void cmTarget::SetProperty(const std::string& prop, const char* value) else if(prop == "INCLUDE_DIRECTORIES") { cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); - cmGeneratorExpression ge(&lfbt); + cmGeneratorExpression ge(lfbt); deleteAndClear(this->Internal->IncludeDirectoriesEntries); cmsys::auto_ptr cge = ge.Parse(value); this->Internal->IncludeDirectoriesEntries.push_back( @@ -1719,7 +1719,7 @@ void cmTarget::SetProperty(const std::string& prop, const char* value) else if(prop == "COMPILE_OPTIONS") { cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); - cmGeneratorExpression ge(&lfbt); + cmGeneratorExpression ge(lfbt); deleteAndClear(this->Internal->CompileOptionsEntries); cmsys::auto_ptr cge = ge.Parse(value); this->Internal->CompileOptionsEntries.push_back( @@ -1728,7 +1728,7 @@ void cmTarget::SetProperty(const std::string& prop, const char* value) else if(prop == "COMPILE_FEATURES") { cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); - cmGeneratorExpression ge(&lfbt); + cmGeneratorExpression ge(lfbt); deleteAndClear(this->Internal->CompileFeaturesEntries); cmsys::auto_ptr cge = ge.Parse(value); this->Internal->CompileFeaturesEntries.push_back( @@ -1737,7 +1737,7 @@ void cmTarget::SetProperty(const std::string& prop, const char* value) else if(prop == "COMPILE_DEFINITIONS") { cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); - cmGeneratorExpression ge(&lfbt); + cmGeneratorExpression ge(lfbt); deleteAndClear(this->Internal->CompileDefinitionsEntries); cmsys::auto_ptr cge = ge.Parse(value); this->Internal->CompileDefinitionsEntries.push_back( @@ -1772,7 +1772,7 @@ void cmTarget::SetProperty(const std::string& prop, const char* value) } this->Internal->SourceFilesMap.clear(); cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); - cmGeneratorExpression ge(&lfbt); + cmGeneratorExpression ge(lfbt); this->Internal->SourceEntries.clear(); cmsys::auto_ptr cge = ge.Parse(value); this->Internal->SourceEntries.push_back( @@ -1808,28 +1808,28 @@ void cmTarget::AppendProperty(const std::string& prop, const char* value, else if(prop == "INCLUDE_DIRECTORIES") { cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); - cmGeneratorExpression ge(&lfbt); + cmGeneratorExpression ge(lfbt); this->Internal->IncludeDirectoriesEntries.push_back( new cmTargetInternals::TargetPropertyEntry(ge.Parse(value))); } else if(prop == "COMPILE_OPTIONS") { cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); - cmGeneratorExpression ge(&lfbt); + cmGeneratorExpression ge(lfbt); this->Internal->CompileOptionsEntries.push_back( new cmTargetInternals::TargetPropertyEntry(ge.Parse(value))); } else if(prop == "COMPILE_FEATURES") { cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); - cmGeneratorExpression ge(&lfbt); + cmGeneratorExpression ge(lfbt); this->Internal->CompileFeaturesEntries.push_back( new cmTargetInternals::TargetPropertyEntry(ge.Parse(value))); } else if(prop == "COMPILE_DEFINITIONS") { cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); - cmGeneratorExpression ge(&lfbt); + cmGeneratorExpression ge(lfbt); this->Internal->CompileDefinitionsEntries.push_back( new cmTargetInternals::TargetPropertyEntry(ge.Parse(value))); } @@ -1861,7 +1861,7 @@ void cmTarget::AppendProperty(const std::string& prop, const char* value, } this->Internal->SourceFilesMap.clear(); cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); - cmGeneratorExpression ge(&lfbt); + cmGeneratorExpression ge(lfbt); cmsys::auto_ptr cge = ge.Parse(value); this->Internal->SourceEntries.push_back( new cmTargetInternals::TargetPropertyEntry(cge)); @@ -1929,7 +1929,7 @@ void cmTarget::AppendBuildInterfaceIncludes() void cmTarget::InsertInclude(const cmValueWithOrigin &entry, bool before) { - cmGeneratorExpression ge(&entry.Backtrace); + cmGeneratorExpression ge(entry.Backtrace); std::vector::iterator position = before ? this->Internal->IncludeDirectoriesEntries.begin() @@ -1943,7 +1943,7 @@ void cmTarget::InsertInclude(const cmValueWithOrigin &entry, void cmTarget::InsertCompileOption(const cmValueWithOrigin &entry, bool before) { - cmGeneratorExpression ge(&entry.Backtrace); + cmGeneratorExpression ge(entry.Backtrace); std::vector::iterator position = before ? this->Internal->CompileOptionsEntries.begin() @@ -1956,7 +1956,7 @@ void cmTarget::InsertCompileOption(const cmValueWithOrigin &entry, //---------------------------------------------------------------------------- void cmTarget::InsertCompileDefinition(const cmValueWithOrigin &entry) { - cmGeneratorExpression ge(&entry.Backtrace); + cmGeneratorExpression ge(entry.Backtrace); this->Internal->CompileDefinitionsEntries.push_back( new cmTargetInternals::TargetPropertyEntry(ge.Parse(entry.Value))); @@ -6162,7 +6162,7 @@ void cmTargetInternals::AddInterfaceEntries( { std::string genex = "$"; - cmGeneratorExpression ge(&it->Backtrace); + cmGeneratorExpression ge(it->Backtrace); cmsys::auto_ptr cge = ge.Parse(genex); cge->SetEvaluateForBuildsystem(true); entries.push_back( @@ -6258,7 +6258,7 @@ cmTargetInternals::ComputeLinkImplementationLibraries( cmGeneratorExpressionDAGChecker dagChecker( thisTarget->GetName(), "LINK_LIBRARIES", 0, 0); - cmGeneratorExpression ge(&le->Backtrace); + cmGeneratorExpression ge(le->Backtrace); cmsys::auto_ptr const cge = ge.Parse(le->Value); std::string const evaluated = diff --git a/Source/cmTestGenerator.cxx b/Source/cmTestGenerator.cxx index 546ad71b8..65d3b6ac2 100644 --- a/Source/cmTestGenerator.cxx +++ b/Source/cmTestGenerator.cxx @@ -70,7 +70,7 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os, this->TestGenerated = true; // Set up generator expression evaluation context. - cmGeneratorExpression ge(&this->Test->GetBacktrace()); + cmGeneratorExpression ge(this->Test->GetBacktrace()); // Start the test command. os << indent << "add_test(" << this->Test->GetName() << " "; From e7fbd489e0da88e2fd70aa039da4f4173ee24028 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sat, 18 Jul 2015 00:01:05 -0400 Subject: [PATCH 0345/1048] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index afa63577a..0c4174598 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 3) -set(CMake_VERSION_PATCH 20150717) +set(CMake_VERSION_PATCH 20150718) #set(CMake_VERSION_RC 1) From 52f22616852e6a6e8f642f84fa821e0c8678a679 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 9 Jul 2015 22:26:51 +0200 Subject: [PATCH 0346/1048] cmListFileBacktrace: Constify API. --- Source/cmListFileCache.cxx | 4 ++-- Source/cmListFileCache.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx index 1097dc2cc..bff298615 100644 --- a/Source/cmListFileCache.cxx +++ b/Source/cmListFileCache.cxx @@ -398,7 +398,7 @@ bool cmListFileParser::AddArgument(cmListFileLexer_Token* token, } } -void cmListFileBacktrace::PrintTitle(std::ostream& out) +void cmListFileBacktrace::PrintTitle(std::ostream& out) const { if (!this->Snapshot.IsValid()) { @@ -412,7 +412,7 @@ void cmListFileBacktrace::PrintTitle(std::ostream& out) out << (lfc.Line ? " at " : " in ") << lfc; } -void cmListFileBacktrace::PrintCallStack(std::ostream& out) +void cmListFileBacktrace::PrintCallStack(std::ostream& out) const { if (!this->Snapshot.IsValid()) { diff --git a/Source/cmListFileCache.h b/Source/cmListFileCache.h index aa8a34c6c..0afd7f5d3 100644 --- a/Source/cmListFileCache.h +++ b/Source/cmListFileCache.h @@ -95,8 +95,8 @@ class cmListFileBacktrace { } - void PrintTitle(std::ostream& out); - void PrintCallStack(std::ostream& out); + void PrintTitle(std::ostream& out) const; + void PrintCallStack(std::ostream& out) const; private: cmCommandContext Context; cmState::Snapshot Snapshot; From 647b533bce48b741a6b048a1e62b24b9bb2f8d23 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 7 Jul 2015 23:37:20 +0200 Subject: [PATCH 0347/1048] cmMakefile: Implement FormatListFileStack in terms of cmState. --- Source/cmMakefile.cxx | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 94c77e13e..cbaf97244 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -4439,14 +4439,22 @@ void cmMakefile::AddCMakeDependFilesFromUser() std::string cmMakefile::FormatListFileStack() const { + std::vector listFiles; + cmState::Snapshot snp = this->StateSnapshot; + while (snp.IsValid()) + { + listFiles.push_back(snp.GetExecutionListFile()); + snp = snp.GetCallStackParent(); + } + std::reverse(listFiles.begin(), listFiles.end()); std::ostringstream tmp; - size_t depth = this->ListFileStack.size(); + size_t depth = listFiles.size(); if (depth > 0) { - std::vector::const_iterator it = this->ListFileStack.end(); + std::vector::const_iterator it = listFiles.end(); do { - if (depth != this->ListFileStack.size()) + if (depth != listFiles.size()) { tmp << "\n "; } @@ -4457,7 +4465,7 @@ std::string cmMakefile::FormatListFileStack() const tmp << *it; depth--; } - while (it != this->ListFileStack.begin()); + while (it != listFiles.begin()); } return tmp.str(); } From 6083ec9a78fd48c66087f9c9e887b9b405c69999 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 7 Jul 2015 23:36:13 +0200 Subject: [PATCH 0348/1048] cmMakefile: Implement LISTFILE_STACK property in terms of cmState. --- Source/cmMakefile.cxx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index cbaf97244..647caba69 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -4282,7 +4282,15 @@ const char *cmMakefile::GetProperty(const std::string& prop, } else if (prop == "LISTFILE_STACK") { - output = cmJoin(this->ListFileStack, ";"); + std::vector listFiles; + cmState::Snapshot snp = this->StateSnapshot; + while (snp.IsValid()) + { + listFiles.push_back(snp.GetExecutionListFile()); + snp = snp.GetCallStackParent(); + } + std::reverse(listFiles.begin(), listFiles.end()); + output = cmJoin(listFiles, ";"); return output.c_str(); } else if ( prop == "CACHE_VARIABLES" ) From 8e7d3030773aae4b1784383abd6af4e5cec087c6 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 7 Jul 2015 23:50:54 +0200 Subject: [PATCH 0349/1048] cmMakefile: Simplify setting of current snapshot. --- Source/cmMakefile.cxx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 647caba69..bd13a17ee 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1714,8 +1714,7 @@ public: this->GG = mf->GetGlobalGenerator(); this->CurrentMakefile = this->GG->GetCurrentMakefile(); this->Snapshot = this->GG->GetCMakeInstance()->GetCurrentSnapshot(); - this->GG->GetCMakeInstance()->SetCurrentSnapshot( - this->GG->GetCMakeInstance()->GetCurrentSnapshot()); + this->GG->GetCMakeInstance()->SetCurrentSnapshot(this->Snapshot); this->GG->SetCurrentMakefile(mf); #if defined(CMAKE_BUILD_WITH_CMAKE) this->GG->GetFileLockPool().PushFileScope(); From e77c46664c384211294b6bdfef99c92212826cc6 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 18 Jul 2015 13:19:34 +0200 Subject: [PATCH 0350/1048] cmMakefile: Remove obsolete condition. --- Source/cmMakefile.cxx | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index bd13a17ee..0f550173c 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -3436,10 +3436,6 @@ bool cmMakefile::IsLoopBlock() const std::string cmMakefile::GetExecutionFilePath() const { - if (this->ContextStack.empty()) - { - return std::string(); - } assert(this->StateSnapshot.IsValid()); return this->StateSnapshot.GetExecutionListFile(); } From 54cc0c0e1f98508892ce653591178c86ff067364 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 18 Jul 2015 13:18:34 +0200 Subject: [PATCH 0351/1048] cmMakefile: Port some users of ListFileStack to cmState. --- Source/cmMakefile.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 0f550173c..f8ac52e3e 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -260,7 +260,7 @@ void cmMakefile::IssueMessage(cmake::MessageType t, cmListFileContext lfc; // We are not currently executing a command. Add whatever context // information we have. - lfc.FilePath = this->ListFileStack.back(); + lfc.FilePath = this->GetExecutionFilePath(); if(!this->GetCMakeInstance()->GetIsInTryCompile()) { @@ -514,7 +514,7 @@ void cmMakefile::IncludeScope::EnforceCMP0011() std::ostringstream w; w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0011) << "\n" << "The included script\n " - << this->Makefile->ListFileStack.back() << "\n" + << this->Makefile->GetExecutionFilePath() << "\n" << "affects policy settings. " << "CMake is implying the NO_POLICY_SCOPE option for compatibility, " << "so the effects are applied to the including context."; @@ -527,7 +527,7 @@ void cmMakefile::IncludeScope::EnforceCMP0011() std::ostringstream e; e << cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0011) << "\n" << "The included script\n " - << this->Makefile->ListFileStack.back() << "\n" + << this->Makefile->GetExecutionFilePath() << "\n" << "affects policy settings, so it requires this policy to be set."; this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); } From 640fc5b54a8e7f9e000d5a661f0656a8701639b5 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 7 Jul 2015 23:40:48 +0200 Subject: [PATCH 0352/1048] cmMakefile: Remove unused ListFileStack. --- Source/cmMakefile.cxx | 5 ----- Source/cmMakefile.h | 3 --- 2 files changed, 8 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index f8ac52e3e..2216264fd 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -455,7 +455,6 @@ cmMakefile::IncludeScope::IncludeScope(cmMakefile* mf, // The included file cannot pop our policy scope. this->Makefile->PushPolicyBarrier(); - this->Makefile->ListFileStack.push_back(filenametoread); this->Makefile->PushFunctionBlockerBarrier(); this->Makefile->StateSnapshot = @@ -498,7 +497,6 @@ cmMakefile::IncludeScope::~IncludeScope() this->EnforceCMP0011(); } } - this->Makefile->ListFileStack.pop_back(); } //---------------------------------------------------------------------------- @@ -593,7 +591,6 @@ public: ListFileScope(cmMakefile* mf, std::string const& filenametoread) : Makefile(mf), ReportError(true) { - this->Makefile->ListFileStack.push_back(filenametoread); this->Makefile->PushPolicyBarrier(); long line = 0; @@ -618,7 +615,6 @@ public: this->Makefile->PopFunctionBlockerBarrier(this->ReportError); this->Makefile->PopPolicyBarrier(this->ReportError); - this->Makefile->ListFileStack.pop_back(); } void Quiet() { this->ReportError = false; } @@ -1707,7 +1703,6 @@ public: this->Makefile->StateSnapshot.GetCurrentSourceDirectory(); currentStart += "/CMakeLists.txt"; this->Makefile->StateSnapshot.SetListFile(currentStart); - this->Makefile->ListFileStack.push_back(currentStart); this->Makefile->PushPolicyBarrier(); this->Makefile->PushFunctionBlockerBarrier(); diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 82a227940..415b5fe53 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -934,9 +934,6 @@ private: cmPropertyMap Properties; - // stack of list files being read - std::vector ListFileStack; - std::vector ContextStack; std::vector ExecutionStatusStack; friend class cmMakefileCall; From 357342602db67e456e9afc9697328d490ab0fc41 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 18 Jul 2015 13:45:43 +0200 Subject: [PATCH 0353/1048] cmMakefile: Inline only use of GetLinkDirectories. --- Source/cmMakefile.cxx | 2 +- Source/cmMakefile.h | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 94c77e13e..1dc0bb723 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -4302,7 +4302,7 @@ const char *cmMakefile::GetProperty(const std::string& prop, } else if (prop == "LINK_DIRECTORIES") { - output = cmJoin(this->GetLinkDirectories(), ";"); + output = cmJoin(this->LinkDirectories, ";"); return output.c_str(); } else if (prop == "INCLUDE_DIRECTORIES") diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 82a227940..154e09938 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -233,10 +233,6 @@ public: */ void AddLinkDirectory(const std::string&); - const std::vector& GetLinkDirectories() const - { - return this->LinkDirectories; - } void SetLinkDirectories(const std::vector& vec) { this->LinkDirectories = vec; From 881613c4abbbca35223678d6b17da418958a0005 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 18 Jul 2015 13:52:46 +0200 Subject: [PATCH 0354/1048] cmMakefile: Remove special handling of LINK_DIRECTORIES property. There is no need to handle it in a special way. --- Source/cmLinkDirectoriesCommand.cxx | 2 +- Source/cmMakefile.cxx | 93 ++++++------------- Source/cmMakefile.h | 10 -- .../RunCMake/CMP0019/CMP0019-WARN-stderr.txt | 6 +- 4 files changed, 33 insertions(+), 78 deletions(-) diff --git a/Source/cmLinkDirectoriesCommand.cxx b/Source/cmLinkDirectoriesCommand.cxx index f486bf7d1..b6c0072db 100644 --- a/Source/cmLinkDirectoriesCommand.cxx +++ b/Source/cmLinkDirectoriesCommand.cxx @@ -65,5 +65,5 @@ void cmLinkDirectoriesCommand::AddLinkDir(std::string const& dir) unixPath = tmp; } } - this->Makefile->AddLinkDirectory(unixPath); + this->Makefile->AppendProperty("LINK_DIRECTORIES", unixPath.c_str()); } diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 1dc0bb723..3c8a41d29 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1520,31 +1520,6 @@ void cmMakefile::AddLinkLibrary(const std::string& lib) this->AddLinkLibrary(lib,cmTarget::GENERAL); } -void cmMakefile::AddLinkDirectory(const std::string& dir) -{ - // Don't add a link directory that is already present. Yes, this - // linear search results in n^2 behavior, but n won't be getting - // much bigger than 20. We cannot use a set because of order - // dependency of the link search path. - - if(dir.empty()) - { - return; - } - std::string newdir = dir; - // remove trailing slashes - if(*dir.rbegin() == '/') - { - newdir = dir.substr(0, dir.size()-1); - } - if(std::find(this->LinkDirectories.begin(), - this->LinkDirectories.end(), newdir) - == this->LinkDirectories.end()) - { - this->LinkDirectories.push_back(dir); - } -} - void cmMakefile::InitializeFromParent(cmMakefile* parent) { // Initialize definitions with the closure of the parent scope. @@ -1607,7 +1582,8 @@ void cmMakefile::InitializeFromParent(cmMakefile* parent) this->LinkLibraries = parent->LinkLibraries; // link directories - this->LinkDirectories = parent->LinkDirectories; + this->SetProperty("LINK_DIRECTORIES", + parent->GetProperty("LINK_DIRECTORIES")); // the initial project name this->ProjectName = parent->ProjectName; @@ -2145,11 +2121,26 @@ void cmMakefile::AddGlobalLinkInformation(const std::string& name, return; default:; } - std::vector::iterator j; - for(j = this->LinkDirectories.begin(); - j != this->LinkDirectories.end(); ++j) + if (const char* linkDirsProp = this->GetProperty("LINK_DIRECTORIES")) { - target.AddLinkDirectory(*j); + std::vector linkDirs; + cmSystemTools::ExpandListArgument(linkDirsProp, linkDirs); + + for(std::vector::iterator j = linkDirs.begin(); + j != linkDirs.end(); ++j) + { + std::string newdir = *j; + // remove trailing slashes + if(*j->rbegin() == '/') + { + newdir = j->substr(0, j->size()-1); + } + if(std::find(this->LinkDirectories.begin(), + this->LinkDirectories.end(), newdir) + == this->LinkDirectories.end()) + {target.AddLinkDirectory(*j); + } + } } target.MergeLinkLibraries( *this, name, this->LinkLibraries ); } @@ -2424,19 +2415,19 @@ void cmMakefile::ExpandVariablesCMP0019() } } - for(std::vector::iterator d = this->LinkDirectories.begin(); - d != this->LinkDirectories.end(); ++d) + if (const char* linkDirsProp = this->GetProperty("LINK_DIRECTORIES")) { - if(mightExpandVariablesCMP0019(d->c_str())) + if(mightExpandVariablesCMP0019(linkDirsProp)) { - std::string orig = *d; - this->ExpandVariablesInString(*d, true, true); - if(pol == cmPolicies::WARN && *d != orig) + std::string d = linkDirsProp; + std::string orig = linkDirsProp; + this->ExpandVariablesInString(d, true, true); + if(pol == cmPolicies::WARN && d != orig) { - w << "Evaluated link directory\n" + w << "Evaluated link directories\n" << " " << orig << "\n" << "as\n" - << " " << *d << "\n"; + << " " << d << "\n"; } } } @@ -4147,16 +4138,6 @@ int cmMakefile::ConfigureFile(const char* infile, const char* outfile, void cmMakefile::SetProperty(const std::string& prop, const char* value) { - if ( prop == "LINK_DIRECTORIES" ) - { - std::vector varArgsExpanded; - if(value) - { - cmSystemTools::ExpandListArgument(value, varArgsExpanded); - } - this->SetLinkDirectories(varArgsExpanded); - return; - } if (prop == "INCLUDE_DIRECTORIES") { this->IncludeDirectoriesEntries.clear(); @@ -4237,17 +4218,6 @@ void cmMakefile::AppendProperty(const std::string& prop, cmValueWithOrigin(value, lfbt)); return; } - if ( prop == "LINK_DIRECTORIES" ) - { - std::vector varArgsExpanded; - cmSystemTools::ExpandListArgument(value, varArgsExpanded); - for(std::vector::const_iterator vi = varArgsExpanded.begin(); - vi != varArgsExpanded.end(); ++vi) - { - this->AddLinkDirectory(*vi); - } - return; - } this->Properties.AppendProperty(prop, value, asString); } @@ -4300,11 +4270,6 @@ const char *cmMakefile::GetProperty(const std::string& prop, this->GetListOfMacros(output); return output.c_str(); } - else if (prop == "LINK_DIRECTORIES") - { - output = cmJoin(this->LinkDirectories, ";"); - return output.c_str(); - } else if (prop == "INCLUDE_DIRECTORIES") { std::string sep; diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 154e09938..98d199a2e 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -228,16 +228,6 @@ public: cmTarget::LinkLibraryType type); void AddLinkDirectoryForTarget(const std::string& tgt, const std::string& d); - /** - * Add a link directory to the build. - */ - void AddLinkDirectory(const std::string&); - - void SetLinkDirectories(const std::vector& vec) - { - this->LinkDirectories = vec; - } - /** * Add a subdirectory to the build. */ diff --git a/Tests/RunCMake/CMP0019/CMP0019-WARN-stderr.txt b/Tests/RunCMake/CMP0019/CMP0019-WARN-stderr.txt index 03faef90e..1e4b47d0c 100644 --- a/Tests/RunCMake/CMP0019/CMP0019-WARN-stderr.txt +++ b/Tests/RunCMake/CMP0019/CMP0019-WARN-stderr.txt @@ -21,13 +21,13 @@ CMake Warning \(dev\) in CMakeLists.txt: /usr/include/VAL_INCLUDE;/usr/include/normal - Evaluated link directory + Evaluated link directories - /usr/lib/\${VAR_LINK_DIRS} + /usr/lib/\${VAR_LINK_DIRS};/usr/lib/normal as - /usr/lib/VAL_LINK_DIRS + /usr/lib/VAL_LINK_DIRS;/usr/lib/normal Evaluated link library From 4efda261fead9f677144ffc6bc2b612a1d1dbcb6 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 4 Apr 2015 19:21:56 +0200 Subject: [PATCH 0355/1048] cmMakefile: Remove special handling of INCLUDE_REGULAR_EXPRESSION. It costs an extra cmMakefile member and extra code to maintain in directory property handling. Remove documentation note that it is read-only and specify high-level command to populate it. --- Help/prop_dir/INCLUDE_REGULAR_EXPRESSION.rst | 5 +++-- Source/cmMakeDepend.cxx | 2 +- Source/cmMakefile.cxx | 14 +------------- Source/cmMakefile.h | 5 ++--- 4 files changed, 7 insertions(+), 19 deletions(-) diff --git a/Help/prop_dir/INCLUDE_REGULAR_EXPRESSION.rst b/Help/prop_dir/INCLUDE_REGULAR_EXPRESSION.rst index befafa58c..bb90c61a7 100644 --- a/Help/prop_dir/INCLUDE_REGULAR_EXPRESSION.rst +++ b/Help/prop_dir/INCLUDE_REGULAR_EXPRESSION.rst @@ -3,6 +3,7 @@ INCLUDE_REGULAR_EXPRESSION Include file scanning regular expression. -This read-only property specifies the regular expression used during +This property specifies the regular expression used during dependency scanning to match include files that should be followed. -See the include_regular_expression command. +See the :command:`include_regular_expression` command for a high-level +interface to set this property. diff --git a/Source/cmMakeDepend.cxx b/Source/cmMakeDepend.cxx index a6d4e58aa..cbc7e0299 100644 --- a/Source/cmMakeDepend.cxx +++ b/Source/cmMakeDepend.cxx @@ -49,7 +49,7 @@ void cmMakeDepend::SetMakefile(cmMakefile* makefile) // Now extract the include file regular expression from the makefile. this->IncludeFileRegularExpression.compile( - this->Makefile->IncludeFileRegularExpression.c_str()); + this->Makefile->GetIncludeRegularExpression()); this->ComplainFileRegularExpression.compile( this->Makefile->ComplainFileRegularExpression.c_str()); diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 07c2fd15b..155c30636 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -150,7 +150,7 @@ cmMakefile::cmMakefile(cmLocalGenerator* localGenerator) this->SuppressWatches = false; // Setup the default include file regular expression (match everything). - this->IncludeFileRegularExpression = "^.*$"; + this->SetProperty("INCLUDE_REGULAR_EXPRESSION", "^.*$"); // Setup the default include complaint regular expression (match nothing). this->ComplainFileRegularExpression = "^$"; // Source and header file extensions that we can handle @@ -1613,7 +1613,6 @@ void cmMakefile::InitializeFromParent(cmMakefile* parent) this->ProjectName = parent->ProjectName; // Copy include regular expressions. - this->IncludeFileRegularExpression = parent->IncludeFileRegularExpression; this->ComplainFileRegularExpression = parent->ComplainFileRegularExpression; // Imported targets. @@ -4193,12 +4192,6 @@ void cmMakefile::SetProperty(const std::string& prop, const char* value) return; } - if ( prop == "INCLUDE_REGULAR_EXPRESSION" ) - { - this->SetIncludeRegularExpression(value); - return; - } - this->Properties.SetProperty(prop, value); } @@ -4265,11 +4258,6 @@ const char *cmMakefile::GetProperty(const std::string& prop, } return ""; } - else if (prop == "INCLUDE_REGULAR_EXPRESSION" ) - { - output = this->GetIncludeRegularExpression(); - return output.c_str(); - } else if (prop == "LISTFILE_STACK") { output = cmJoin(this->ListFileStack, ";"); diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 82a227940..585880e90 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -387,11 +387,11 @@ public: */ void SetIncludeRegularExpression(const char* regex) { - this->IncludeFileRegularExpression = regex; + this->SetProperty("INCLUDE_REGULAR_EXPRESSION", regex); } const char* GetIncludeRegularExpression() const { - return this->IncludeFileRegularExpression.c_str(); + return this->GetProperty("INCLUDE_REGULAR_EXPRESSION"); } /** @@ -873,7 +873,6 @@ protected: std::vector InstallGenerators; std::vector TestGenerators; - std::string IncludeFileRegularExpression; std::string ComplainFileRegularExpression; std::vector SourceFileExtensions; std::vector HeaderFileExtensions; From a622b829bd5fdb38c82fd3810e1b1f8cdb5ee0d8 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 18 Jul 2015 14:35:50 +0200 Subject: [PATCH 0356/1048] cmGetCMakePropertyCommand: Clean up VARIABLES handling. --- Source/cmGetCMakePropertyCommand.cxx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Source/cmGetCMakePropertyCommand.cxx b/Source/cmGetCMakePropertyCommand.cxx index a460ca6ed..5a1644ca0 100644 --- a/Source/cmGetCMakePropertyCommand.cxx +++ b/Source/cmGetCMakePropertyCommand.cxx @@ -32,10 +32,9 @@ bool cmGetCMakePropertyCommand if ( args[1] == "VARIABLES" ) { - std::vector vars = this->Makefile->GetDefinitions(); - if (!vars.empty()) + if (const char* varsProp = this->Makefile->GetProperty("VARIABLES")) { - output = cmJoin(vars, ";"); + output = varsProp; } } else if ( args[1] == "MACROS" ) From 2007d11caf6696f44d85bab165a665c5c4bf48f5 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 18 Jul 2015 14:25:21 +0200 Subject: [PATCH 0357/1048] cmState: Remove unused variable. --- Source/cmState.cxx | 2 -- 1 file changed, 2 deletions(-) diff --git a/Source/cmState.cxx b/Source/cmState.cxx index 2d8b93530..bd37e614e 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -470,8 +470,6 @@ void cmState::AppendGlobalProperty(const std::string& prop, const char *cmState::GetGlobalProperty(const std::string& prop) { - // watch for special properties - std::string output = ""; if ( prop == "CACHE_VARIABLES" ) { std::vector cacheKeys = this->GetCacheEntryKeys(); From 5505bff7ae85b84fbdb60604de6bb4a515cd3e8a Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 18 Jul 2015 18:40:36 +0200 Subject: [PATCH 0358/1048] cmMakefile: Add include which we use. Don't rely on this through the cmLocalGenerator include. --- Source/cmMakefile.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 07c2fd15b..a4164ff9c 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -19,6 +19,7 @@ #include "cmLocalGenerator.h" #include "cmCommands.h" #include "cmState.h" +#include "cmOutputConverter.h" #include "cmFunctionBlocker.h" #include "cmListFileCache.h" #include "cmCommandArgumentParserHelper.h" From cff2dc34f98fd0960a5ec1b37d9bf5f937c31efc Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 18 Jul 2015 18:43:17 +0200 Subject: [PATCH 0359/1048] cmLocalUnixMakefileGenerator3: Port away from the Parent. --- Source/cmLocalUnixMakefileGenerator3.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 5d17a404a..64f8bb8e6 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -256,7 +256,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefile() return; } // always write the top makefile - if (this->Parent) + if (!this->GetMakefile()->IsRootMakefile()) { ruleFileStream.SetCopyIfDifferent(true); } @@ -267,7 +267,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefile() // only write local targets unless at the top Keep track of targets already // listed. std::set emittedTargets; - if (this->Parent) + if (!this->GetMakefile()->IsRootMakefile()) { // write our targets, and while doing it collect up the object // file rules @@ -888,7 +888,7 @@ void cmLocalUnixMakefileGenerator3 std::vector no_depends; std::vector commands; commands.push_back(runRule); - if(this->Parent) + if(!this->GetMakefile()->IsRootMakefile()) { this->CreateCDCommand(commands, this->Makefile->GetHomeOutputDirectory(), From cbe3ee58ca568ede66ff04abb6b73ac39b092701 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 18 Jul 2015 18:59:18 +0200 Subject: [PATCH 0360/1048] cmMakefile: Add a PropertyKeys accessor. --- Source/cmGlobalVisualStudio7Generator.cxx | 16 +++++++++------- Source/cmMakefile.cxx | 12 ++++++++++++ Source/cmMakefile.h | 1 + 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 1674e9818..f8d882c2b 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -814,14 +814,15 @@ void cmGlobalVisualStudio7Generator { bool extensibilityGlobalsOverridden = false; bool extensibilityAddInsOverridden = false; - const cmPropertyMap& props = root->GetMakefile()->GetProperties(); - for(cmPropertyMap::const_iterator itProp = props.begin(); - itProp != props.end(); ++itProp) + const std::vector propKeys = + root->GetMakefile()->GetPropertyKeys(); + for(std::vector::const_iterator it = propKeys.begin(); + it != propKeys.end(); ++it) { - if(itProp->first.find("VS_GLOBAL_SECTION_") == 0) + if(it->find("VS_GLOBAL_SECTION_") == 0) { std::string sectionType; - std::string name = itProp->first.substr(18); + std::string name = it->substr(18); if(name.find("PRE_") == 0) { name = name.substr(4); @@ -842,8 +843,9 @@ void cmGlobalVisualStudio7Generator extensibilityAddInsOverridden = true; fout << "\tGlobalSection(" << name << ") = " << sectionType << "\n"; std::vector keyValuePairs; - cmSystemTools::ExpandListArgument(itProp->second.GetValue(), - keyValuePairs); + cmSystemTools::ExpandListArgument( + root->GetMakefile()->GetProperty(it->c_str()), + keyValuePairs); for(std::vector::const_iterator itPair = keyValuePairs.begin(); itPair != keyValuePairs.end(); ++itPair) { diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 94c77e13e..609e2d876 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -4367,6 +4367,18 @@ bool cmMakefile::GetPropertyAsBool(const std::string& prop) const return cmSystemTools::IsOn(this->GetProperty(prop)); } +std::vector cmMakefile::GetPropertyKeys() const +{ + std::vector keys; + keys.reserve(this->Properties.size()); + for(cmPropertyMap::const_iterator it = this->Properties.begin(); + it != this->Properties.end(); ++it) + { + keys.push_back(it->first); + } + return keys; +} + cmTarget* cmMakefile::FindTarget(const std::string& name, bool excludeAliases) const { diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 82a227940..a010da1f4 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -700,6 +700,7 @@ public: const char *GetProperty(const std::string& prop) const; const char *GetProperty(const std::string& prop, bool chain) const; bool GetPropertyAsBool(const std::string& prop) const; + std::vector GetPropertyKeys() const; // Get the properties cmPropertyMap &GetProperties() { return this->Properties; } From c6055d9d4c2f37822866981f5cea1f7389431d49 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 18 Jul 2015 18:59:41 +0200 Subject: [PATCH 0361/1048] cmMakefile: Remove GetProperties method. The storage details of properties do not belong in the API. --- Source/cmMakefile.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index a010da1f4..1e2615d66 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -702,9 +702,6 @@ public: bool GetPropertyAsBool(const std::string& prop) const; std::vector GetPropertyKeys() const; - // Get the properties - cmPropertyMap &GetProperties() { return this->Properties; } - ///! Initialize a makefile from its parent void InitializeFromParent(cmMakefile* parent); From 27ec21dbb2370ac71aebc0089d4269f27661f4b8 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 18 Jul 2015 11:34:44 +0200 Subject: [PATCH 0362/1048] cmState: Forward-declare a type earlier. --- Source/cmState.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/cmState.h b/Source/cmState.h index 473a1948b..15a619221 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -23,6 +23,7 @@ class cmCommand; class cmState { struct SnapshotDataType; + struct BuildsystemDirectoryStateType; typedef cmLinkedTree::iterator PositionType; friend class Snapshot; public: @@ -203,7 +204,6 @@ private: cmPropertyMap GlobalProperties; cmake* CMakeInstance; - struct BuildsystemDirectoryStateType; cmLinkedTree BuildsystemDirectory; cmLinkedTree ExecutionListFiles; From 9ebc7502b2e4cf991e721b695aead2c366eb0bef Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 18 Jul 2015 19:11:05 +0200 Subject: [PATCH 0363/1048] cmState: Extract a Directory class. Move Directory-scoped state accessors to it. This will be expanded with directory property state soon. --- Source/cmLocalGenerator.cxx | 43 +++++++------ Source/cmLocalUnixMakefileGenerator3.cxx | 10 +-- Source/cmMakefile.cxx | 21 +++--- Source/cmOutputConverter.cxx | 34 ++++++---- Source/cmState.cxx | 82 +++++++++++++----------- Source/cmState.h | 52 +++++++++------ 6 files changed, 141 insertions(+), 101 deletions(-) diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 5c9ee0ec9..7e4b4700b 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -70,7 +70,7 @@ void cmLocalGenerator::IssueMessage(cmake::MessageType t, std::string const& text) const { cmListFileContext lfc; - lfc.FilePath = this->StateSnapshot.GetCurrentSourceDirectory(); + lfc.FilePath = this->StateSnapshot.GetDirectory().GetCurrentSource(); lfc.FilePath += "/CMakeLists.txt"; if(!this->GlobalGenerator->GetCMakeInstance()->GetIsInTryCompile()) @@ -161,7 +161,8 @@ void cmLocalGenerator::GenerateTestFiles() const std::string& config = this->Makefile->GetConfigurations(configurationTypes, false); - std::string file = this->StateSnapshot.GetCurrentBinaryDirectory(); + std::string file = + this->StateSnapshot.GetDirectory().GetCurrentBinary(); file += "/"; file += "CTestTestfile.cmake"; @@ -170,9 +171,11 @@ void cmLocalGenerator::GenerateTestFiles() fout << "# CMake generated Testfile for " << std::endl << "# Source directory: " - << this->StateSnapshot.GetCurrentSourceDirectory() << std::endl + << this->StateSnapshot.GetDirectory().GetCurrentSource() + << std::endl << "# Build directory: " - << this->StateSnapshot.GetCurrentBinaryDirectory() << std::endl + << this->StateSnapshot.GetDirectory().GetCurrentBinary() + << std::endl << "# " << std::endl << "# This file includes the relevant testing commands " << "required for " << std::endl @@ -286,7 +289,8 @@ void cmLocalGenerator::GenerateInstallRules() } // Create the install script file. - std::string file = this->StateSnapshot.GetCurrentBinaryDirectory(); + std::string file = + this->StateSnapshot.GetDirectory().GetCurrentBinary(); std::string homedir = this->GetState()->GetBinaryDirectory(); int toplevel_install = 0; if (file == homedir) @@ -299,7 +303,7 @@ void cmLocalGenerator::GenerateInstallRules() // Write the header. fout << "# Install script for directory: " - << this->StateSnapshot.GetCurrentSourceDirectory() + << this->StateSnapshot.GetDirectory().GetCurrentSource() << std::endl << std::endl; fout << "# Set the install prefix" << std::endl << "if(NOT DEFINED CMAKE_INSTALL_PREFIX)" << std::endl @@ -518,7 +522,7 @@ void cmLocalGenerator::AddCustomCommandToCreateObject(const char* ofname, source.GetFullPath(), commandLines, comment.c_str(), - this->StateSnapshot.GetCurrentBinaryDirectory() + this->StateSnapshot.GetDirectory().GetCurrentBinary() ); } @@ -540,12 +544,13 @@ void cmLocalGenerator::AddBuildTargetRule(const std::string& llang, !sf->GetPropertyAsBool("EXTERNAL_OBJECT")) { std::string dir_max; - dir_max += this->StateSnapshot.GetCurrentBinaryDirectory(); + dir_max += this->StateSnapshot.GetDirectory().GetCurrentBinary(); dir_max += "/"; std::string obj = this->GetObjectFileNameWithoutTarget(*sf, dir_max); if(!obj.empty()) { - std::string ofname = this->StateSnapshot.GetCurrentBinaryDirectory(); + std::string ofname = + this->StateSnapshot.GetDirectory().GetCurrentBinary(); ofname += "/"; ofname += obj; objVector.push_back(ofname); @@ -615,7 +620,7 @@ void cmLocalGenerator::AddBuildTargetRule(const std::string& llang, "", commandLines, comment.c_str(), - this->StateSnapshot.GetCurrentBinaryDirectory() + this->StateSnapshot.GetDirectory().GetCurrentBinary() ); this->Makefile->GetSource(targetFullPath); target.Target->AddSource(targetFullPath); @@ -1369,20 +1374,20 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector& dirs, // Store the automatic include paths. if(includeBinaryDir) { - if(emitted.find( - this->StateSnapshot.GetCurrentBinaryDirectory()) == emitted.end()) + std::string binDir = this->StateSnapshot.GetDirectory().GetCurrentBinary(); + if(emitted.find(binDir) == emitted.end()) { - dirs.push_back(this->StateSnapshot.GetCurrentBinaryDirectory()); - emitted.insert(this->StateSnapshot.GetCurrentBinaryDirectory()); + dirs.push_back(binDir); + emitted.insert(binDir); } } if(includeSourceDir) { - if(emitted.find( - this->StateSnapshot.GetCurrentSourceDirectory()) == emitted.end()) + std::string srcDir = this->StateSnapshot.GetDirectory().GetCurrentSource(); + if(emitted.find(srcDir) == emitted.end()) { - dirs.push_back(this->StateSnapshot.GetCurrentSourceDirectory()); - emitted.insert(this->StateSnapshot.GetCurrentSourceDirectory()); + dirs.push_back(srcDir); + emitted.insert(srcDir); } } @@ -1983,7 +1988,7 @@ bool cmLocalGenerator::GetRealDependency(const std::string& inName, // Treat the name as relative to the source directory in which it // was given. - dep = this->StateSnapshot.GetCurrentSourceDirectory(); + dep = this->StateSnapshot.GetDirectory().GetCurrentSource(); dep += "/"; dep += inName; return true; diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 5d17a404a..fa8022291 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -530,10 +530,10 @@ void cmLocalUnixMakefileGenerator3::WriteDirectoryInformationFile() infoFileStream << "# Relative path conversion top directories.\n" << "set(CMAKE_RELATIVE_PATH_TOP_SOURCE \"" - << this->StateSnapshot.GetRelativePathTopSource() + << this->StateSnapshot.GetDirectory().GetRelativePathTopSource() << "\")\n" << "set(CMAKE_RELATIVE_PATH_TOP_BINARY \"" - << this->StateSnapshot.GetRelativePathTopBinary() + << this->StateSnapshot.GetDirectory().GetRelativePathTopBinary() << "\")\n" << "\n"; @@ -1602,12 +1602,14 @@ cmLocalUnixMakefileGenerator3 if(const char* relativePathTopSource = mf->GetDefinition("CMAKE_RELATIVE_PATH_TOP_SOURCE")) { - this->StateSnapshot.SetRelativePathTopSource(relativePathTopSource); + this->StateSnapshot.GetDirectory() + .SetRelativePathTopSource(relativePathTopSource); } if(const char* relativePathTopBinary = mf->GetDefinition("CMAKE_RELATIVE_PATH_TOP_BINARY")) { - this->StateSnapshot.SetRelativePathTopBinary(relativePathTopBinary); + this->StateSnapshot.GetDirectory() + .SetRelativePathTopBinary(relativePathTopBinary); } } else diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 94c77e13e..043200253 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1704,7 +1704,7 @@ public: : Makefile(mf), ReportError(true) { std::string currentStart = - this->Makefile->StateSnapshot.GetCurrentSourceDirectory(); + this->Makefile->StateSnapshot.GetDirectory().GetCurrentSource(); currentStart += "/CMakeLists.txt"; this->Makefile->StateSnapshot.SetListFile(currentStart); this->Makefile->ListFileStack.push_back(currentStart); @@ -1748,11 +1748,12 @@ void cmMakefile::Configure() BuildsystemFileScope scope(this); // make sure the CMakeFiles dir is there - std::string filesDir = this->StateSnapshot.GetCurrentBinaryDirectory(); + std::string filesDir = this->StateSnapshot.GetDirectory().GetCurrentBinary(); filesDir += cmake::GetCMakeFilesDirectory(); cmSystemTools::MakeDirectory(filesDir.c_str()); - std::string currentStart = this->StateSnapshot.GetCurrentSourceDirectory(); + std::string currentStart = + this->StateSnapshot.GetDirectory().GetCurrentSource(); currentStart += "/CMakeLists.txt"; assert(cmSystemTools::FileExists(currentStart.c_str(), true)); this->AddDefinition("CMAKE_PARENT_LIST_FILE", currentStart.c_str()); @@ -1884,27 +1885,27 @@ void cmMakefile::AddSubDirectory(const std::string& srcPath, void cmMakefile::SetCurrentSourceDirectory(const std::string& dir) { - this->StateSnapshot.SetCurrentSourceDirectory(dir); + this->StateSnapshot.GetDirectory().SetCurrentSource(dir); this->AddDefinition("CMAKE_CURRENT_SOURCE_DIR", - this->StateSnapshot.GetCurrentSourceDirectory()); + this->StateSnapshot.GetDirectory().GetCurrentSource()); } const char* cmMakefile::GetCurrentSourceDirectory() const { - return this->StateSnapshot.GetCurrentSourceDirectory(); + return this->StateSnapshot.GetDirectory().GetCurrentSource(); } void cmMakefile::SetCurrentBinaryDirectory(const std::string& dir) { - this->StateSnapshot.SetCurrentBinaryDirectory(dir); - const char* binDir = this->StateSnapshot.GetCurrentBinaryDirectory(); + this->StateSnapshot.GetDirectory().SetCurrentBinary(dir); + const char* binDir = this->StateSnapshot.GetDirectory().GetCurrentBinary(); cmSystemTools::MakeDirectory(binDir); this->AddDefinition("CMAKE_CURRENT_BINARY_DIR", binDir); } const char* cmMakefile::GetCurrentBinaryDirectory() const { - return this->StateSnapshot.GetCurrentBinaryDirectory(); + return this->StateSnapshot.GetDirectory().GetCurrentBinary(); } //---------------------------------------------------------------------------- @@ -4271,7 +4272,7 @@ const char *cmMakefile::GetProperty(const std::string& prop, this->StateSnapshot.GetBuildsystemDirectoryParent(); if(parent.IsValid()) { - return parent.GetCurrentSourceDirectory(); + return parent.GetDirectory().GetCurrentSource(); } return ""; } diff --git a/Source/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx index 7cd6a47b5..91f3c0ad5 100644 --- a/Source/cmOutputConverter.cxx +++ b/Source/cmOutputConverter.cxx @@ -81,11 +81,15 @@ const char* cmOutputConverter::GetRelativeRootPath(RelativeRoot relroot) const { switch (relroot) { - case HOME: return this->GetState()->GetSourceDirectory(); - case START: return this->StateSnapshot.GetCurrentSourceDirectory(); - case HOME_OUTPUT: return this->GetState()->GetBinaryDirectory(); - case START_OUTPUT: return this->StateSnapshot.GetCurrentBinaryDirectory(); - default: break; + case HOME: + return this->GetState()->GetSourceDirectory(); + case START: + return this->StateSnapshot.GetDirectory().GetCurrentSource(); + case HOME_OUTPUT: + return this->GetState()->GetBinaryDirectory(); + case START_OUTPUT: + return this->StateSnapshot.GetDirectory().GetCurrentBinary(); + default: break; } return 0; } @@ -105,7 +109,8 @@ std::string cmOutputConverter::Convert(const std::string& source, break; case START: result = this->ConvertToRelativePath( - this->StateSnapshot.GetCurrentSourceDirectoryComponents(), result); + this->StateSnapshot.GetDirectory().GetCurrentSourceComponents(), + result); break; case HOME_OUTPUT: result = this->ConvertToRelativePath( @@ -113,7 +118,8 @@ std::string cmOutputConverter::Convert(const std::string& source, break; case START_OUTPUT: result = this->ConvertToRelativePath( - this->StateSnapshot.GetCurrentBinaryDirectoryComponents(), result); + this->StateSnapshot.GetDirectory().GetCurrentBinaryComponents(), + result); break; case FULL: result = cmSystemTools::CollapseFullPath(result); @@ -213,13 +219,13 @@ cmOutputConverter::ConvertToRelativePath(const std::vector& local, // or both in the binary tree. std::string local_path = cmSystemTools::JoinPath(local); if(!((cmOutputConverterNotAbove(local_path.c_str(), - this->StateSnapshot.GetRelativePathTopBinary()) && - cmOutputConverterNotAbove(in_remote.c_str(), - this->StateSnapshot.GetRelativePathTopBinary())) || - (cmOutputConverterNotAbove(local_path.c_str(), - this->StateSnapshot.GetRelativePathTopSource()) && - cmOutputConverterNotAbove(in_remote.c_str(), - this->StateSnapshot.GetRelativePathTopSource())))) + this->StateSnapshot.GetDirectory().GetRelativePathTopBinary()) + && cmOutputConverterNotAbove(in_remote.c_str(), + this->StateSnapshot.GetDirectory().GetRelativePathTopBinary())) + || (cmOutputConverterNotAbove(local_path.c_str(), + this->StateSnapshot.GetDirectory().GetRelativePathTopSource()) + && cmOutputConverterNotAbove(in_remote.c_str(), + this->StateSnapshot.GetDirectory().GetRelativePathTopSource())))) { return in_remote; } diff --git a/Source/cmState.cxx b/Source/cmState.cxx index 2d8b93530..fdafd4c36 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -611,13 +611,13 @@ std::vector const& cmState::GetBinaryDirectoryComponents() const return this->BinaryDirectoryComponents; } -void cmState::Snapshot::ComputeRelativePathTopSource() +void cmState::Directory::ComputeRelativePathTopSource() { // Relative path conversion inside the source tree is not used to // construct relative paths passed to build tools so it is safe to use // even when the source is a network path. - cmState::Snapshot snapshot = *this; + cmState::Snapshot snapshot = this->Snapshot_; std::vector snapshots; snapshots.push_back(snapshot); while (true) @@ -633,23 +633,23 @@ void cmState::Snapshot::ComputeRelativePathTopSource() } } - std::string result = snapshots.front().GetCurrentSourceDirectory(); + std::string result = snapshots.front().GetDirectory().GetCurrentSource(); for (std::vector::const_iterator it = snapshots.begin() + 1; it != snapshots.end(); ++it) { - std::string currentSource = it->GetCurrentSourceDirectory(); + std::string currentSource = it->GetDirectory().GetCurrentSource(); if(cmSystemTools::IsSubDirectory(result, currentSource)) { result = currentSource; } } - this->Position->BuildSystemDirectory->RelativePathTopSource = result; + this->DirectoryState->RelativePathTopSource = result; } -void cmState::Snapshot::ComputeRelativePathTopBinary() +void cmState::Directory::ComputeRelativePathTopBinary() { - cmState::Snapshot snapshot = *this; + cmState::Snapshot snapshot = this->Snapshot_; std::vector snapshots; snapshots.push_back(snapshot); while (true) @@ -666,12 +666,12 @@ void cmState::Snapshot::ComputeRelativePathTopBinary() } std::string result = - snapshots.front().GetCurrentBinaryDirectory(); + snapshots.front().GetDirectory().GetCurrentBinary(); for (std::vector::const_iterator it = snapshots.begin() + 1; it != snapshots.end(); ++it) { - std::string currentBinary = it->GetCurrentBinaryDirectory(); + std::string currentBinary = it->GetDirectory().GetCurrentBinary(); if(cmSystemTools::IsSubDirectory(result, currentBinary)) { result = currentBinary; @@ -683,11 +683,11 @@ void cmState::Snapshot::ComputeRelativePathTopBinary() // is a network path. if(result.size() < 2 || result.substr(0, 2) != "//") { - this->Position->BuildSystemDirectory->RelativePathTopBinary = result; + this->DirectoryState->RelativePathTopBinary = result; } else { - this->Position->BuildSystemDirectory->RelativePathTopBinary = ""; + this->DirectoryState->RelativePathTopBinary = ""; } } @@ -812,40 +812,39 @@ cmState::Snapshot::Snapshot(cmState* state, PositionType position) } -const char* cmState::Snapshot::GetCurrentSourceDirectory() const +const char* cmState::Directory::GetCurrentSource() const { - return this->Position->BuildSystemDirectory->Location.c_str(); + return this->DirectoryState->Location.c_str(); } -void cmState::Snapshot::SetCurrentSourceDirectory(std::string const& dir) +void cmState::Directory::SetCurrentSource(std::string const& dir) { - assert(this->State); - std::string& loc = this->Position->BuildSystemDirectory->Location; + std::string& loc = this->DirectoryState->Location; loc = dir; cmSystemTools::ConvertToUnixSlashes(loc); loc = cmSystemTools::CollapseFullPath(loc); cmSystemTools::SplitPath( loc, - this->Position->BuildSystemDirectory->CurrentSourceDirectoryComponents); + this->DirectoryState->CurrentSourceDirectoryComponents); this->ComputeRelativePathTopSource(); } -const char* cmState::Snapshot::GetCurrentBinaryDirectory() const +const char* cmState::Directory::GetCurrentBinary() const { - return this->Position->BuildSystemDirectory->OutputLocation.c_str(); + return this->DirectoryState->OutputLocation.c_str(); } -void cmState::Snapshot::SetCurrentBinaryDirectory(std::string const& dir) +void cmState::Directory::SetCurrentBinary(std::string const& dir) { - std::string& loc = this->Position->BuildSystemDirectory->OutputLocation; + std::string& loc = this->DirectoryState->OutputLocation; loc = dir; cmSystemTools::ConvertToUnixSlashes(loc); loc = cmSystemTools::CollapseFullPath(loc); cmSystemTools::SplitPath( loc, - this->Position->BuildSystemDirectory->CurrentBinaryDirectoryComponents); + this->DirectoryState->CurrentBinaryDirectoryComponents); this->ComputeRelativePathTopBinary(); } @@ -855,37 +854,35 @@ void cmState::Snapshot::SetListFile(const std::string& listfile) } std::vector const& -cmState::Snapshot::GetCurrentSourceDirectoryComponents() const +cmState::Directory::GetCurrentSourceComponents() const { - return this->Position->BuildSystemDirectory - ->CurrentSourceDirectoryComponents; + return this->DirectoryState->CurrentSourceDirectoryComponents; } std::vector const& -cmState::Snapshot::GetCurrentBinaryDirectoryComponents() const +cmState::Directory::GetCurrentBinaryComponents() const { - return this->Position->BuildSystemDirectory - ->CurrentBinaryDirectoryComponents; + return this->DirectoryState->CurrentBinaryDirectoryComponents; } -const char* cmState::Snapshot::GetRelativePathTopSource() const +const char* cmState::Directory::GetRelativePathTopSource() const { - return this->Position->BuildSystemDirectory->RelativePathTopSource.c_str(); + return this->DirectoryState->RelativePathTopSource.c_str(); } -const char* cmState::Snapshot::GetRelativePathTopBinary() const +const char* cmState::Directory::GetRelativePathTopBinary() const { - return this->Position->BuildSystemDirectory->RelativePathTopBinary.c_str(); + return this->DirectoryState->RelativePathTopBinary.c_str(); } -void cmState::Snapshot::SetRelativePathTopSource(const char* dir) +void cmState::Directory::SetRelativePathTopSource(const char* dir) { - this->Position->BuildSystemDirectory->RelativePathTopSource = dir; + this->DirectoryState->RelativePathTopSource = dir; } -void cmState::Snapshot::SetRelativePathTopBinary(const char* dir) +void cmState::Directory::SetRelativePathTopBinary(const char* dir) { - this->Position->BuildSystemDirectory->RelativePathTopBinary = dir; + this->DirectoryState->RelativePathTopBinary = dir; } std::string cmState::Snapshot::GetExecutionListFile() const @@ -952,3 +949,16 @@ cmState* cmState::Snapshot::GetState() const { return this->State; } + +cmState::Directory cmState::Snapshot::GetDirectory() const +{ + return Directory(this->Position->BuildSystemDirectory, *this); +} + +cmState::Directory::Directory( + cmLinkedTree::iterator iter, + const cmState::Snapshot& snapshot) + : DirectoryState(iter), Snapshot_(snapshot) +{ + +} diff --git a/Source/cmState.h b/Source/cmState.h index 15a619221..acd23a529 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -39,27 +39,14 @@ public: InlineListFileType }; + class Directory; + class Snapshot { public: Snapshot(cmState* state = 0, PositionType position = PositionType()); - const char* GetCurrentSourceDirectory() const; - void SetCurrentSourceDirectory(std::string const& dir); - const char* GetCurrentBinaryDirectory() const; - void SetCurrentBinaryDirectory(std::string const& dir); - void SetListFile(std::string const& listfile); - std::vector const& - GetCurrentSourceDirectoryComponents() const; - std::vector const& - GetCurrentBinaryDirectoryComponents() const; - - const char* GetRelativePathTopSource() const; - const char* GetRelativePathTopBinary() const; - void SetRelativePathTopSource(const char* dir); - void SetRelativePathTopBinary(const char* dir); - std::string GetExecutionListFile() const; std::string GetEntryPointCommand() const; long GetEntryPointLine() const; @@ -70,14 +57,43 @@ public: cmState* GetState() const; + Directory GetDirectory() const; + + private: + friend class cmState; + friend class Directory; + cmState* State; + cmState::PositionType Position; + }; + + class Directory + { + Directory(cmLinkedTree::iterator iter, + Snapshot const& snapshot); + public: + const char* GetCurrentSource() const; + void SetCurrentSource(std::string const& dir); + const char* GetCurrentBinary() const; + void SetCurrentBinary(std::string const& dir); + + std::vector const& + GetCurrentSourceComponents() const; + std::vector const& + GetCurrentBinaryComponents() const; + + const char* GetRelativePathTopSource() const; + const char* GetRelativePathTopBinary() const; + void SetRelativePathTopSource(const char* dir); + void SetRelativePathTopBinary(const char* dir); + private: void ComputeRelativePathTopSource(); void ComputeRelativePathTopBinary(); private: - friend class cmState; - cmState* State; - cmState::PositionType Position; + cmLinkedTree::iterator DirectoryState; + Snapshot Snapshot_; + friend class Snapshot; }; Snapshot CreateBaseSnapshot(); From 0d48bb627388e24a961d36ea6d152eb866676ac1 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sun, 19 Jul 2015 00:01:06 -0400 Subject: [PATCH 0364/1048] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 0c4174598..698f7f3c5 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 3) -set(CMake_VERSION_PATCH 20150718) +set(CMake_VERSION_PATCH 20150719) #set(CMake_VERSION_RC 1) From 41bb831fc910d85d79811dc367b25c0880cbe6ac Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 18 Jul 2015 14:32:09 +0200 Subject: [PATCH 0365/1048] cmMakefile: Remove special handling of MACROS property. --- Source/cmGetCMakePropertyCommand.cxx | 5 ++++- Source/cmMacroCommand.cxx | 2 +- Source/cmMakefile.cxx | 17 ----------------- Source/cmMakefile.h | 13 ------------- 4 files changed, 5 insertions(+), 32 deletions(-) diff --git a/Source/cmGetCMakePropertyCommand.cxx b/Source/cmGetCMakePropertyCommand.cxx index a460ca6ed..99e2867c3 100644 --- a/Source/cmGetCMakePropertyCommand.cxx +++ b/Source/cmGetCMakePropertyCommand.cxx @@ -41,7 +41,10 @@ bool cmGetCMakePropertyCommand else if ( args[1] == "MACROS" ) { output.clear(); - this->Makefile->GetListOfMacros(output); + if (const char* macrosProp = this->Makefile->GetProperty("MACROS")) + { + output = macrosProp; + } } else if ( args[1] == "COMPONENTS" ) { diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx index 6d3054a1b..fa5a62354 100644 --- a/Source/cmMacroCommand.cxx +++ b/Source/cmMacroCommand.cxx @@ -211,7 +211,7 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf, // if this is the endmacro for this macro then execute if (!this->Depth) { - mf.AddMacro(this->Args[0].c_str()); + mf.AppendProperty("MACROS", this->Args[0].c_str()); // create a new command and add it to cmake cmMacroHelperCommand *f = new cmMacroHelperCommand(); f->Args = this->Args; diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 3c8a41d29..14ef93472 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -3817,18 +3817,6 @@ cmVariableWatch *cmMakefile::GetVariableWatch() const } #endif -void cmMakefile::AddMacro(const char* name) -{ - assert(name); - this->MacrosList.push_back(name); -} - -void cmMakefile::GetListOfMacros(std::string& macros) const -{ - assert(macros.empty()); - macros = cmJoin(this->MacrosList, ";"); -} - cmState *cmMakefile::GetState() const { return this->GetCMakeInstance()->GetState(); @@ -4265,11 +4253,6 @@ const char *cmMakefile::GetProperty(const std::string& prop, output = cmJoin(this->GetDefinitions(), ";"); return output.c_str(); } - else if (prop == "MACROS") - { - this->GetListOfMacros(output); - return output.c_str(); - } else if (prop == "INCLUDE_DIRECTORIES") { std::string sep; diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 98d199a2e..489a8b124 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -655,12 +655,6 @@ public: */ cmSourceFile *GetSourceFileWithOutput(const std::string& outName) const; - /** - * Add a macro to the list of macros. The arguments should be name of the - * macro and a documentation signature of it - */ - void AddMacro(const char* name); - ///! Add a new cmTest to the list of tests for this makefile. cmTest* CreateTest(const std::string& testName); @@ -669,11 +663,6 @@ public: */ cmTest* GetTest(const std::string& testName) const; - /** - * Get a list of macros as a ; separated string - */ - void GetListOfMacros(std::string& macros) const; - /** * Return a location of a file in cmake or custom modules directory */ @@ -909,8 +898,6 @@ private: std::stack LoopBlockCounter; - std::vector MacrosList; - mutable cmsys::RegularExpression cmDefineRegex; mutable cmsys::RegularExpression cmDefine01Regex; mutable cmsys::RegularExpression cmAtVarRegex; From 4572d8b34e5ac0985dc3beaefbe9dde514aa0ff4 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 19 Jul 2015 18:17:16 +0200 Subject: [PATCH 0366/1048] KDE4: Find the Internal package with NO_POLICY_SCOPE. If someone in KDE wants to port away from OLD policies, they might want to do so one policy at a time. This patch will allow them to use find_package(KDE4 NO_POLICY_SCOPE) in callers to get around the CMP0011 warning, while still getting the policy settings contained within. --- Modules/FindKDE4.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/FindKDE4.cmake b/Modules/FindKDE4.cmake index 3c2c30987..55301667b 100644 --- a/Modules/FindKDE4.cmake +++ b/Modules/FindKDE4.cmake @@ -105,7 +105,7 @@ if (KDE4_DATA_DIR) endif () # use FindKDE4Internal.cmake to do the rest - find_package(KDE4Internal ${_req} ${_quiet}) + find_package(KDE4Internal ${_req} ${_quiet} NO_POLICY_SCOPE) else () if (KDE4_FIND_REQUIRED) message(FATAL_ERROR "ERROR: cmake/modules/FindKDE4Internal.cmake not found in ${_data_DIR}") From 04b45acc3dbaffc1938ce7dd65aea8466683fdc8 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Mon, 20 Jul 2015 00:01:05 -0400 Subject: [PATCH 0367/1048] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 698f7f3c5..ef65b096a 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 3) -set(CMake_VERSION_PATCH 20150719) +set(CMake_VERSION_PATCH 20150720) #set(CMake_VERSION_RC 1) From 533798275cd9cfff0fce8080b199918e870c8393 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Tue, 21 Jul 2015 00:01:05 -0400 Subject: [PATCH 0368/1048] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index ef65b096a..ebceff949 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 3) -set(CMake_VERSION_PATCH 20150720) +set(CMake_VERSION_PATCH 20150721) #set(CMake_VERSION_RC 1) From dec8d1ccf895195b8a2db72685948607c7c085f7 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 21 Jul 2015 09:23:42 -0400 Subject: [PATCH 0369/1048] Help: Add notes for topic 'doc-CMakeExpandImportedTargets-deprecated' --- .../dev/doc-CMakeExpandImportedTargets-deprecated.rst | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 Help/release/dev/doc-CMakeExpandImportedTargets-deprecated.rst diff --git a/Help/release/dev/doc-CMakeExpandImportedTargets-deprecated.rst b/Help/release/dev/doc-CMakeExpandImportedTargets-deprecated.rst new file mode 100644 index 000000000..3bdaebeb6 --- /dev/null +++ b/Help/release/dev/doc-CMakeExpandImportedTargets-deprecated.rst @@ -0,0 +1,5 @@ +doc-CMakeExpandImportedTargets-deprecated +----------------------------------------- + +* The :module:`CMakeExpandImportedTargets` module is now documented + as deprecated. See module documentation for an explanation. From 23876eda9f1d4b5725407aef7d218fc3ce4113cb Mon Sep 17 00:00:00 2001 From: Ralf Habacker Date: Tue, 21 Jul 2015 18:10:16 +0200 Subject: [PATCH 0370/1048] FindBZip2: Check BZIP2_NEED_PREFIX with real prototype Run our check for the '_' prefix using a bzip2 API function as declared with a prototype in the real header file. This is needed in case the function is provided in a DLL import library where the symbol name may not match without proper markup from the header. --- Modules/FindBZip2.cmake | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Modules/FindBZip2.cmake b/Modules/FindBZip2.cmake index b4793327d..6af42ddb5 100644 --- a/Modules/FindBZip2.cmake +++ b/Modules/FindBZip2.cmake @@ -56,11 +56,13 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(BZip2 VERSION_VAR BZIP2_VERSION_STRING) if (BZIP2_FOUND) - include(${CMAKE_CURRENT_LIST_DIR}/CheckLibraryExists.cmake) + include(${CMAKE_CURRENT_LIST_DIR}/CheckSymbolExists.cmake) include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake) cmake_push_check_state() set(CMAKE_REQUIRED_QUIET ${BZip2_FIND_QUIETLY}) - CHECK_LIBRARY_EXISTS("${BZIP2_LIBRARIES}" BZ2_bzCompressInit "" BZIP2_NEED_PREFIX) + set(CMAKE_REQUIRED_INCLUDES ${BZIP2_INCLUDE_DIR}) + set(CMAKE_REQUIRED_LIBRARIES ${BZIP2_LIBRARIES}) + CHECK_SYMBOL_EXISTS(BZ2_bzCompressInit "bzlib.h" BZIP2_NEED_PREFIX) cmake_pop_check_state() endif () From 45c5f8cad2f95ccfada50e1b65e56918f3c6c5c4 Mon Sep 17 00:00:00 2001 From: Clifford Yapp Date: Tue, 21 Jul 2015 11:57:22 -0400 Subject: [PATCH 0371/1048] Add SOURCE_DIR and BINARY_DIR target properties This will allow project code to recover the directory information about where a target was created. --- Help/manual/cmake-properties.7.rst | 2 ++ Help/prop_tgt/BINARY_DIR.rst | 6 ++++++ Help/prop_tgt/SOURCE_DIR.rst | 6 ++++++ Help/release/dev/target-directory-properties.rst | 5 +++++ Source/cmTarget.cxx | 12 ++++++++++++ .../get_property/target_properties-stderr.txt | 6 +++++- Tests/RunCMake/get_property/target_properties.cmake | 2 ++ 7 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 Help/prop_tgt/BINARY_DIR.rst create mode 100644 Help/prop_tgt/SOURCE_DIR.rst create mode 100644 Help/release/dev/target-directory-properties.rst diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index 1d27a640d..ac893c256 100644 --- a/Help/manual/cmake-properties.7.rst +++ b/Help/manual/cmake-properties.7.rst @@ -114,6 +114,7 @@ Properties on Targets /prop_tgt/AUTOUIC_OPTIONS /prop_tgt/AUTORCC /prop_tgt/AUTORCC_OPTIONS + /prop_tgt/BINARY_DIR /prop_tgt/BUILD_WITH_INSTALL_RPATH /prop_tgt/BUNDLE_EXTENSION /prop_tgt/BUNDLE @@ -244,6 +245,7 @@ Properties on Targets /prop_tgt/RUNTIME_OUTPUT_NAME_CONFIG /prop_tgt/RUNTIME_OUTPUT_NAME /prop_tgt/SKIP_BUILD_RPATH + /prop_tgt/SOURCE_DIR /prop_tgt/SOURCES /prop_tgt/SOVERSION /prop_tgt/STATIC_LIBRARY_FLAGS_CONFIG diff --git a/Help/prop_tgt/BINARY_DIR.rst b/Help/prop_tgt/BINARY_DIR.rst new file mode 100644 index 000000000..246f7e605 --- /dev/null +++ b/Help/prop_tgt/BINARY_DIR.rst @@ -0,0 +1,6 @@ +BINARY_DIR +---------- + +This read-only property reports the value of the +:variable:`CMAKE_CURRENT_BINARY_DIR` variable in the directory in which +the target was defined. diff --git a/Help/prop_tgt/SOURCE_DIR.rst b/Help/prop_tgt/SOURCE_DIR.rst new file mode 100644 index 000000000..b25813bff --- /dev/null +++ b/Help/prop_tgt/SOURCE_DIR.rst @@ -0,0 +1,6 @@ +SOURCE_DIR +---------- + +This read-only property reports the value of the +:variable:`CMAKE_CURRENT_SOURCE_DIR` variable in the directory in which +the target was defined. diff --git a/Help/release/dev/target-directory-properties.rst b/Help/release/dev/target-directory-properties.rst new file mode 100644 index 000000000..5ab293853 --- /dev/null +++ b/Help/release/dev/target-directory-properties.rst @@ -0,0 +1,5 @@ +target-directory-properties +--------------------------- + +* The :prop_tgt:`SOURCE_DIR` and :prop_tgt:`BINARY_DIR` target properties + were introduced to allow project code to query where a target is defined. diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 46e9ed4a1..3d8adae9e 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -2959,6 +2959,8 @@ const char *cmTarget::GetProperty(const std::string& prop, MAKE_STATIC_PROP(COMPILE_DEFINITIONS); MAKE_STATIC_PROP(IMPORTED); MAKE_STATIC_PROP(NAME); + MAKE_STATIC_PROP(BINARY_DIR); + MAKE_STATIC_PROP(SOURCE_DIR); MAKE_STATIC_PROP(SOURCES); #undef MAKE_STATIC_PROP if(specialProps.empty()) @@ -2971,6 +2973,8 @@ const char *cmTarget::GetProperty(const std::string& prop, specialProps.insert(propCOMPILE_DEFINITIONS); specialProps.insert(propIMPORTED); specialProps.insert(propNAME); + specialProps.insert(propBINARY_DIR); + specialProps.insert(propSOURCE_DIR); specialProps.insert(propSOURCES); } if(specialProps.count(prop)) @@ -3053,6 +3057,14 @@ const char *cmTarget::GetProperty(const std::string& prop, { return this->GetName().c_str(); } + else if (prop == propBINARY_DIR) + { + return this->GetMakefile()->GetCurrentBinaryDirectory(); + } + else if (prop == propSOURCE_DIR) + { + return this->GetMakefile()->GetCurrentSourceDirectory(); + } else if(prop == propSOURCES) { if (this->Internal->SourceEntries.empty()) diff --git a/Tests/RunCMake/get_property/target_properties-stderr.txt b/Tests/RunCMake/get_property/target_properties-stderr.txt index d0981ac7e..6b3c6ca1b 100644 --- a/Tests/RunCMake/get_property/target_properties-stderr.txt +++ b/Tests/RunCMake/get_property/target_properties-stderr.txt @@ -3,4 +3,8 @@ get_property: --><-- get_target_property: -->value<-- get_property: -->value<-- get_target_property: -->gtp_val-NOTFOUND<-- -get_property: --><--$ +get_property: --><-- +get_target_property: -->(.*)/Tests/RunCMake/get_property<-- +get_property: -->(.*)/Tests/RunCMake/get_property<-- +get_target_property: -->(.*)/Tests/RunCMake/get_property/target_properties-build<-- +get_property: -->(.*)/Tests/RunCMake/get_property/target_properties-build<--$ diff --git a/Tests/RunCMake/get_property/target_properties.cmake b/Tests/RunCMake/get_property/target_properties.cmake index c5a141d45..9ff833a67 100644 --- a/Tests/RunCMake/get_property/target_properties.cmake +++ b/Tests/RunCMake/get_property/target_properties.cmake @@ -14,3 +14,5 @@ set_target_properties(tgt PROPERTIES empty "" custom value) check_target_property(tgt empty) check_target_property(tgt custom) check_target_property(tgt noexist) +check_target_property(tgt SOURCE_DIR) +check_target_property(tgt BINARY_DIR) From 3b09398ae27f0e4b5975920ac2787427ffc6ccc4 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 21 Jul 2015 14:27:00 -0400 Subject: [PATCH 0372/1048] Tests: Teach RunCMake.export to enable languages only when needed --- Tests/RunCMake/export/AppendExport-stderr.txt | 2 +- Tests/RunCMake/export/AppendExport.cmake | 1 + Tests/RunCMake/export/CMakeLists.txt | 2 +- Tests/RunCMake/export/OldIface-stderr.txt | 2 +- Tests/RunCMake/export/OldIface.cmake | 1 + 5 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Tests/RunCMake/export/AppendExport-stderr.txt b/Tests/RunCMake/export/AppendExport-stderr.txt index 6e385d495..d71620e5f 100644 --- a/Tests/RunCMake/export/AppendExport-stderr.txt +++ b/Tests/RunCMake/export/AppendExport-stderr.txt @@ -1,4 +1,4 @@ -CMake Error at AppendExport.cmake:8 \(export\): +CMake Error at AppendExport.cmake:[0-9]+ \(export\): export EXPORT signature does not recognise the APPEND option. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/export/AppendExport.cmake b/Tests/RunCMake/export/AppendExport.cmake index f36010b6a..2a99dfce4 100644 --- a/Tests/RunCMake/export/AppendExport.cmake +++ b/Tests/RunCMake/export/AppendExport.cmake @@ -1,3 +1,4 @@ +enable_language(CXX) add_library(foo empty.cpp) export(TARGETS foo FILE "${CMAKE_CURRENT_BINARY_DIR}/foo.cmake") install(TARGETS foo EXPORT fooExport diff --git a/Tests/RunCMake/export/CMakeLists.txt b/Tests/RunCMake/export/CMakeLists.txt index be9d4038d..12cd3c775 100644 --- a/Tests/RunCMake/export/CMakeLists.txt +++ b/Tests/RunCMake/export/CMakeLists.txt @@ -1,3 +1,3 @@ cmake_minimum_required(VERSION 2.8.4) -project(${RunCMake_TEST}) +project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/export/OldIface-stderr.txt b/Tests/RunCMake/export/OldIface-stderr.txt index afb4ae3ac..818c2cb20 100644 --- a/Tests/RunCMake/export/OldIface-stderr.txt +++ b/Tests/RunCMake/export/OldIface-stderr.txt @@ -1,4 +1,4 @@ -CMake Error at OldIface.cmake:8 \(export\): +CMake Error at OldIface.cmake:[0-9]+ \(export\): export EXPORT signature does not recognise the EXPORT_LINK_INTERFACE_LIBRARIES option. Call Stack \(most recent call first\): diff --git a/Tests/RunCMake/export/OldIface.cmake b/Tests/RunCMake/export/OldIface.cmake index 5fb8e259d..833b023d1 100644 --- a/Tests/RunCMake/export/OldIface.cmake +++ b/Tests/RunCMake/export/OldIface.cmake @@ -1,3 +1,4 @@ +enable_language(CXX) add_library(foo empty.cpp) export(TARGETS foo FILE "${CMAKE_CURRENT_BINARY_DIR}/foo.cmake") install(TARGETS foo EXPORT fooExport From 7e9f908ef54a3c2fe42ae8f9376c77e5bc988a9a Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 21 Jul 2015 14:37:20 -0400 Subject: [PATCH 0373/1048] export: Reject custom target exports earlier (#15657) Diagnose and reject custom targets given to the export() command immediately. Previously we would generate an internal error later. --- Source/cmExportCommand.cxx | 6 ++++++ Tests/RunCMake/export/CustomTarget-result.txt | 1 + Tests/RunCMake/export/CustomTarget-stderr.txt | 4 ++++ Tests/RunCMake/export/CustomTarget.cmake | 2 ++ Tests/RunCMake/export/RunCMakeTest.cmake | 1 + 5 files changed, 14 insertions(+) create mode 100644 Tests/RunCMake/export/CustomTarget-result.txt create mode 100644 Tests/RunCMake/export/CustomTarget-stderr.txt create mode 100644 Tests/RunCMake/export/CustomTarget.cmake diff --git a/Source/cmExportCommand.cxx b/Source/cmExportCommand.cxx index 43d26f9e4..96ea77b2d 100644 --- a/Source/cmExportCommand.cxx +++ b/Source/cmExportCommand.cxx @@ -177,6 +177,12 @@ bool cmExportCommand this->SetError(e.str()); return false; } + if (target->GetType() == cmTarget::UTILITY) + { + this->SetError("given custom target \"" + *currentTarget + + "\" which may not be exported."); + return false; + } } else { diff --git a/Tests/RunCMake/export/CustomTarget-result.txt b/Tests/RunCMake/export/CustomTarget-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/export/CustomTarget-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/export/CustomTarget-stderr.txt b/Tests/RunCMake/export/CustomTarget-stderr.txt new file mode 100644 index 000000000..57a9af368 --- /dev/null +++ b/Tests/RunCMake/export/CustomTarget-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at CustomTarget.cmake:[0-9]+ \(export\): + export given custom target "CustomTarget" which may not be exported. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/export/CustomTarget.cmake b/Tests/RunCMake/export/CustomTarget.cmake new file mode 100644 index 000000000..4d2bf18db --- /dev/null +++ b/Tests/RunCMake/export/CustomTarget.cmake @@ -0,0 +1,2 @@ +add_custom_target(CustomTarget) +export(TARGETS CustomTarget FILE somefile.cmake) diff --git a/Tests/RunCMake/export/RunCMakeTest.cmake b/Tests/RunCMake/export/RunCMakeTest.cmake index 4b04f1858..6d0b7ca7c 100644 --- a/Tests/RunCMake/export/RunCMakeTest.cmake +++ b/Tests/RunCMake/export/RunCMakeTest.cmake @@ -1,5 +1,6 @@ include(RunCMake) +run_cmake(CustomTarget) run_cmake(TargetNotFound) run_cmake(AppendExport) run_cmake(OldIface) From 91d24972865be24355005fbb876eca6306a39ea5 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Wed, 22 Jul 2015 00:01:06 -0400 Subject: [PATCH 0374/1048] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index ebceff949..2b8be770f 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 3) -set(CMake_VERSION_PATCH 20150721) +set(CMake_VERSION_PATCH 20150722) #set(CMake_VERSION_RC 1) From 8ea0b81d20d3fff15e4aa35d68945cb1f0f011ec Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 18 Jul 2015 10:45:18 +0200 Subject: [PATCH 0375/1048] cmAlgorithms: Rename cmRange to cmMakeRange. --- Source/cmAlgorithms.h | 4 ++-- Source/cmFileCommand.cxx | 2 +- Source/cmFindBase.cxx | 4 ++-- Source/cmFunctionCommand.cxx | 2 +- Source/cmListCommand.cxx | 12 ++++++------ Source/cmLocalUnixMakefileGenerator3.cxx | 2 +- Source/cmMacroCommand.cxx | 2 +- Source/cmMakefile.cxx | 2 +- Source/cmMessageCommand.cxx | 2 +- Source/cmOutputConverter.cxx | 2 +- Source/cmSetCommand.cxx | 2 +- Source/cmStringCommand.cxx | 12 ++++++------ Source/cmTarget.cxx | 2 +- Source/cmcmd.cxx | 9 +++++---- 14 files changed, 30 insertions(+), 29 deletions(-) diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h index f117475e9..5013e7425 100644 --- a/Source/cmAlgorithms.h +++ b/Source/cmAlgorithms.h @@ -179,14 +179,14 @@ private: } template -ContainerAlgorithms::Range cmRange(Iter1 begin, Iter2 end) +ContainerAlgorithms::Range cmMakeRange(Iter1 begin, Iter2 end) { return ContainerAlgorithms::Range(begin, end); } template ContainerAlgorithms::Range -cmRange(Range const& range) +cmMakeRange(Range const& range) { return ContainerAlgorithms::Range( range.begin(), range.end()); diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 3d84f3827..0daed66c2 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -270,7 +270,7 @@ bool cmFileCommand::HandleWriteCommand(std::vector const& args, this->SetError(error); return false; } - std::string message = cmJoin(cmRange(i, args.end()), std::string()); + std::string message = cmJoin(cmMakeRange(i, args.end()), std::string()); file << message; file.close(); if(mode) diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx index add06a730..7959ffe3b 100644 --- a/Source/cmFindBase.cxx +++ b/Source/cmFindBase.cxx @@ -170,8 +170,8 @@ bool cmFindBase::ParseArguments(std::vector const& argsIn) else { this->VariableDocumentation += "one of the "; - this->VariableDocumentation += cmJoin(cmRange(this->Names).retreat(1), - ", "); + this->VariableDocumentation += + cmJoin(cmMakeRange(this->Names).retreat(1), ", "); this->VariableDocumentation += " or " + this->Names[this->Names.size() - 1] + " libraries be found"; } diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx index 78853ceba..c883ad743 100644 --- a/Source/cmFunctionCommand.cxx +++ b/Source/cmFunctionCommand.cxx @@ -125,7 +125,7 @@ bool cmFunctionHelperCommand::InvokeInitialPass std::string argvDef = cmJoin(expandedArgs, ";"); std::vector::const_iterator eit = expandedArgs.begin() + (this->Args.size()-1); - std::string argnDef = cmJoin(cmRange(eit, expandedArgs.end()), ";"); + std::string argnDef = cmJoin(cmMakeRange(eit, expandedArgs.end()), ";"); this->Makefile->AddDefinition("ARGV", argvDef.c_str()); this->Makefile->MarkVariableAsUsed("ARGV"); this->Makefile->AddDefinition("ARGN", argnDef.c_str()); diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx index f96b4a824..6041fb77d 100644 --- a/Source/cmListCommand.cxx +++ b/Source/cmListCommand.cxx @@ -247,7 +247,7 @@ bool cmListCommand::HandleAppendCommand(std::vector const& args) { listString += ";"; } - listString += cmJoin(cmRange(args).advance(2), ";"); + listString += cmJoin(cmMakeRange(args).advance(2), ";"); this->Makefile->AddDefinition(listName, listString.c_str()); return true; @@ -361,9 +361,9 @@ bool cmListCommand std::vector::const_iterator remBegin = remove.begin(); std::vector::const_iterator argsEnd = - cmRemoveMatching(varArgsExpanded, cmRange(remBegin, remEnd)); + cmRemoveMatching(varArgsExpanded, cmMakeRange(remBegin, remEnd)); std::vector::const_iterator argsBegin = varArgsExpanded.begin(); - std::string value = cmJoin(cmRange(argsBegin, argsEnd), ";"); + std::string value = cmJoin(cmMakeRange(argsBegin, argsEnd), ";"); this->Makefile->AddDefinition(listName, value.c_str()); return true; } @@ -421,7 +421,7 @@ bool cmListCommand cmRemoveDuplicates(varArgsExpanded); std::vector::const_iterator argsBegin = varArgsExpanded.begin(); - std::string value = cmJoin(cmRange(argsBegin, argsEnd), ";"); + std::string value = cmJoin(cmMakeRange(argsBegin, argsEnd), ";"); this->Makefile->AddDefinition(listName, value.c_str()); return true; @@ -509,9 +509,9 @@ bool cmListCommand::HandleRemoveAtCommand( std::vector::const_iterator remBegin = removed.begin(); std::vector::const_iterator argsEnd = - cmRemoveIndices(varArgsExpanded, cmRange(remBegin, remEnd)); + cmRemoveIndices(varArgsExpanded, cmMakeRange(remBegin, remEnd)); std::vector::const_iterator argsBegin = varArgsExpanded.begin(); - std::string value = cmJoin(cmRange(argsBegin, argsEnd), ";"); + std::string value = cmJoin(cmMakeRange(argsBegin, argsEnd), ";"); this->Makefile->AddDefinition(listName, value.c_str()); return true; diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 077d4d93a..ca4d359ce 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -2259,7 +2259,7 @@ cmLocalUnixMakefileGenerator3::ConvertToQuotedOutputPath(const char* p, std::string()); std::vector::const_iterator compStart = components.begin() + 1; - result += cmJoin(cmRange(compStart, compEnd), slash); + result += cmJoin(cmMakeRange(compStart, compEnd), slash); // Only the last component can be empty to avoid double slashes. result += slash; result += components.back(); diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx index fa5a62354..e4026b084 100644 --- a/Source/cmMacroCommand.cxx +++ b/Source/cmMacroCommand.cxx @@ -107,7 +107,7 @@ bool cmMacroHelperCommand::InvokeInitialPass std::vector::const_iterator eit = expandedArgs.begin() + (this->Args.size() - 1); - std::string expandedArgn = cmJoin(cmRange(eit, expandedArgs.end()), ";"); + std::string expandedArgn = cmJoin(cmMakeRange(eit, expandedArgs.end()), ";"); std::string expandedArgv = cmJoin(expandedArgs, ";"); std::vector variables; variables.reserve(this->Args.size() - 1); diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index ae69b24b6..e4ecd1fcd 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1427,7 +1427,7 @@ bool cmMakefile::ParseDefineFlag(std::string const& def, bool remove) std::remove(defs.begin(), defs.end(), define); std::vector::const_iterator defBegin = defs.begin(); - std::string ndefs = cmJoin(cmRange(defBegin, defEnd), ";"); + std::string ndefs = cmJoin(cmMakeRange(defBegin, defEnd), ";"); // Store the new list. this->SetProperty("COMPILE_DEFINITIONS", ndefs.c_str()); diff --git a/Source/cmMessageCommand.cxx b/Source/cmMessageCommand.cxx index 0449c501d..2854a82bd 100644 --- a/Source/cmMessageCommand.cxx +++ b/Source/cmMessageCommand.cxx @@ -69,7 +69,7 @@ bool cmMessageCommand ++i; } - std::string message = cmJoin(cmRange(i, args.end()), std::string()); + std::string message = cmJoin(cmMakeRange(i, args.end()), std::string()); if (type != cmake::MESSAGE) { diff --git a/Source/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx index 91f3c0ad5..7be5b3f47 100644 --- a/Source/cmOutputConverter.cxx +++ b/Source/cmOutputConverter.cxx @@ -293,7 +293,7 @@ cmOutputConverter::ConvertToRelativePath(const std::vector& local, { relative += "/"; } - relative += cmJoin(cmRange(remote).advance(common), "/"); + relative += cmJoin(cmMakeRange(remote).advance(common), "/"); // Finally return the path. return relative; diff --git a/Source/cmSetCommand.cxx b/Source/cmSetCommand.cxx index bf9f42c8a..306276bba 100644 --- a/Source/cmSetCommand.cxx +++ b/Source/cmSetCommand.cxx @@ -108,7 +108,7 @@ bool cmSetCommand } // collect any values into a single semi-colon separated value list - value = cmJoin(cmRange(args).advance(1).retreat(ignoreLastArgs), ";"); + value = cmJoin(cmMakeRange(args).advance(1).retreat(ignoreLastArgs), ";"); if (parentScope) { diff --git a/Source/cmStringCommand.cxx b/Source/cmStringCommand.cxx index efc1f1627..649fb3933 100644 --- a/Source/cmStringCommand.cxx +++ b/Source/cmStringCommand.cxx @@ -319,7 +319,7 @@ bool cmStringCommand::RegexMatch(std::vector const& args) } // Concatenate all the last arguments together. - std::string input = cmJoin(cmRange(args).advance(4), std::string()); + std::string input = cmJoin(cmMakeRange(args).advance(4), std::string()); // Scan through the input for all matches. std::string output; @@ -365,7 +365,7 @@ bool cmStringCommand::RegexMatchAll(std::vector const& args) } // Concatenate all the last arguments together. - std::string input = cmJoin(cmRange(args).advance(4), std::string()); + std::string input = cmJoin(cmMakeRange(args).advance(4), std::string()); // Scan through the input for all matches. std::string output; @@ -465,7 +465,7 @@ bool cmStringCommand::RegexReplace(std::vector const& args) } // Concatenate all the last arguments together. - std::string input = cmJoin(cmRange(args).advance(5), std::string()); + std::string input = cmJoin(cmMakeRange(args).advance(5), std::string()); // Scan through the input for all matches. std::string output; @@ -665,7 +665,7 @@ bool cmStringCommand::HandleReplaceCommand(std::vector const& const std::string& replaceExpression = args[2]; const std::string& variableName = args[3]; - std::string input = cmJoin(cmRange(args).advance(4), std::string()); + std::string input = cmJoin(cmMakeRange(args).advance(4), std::string()); cmsys::SystemTools::ReplaceString(input, matchExpression.c_str(), replaceExpression.c_str()); @@ -756,7 +756,7 @@ bool cmStringCommand::HandleAppendCommand(std::vector const& args) { value = oldValue; } - value += cmJoin(cmRange(args).advance(2), std::string()); + value += cmJoin(cmMakeRange(args).advance(2), std::string()); this->Makefile->AddDefinition(variable, value.c_str()); return true; } @@ -772,7 +772,7 @@ bool cmStringCommand } std::string const& variableName = args[1]; - std::string value = cmJoin(cmRange(args).advance(2), std::string()); + std::string value = cmJoin(cmMakeRange(args).advance(2), std::string()); this->Makefile->AddDefinition(variableName, value.c_str()); return true; diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 46e9ed4a1..ac3938721 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -6674,7 +6674,7 @@ void cmTarget::CheckPropertyCompatibility(cmComputeLinkInformation *info, } std::sort(props.begin(), props.end()); - std::string propsString = cmJoin(cmRange(props).retreat(1), ", "); + std::string propsString = cmJoin(cmMakeRange(props).retreat(1), ", "); propsString += " and the " + props.back(); std::ostringstream e; diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 63838b49b..71f47f33f 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -335,14 +335,14 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) // Echo string else if (args[1] == "echo" ) { - std::cout << cmJoin(cmRange(args).advance(2), " ") << std::endl; + std::cout << cmJoin(cmMakeRange(args).advance(2), " ") << std::endl; return 0; } // Echo string no new line else if (args[1] == "echo_append" ) { - std::cout << cmJoin(cmRange(args).advance(2), " "); + std::cout << cmJoin(cmMakeRange(args).advance(2), " "); return 0; } @@ -511,7 +511,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) // Clock command else if (args[1] == "time" && args.size() > 2) { - std::string command = cmJoin(cmRange(args).advance(2), " "); + std::string command = cmJoin(cmMakeRange(args).advance(2), " "); clock_t clock_start, clock_finish; time_t time_start, time_finish; @@ -572,7 +572,8 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) return 1; } - std::string command = cmWrap('"', cmRange(args).advance(3), '"', " "); + std::string command = + cmWrap('"', cmMakeRange(args).advance(3), '"', " "); int retval = 0; int timeout = 0; if ( cmSystemTools::RunSingleCommand(command.c_str(), 0, 0, &retval, From 1fe71e2ef04e20ff8e1de888820496fc922bffe0 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 18 Jul 2015 10:47:04 +0200 Subject: [PATCH 0376/1048] cmAlgorithms: Move Range type out of private namespace. --- Source/cmAlgorithms.h | 72 +++++++++++++++++++++---------------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h index 5013e7425..a4447ad50 100644 --- a/Source/cmAlgorithms.h +++ b/Source/cmAlgorithms.h @@ -122,35 +122,6 @@ struct DefaultDeleter } }; -template -struct Range -{ - typedef const_iterator_ const_iterator; - typedef typename std::iterator_traits::value_type value_type; - typedef typename std::iterator_traits::difference_type - difference_type; - Range(const_iterator begin_, const_iterator end_) - : Begin(begin_), End(end_) {} - const_iterator begin() const { return Begin; } - const_iterator end() const { return End; } - bool empty() const { return std::distance(Begin, End) == 0; } - difference_type size() const { return std::distance(Begin, End); } - Range& advance(cmIML_INT_intptr_t amount) - { - std::advance(Begin, amount); - return *this; - } - - Range& retreat(cmIML_INT_intptr_t amount) - { - std::advance(End, -amount); - return *this; - } -private: - const_iterator Begin; - const_iterator End; -}; - template FwdIt RemoveN(FwdIt i1, FwdIt i2, size_t n) { @@ -178,17 +149,46 @@ private: } -template -ContainerAlgorithms::Range cmMakeRange(Iter1 begin, Iter2 end) +template +struct cmRange { - return ContainerAlgorithms::Range(begin, end); + typedef const_iterator_ const_iterator; + typedef typename std::iterator_traits::value_type value_type; + typedef typename std::iterator_traits::difference_type + difference_type; + cmRange(const_iterator begin_, const_iterator end_) + : Begin(begin_), End(end_) {} + const_iterator begin() const { return Begin; } + const_iterator end() const { return End; } + bool empty() const { return std::distance(Begin, End) == 0; } + difference_type size() const { return std::distance(Begin, End); } + cmRange& advance(cmIML_INT_intptr_t amount) + { + std::advance(Begin, amount); + return *this; + } + + cmRange& retreat(cmIML_INT_intptr_t amount) + { + std::advance(End, -amount); + return *this; + } +private: + const_iterator Begin; + const_iterator End; +}; + +template +cmRange cmMakeRange(Iter1 begin, Iter2 end) +{ + return cmRange(begin, end); } template -ContainerAlgorithms::Range +cmRange cmMakeRange(Range const& range) { - return ContainerAlgorithms::Range( + return cmRange( range.begin(), range.end()); } @@ -350,10 +350,10 @@ typename Range::const_iterator cmFindNot(Range const& r, T const& t) } template -ContainerAlgorithms::Range +cmRange cmReverseRange(Range const& range) { - return ContainerAlgorithms::Range( + return cmRange( range.rbegin(), range.rend()); } From 783c375766b1e5656dd34dd99281fceb7ed7aab2 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 22 Jul 2015 11:15:20 -0400 Subject: [PATCH 0377/1048] Tests: Extend BuildDepends test to cover OBJECT_DEPENDS The actual file timestamp dependency is known to not work on Visual Studio or Xcode generators. Tolerate such failure for these generators (Tests/CustomCommand already covers using OBJECT_DEPENDS to pull a custom command into a target, and that still works with these generators). --- Tests/BuildDepends/CMakeLists.txt | 19 +++++++++++++++++++ Tests/BuildDepends/Project/CMakeLists.txt | 12 ++++++++++++ Tests/BuildDepends/Project/object_depends.cxx | 1 + .../Project/object_depends_check.cmake | 7 +++++++ 4 files changed, 39 insertions(+) create mode 100644 Tests/BuildDepends/Project/object_depends.cxx create mode 100644 Tests/BuildDepends/Project/object_depends_check.cmake diff --git a/Tests/BuildDepends/CMakeLists.txt b/Tests/BuildDepends/CMakeLists.txt index 2be59b61c..7b7353c7d 100644 --- a/Tests/BuildDepends/CMakeLists.txt +++ b/Tests/BuildDepends/CMakeLists.txt @@ -69,6 +69,9 @@ file(WRITE ${BuildDepends_BINARY_DIR}/Project/link_depends_no_shared_exe.h "#define link_depends_no_shared_exe_value 0\n") set(link_depends_no_shared_check_txt ${BuildDepends_BINARY_DIR}/Project/link_depends_no_shared_check.txt) +file(WRITE ${BuildDepends_BINARY_DIR}/Project/object_depends.txt "0\n") +set(object_depends_check_txt ${BuildDepends_BINARY_DIR}/Project/object_depends_check.txt) + file(WRITE ${BuildDepends_BINARY_DIR}/Project/external.in "external original\n") file(WRITE ${BuildDepends_BINARY_DIR}/Project/multi1-in.txt "multi1-in original\n") file(WRITE ${BuildDepends_BINARY_DIR}/Project/multi2-stamp.txt "multi2-stamp original\n") @@ -246,6 +249,8 @@ file(WRITE ${BuildDepends_BINARY_DIR}/Project/zot_macro_tgt.hxx file(WRITE ${BuildDepends_BINARY_DIR}/Project/link_depends_no_shared_lib.h "#define link_depends_no_shared_lib_value 0\n") +file(WRITE ${BuildDepends_BINARY_DIR}/Project/object_depends.txt "1\n") + if(TEST_LINK_DEPENDS) file(WRITE ${TEST_LINK_DEPENDS} "2") endif() @@ -359,6 +364,20 @@ else() "Targets link_depends_no_shared_lib and link_depends_no_shared_exe not both built.") endif() +if(EXISTS "${object_depends_check_txt}") + file(STRINGS "${object_depends_check_txt}" object_depends_check LIMIT_COUNT 1) + if("${object_depends_check}" STREQUAL "1") + message(STATUS "object_depends exe is newer than object_depends.txt as expected.") + elseif(CMAKE_GENERATOR MATCHES "Visual Studio|Xcode") + message(STATUS "Known limitation: OBJECT_DEPENDS does not work on ${CMAKE_GENERATOR}") + else() + message(SEND_ERROR "Project did not rebuild properly: object_depends exe is not newer than object_depends.txt.") + endif() +else() + message(SEND_ERROR "Project did not rebuild properly. " + "object_depends exe and object_depends.txt are not both present.") +endif() + if(EXISTS ${BuildDepends_BINARY_DIR}/Project/external.out) file(STRINGS ${BuildDepends_BINARY_DIR}/Project/external.out external_out) if("${external_out}" STREQUAL "external changed") diff --git a/Tests/BuildDepends/Project/CMakeLists.txt b/Tests/BuildDepends/Project/CMakeLists.txt index 0db39c577..3aa57fc9e 100644 --- a/Tests/BuildDepends/Project/CMakeLists.txt +++ b/Tests/BuildDepends/Project/CMakeLists.txt @@ -182,3 +182,15 @@ if(TEST_MULTI3) set_property(SOURCE multi3-real.txt multi3-dummy.txt PROPERTY SYMBOLIC 1) add_custom_target(multi3 ALL DEPENDS multi3-real.txt) endif() + +add_executable(object_depends object_depends.cxx) +set_property(SOURCE object_depends.cxx PROPERTY OBJECT_DEPENDS + ${CMAKE_CURRENT_BINARY_DIR}/object_depends.txt) +add_custom_target(object_depends_check ALL + COMMAND ${CMAKE_COMMAND} + -Dexe=$ + -Dout=${CMAKE_CURRENT_BINARY_DIR}/object_depends_check.txt + -Dtxt=${CMAKE_CURRENT_BINARY_DIR}/object_depends.txt + -P ${CMAKE_CURRENT_SOURCE_DIR}/object_depends_check.cmake + ) +add_dependencies(object_depends_check object_depends) diff --git a/Tests/BuildDepends/Project/object_depends.cxx b/Tests/BuildDepends/Project/object_depends.cxx new file mode 100644 index 000000000..76e819701 --- /dev/null +++ b/Tests/BuildDepends/Project/object_depends.cxx @@ -0,0 +1 @@ +int main() { return 0; } diff --git a/Tests/BuildDepends/Project/object_depends_check.cmake b/Tests/BuildDepends/Project/object_depends_check.cmake new file mode 100644 index 000000000..e00989288 --- /dev/null +++ b/Tests/BuildDepends/Project/object_depends_check.cmake @@ -0,0 +1,7 @@ +if(NOT EXISTS "${txt}" OR NOT EXISTS "${exe}") + file(REMOVE "${out}") +elseif("${exe}" IS_NEWER_THAN "${txt}") + file(WRITE "${out}" "1\n") +else() + file(WRITE "${out}" "0\n") +endif() From b19587e7d7ff90a25d1a75fc987d911d966d77f6 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 8 Jul 2015 22:57:54 +0200 Subject: [PATCH 0378/1048] cmMakefile: Remove some references from APIs. --- Source/cmMakefile.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 2fc4d78a8..d9dd46668 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -746,15 +746,15 @@ public: /** Set whether or not to report a CMP0000 violation. */ void SetCheckCMP0000(bool b) { this->CheckCMP0000 = b; } - const std::vector& GetIncludeDirectoriesEntries() const + std::vector GetIncludeDirectoriesEntries() const { return this->IncludeDirectoriesEntries; } - const std::vector& GetCompileOptionsEntries() const + std::vector GetCompileOptionsEntries() const { return this->CompileOptionsEntries; } - const std::vector& GetCompileDefinitionsEntries() const + std::vector GetCompileDefinitionsEntries() const { return this->CompileDefinitionsEntries; } From a89c02ce3d53aa6459a3d76d9f5c0573da88ceb3 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 8 Jul 2015 22:58:30 +0200 Subject: [PATCH 0379/1048] cmMakefile: Out of line some API. --- Source/cmMakefile.cxx | 15 +++++++++++++++ Source/cmMakefile.h | 15 +++------------ 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index e4ecd1fcd..d5775fbf8 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -273,6 +273,21 @@ void cmMakefile::IssueMessage(cmake::MessageType t, } } +std::vector cmMakefile::GetIncludeDirectoriesEntries() const +{ + return this->IncludeDirectoriesEntries; +} + +std::vector cmMakefile::GetCompileOptionsEntries() const +{ + return this->CompileOptionsEntries; +} + +std::vector cmMakefile::GetCompileDefinitionsEntries() const +{ + return this->CompileDefinitionsEntries; +} + //---------------------------------------------------------------------------- cmListFileBacktrace cmMakefile::GetBacktrace() const { diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index d9dd46668..783658d48 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -746,18 +746,9 @@ public: /** Set whether or not to report a CMP0000 violation. */ void SetCheckCMP0000(bool b) { this->CheckCMP0000 = b; } - std::vector GetIncludeDirectoriesEntries() const - { - return this->IncludeDirectoriesEntries; - } - std::vector GetCompileOptionsEntries() const - { - return this->CompileOptionsEntries; - } - std::vector GetCompileDefinitionsEntries() const - { - return this->CompileDefinitionsEntries; - } + std::vector GetIncludeDirectoriesEntries() const; + std::vector GetCompileOptionsEntries() const; + std::vector GetCompileDefinitionsEntries() const; bool IsConfigured() const { return this->Configured; } void SetConfigured(){ this->Configured = true; } From ef17bbefd7c504af65f2e6c52f5d7fa8e82d087e Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 8 Jul 2015 00:29:41 +0200 Subject: [PATCH 0380/1048] cmMakefile: Separate storage of buildsystem properties and their origins. This simplifies some existing and upcoming algorithms. --- Source/cmMakefile.cxx | 145 ++++++++++++++++++++++++------------------ Source/cmMakefile.h | 9 ++- 2 files changed, 89 insertions(+), 65 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index d5775fbf8..dc8d98323 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -275,17 +275,47 @@ void cmMakefile::IssueMessage(cmake::MessageType t, std::vector cmMakefile::GetIncludeDirectoriesEntries() const { - return this->IncludeDirectoriesEntries; + std::vector entries; + entries.reserve(this->IncludeDirectoriesEntries.size()); + std::vector::const_iterator btIt = + this->IncludeDirectoriesEntryBacktraces.begin(); + for(std::vector::const_iterator it = + this->IncludeDirectoriesEntries.begin(); + it != this->IncludeDirectoriesEntries.end(); ++it, ++btIt) + { + entries.push_back(cmValueWithOrigin(*it, *btIt)); + } + return entries; } std::vector cmMakefile::GetCompileOptionsEntries() const { - return this->CompileOptionsEntries; + std::vector entries; + entries.reserve(this->CompileOptionsEntries.size()); + std::vector::const_iterator btIt = + this->CompileOptionsEntryBacktraces.begin(); + for(std::vector::const_iterator it = + this->CompileOptionsEntries.begin(); + it != this->CompileOptionsEntries.end(); ++it, ++btIt) + { + entries.push_back(cmValueWithOrigin(*it, *btIt)); + } + return entries; } std::vector cmMakefile::GetCompileDefinitionsEntries() const { - return this->CompileDefinitionsEntries; + std::vector entries; + entries.reserve(this->CompileDefinitionsEntries.size()); + std::vector::const_iterator btIt = + this->CompileDefinitionsEntryBacktraces.begin(); + for(std::vector::const_iterator it = + this->CompileDefinitionsEntries.begin(); + it != this->CompileDefinitionsEntries.end(); ++it, ++btIt) + { + entries.push_back(cmValueWithOrigin(*it, *btIt)); + } + return entries; } //---------------------------------------------------------------------------- @@ -1542,23 +1572,32 @@ void cmMakefile::InitializeFromParent(cmMakefile* parent) this->AddDefinition("CMAKE_CURRENT_BINARY_DIR", this->GetCurrentBinaryDirectory()); - const std::vector& parentIncludes = - parent->GetIncludeDirectoriesEntries(); - this->IncludeDirectoriesEntries.insert(this->IncludeDirectoriesEntries.end(), - parentIncludes.begin(), - parentIncludes.end()); + this->IncludeDirectoriesEntries.insert( + this->IncludeDirectoriesEntries.end(), + parent->IncludeDirectoriesEntries.begin(), + parent->IncludeDirectoriesEntries.end()); + this->IncludeDirectoriesEntryBacktraces.insert( + this->IncludeDirectoriesEntryBacktraces.end(), + parent->IncludeDirectoriesEntryBacktraces.begin(), + parent->IncludeDirectoriesEntryBacktraces.end()); - const std::vector& parentOptions = - parent->GetCompileOptionsEntries(); - this->CompileOptionsEntries.insert(this->CompileOptionsEntries.end(), - parentOptions.begin(), - parentOptions.end()); + this->CompileOptionsEntries.insert( + this->CompileOptionsEntries.end(), + parent->CompileOptionsEntries.begin(), + parent->CompileOptionsEntries.end()); + this->CompileOptionsEntryBacktraces.insert( + this->CompileOptionsEntryBacktraces.end(), + parent->CompileOptionsEntryBacktraces.begin(), + parent->CompileOptionsEntryBacktraces.end()); - const std::vector& parentDefines = - parent->GetCompileDefinitionsEntries(); - this->CompileDefinitionsEntries.insert(this->CompileDefinitionsEntries.end(), - parentDefines.begin(), - parentDefines.end()); + this->CompileDefinitionsEntries.insert( + this->CompileDefinitionsEntries.end(), + parent->CompileDefinitionsEntries.begin(), + parent->CompileDefinitionsEntries.end()); + this->CompileDefinitionsEntryBacktraces.insert( + this->CompileDefinitionsEntryBacktraces.end(), + parent->CompileDefinitionsEntryBacktraces.begin(), + parent->CompileDefinitionsEntryBacktraces.end()); this->SystemIncludeDirectories = parent->SystemIncludeDirectories; @@ -1902,13 +1941,18 @@ void cmMakefile::AddIncludeDirectories(const std::vector &incs, return; } - std::vector::iterator position = + std::vector::iterator position = before ? this->IncludeDirectoriesEntries.begin() : this->IncludeDirectoriesEntries.end(); + std::vector::iterator btPos = + this->IncludeDirectoriesEntryBacktraces.begin() + + std::distance(this->IncludeDirectoriesEntries.begin(), position); cmListFileBacktrace lfbt = this->GetBacktrace(); - cmValueWithOrigin entry(cmJoin(incs, ";"), lfbt); - this->IncludeDirectoriesEntries.insert(position, entry); + std::string entryString = cmJoin(incs, ";"); + cmValueWithOrigin entry(entryString, lfbt); + this->IncludeDirectoriesEntries.insert(position, entryString); + this->IncludeDirectoriesEntryBacktraces.insert(btPos, lfbt); // Property on each target: for (cmTargets::iterator l = this->Targets.begin(); @@ -4135,36 +4179,40 @@ void cmMakefile::SetProperty(const std::string& prop, const char* value) if (prop == "INCLUDE_DIRECTORIES") { this->IncludeDirectoriesEntries.clear(); + this->IncludeDirectoriesEntryBacktraces.clear(); if (!value) { return; } cmListFileBacktrace lfbt = this->GetBacktrace(); - this->IncludeDirectoriesEntries.push_back( - cmValueWithOrigin(value, lfbt)); + this->IncludeDirectoriesEntries.push_back(value); + this->IncludeDirectoriesEntryBacktraces.push_back(lfbt); return; } if (prop == "COMPILE_OPTIONS") { this->CompileOptionsEntries.clear(); + this->CompileDefinitionsEntryBacktraces.clear(); if (!value) { return; } cmListFileBacktrace lfbt = this->GetBacktrace(); - this->CompileOptionsEntries.push_back(cmValueWithOrigin(value, lfbt)); + this->CompileOptionsEntries.push_back(value); + this->CompileOptionsEntryBacktraces.push_back(lfbt); return; } if (prop == "COMPILE_DEFINITIONS") { this->CompileDefinitionsEntries.clear(); + this->CompileDefinitionsEntryBacktraces.clear(); if (!value) { return; } cmListFileBacktrace lfbt = this->GetBacktrace(); - cmValueWithOrigin entry(value, lfbt); - this->CompileDefinitionsEntries.push_back(entry); + this->CompileDefinitionsEntries.push_back(value); + this->CompileDefinitionsEntryBacktraces.push_back(lfbt); return; } @@ -4178,22 +4226,22 @@ void cmMakefile::AppendProperty(const std::string& prop, if (prop == "INCLUDE_DIRECTORIES") { cmListFileBacktrace lfbt = this->GetBacktrace(); - this->IncludeDirectoriesEntries.push_back( - cmValueWithOrigin(value, lfbt)); + this->IncludeDirectoriesEntries.push_back(value); + this->IncludeDirectoriesEntryBacktraces.push_back(lfbt); return; } if (prop == "COMPILE_OPTIONS") { cmListFileBacktrace lfbt = this->GetBacktrace(); - this->CompileOptionsEntries.push_back( - cmValueWithOrigin(value, lfbt)); + this->CompileOptionsEntries.push_back(value); + this->CompileOptionsEntryBacktraces.push_back(lfbt); return; } if (prop == "COMPILE_DEFINITIONS") { cmListFileBacktrace lfbt = this->GetBacktrace(); - this->CompileDefinitionsEntries.push_back( - cmValueWithOrigin(value, lfbt)); + this->CompileDefinitionsEntries.push_back(value); + this->CompileDefinitionsEntryBacktraces.push_back(lfbt); return; } @@ -4248,44 +4296,17 @@ const char *cmMakefile::GetProperty(const std::string& prop, } else if (prop == "INCLUDE_DIRECTORIES") { - std::string sep; - for (std::vector::const_iterator - it = this->IncludeDirectoriesEntries.begin(), - end = this->IncludeDirectoriesEntries.end(); - it != end; ++it) - { - output += sep; - output += it->Value; - sep = ";"; - } + output = cmJoin(this->IncludeDirectoriesEntries, ";"); return output.c_str(); } else if (prop == "COMPILE_OPTIONS") { - std::string sep; - for (std::vector::const_iterator - it = this->CompileOptionsEntries.begin(), - end = this->CompileOptionsEntries.end(); - it != end; ++it) - { - output += sep; - output += it->Value; - sep = ";"; - } + output = cmJoin(this->CompileOptionsEntries, ";"); return output.c_str(); } else if (prop == "COMPILE_DEFINITIONS") { - std::string sep; - for (std::vector::const_iterator - it = this->CompileDefinitionsEntries.begin(), - end = this->CompileDefinitionsEntries.end(); - it != end; ++it) - { - output += sep; - output += it->Value; - sep = ";"; - } + output = cmJoin(this->CompileDefinitionsEntries, ";"); return output.c_str(); } diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 783658d48..57dcdb6f0 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -842,9 +842,12 @@ protected: std::vector HeaderFileExtensions; std::string DefineFlags; - std::vector IncludeDirectoriesEntries; - std::vector CompileOptionsEntries; - std::vector CompileDefinitionsEntries; + std::vector IncludeDirectoriesEntries; + std::vector IncludeDirectoriesEntryBacktraces; + std::vector CompileOptionsEntries; + std::vector CompileOptionsEntryBacktraces; + std::vector CompileDefinitionsEntries; + std::vector CompileDefinitionsEntryBacktraces; // Track the value of the computed DEFINITIONS property. void AddDefineFlag(const char*, std::string&); From d6239507b2f08bd1fee53c84af3998a14fa9819b Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 8 Jul 2015 23:11:22 +0200 Subject: [PATCH 0381/1048] cmMakefile: Split accessors for compile definitions and origins. --- Source/cmGlobalGenerator.cxx | 12 ++++++++---- Source/cmMakefile.cxx | 20 ++++++++------------ Source/cmMakefile.h | 3 ++- Source/cmTarget.cxx | 7 ++++--- Source/cmTarget.h | 3 ++- 5 files changed, 24 insertions(+), 21 deletions(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 88ac0bcd4..2c5ed4f9e 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1417,8 +1417,10 @@ void cmGlobalGenerator::FinalizeTargetCompileInfo() { cmMakefile *mf = this->LocalGenerators[i]->GetMakefile(); - const std::vector noconfig_compile_definitions = + const std::vector noconfig_compile_definitions = mf->GetCompileDefinitionsEntries(); + const std::vector noconfig_compile_definitions_bts = + mf->GetCompileDefinitionsBacktraces(); cmTargets& targets = mf->GetTargets(); for(cmTargets::iterator ti = targets.begin(); @@ -1433,11 +1435,13 @@ void cmGlobalGenerator::FinalizeTargetCompileInfo() continue; } - for (std::vector::const_iterator it + std::vector::const_iterator btIt + = noconfig_compile_definitions_bts.begin(); + for (std::vector::const_iterator it = noconfig_compile_definitions.begin(); - it != noconfig_compile_definitions.end(); ++it) + it != noconfig_compile_definitions.end(); ++it, ++btIt) { - t->InsertCompileDefinition(*it); + t->InsertCompileDefinition(*it, *btIt); } cmPolicies::PolicyStatus polSt diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index dc8d98323..c705e7dea 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -303,19 +303,15 @@ std::vector cmMakefile::GetCompileOptionsEntries() const return entries; } -std::vector cmMakefile::GetCompileDefinitionsEntries() const +std::vector cmMakefile::GetCompileDefinitionsEntries() const { - std::vector entries; - entries.reserve(this->CompileDefinitionsEntries.size()); - std::vector::const_iterator btIt = - this->CompileDefinitionsEntryBacktraces.begin(); - for(std::vector::const_iterator it = - this->CompileDefinitionsEntries.begin(); - it != this->CompileDefinitionsEntries.end(); ++it, ++btIt) - { - entries.push_back(cmValueWithOrigin(*it, *btIt)); - } - return entries; + return this->CompileDefinitionsEntries; +} + +std::vector +cmMakefile::GetCompileDefinitionsBacktraces() const +{ + return this->CompileDefinitionsEntryBacktraces; } //---------------------------------------------------------------------------- diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 57dcdb6f0..e69ce1eea 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -748,7 +748,8 @@ public: std::vector GetIncludeDirectoriesEntries() const; std::vector GetCompileOptionsEntries() const; - std::vector GetCompileDefinitionsEntries() const; + std::vector GetCompileDefinitionsEntries() const; + std::vector GetCompileDefinitionsBacktraces() const; bool IsConfigured() const { return this->Configured; } void SetConfigured(){ this->Configured = true; } diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index ac3938721..906517bc1 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -1954,12 +1954,13 @@ void cmTarget::InsertCompileOption(const cmValueWithOrigin &entry, } //---------------------------------------------------------------------------- -void cmTarget::InsertCompileDefinition(const cmValueWithOrigin &entry) +void cmTarget::InsertCompileDefinition(std::string const& entry, + cmListFileBacktrace const& bt) { - cmGeneratorExpression ge(entry.Backtrace); + cmGeneratorExpression ge(bt); this->Internal->CompileDefinitionsEntries.push_back( - new cmTargetInternals::TargetPropertyEntry(ge.Parse(entry.Value))); + new cmTargetInternals::TargetPropertyEntry(ge.Parse(entry))); } //---------------------------------------------------------------------------- diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 192031255..9c9867284 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -576,7 +576,8 @@ public: bool before = false); void InsertCompileOption(const cmValueWithOrigin &entry, bool before = false); - void InsertCompileDefinition(const cmValueWithOrigin &entry); + void InsertCompileDefinition(std::string const& entry, + cmListFileBacktrace const& bt); void AppendBuildInterfaceIncludes(); From b2de25adeda1c37c8d626432df25fce7cd2ab032 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 8 Jul 2015 23:17:16 +0200 Subject: [PATCH 0382/1048] cmMakefile: Split accessors for compile options and origins. --- Source/cmMakefile.cxx | 20 ++++++++------------ Source/cmMakefile.h | 3 ++- Source/cmTarget.cxx | 22 ++++++++++++++-------- Source/cmTarget.h | 5 +++-- Source/cmTargetCompileOptionsCommand.cxx | 3 +-- 5 files changed, 28 insertions(+), 25 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index c705e7dea..8276faa7d 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -288,19 +288,15 @@ std::vector cmMakefile::GetIncludeDirectoriesEntries() const return entries; } -std::vector cmMakefile::GetCompileOptionsEntries() const +std::vector cmMakefile::GetCompileOptionsEntries() const { - std::vector entries; - entries.reserve(this->CompileOptionsEntries.size()); - std::vector::const_iterator btIt = - this->CompileOptionsEntryBacktraces.begin(); - for(std::vector::const_iterator it = - this->CompileOptionsEntries.begin(); - it != this->CompileOptionsEntries.end(); ++it, ++btIt) - { - entries.push_back(cmValueWithOrigin(*it, *btIt)); - } - return entries; + return this->CompileOptionsEntries; +} + +std::vector +cmMakefile::GetCompileOptionsBacktraces() const +{ + return this->CompileOptionsEntryBacktraces; } std::vector cmMakefile::GetCompileDefinitionsEntries() const diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index e69ce1eea..9b216087d 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -747,7 +747,8 @@ public: void SetCheckCMP0000(bool b) { this->CheckCMP0000 = b; } std::vector GetIncludeDirectoriesEntries() const; - std::vector GetCompileOptionsEntries() const; + std::vector GetCompileOptionsEntries() const; + std::vector GetCompileOptionsBacktraces() const; std::vector GetCompileDefinitionsEntries() const; std::vector GetCompileDefinitionsBacktraces() const; diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 906517bc1..0aa66cd8b 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -416,13 +416,18 @@ void cmTarget::SetMakefile(cmMakefile* mf) this->SystemIncludeDirectories.insert(parentSystemIncludes.begin(), parentSystemIncludes.end()); - const std::vector parentOptions = + const std::vector parentOptions = this->Makefile->GetCompileOptionsEntries(); + const std::vector parentOptionsBts = + this->Makefile->GetCompileOptionsBacktraces(); - for (std::vector::const_iterator it - = parentOptions.begin(); it != parentOptions.end(); ++it) + std::vector::const_iterator btIt = + parentOptionsBts.begin(); + for (std::vector::const_iterator it + = parentOptions.begin(); + it != parentOptions.end(); ++it, ++btIt) { - this->InsertCompileOption(*it); + this->InsertCompileOption(*it, *btIt); } } @@ -1940,17 +1945,18 @@ void cmTarget::InsertInclude(const cmValueWithOrigin &entry, } //---------------------------------------------------------------------------- -void cmTarget::InsertCompileOption(const cmValueWithOrigin &entry, - bool before) +void cmTarget::InsertCompileOption(std::string const& entry, + cmListFileBacktrace const& bt, + bool before) { - cmGeneratorExpression ge(entry.Backtrace); + cmGeneratorExpression ge(bt); std::vector::iterator position = before ? this->Internal->CompileOptionsEntries.begin() : this->Internal->CompileOptionsEntries.end(); this->Internal->CompileOptionsEntries.insert(position, - new cmTargetInternals::TargetPropertyEntry(ge.Parse(entry.Value))); + new cmTargetInternals::TargetPropertyEntry(ge.Parse(entry))); } //---------------------------------------------------------------------------- diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 9c9867284..ba3bc5a7a 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -574,8 +574,9 @@ public: const std::string& language) const; void InsertInclude(const cmValueWithOrigin &entry, bool before = false); - void InsertCompileOption(const cmValueWithOrigin &entry, - bool before = false); + void InsertCompileOption(std::string const& entry, + cmListFileBacktrace const& bt, + bool before = false); void InsertCompileDefinition(std::string const& entry, cmListFileBacktrace const& bt); diff --git a/Source/cmTargetCompileOptionsCommand.cxx b/Source/cmTargetCompileOptionsCommand.cxx index a85153dd5..8e86f0f79 100644 --- a/Source/cmTargetCompileOptionsCommand.cxx +++ b/Source/cmTargetCompileOptionsCommand.cxx @@ -50,7 +50,6 @@ bool cmTargetCompileOptionsCommand bool, bool) { cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); - cmValueWithOrigin entry(this->Join(content), lfbt); - tgt->InsertCompileOption(entry); + tgt->InsertCompileOption(this->Join(content), lfbt); return true; } From c7b39d06f9b1b5843682f52992634c8dad22aece Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 8 Jul 2015 23:35:01 +0200 Subject: [PATCH 0383/1048] cmMakefile: Split accessors for include directories and origins. --- Source/cmMakefile.cxx | 24 ++++++++--------- Source/cmMakefile.h | 3 ++- Source/cmTarget.cxx | 27 ++++++++++++-------- Source/cmTarget.h | 3 ++- Source/cmTargetIncludeDirectoriesCommand.cxx | 3 +-- 5 files changed, 31 insertions(+), 29 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 8276faa7d..58d9d7301 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -273,21 +273,18 @@ void cmMakefile::IssueMessage(cmake::MessageType t, } } -std::vector cmMakefile::GetIncludeDirectoriesEntries() const +std::vector cmMakefile::GetIncludeDirectoriesEntries() const { - std::vector entries; - entries.reserve(this->IncludeDirectoriesEntries.size()); - std::vector::const_iterator btIt = - this->IncludeDirectoriesEntryBacktraces.begin(); - for(std::vector::const_iterator it = - this->IncludeDirectoriesEntries.begin(); - it != this->IncludeDirectoriesEntries.end(); ++it, ++btIt) - { - entries.push_back(cmValueWithOrigin(*it, *btIt)); - } - return entries; + return this->IncludeDirectoriesEntries; } +std::vector +cmMakefile::GetIncludeDirectoriesBacktraces() const +{ + return this->IncludeDirectoriesEntryBacktraces; +} + + std::vector cmMakefile::GetCompileOptionsEntries() const { return this->CompileOptionsEntries; @@ -1942,7 +1939,6 @@ void cmMakefile::AddIncludeDirectories(const std::vector &incs, cmListFileBacktrace lfbt = this->GetBacktrace(); std::string entryString = cmJoin(incs, ";"); - cmValueWithOrigin entry(entryString, lfbt); this->IncludeDirectoriesEntries.insert(position, entryString); this->IncludeDirectoriesEntryBacktraces.insert(btPos, lfbt); @@ -1951,7 +1947,7 @@ void cmMakefile::AddIncludeDirectories(const std::vector &incs, l != this->Targets.end(); ++l) { cmTarget &t = l->second; - t.InsertInclude(entry, before); + t.InsertInclude(entryString, lfbt, before); } } diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 9b216087d..8f236af6c 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -746,7 +746,8 @@ public: /** Set whether or not to report a CMP0000 violation. */ void SetCheckCMP0000(bool b) { this->CheckCMP0000 = b; } - std::vector GetIncludeDirectoriesEntries() const; + std::vector GetIncludeDirectoriesEntries() const; + std::vector GetIncludeDirectoriesBacktraces() const; std::vector GetCompileOptionsEntries() const; std::vector GetCompileOptionsBacktraces() const; std::vector GetCompileDefinitionsEntries() const; diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 0aa66cd8b..ac453e2d5 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -402,13 +402,18 @@ void cmTarget::SetMakefile(cmMakefile* mf) { // Initialize the INCLUDE_DIRECTORIES property based on the current value // of the same directory property: - const std::vector parentIncludes = - this->Makefile->GetIncludeDirectoriesEntries(); + const std::vector parentIncludes = + this->Makefile->GetIncludeDirectoriesEntries(); + const std::vector parentIncludesBts = + this->Makefile->GetIncludeDirectoriesBacktraces(); - for (std::vector::const_iterator it - = parentIncludes.begin(); it != parentIncludes.end(); ++it) + std::vector::const_iterator btIt = + parentIncludesBts.begin(); + for (std::vector::const_iterator it + = parentIncludes.begin(); + it != parentIncludes.end(); ++it, ++btIt) { - this->InsertInclude(*it); + this->InsertInclude(*it, *btIt); } const std::set parentSystemIncludes = this->Makefile->GetSystemIncludeDirectories(); @@ -421,8 +426,7 @@ void cmTarget::SetMakefile(cmMakefile* mf) const std::vector parentOptionsBts = this->Makefile->GetCompileOptionsBacktraces(); - std::vector::const_iterator btIt = - parentOptionsBts.begin(); + btIt = parentOptionsBts.begin(); for (std::vector::const_iterator it = parentOptions.begin(); it != parentOptions.end(); ++it, ++btIt) @@ -1931,17 +1935,18 @@ void cmTarget::AppendBuildInterfaceIncludes() } //---------------------------------------------------------------------------- -void cmTarget::InsertInclude(const cmValueWithOrigin &entry, - bool before) +void cmTarget::InsertInclude(std::string const& entry, + cmListFileBacktrace const& bt, + bool before) { - cmGeneratorExpression ge(entry.Backtrace); + cmGeneratorExpression ge(bt); std::vector::iterator position = before ? this->Internal->IncludeDirectoriesEntries.begin() : this->Internal->IncludeDirectoriesEntries.end(); this->Internal->IncludeDirectoriesEntries.insert(position, - new cmTargetInternals::TargetPropertyEntry(ge.Parse(entry.Value))); + new cmTargetInternals::TargetPropertyEntry(ge.Parse(entry))); } //---------------------------------------------------------------------------- diff --git a/Source/cmTarget.h b/Source/cmTarget.h index ba3bc5a7a..f9bcb0576 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -572,7 +572,8 @@ public: std::vector GetIncludeDirectories( const std::string& config, const std::string& language) const; - void InsertInclude(const cmValueWithOrigin &entry, + void InsertInclude(std::string const& entry, + cmListFileBacktrace const& bt, bool before = false); void InsertCompileOption(std::string const& entry, cmListFileBacktrace const& bt, diff --git a/Source/cmTargetIncludeDirectoriesCommand.cxx b/Source/cmTargetIncludeDirectoriesCommand.cxx index 24500db13..7824c898d 100644 --- a/Source/cmTargetIncludeDirectoriesCommand.cxx +++ b/Source/cmTargetIncludeDirectoriesCommand.cxx @@ -72,8 +72,7 @@ bool cmTargetIncludeDirectoriesCommand bool prepend, bool system) { cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); - cmValueWithOrigin entry(this->Join(content), lfbt); - tgt->InsertInclude(entry, prepend); + tgt->InsertInclude(this->Join(content), lfbt, prepend); if (system) { tgt->AddSystemIncludeDirectories(content); From 514a1dff5b532c94dca2f77ed6d8742f45c48ddc Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 18 Jul 2015 11:09:20 +0200 Subject: [PATCH 0384/1048] cmAlgorithms: Add some convenient typedefs. --- Source/cmAlgorithms.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h index a4447ad50..e510fcf9f 100644 --- a/Source/cmAlgorithms.h +++ b/Source/cmAlgorithms.h @@ -178,6 +178,12 @@ private: const_iterator End; }; +typedef cmRange::const_iterator> cmStringRange; + +class cmListFileBacktrace; +typedef +cmRange::const_iterator> cmBacktraceRange; + template cmRange cmMakeRange(Iter1 begin, Iter2 end) { From 8d336875b3cea99e5c458d3e299d8caf8bc84b75 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 18 Jul 2015 10:52:09 +0200 Subject: [PATCH 0385/1048] cmMakefile: Use Ranges for buildsystem property access. Don't return vector copies. --- Source/cmGlobalGenerator.cxx | 8 ++++---- Source/cmMakefile.cxx | 28 ++++++++++++---------------- Source/cmMakefile.h | 13 +++++++------ Source/cmTarget.cxx | 15 +++++++-------- 4 files changed, 30 insertions(+), 34 deletions(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 2c5ed4f9e..40a858611 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1417,9 +1417,9 @@ void cmGlobalGenerator::FinalizeTargetCompileInfo() { cmMakefile *mf = this->LocalGenerators[i]->GetMakefile(); - const std::vector noconfig_compile_definitions = + const cmStringRange noconfig_compile_definitions = mf->GetCompileDefinitionsEntries(); - const std::vector noconfig_compile_definitions_bts = + const cmBacktraceRange noconfig_compile_definitions_bts = mf->GetCompileDefinitionsBacktraces(); cmTargets& targets = mf->GetTargets(); @@ -1435,9 +1435,9 @@ void cmGlobalGenerator::FinalizeTargetCompileInfo() continue; } - std::vector::const_iterator btIt + cmBacktraceRange::const_iterator btIt = noconfig_compile_definitions_bts.begin(); - for (std::vector::const_iterator it + for (cmStringRange::const_iterator it = noconfig_compile_definitions.begin(); it != noconfig_compile_definitions.end(); ++it, ++btIt) { diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 58d9d7301..81c88317d 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -273,38 +273,34 @@ void cmMakefile::IssueMessage(cmake::MessageType t, } } -std::vector cmMakefile::GetIncludeDirectoriesEntries() const +cmStringRange cmMakefile::GetIncludeDirectoriesEntries() const { - return this->IncludeDirectoriesEntries; + return cmMakeRange(this->IncludeDirectoriesEntries); } -std::vector -cmMakefile::GetIncludeDirectoriesBacktraces() const +cmBacktraceRange cmMakefile::GetIncludeDirectoriesBacktraces() const { - return this->IncludeDirectoriesEntryBacktraces; + return cmMakeRange(this->IncludeDirectoriesEntryBacktraces); } - -std::vector cmMakefile::GetCompileOptionsEntries() const +cmStringRange cmMakefile::GetCompileOptionsEntries() const { - return this->CompileOptionsEntries; + return cmMakeRange(this->CompileOptionsEntries); } -std::vector -cmMakefile::GetCompileOptionsBacktraces() const +cmBacktraceRange cmMakefile::GetCompileOptionsBacktraces() const { - return this->CompileOptionsEntryBacktraces; + return cmMakeRange(this->CompileOptionsEntryBacktraces); } -std::vector cmMakefile::GetCompileDefinitionsEntries() const +cmStringRange cmMakefile::GetCompileDefinitionsEntries() const { - return this->CompileDefinitionsEntries; + return cmMakeRange(this->CompileDefinitionsEntries); } -std::vector -cmMakefile::GetCompileDefinitionsBacktraces() const +cmBacktraceRange cmMakefile::GetCompileDefinitionsBacktraces() const { - return this->CompileDefinitionsEntryBacktraces; + return cmMakeRange(this->CompileDefinitionsEntryBacktraces); } //---------------------------------------------------------------------------- diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 8f236af6c..27911a97c 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -22,6 +22,7 @@ #include "cmExpandedCommandArgument.h" #include "cmake.h" #include "cmState.h" +#include "cmAlgorithms.h" #if defined(CMAKE_BUILD_WITH_CMAKE) #include "cmSourceGroup.h" @@ -746,12 +747,12 @@ public: /** Set whether or not to report a CMP0000 violation. */ void SetCheckCMP0000(bool b) { this->CheckCMP0000 = b; } - std::vector GetIncludeDirectoriesEntries() const; - std::vector GetIncludeDirectoriesBacktraces() const; - std::vector GetCompileOptionsEntries() const; - std::vector GetCompileOptionsBacktraces() const; - std::vector GetCompileDefinitionsEntries() const; - std::vector GetCompileDefinitionsBacktraces() const; + cmStringRange GetIncludeDirectoriesEntries() const; + cmBacktraceRange GetIncludeDirectoriesBacktraces() const; + cmStringRange GetCompileOptionsEntries() const; + cmBacktraceRange GetCompileOptionsBacktraces() const; + cmStringRange GetCompileDefinitionsEntries() const; + cmBacktraceRange GetCompileDefinitionsBacktraces() const; bool IsConfigured() const { return this->Configured; } void SetConfigured(){ this->Configured = true; } diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index ac453e2d5..22114fdc2 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -402,14 +402,13 @@ void cmTarget::SetMakefile(cmMakefile* mf) { // Initialize the INCLUDE_DIRECTORIES property based on the current value // of the same directory property: - const std::vector parentIncludes = + const cmStringRange parentIncludes = this->Makefile->GetIncludeDirectoriesEntries(); - const std::vector parentIncludesBts = + const cmBacktraceRange parentIncludesBts = this->Makefile->GetIncludeDirectoriesBacktraces(); - std::vector::const_iterator btIt = - parentIncludesBts.begin(); - for (std::vector::const_iterator it + cmBacktraceRange::const_iterator btIt = parentIncludesBts.begin(); + for (cmStringRange::const_iterator it = parentIncludes.begin(); it != parentIncludes.end(); ++it, ++btIt) { @@ -421,13 +420,13 @@ void cmTarget::SetMakefile(cmMakefile* mf) this->SystemIncludeDirectories.insert(parentSystemIncludes.begin(), parentSystemIncludes.end()); - const std::vector parentOptions = + const cmStringRange parentOptions = this->Makefile->GetCompileOptionsEntries(); - const std::vector parentOptionsBts = + const cmBacktraceRange parentOptionsBts = this->Makefile->GetCompileOptionsBacktraces(); btIt = parentOptionsBts.begin(); - for (std::vector::const_iterator it + for (cmStringRange::const_iterator it = parentOptions.begin(); it != parentOptions.end(); ++it, ++btIt) { From c1bf1a59ffe983086b30aee3e0299b80f9c8a817 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 21 Jul 2015 22:52:44 +0200 Subject: [PATCH 0386/1048] CompileDefinitions: Add unit test for setting empty content. --- Tests/RunCMake/CMakeLists.txt | 1 + Tests/RunCMake/CompileDefinitions/CMakeLists.txt | 3 +++ Tests/RunCMake/CompileDefinitions/RunCMakeTest.cmake | 3 +++ .../RunCMake/CompileDefinitions/SetEmpty-result.txt | 1 + .../RunCMake/CompileDefinitions/SetEmpty-stderr.txt | 3 +++ Tests/RunCMake/CompileDefinitions/SetEmpty.cmake | 12 ++++++++++++ 6 files changed, 23 insertions(+) create mode 100644 Tests/RunCMake/CompileDefinitions/CMakeLists.txt create mode 100644 Tests/RunCMake/CompileDefinitions/RunCMakeTest.cmake create mode 100644 Tests/RunCMake/CompileDefinitions/SetEmpty-result.txt create mode 100644 Tests/RunCMake/CompileDefinitions/SetEmpty-stderr.txt create mode 100644 Tests/RunCMake/CompileDefinitions/SetEmpty.cmake diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 7ff18898b..607e79977 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -143,6 +143,7 @@ add_RunCMake_test(Swift) add_RunCMake_test(TargetObjects) add_RunCMake_test(TargetSources) add_RunCMake_test(find_dependency) +add_RunCMake_test(CompileDefinitions) add_RunCMake_test(CompileFeatures) add_RunCMake_test(WriteCompilerDetectionHeader) if(NOT WIN32) diff --git a/Tests/RunCMake/CompileDefinitions/CMakeLists.txt b/Tests/RunCMake/CompileDefinitions/CMakeLists.txt new file mode 100644 index 000000000..74b3ff8de --- /dev/null +++ b/Tests/RunCMake/CompileDefinitions/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.3) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CompileDefinitions/RunCMakeTest.cmake b/Tests/RunCMake/CompileDefinitions/RunCMakeTest.cmake new file mode 100644 index 000000000..233fe3467 --- /dev/null +++ b/Tests/RunCMake/CompileDefinitions/RunCMakeTest.cmake @@ -0,0 +1,3 @@ +include(RunCMake) + +run_cmake(SetEmpty) diff --git a/Tests/RunCMake/CompileDefinitions/SetEmpty-result.txt b/Tests/RunCMake/CompileDefinitions/SetEmpty-result.txt new file mode 100644 index 000000000..573541ac9 --- /dev/null +++ b/Tests/RunCMake/CompileDefinitions/SetEmpty-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CompileDefinitions/SetEmpty-stderr.txt b/Tests/RunCMake/CompileDefinitions/SetEmpty-stderr.txt new file mode 100644 index 000000000..ace6656e2 --- /dev/null +++ b/Tests/RunCMake/CompileDefinitions/SetEmpty-stderr.txt @@ -0,0 +1,3 @@ +RESULT1=A;;B +RESULT2= +RESULT3=-DBAR diff --git a/Tests/RunCMake/CompileDefinitions/SetEmpty.cmake b/Tests/RunCMake/CompileDefinitions/SetEmpty.cmake new file mode 100644 index 000000000..15cb4e9a3 --- /dev/null +++ b/Tests/RunCMake/CompileDefinitions/SetEmpty.cmake @@ -0,0 +1,12 @@ + +set_property(DIRECTORY PROPERTY COMPILE_DEFINITIONS A "" B) +get_property(result DIRECTORY PROPERTY COMPILE_DEFINITIONS) +message("RESULT1=${result}") + +set_property(DIRECTORY PROPERTY COMPILE_DEFINITIONS) +get_property(result DIRECTORY PROPERTY COMPILE_DEFINITIONS) +message("RESULT2=${result}") + +set_property(DIRECTORY PROPERTY COMPILE_DEFINITIONS -DBAR) +get_property(result DIRECTORY PROPERTY COMPILE_DEFINITIONS) +message("RESULT3=${result}") From 1e77de7411e982c007c884d05039c4f5ffbd8756 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 9 Jul 2015 00:02:45 +0200 Subject: [PATCH 0387/1048] cmMakefile: Don't clear buildsystem properties. Instead put a sentinal empty entry in the container when a property is overwritten. Use this sentinal when reading from the containers. Use iterator::operator+(size_type) directly instead of std::advance, because this only really makes sense if using RandomAccessIterators. --- Source/cmMakefile.cxx | 140 ++++++++++++++++++++++++++++++++---------- 1 file changed, 106 insertions(+), 34 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 81c88317d..9575affcd 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -273,34 +273,68 @@ void cmMakefile::IssueMessage(cmake::MessageType t, } } +template +typename Range::const_iterator find_backwards(Range const& range, T t) +{ + typename Range::const_reverse_iterator rend = + std::find(range.rbegin(), range.rend(), t); + return rend.base(); +} + +static const std::string cmPropertySentinal = std::string(); + cmStringRange cmMakefile::GetIncludeDirectoriesEntries() const { - return cmMakeRange(this->IncludeDirectoriesEntries); + std::vector::const_iterator it = + find_backwards(this->IncludeDirectoriesEntries, cmPropertySentinal); + return cmMakeRange(it, this->IncludeDirectoriesEntries.end()); } cmBacktraceRange cmMakefile::GetIncludeDirectoriesBacktraces() const { - return cmMakeRange(this->IncludeDirectoriesEntryBacktraces); + std::vector::const_iterator it = + find_backwards(this->IncludeDirectoriesEntries, cmPropertySentinal); + std::vector::const_iterator btIt = + this->IncludeDirectoriesEntryBacktraces.begin() + + std::distance(this->IncludeDirectoriesEntries.begin(), it); + return cmMakeRange( + btIt, this->IncludeDirectoriesEntryBacktraces.end()); } cmStringRange cmMakefile::GetCompileOptionsEntries() const { - return cmMakeRange(this->CompileOptionsEntries); + std::vector::const_iterator it = + find_backwards(this->CompileOptionsEntries, cmPropertySentinal); + return cmMakeRange(it, this->CompileOptionsEntries.end()); } cmBacktraceRange cmMakefile::GetCompileOptionsBacktraces() const { - return cmMakeRange(this->CompileOptionsEntryBacktraces); + std::vector::const_iterator it = + find_backwards(this->CompileOptionsEntries, cmPropertySentinal); + std::vector::const_iterator btIt = + this->CompileOptionsEntryBacktraces.begin() + + std::distance(this->CompileOptionsEntries.begin(), it); + return cmMakeRange( + btIt, this->CompileOptionsEntryBacktraces.end()); } cmStringRange cmMakefile::GetCompileDefinitionsEntries() const { - return cmMakeRange(this->CompileDefinitionsEntries); + std::vector::const_iterator it = + find_backwards(this->CompileDefinitionsEntries, cmPropertySentinal); + return cmMakeRange(it, this->CompileDefinitionsEntries.end()); } cmBacktraceRange cmMakefile::GetCompileDefinitionsBacktraces() const { - return cmMakeRange(this->CompileDefinitionsEntryBacktraces); + std::vector::const_iterator btIt = + this->CompileDefinitionsEntryBacktraces.begin(); + std::vector::const_iterator it = + find_backwards(this->CompileDefinitionsEntries, cmPropertySentinal) + + std::distance(this->CompileDefinitionsEntries.begin(), it); + return cmMakeRange( + btIt, this->CompileDefinitionsEntryBacktraces.end()); } //---------------------------------------------------------------------------- @@ -1557,32 +1591,62 @@ void cmMakefile::InitializeFromParent(cmMakefile* parent) this->AddDefinition("CMAKE_CURRENT_BINARY_DIR", this->GetCurrentBinaryDirectory()); + { + std::vector::const_iterator it = + find_backwards(parent->IncludeDirectoriesEntries, cmPropertySentinal); + std::vector::const_iterator begin = + parent->IncludeDirectoriesEntries.begin(); + std::vector::const_iterator end = + parent->IncludeDirectoriesEntries.end(); this->IncludeDirectoriesEntries.insert( - this->IncludeDirectoriesEntries.end(), - parent->IncludeDirectoriesEntries.begin(), - parent->IncludeDirectoriesEntries.end()); + this->IncludeDirectoriesEntries.end(), it, end); + + std::vector::const_iterator btIt = + parent->IncludeDirectoriesEntryBacktraces.begin() + + std::distance(begin, it); + std::vector::const_iterator btEnd = + parent->IncludeDirectoriesEntryBacktraces.end(); this->IncludeDirectoriesEntryBacktraces.insert( - this->IncludeDirectoriesEntryBacktraces.end(), - parent->IncludeDirectoriesEntryBacktraces.begin(), - parent->IncludeDirectoriesEntryBacktraces.end()); + this->IncludeDirectoriesEntryBacktraces.end(), btIt, btEnd); + } + { + std::vector::const_iterator it = + find_backwards(parent->CompileOptionsEntries, cmPropertySentinal); + std::vector::const_iterator begin = + parent->CompileOptionsEntries.begin(); + std::vector::const_iterator end = + parent->CompileOptionsEntries.end(); this->CompileOptionsEntries.insert( - this->CompileOptionsEntries.end(), - parent->CompileOptionsEntries.begin(), - parent->CompileOptionsEntries.end()); - this->CompileOptionsEntryBacktraces.insert( - this->CompileOptionsEntryBacktraces.end(), - parent->CompileOptionsEntryBacktraces.begin(), - parent->CompileOptionsEntryBacktraces.end()); + this->CompileOptionsEntries.end(), it, end); + std::vector::const_iterator btIt = + parent->CompileOptionsEntryBacktraces.begin() + + std::distance(begin, it); + std::vector::const_iterator btEnd = + parent->CompileOptionsEntryBacktraces.end(); + this->CompileOptionsEntryBacktraces.insert( + this->CompileOptionsEntryBacktraces.end(), btIt, btEnd); + } + + { + std::vector::const_iterator it = + find_backwards(parent->CompileDefinitionsEntries, cmPropertySentinal); + std::vector::const_iterator begin = + parent->CompileDefinitionsEntries.begin(); + std::vector::const_iterator end = + parent->CompileDefinitionsEntries.end(); this->CompileDefinitionsEntries.insert( - this->CompileDefinitionsEntries.end(), - parent->CompileDefinitionsEntries.begin(), - parent->CompileDefinitionsEntries.end()); + this->CompileDefinitionsEntries.end(), it, end); + + std::vector::const_iterator btIt = + parent->CompileDefinitionsEntryBacktraces.begin() + + std::distance(begin, it); + std::vector::const_iterator btEnd = + parent->CompileDefinitionsEntryBacktraces.end(); this->CompileDefinitionsEntryBacktraces.insert( - this->CompileDefinitionsEntryBacktraces.end(), - parent->CompileDefinitionsEntryBacktraces.begin(), - parent->CompileDefinitionsEntryBacktraces.end()); + this->CompileDefinitionsEntryBacktraces.end(), btIt, btEnd); + } this->SystemIncludeDirectories = parent->SystemIncludeDirectories; @@ -4162,8 +4226,8 @@ void cmMakefile::SetProperty(const std::string& prop, const char* value) { if (prop == "INCLUDE_DIRECTORIES") { - this->IncludeDirectoriesEntries.clear(); - this->IncludeDirectoriesEntryBacktraces.clear(); + this->IncludeDirectoriesEntries.push_back(cmPropertySentinal); + this->IncludeDirectoriesEntryBacktraces.push_back(cmListFileBacktrace()); if (!value) { return; @@ -4175,8 +4239,8 @@ void cmMakefile::SetProperty(const std::string& prop, const char* value) } if (prop == "COMPILE_OPTIONS") { - this->CompileOptionsEntries.clear(); - this->CompileDefinitionsEntryBacktraces.clear(); + this->CompileOptionsEntries.push_back(cmPropertySentinal); + this->CompileDefinitionsEntryBacktraces.push_back(cmListFileBacktrace()); if (!value) { return; @@ -4188,8 +4252,8 @@ void cmMakefile::SetProperty(const std::string& prop, const char* value) } if (prop == "COMPILE_DEFINITIONS") { - this->CompileDefinitionsEntries.clear(); - this->CompileDefinitionsEntryBacktraces.clear(); + this->CompileDefinitionsEntries.push_back(cmPropertySentinal); + this->CompileDefinitionsEntryBacktraces.push_back(cmListFileBacktrace()); if (!value) { return; @@ -4280,17 +4344,25 @@ const char *cmMakefile::GetProperty(const std::string& prop, } else if (prop == "INCLUDE_DIRECTORIES") { - output = cmJoin(this->IncludeDirectoriesEntries, ";"); + std::vector::const_iterator it = + find_backwards(this->IncludeDirectoriesEntries, cmPropertySentinal); + output = cmJoin(cmMakeRange(it, this->IncludeDirectoriesEntries.end()), + ";"); return output.c_str(); } else if (prop == "COMPILE_OPTIONS") { - output = cmJoin(this->CompileOptionsEntries, ";"); + std::vector::const_iterator it = + find_backwards(this->CompileOptionsEntries, cmPropertySentinal); + output = cmJoin(cmMakeRange(it, this->CompileOptionsEntries.end()), ";"); return output.c_str(); } else if (prop == "COMPILE_DEFINITIONS") { - output = cmJoin(this->CompileDefinitionsEntries, ";"); + std::vector::const_iterator it = + find_backwards(this->CompileDefinitionsEntries, cmPropertySentinal); + output = cmJoin(cmMakeRange(it, this->CompileDefinitionsEntries.end()), + ";"); return output.c_str(); } From 9644a2d11c06a547c82097028a86bff976f12040 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 21 Jul 2015 22:42:03 +0200 Subject: [PATCH 0388/1048] cmAlgorithms: Add cmMakeReverseIterator. --- Source/cmAlgorithms.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h index e510fcf9f..bda933bc3 100644 --- a/Source/cmAlgorithms.h +++ b/Source/cmAlgorithms.h @@ -363,4 +363,10 @@ cmReverseRange(Range const& range) range.rbegin(), range.rend()); } +template +std::reverse_iterator cmMakeReverseIterator(Iter it) +{ + return std::reverse_iterator(it); +} + #endif From 900554b021b00f9e64d21cb1aabf01b27cf800cd Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Thu, 23 Jul 2015 00:01:06 -0400 Subject: [PATCH 0389/1048] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 2b8be770f..9dcb4c8e6 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 3) -set(CMake_VERSION_PATCH 20150722) +set(CMake_VERSION_PATCH 20150723) #set(CMake_VERSION_RC 1) From 10f2065249d780568b4460872b783531e7ebec0b Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 23 Jul 2015 11:44:09 -0400 Subject: [PATCH 0390/1048] Utilities/Release: Drop IBM AIX release scripts We no longer produce binaries for AIX. --- Utilities/Release/create-cmake-release.cmake | 1 - Utilities/Release/ibm_aix_release.cmake | 15 --------------- 2 files changed, 16 deletions(-) delete mode 100644 Utilities/Release/ibm_aix_release.cmake diff --git a/Utilities/Release/create-cmake-release.cmake b/Utilities/Release/create-cmake-release.cmake index 19f4cb115..4b93e6e30 100644 --- a/Utilities/Release/create-cmake-release.cmake +++ b/Utilities/Release/create-cmake-release.cmake @@ -11,7 +11,6 @@ set(RELEASE_SCRIPTS_BATCH_1 dashmacmini5_release.cmake # Mac Darwin64 universal x86_64;i386 magrathea_release.cmake # Linux linux64_release.cmake # Linux x86_64 - ibm_aix_release.cmake # AIX ) set(RELEASE_SCRIPTS_BATCH_2 diff --git a/Utilities/Release/ibm_aix_release.cmake b/Utilities/Release/ibm_aix_release.cmake deleted file mode 100644 index 5a6efe612..000000000 --- a/Utilities/Release/ibm_aix_release.cmake +++ /dev/null @@ -1,15 +0,0 @@ -set(CMAKE_RELEASE_DIRECTORY "/bench1/noibm34/CMakeReleaseDirectory") -set(PROCESSORS 64) -set(HOST "ibm-backend") -set(SCRIPT_NAME aix) -set(MAKE_PROGRAM "make") -set(CC "xlc_r") -set(CXX "xlC_r") -set(FC "xlf") -set(LDFLAGS "-Wl,-bmaxdata:0x80000000") # Push "Segmentation fault in extend_brk" over horizon -set(INITIAL_CACHE " -CMAKE_BUILD_TYPE:STRING=Release -CMAKE_SKIP_BOOTSTRAP_TEST:STRING=TRUE -") -get_filename_component(path "${CMAKE_CURRENT_LIST_FILE}" PATH) -include(${path}/release_cmake.cmake) From 594bafe52773c940fc3fb9cd9022a4d1a3a194c7 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 21 Jul 2015 17:18:53 -0400 Subject: [PATCH 0391/1048] cmake: add --trace-expand option The --trace option is helpful, but sometimes, what you're looking for is deep under many layers of function calls and figuring out what instance of the function call you're looking at is tedious to determine (usually involving patching and message()). Instead, add a --trace-expand option to trace while expanding commands into what CMake actually sees. --- Help/manual/cmake.1.rst | 10 +++++++--- Help/release/dev/trace-expand.rst | 5 +++++ Help/variable/CMAKE_POLICY_WARNING_CMPNNNN.rst | 4 ++-- Source/cmMakefile.cxx | 16 ++++++++++++++-- Source/cmake.cxx | 8 ++++++++ Source/cmake.h | 3 +++ Source/cmakemain.cxx | 1 + Tests/RunCMake/CommandLine/RunCMakeTest.cmake | 4 ++++ .../RunCMake/CommandLine/trace-expand-stderr.txt | 2 ++ Tests/RunCMake/CommandLine/trace-expand.cmake | 0 10 files changed, 46 insertions(+), 7 deletions(-) create mode 100644 Help/release/dev/trace-expand.rst create mode 100644 Tests/RunCMake/CommandLine/trace-expand-stderr.txt create mode 100644 Tests/RunCMake/CommandLine/trace-expand.cmake diff --git a/Help/manual/cmake.1.rst b/Help/manual/cmake.1.rst index 4bd5a5ec7..9ce497140 100644 --- a/Help/manual/cmake.1.rst +++ b/Help/manual/cmake.1.rst @@ -113,14 +113,18 @@ Options ``--debug-output`` Put cmake in a debug mode. - Print extra stuff during the cmake run like stack traces with + Print extra information during the cmake run like stack traces with message(send_error ) calls. ``--trace`` Put cmake in trace mode. - Print a trace of all calls made and from where with - message(send_error ) calls. + Print a trace of all calls made and from where. + +``--trace-expand`` + Put cmake in trace mode. + + Like ``--trace``, but with variables expanded. ``--warn-uninitialized`` Warn about uninitialized values. diff --git a/Help/release/dev/trace-expand.rst b/Help/release/dev/trace-expand.rst new file mode 100644 index 000000000..383326e3f --- /dev/null +++ b/Help/release/dev/trace-expand.rst @@ -0,0 +1,5 @@ +trace-expand +------------ + +* Add ``--trace-expand`` argument to CMake. Acts like ``--trace``, but expands + variable references in the output. diff --git a/Help/variable/CMAKE_POLICY_WARNING_CMPNNNN.rst b/Help/variable/CMAKE_POLICY_WARNING_CMPNNNN.rst index 092fe3eb6..8de0d56f6 100644 --- a/Help/variable/CMAKE_POLICY_WARNING_CMPNNNN.rst +++ b/Help/variable/CMAKE_POLICY_WARNING_CMPNNNN.rst @@ -17,5 +17,5 @@ warn by default: This variable should not be set by a project in CMake code. Project developers running CMake may set this variable in their cache to enable the warning (e.g. ``-DCMAKE_POLICY_WARNING_CMP=ON``). -Alternatively, running :manual:`cmake(1)` with the ``--debug-output`` -or ``--trace`` option will also enable the warning. +Alternatively, running :manual:`cmake(1)` with the ``--debug-output``, +``--trace``, or ``--trace-expand`` option will also enable the warning. diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index ae69b24b6..7c9897056 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -307,10 +307,21 @@ void cmMakefile::PrintCommandTrace(const cmListFileFunction& lff) const std::ostringstream msg; msg << this->GetExecutionFilePath() << "(" << lff.Line << "): "; msg << lff.Name << "("; + bool expand = this->GetCMakeInstance()->GetTraceExpand(); + std::string temp; for(std::vector::const_iterator i = lff.Arguments.begin(); i != lff.Arguments.end(); ++i) { - msg << i->Value; + if (expand) + { + temp = i->Value; + this->ExpandVariablesInString(temp); + msg << temp; + } + else + { + msg << i->Value; + } msg << " "; } msg << ")"; @@ -4802,7 +4813,8 @@ bool cmMakefile::PolicyOptionalWarningEnabled(std::string const& var) return cmSystemTools::IsOn(val); } } - // Enable optional policy warnings with --debug-output or --trace. + // Enable optional policy warnings with --debug-output, --trace, + // or --trace-expand. cmake* cm = this->GetCMakeInstance(); return cm->GetDebugOutput() || cm->GetTrace(); } diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 7bf3832a9..6abdbed88 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -121,6 +121,7 @@ void cmWarnUnusedCliWarning(const std::string& variable, cmake::cmake() { this->Trace = false; + this->TraceExpand = false; this->WarnUninitialized = false; this->WarnUnused = false; this->WarnUnusedCli = true; @@ -617,10 +618,17 @@ void cmake::SetArgs(const std::vector& args, std::cout << "Running with debug output on.\n"; this->SetDebugOutputOn(true); } + else if(arg.find("--trace-expand",0) == 0) + { + std::cout << "Running with expanded trace output on.\n"; + this->SetTrace(true); + this->SetTraceExpand(true); + } else if(arg.find("--trace",0) == 0) { std::cout << "Running with trace output on.\n"; this->SetTrace(true); + this->SetTraceExpand(false); } else if(arg.find("--warn-uninitialized",0) == 0) { diff --git a/Source/cmake.h b/Source/cmake.h index f0f94115c..20e49e3a6 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -270,6 +270,8 @@ class cmake // Do we want trace output during the cmake run. bool GetTrace() { return this->Trace;} void SetTrace(bool b) { this->Trace = b;} + bool GetTraceExpand() { return this->TraceExpand;} + void SetTraceExpand(bool b) { this->TraceExpand = b;} bool GetWarnUninitialized() { return this->WarnUninitialized;} void SetWarnUninitialized(bool b) { this->WarnUninitialized = b;} bool GetWarnUnused() { return this->WarnUnused;} @@ -378,6 +380,7 @@ private: WorkingMode CurrentWorkingMode; bool DebugOutput; bool Trace; + bool TraceExpand; bool WarnUninitialized; bool WarnUnused; bool WarnUnusedCli; diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index c94ffec06..a06b26fc6 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -83,6 +83,7 @@ static const char * cmDocumentationOptions[][2] = "useful on one try_compile at a time."}, {"--debug-output", "Put cmake in a debug mode."}, {"--trace", "Put cmake in trace mode."}, + {"--trace-expand", "Put cmake in trace mode with variable expansion."}, {"--warn-uninitialized", "Warn about uninitialized values."}, {"--warn-unused-vars", "Warn about unused variables."}, {"--no-warn-unused-cli", "Don't warn about command line options."}, diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index 84d4cc904..cef636852 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -140,6 +140,10 @@ set(RunCMake_TEST_OPTIONS --trace) run_cmake(trace) unset(RunCMake_TEST_OPTIONS) +set(RunCMake_TEST_OPTIONS --trace-expand) +run_cmake(trace-expand) +unset(RunCMake_TEST_OPTIONS) + set(RunCMake_TEST_OPTIONS --debug-trycompile) run_cmake(debug-trycompile) unset(RunCMake_TEST_OPTIONS) diff --git a/Tests/RunCMake/CommandLine/trace-expand-stderr.txt b/Tests/RunCMake/CommandLine/trace-expand-stderr.txt new file mode 100644 index 000000000..4fee9bc96 --- /dev/null +++ b/Tests/RunCMake/CommandLine/trace-expand-stderr.txt @@ -0,0 +1,2 @@ +^.*/Tests/RunCMake/CommandLine/CMakeLists.txt\(1\): cmake_minimum_required\(VERSION 3.0 \) +.*/Tests/RunCMake/CommandLine/CMakeLists.txt\(2\): project\(trace-expand NONE \) diff --git a/Tests/RunCMake/CommandLine/trace-expand.cmake b/Tests/RunCMake/CommandLine/trace-expand.cmake new file mode 100644 index 000000000..e69de29bb From d546133d49432d24561760730b6e09213b5d136c Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Fri, 24 Jul 2015 00:01:07 -0400 Subject: [PATCH 0392/1048] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 9dcb4c8e6..7aef791ec 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 3) -set(CMake_VERSION_PATCH 20150723) +set(CMake_VERSION_PATCH 20150724) #set(CMake_VERSION_RC 1) From 26d1a9d356ad3122f7d07dcd93d12767726807cf Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sat, 25 Jul 2015 00:01:05 -0400 Subject: [PATCH 0393/1048] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 7aef791ec..59656b8bf 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 3) -set(CMake_VERSION_PATCH 20150724) +set(CMake_VERSION_PATCH 20150725) #set(CMake_VERSION_RC 1) From 84e18056668491d5a7e0068c9287455151a18197 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 4 Jun 2015 23:38:51 +0200 Subject: [PATCH 0394/1048] cmMakefile: Convert recursion to loop. --- Source/cmMakefile.cxx | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index ae69b24b6..36b42bd6a 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -4770,21 +4770,19 @@ cmMakefile::GetPolicyStatus(cmPolicies::PolicyID id) const cmPolicies::PolicyStatus cmMakefile::GetPolicyStatusInternal(cmPolicies::PolicyID id) const { - // Is the policy set in our stack? - for(PolicyStackType::const_reverse_iterator psi = this->PolicyStack.rbegin(); - psi != this->PolicyStack.rend(); ++psi) + cmLocalGenerator* lg = this->LocalGenerator; + while(lg) { - if(psi->IsDefined(id)) + cmMakefile const* mf = lg->GetMakefile(); + for(PolicyStackType::const_reverse_iterator psi = + mf->PolicyStack.rbegin(); psi != mf->PolicyStack.rend(); ++psi) { - return psi->Get(id); + if(psi->IsDefined(id)) + { + return psi->Get(id); + } } - } - - // If we have a parent directory, recurse up to it. - if(this->LocalGenerator->GetParent()) - { - cmMakefile* parent = this->LocalGenerator->GetParent()->GetMakefile(); - return parent->GetPolicyStatusInternal(id); + lg = lg->GetParent(); } // The policy is not set. Use the default for this CMake version. From 71e69fc93b9f1a0829d04b9e44107c92458efe20 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 22 Jun 2015 03:18:55 +0200 Subject: [PATCH 0395/1048] cmPolicies: Store only state that users can set. cmPolicies::PolicyMap does not need to store the REQUIRED_ALWAYS or REQUIRED_IF_USED states as they are statically determined. --- Source/cmPolicies.cxx | 16 +--------------- Source/cmPolicies.h | 2 +- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index 5026893ba..2a5ae1cff 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -356,14 +356,6 @@ cmPolicies::PolicyMap::Get(cmPolicies::PolicyID id) const { status = cmPolicies::NEW; } - else if (this->Status[(POLICY_STATUS_COUNT * id) + REQUIRED_ALWAYS]) - { - status = cmPolicies::REQUIRED_ALWAYS; - } - else if (this->Status[(POLICY_STATUS_COUNT * id) + REQUIRED_IF_USED]) - { - status = cmPolicies::REQUIRED_IF_USED; - } return status; } @@ -373,19 +365,13 @@ void cmPolicies::PolicyMap::Set(cmPolicies::PolicyID id, this->Status[(POLICY_STATUS_COUNT * id) + OLD] = (status == OLD); this->Status[(POLICY_STATUS_COUNT * id) + WARN] = (status == WARN); this->Status[(POLICY_STATUS_COUNT * id) + NEW] = (status == NEW); - this->Status[(POLICY_STATUS_COUNT * id) + REQUIRED_ALWAYS] = - (status == REQUIRED_ALWAYS); - this->Status[(POLICY_STATUS_COUNT * id) + REQUIRED_IF_USED] = - (status == REQUIRED_IF_USED); } bool cmPolicies::PolicyMap::IsDefined(cmPolicies::PolicyID id) const { return this->Status[(POLICY_STATUS_COUNT * id) + OLD] || this->Status[(POLICY_STATUS_COUNT * id) + WARN] - || this->Status[(POLICY_STATUS_COUNT * id) + NEW] - || this->Status[(POLICY_STATUS_COUNT * id) + REQUIRED_ALWAYS] - || this->Status[(POLICY_STATUS_COUNT * id) + REQUIRED_IF_USED]; + || this->Status[(POLICY_STATUS_COUNT * id) + NEW]; } bool cmPolicies::PolicyMap::IsEmpty() const diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 8a3c27d9f..a5aba580f 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -244,7 +244,6 @@ public: REQUIRED_IF_USED, REQUIRED_ALWAYS ///< Issue an error unless user sets policy status to NEW. }; -#define POLICY_STATUS_COUNT 5 /// Policy identifiers enum PolicyID @@ -288,6 +287,7 @@ public: bool IsEmpty() const; private: +#define POLICY_STATUS_COUNT 3 std::bitset Status; }; }; From 3c45471c2d4a0c08b88f10161d4b166a27165e31 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 6 Jul 2015 01:55:29 +0200 Subject: [PATCH 0396/1048] cmPolicies: Enable RVO for internal method. --- Source/cmMakefile.cxx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 36b42bd6a..cae7bbc07 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -4770,6 +4770,7 @@ cmMakefile::GetPolicyStatus(cmPolicies::PolicyID id) const cmPolicies::PolicyStatus cmMakefile::GetPolicyStatusInternal(cmPolicies::PolicyID id) const { + cmPolicies::PolicyStatus status = cmPolicies::GetPolicyStatus(id); cmLocalGenerator* lg = this->LocalGenerator; while(lg) { @@ -4779,14 +4780,15 @@ cmMakefile::GetPolicyStatusInternal(cmPolicies::PolicyID id) const { if(psi->IsDefined(id)) { - return psi->Get(id); + status = psi->Get(id); + return status; } } lg = lg->GetParent(); } // The policy is not set. Use the default for this CMake version. - return cmPolicies::GetPolicyStatus(id); + return status; } //---------------------------------------------------------------------------- From f4a25874a2cb5468e7ecce6812e5833e10943017 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 6 Jul 2015 02:00:32 +0200 Subject: [PATCH 0397/1048] cmMakefile: Inline internal policy status method. --- Source/cmMakefile.cxx | 47 +++++++++++++++++-------------------------- Source/cmMakefile.h | 2 -- 2 files changed, 18 insertions(+), 31 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index cae7bbc07..7a35a26af 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -4741,34 +4741,6 @@ const char* cmMakefile::GetDefineFlagsCMP0059() const //---------------------------------------------------------------------------- cmPolicies::PolicyStatus cmMakefile::GetPolicyStatus(cmPolicies::PolicyID id) const -{ - // Get the current setting of the policy. - cmPolicies::PolicyStatus cur = this->GetPolicyStatusInternal(id); - - // If the policy is required to be set to NEW but is not, ignore the - // current setting and tell the caller. - if(cur != cmPolicies::NEW) - { - if(cur == cmPolicies::REQUIRED_ALWAYS || - cur == cmPolicies::REQUIRED_IF_USED) - { - return cur; - } - cmPolicies::PolicyStatus def = cmPolicies::GetPolicyStatus(id); - if(def == cmPolicies::REQUIRED_ALWAYS || - def == cmPolicies::REQUIRED_IF_USED) - { - return def; - } - } - - // The current setting is okay. - return cur; -} - -//---------------------------------------------------------------------------- -cmPolicies::PolicyStatus -cmMakefile::GetPolicyStatusInternal(cmPolicies::PolicyID id) const { cmPolicies::PolicyStatus status = cmPolicies::GetPolicyStatus(id); cmLocalGenerator* lg = this->LocalGenerator; @@ -4787,7 +4759,24 @@ cmMakefile::GetPolicyStatusInternal(cmPolicies::PolicyID id) const lg = lg->GetParent(); } - // The policy is not set. Use the default for this CMake version. + // If the policy is required to be set to NEW but is not, ignore the + // current setting and tell the caller. + if(status != cmPolicies::NEW) + { + if(status == cmPolicies::REQUIRED_ALWAYS || + status == cmPolicies::REQUIRED_IF_USED) + { + return status; + } + cmPolicies::PolicyStatus def = cmPolicies::GetPolicyStatus(id); + if(def == cmPolicies::REQUIRED_ALWAYS || + def == cmPolicies::REQUIRED_IF_USED) + { + return def; + } + } + + // The current setting is okay. return status; } diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 2fc4d78a8..6dbea89bc 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -938,8 +938,6 @@ private: typedef std::vector PolicyStackType; PolicyStackType PolicyStack; std::vector PolicyBarriers; - cmPolicies::PolicyStatus - GetPolicyStatusInternal(cmPolicies::PolicyID id) const; // CMP0053 == old cmake::MessageType ExpandVariablesInStringOld( From 658bfc5c525bd21ecd68847cd19bda7102245c35 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 6 Jul 2015 02:02:02 +0200 Subject: [PATCH 0398/1048] cmMakefile: Remove redundant condition from policy status computation. --- Source/cmMakefile.cxx | 5 ----- 1 file changed, 5 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 7a35a26af..ab8499f83 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -4763,11 +4763,6 @@ cmMakefile::GetPolicyStatus(cmPolicies::PolicyID id) const // current setting and tell the caller. if(status != cmPolicies::NEW) { - if(status == cmPolicies::REQUIRED_ALWAYS || - status == cmPolicies::REQUIRED_IF_USED) - { - return status; - } cmPolicies::PolicyStatus def = cmPolicies::GetPolicyStatus(id); if(def == cmPolicies::REQUIRED_ALWAYS || def == cmPolicies::REQUIRED_IF_USED) From d0dcce15f4cc4e7c100556fbd016c59f64d0d238 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 6 Jul 2015 02:04:12 +0200 Subject: [PATCH 0399/1048] cmMakefile: Simplify computation of ancient policy status. --- Source/cmMakefile.cxx | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index ab8499f83..d6854e7bc 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -4743,6 +4743,13 @@ cmPolicies::PolicyStatus cmMakefile::GetPolicyStatus(cmPolicies::PolicyID id) const { cmPolicies::PolicyStatus status = cmPolicies::GetPolicyStatus(id); + + if(status == cmPolicies::REQUIRED_ALWAYS || + status == cmPolicies::REQUIRED_IF_USED) + { + return status; + } + cmLocalGenerator* lg = this->LocalGenerator; while(lg) { @@ -4758,20 +4765,6 @@ cmMakefile::GetPolicyStatus(cmPolicies::PolicyID id) const } lg = lg->GetParent(); } - - // If the policy is required to be set to NEW but is not, ignore the - // current setting and tell the caller. - if(status != cmPolicies::NEW) - { - cmPolicies::PolicyStatus def = cmPolicies::GetPolicyStatus(id); - if(def == cmPolicies::REQUIRED_ALWAYS || - def == cmPolicies::REQUIRED_IF_USED) - { - return def; - } - } - - // The current setting is okay. return status; } From 5447ca1a94309fa394be3a8233090b33e81e4c9f Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 6 Jul 2015 02:10:25 +0200 Subject: [PATCH 0400/1048] cmMakefile: Remove CMP0001 handling to callers. --- Source/cmCMakePolicyCommand.cxx | 16 ++++++++++++++++ Source/cmMakefile.cxx | 19 ------------------- Source/cmPolicies.cxx | 16 ++++++++++++++++ 3 files changed, 32 insertions(+), 19 deletions(-) diff --git a/Source/cmCMakePolicyCommand.cxx b/Source/cmCMakePolicyCommand.cxx index 3c878bf3b..3ef6d356b 100644 --- a/Source/cmCMakePolicyCommand.cxx +++ b/Source/cmCMakePolicyCommand.cxx @@ -93,6 +93,22 @@ bool cmCMakePolicyCommand::HandleSetMode(std::vector const& args) this->SetError("SET failed to set policy."); return false; } + if(args[1] == "CMP0001" && + (status == cmPolicies::WARN || status == cmPolicies::OLD)) + { + if(!(this->Makefile->GetState() + ->GetInitializedCacheValue("CMAKE_BACKWARDS_COMPATIBILITY"))) + { + // Set it to 2.4 because that is the last version where the + // variable had meaning. + this->Makefile->AddCacheDefinition + ("CMAKE_BACKWARDS_COMPATIBILITY", "2.4", + "For backwards compatibility, what version of CMake " + "commands and " + "syntax should this version of CMake try to support.", + cmState::STRING); + } + } return true; } diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index d6854e7bc..c5ce2e99e 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -4822,25 +4822,6 @@ bool cmMakefile::SetPolicy(cmPolicies::PolicyID id, previous_was_weak = psi->Weak; } - // Special hook for presenting compatibility variable as soon as - // the user requests it. - if(id == cmPolicies::CMP0001 && - (status == cmPolicies::WARN || status == cmPolicies::OLD)) - { - if(!(this->GetState() - ->GetInitializedCacheValue("CMAKE_BACKWARDS_COMPATIBILITY"))) - { - // Set it to 2.4 because that is the last version where the - // variable had meaning. - this->AddCacheDefinition - ("CMAKE_BACKWARDS_COMPATIBILITY", "2.4", - "For backwards compatibility, what version of CMake " - "commands and " - "syntax should this version of CMake try to support.", - cmState::STRING); - } - } - return true; } diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index 2a5ae1cff..3eb19bb96 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -255,6 +255,22 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile *mf, { return false; } + if(pid == cmPolicies::CMP0001 && + (status == cmPolicies::WARN || status == cmPolicies::OLD)) + { + if(!(mf->GetState() + ->GetInitializedCacheValue("CMAKE_BACKWARDS_COMPATIBILITY"))) + { + // Set it to 2.4 because that is the last version where the + // variable had meaning. + mf->AddCacheDefinition + ("CMAKE_BACKWARDS_COMPATIBILITY", "2.4", + "For backwards compatibility, what version of CMake " + "commands and " + "syntax should this version of CMake try to support.", + cmState::STRING); + } + } } } else From 8329fc016fd0b6e82b9bc1da9e857206d11b9bbe Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 25 Jul 2015 14:45:45 +0200 Subject: [PATCH 0401/1048] cmPolicies: Replace unused include. --- Source/cmPolicies.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index a5aba580f..b78370166 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -12,7 +12,7 @@ #ifndef cmPolicies_h #define cmPolicies_h -#include "cmCustomCommand.h" +#include "cmStandardIncludes.h" #include From 8f0a5d84e3fa894c687089d5f6dd6463c47968d8 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 23 Jul 2015 09:11:37 -0400 Subject: [PATCH 0402/1048] cmState: Fix compilation on IBM XL compiler Delay use of the PositionType constructor until after SnapshotDataType is fully defined. --- Source/cmState.cxx | 6 ++++++ Source/cmState.h | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Source/cmState.cxx b/Source/cmState.cxx index 9cbb84129..d73148df3 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -803,6 +803,12 @@ cmState::Snapshot cmState::Pop(cmState::Snapshot originSnapshot) return Snapshot(this, originSnapshot.Position->CallStackParent); } +cmState::Snapshot::Snapshot(cmState* state) + : State(state) + , Position() +{ +} + cmState::Snapshot::Snapshot(cmState* state, PositionType position) : State(state), Position(position) diff --git a/Source/cmState.h b/Source/cmState.h index acd23a529..17ee6ecea 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -43,7 +43,8 @@ public: class Snapshot { public: - Snapshot(cmState* state = 0, PositionType position = PositionType()); + Snapshot(cmState* state = 0); + Snapshot(cmState* state, PositionType position); void SetListFile(std::string const& listfile); From 6ed9c7e024d66d89ab303ba0d299fa4ee099f91b Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 18 Jul 2015 12:28:49 +0200 Subject: [PATCH 0403/1048] cmState: Host buildsystem properties for directories. --- Source/cmMakefile.cxx | 170 +++++------------------ Source/cmMakefile.h | 7 - Source/cmState.cxx | 306 +++++++++++++++++++++++++++++++++++++++++- Source/cmState.h | 29 ++++ 4 files changed, 370 insertions(+), 142 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 9575affcd..c54f97240 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -273,68 +273,36 @@ void cmMakefile::IssueMessage(cmake::MessageType t, } } -template -typename Range::const_iterator find_backwards(Range const& range, T t) -{ - typename Range::const_reverse_iterator rend = - std::find(range.rbegin(), range.rend(), t); - return rend.base(); -} - -static const std::string cmPropertySentinal = std::string(); - cmStringRange cmMakefile::GetIncludeDirectoriesEntries() const { - std::vector::const_iterator it = - find_backwards(this->IncludeDirectoriesEntries, cmPropertySentinal); - return cmMakeRange(it, this->IncludeDirectoriesEntries.end()); + return this->StateSnapshot.GetDirectory().GetIncludeDirectoriesEntries(); } cmBacktraceRange cmMakefile::GetIncludeDirectoriesBacktraces() const { - std::vector::const_iterator it = - find_backwards(this->IncludeDirectoriesEntries, cmPropertySentinal); - std::vector::const_iterator btIt = - this->IncludeDirectoriesEntryBacktraces.begin() - + std::distance(this->IncludeDirectoriesEntries.begin(), it); - return cmMakeRange( - btIt, this->IncludeDirectoriesEntryBacktraces.end()); + return this->StateSnapshot.GetDirectory() + .GetIncludeDirectoriesEntryBacktraces(); } cmStringRange cmMakefile::GetCompileOptionsEntries() const { - std::vector::const_iterator it = - find_backwards(this->CompileOptionsEntries, cmPropertySentinal); - return cmMakeRange(it, this->CompileOptionsEntries.end()); + return this->StateSnapshot.GetDirectory().GetCompileOptionsEntries(); } cmBacktraceRange cmMakefile::GetCompileOptionsBacktraces() const { - std::vector::const_iterator it = - find_backwards(this->CompileOptionsEntries, cmPropertySentinal); - std::vector::const_iterator btIt = - this->CompileOptionsEntryBacktraces.begin() - + std::distance(this->CompileOptionsEntries.begin(), it); - return cmMakeRange( - btIt, this->CompileOptionsEntryBacktraces.end()); + return this->StateSnapshot.GetDirectory().GetCompileOptionsEntryBacktraces(); } cmStringRange cmMakefile::GetCompileDefinitionsEntries() const { - std::vector::const_iterator it = - find_backwards(this->CompileDefinitionsEntries, cmPropertySentinal); - return cmMakeRange(it, this->CompileDefinitionsEntries.end()); + return this->StateSnapshot.GetDirectory().GetCompileDefinitionsEntries(); } cmBacktraceRange cmMakefile::GetCompileDefinitionsBacktraces() const { - std::vector::const_iterator btIt = - this->CompileDefinitionsEntryBacktraces.begin(); - std::vector::const_iterator it = - find_backwards(this->CompileDefinitionsEntries, cmPropertySentinal) - + std::distance(this->CompileDefinitionsEntries.begin(), it); - return cmMakeRange( - btIt, this->CompileDefinitionsEntryBacktraces.end()); + return this->StateSnapshot.GetDirectory() + .GetCompileDefinitionsEntryBacktraces(); } //---------------------------------------------------------------------------- @@ -1591,62 +1559,7 @@ void cmMakefile::InitializeFromParent(cmMakefile* parent) this->AddDefinition("CMAKE_CURRENT_BINARY_DIR", this->GetCurrentBinaryDirectory()); - { - std::vector::const_iterator it = - find_backwards(parent->IncludeDirectoriesEntries, cmPropertySentinal); - std::vector::const_iterator begin = - parent->IncludeDirectoriesEntries.begin(); - std::vector::const_iterator end = - parent->IncludeDirectoriesEntries.end(); - this->IncludeDirectoriesEntries.insert( - this->IncludeDirectoriesEntries.end(), it, end); - - std::vector::const_iterator btIt = - parent->IncludeDirectoriesEntryBacktraces.begin() - + std::distance(begin, it); - std::vector::const_iterator btEnd = - parent->IncludeDirectoriesEntryBacktraces.end(); - this->IncludeDirectoriesEntryBacktraces.insert( - this->IncludeDirectoriesEntryBacktraces.end(), btIt, btEnd); - } - - { - std::vector::const_iterator it = - find_backwards(parent->CompileOptionsEntries, cmPropertySentinal); - std::vector::const_iterator begin = - parent->CompileOptionsEntries.begin(); - std::vector::const_iterator end = - parent->CompileOptionsEntries.end(); - this->CompileOptionsEntries.insert( - this->CompileOptionsEntries.end(), it, end); - - std::vector::const_iterator btIt = - parent->CompileOptionsEntryBacktraces.begin() - + std::distance(begin, it); - std::vector::const_iterator btEnd = - parent->CompileOptionsEntryBacktraces.end(); - this->CompileOptionsEntryBacktraces.insert( - this->CompileOptionsEntryBacktraces.end(), btIt, btEnd); - } - - { - std::vector::const_iterator it = - find_backwards(parent->CompileDefinitionsEntries, cmPropertySentinal); - std::vector::const_iterator begin = - parent->CompileDefinitionsEntries.begin(); - std::vector::const_iterator end = - parent->CompileDefinitionsEntries.end(); - this->CompileDefinitionsEntries.insert( - this->CompileDefinitionsEntries.end(), it, end); - - std::vector::const_iterator btIt = - parent->CompileDefinitionsEntryBacktraces.begin() - + std::distance(begin, it); - std::vector::const_iterator btEnd = - parent->CompileDefinitionsEntryBacktraces.end(); - this->CompileDefinitionsEntryBacktraces.insert( - this->CompileDefinitionsEntryBacktraces.end(), btIt, btEnd); - } + this->StateSnapshot.InitializeFromParent(); this->SystemIncludeDirectories = parent->SystemIncludeDirectories; @@ -1990,17 +1903,18 @@ void cmMakefile::AddIncludeDirectories(const std::vector &incs, return; } - std::vector::iterator position = - before ? this->IncludeDirectoriesEntries.begin() - : this->IncludeDirectoriesEntries.end(); - std::vector::iterator btPos = - this->IncludeDirectoriesEntryBacktraces.begin() - + std::distance(this->IncludeDirectoriesEntries.begin(), position); - cmListFileBacktrace lfbt = this->GetBacktrace(); std::string entryString = cmJoin(incs, ";"); - this->IncludeDirectoriesEntries.insert(position, entryString); - this->IncludeDirectoriesEntryBacktraces.insert(btPos, lfbt); + if (before) + { + this->StateSnapshot.GetDirectory() + .PrependIncludeDirectoriesEntry(entryString, lfbt); + } + else + { + this->StateSnapshot.GetDirectory() + .AppendIncludeDirectoriesEntry(entryString, lfbt); + } // Property on each target: for (cmTargets::iterator l = this->Targets.begin(); @@ -4226,41 +4140,35 @@ void cmMakefile::SetProperty(const std::string& prop, const char* value) { if (prop == "INCLUDE_DIRECTORIES") { - this->IncludeDirectoriesEntries.push_back(cmPropertySentinal); - this->IncludeDirectoriesEntryBacktraces.push_back(cmListFileBacktrace()); if (!value) { + this->StateSnapshot.GetDirectory().ClearIncludeDirectories(); return; } cmListFileBacktrace lfbt = this->GetBacktrace(); - this->IncludeDirectoriesEntries.push_back(value); - this->IncludeDirectoriesEntryBacktraces.push_back(lfbt); + this->StateSnapshot.GetDirectory().SetIncludeDirectories(value, lfbt); return; } if (prop == "COMPILE_OPTIONS") { - this->CompileOptionsEntries.push_back(cmPropertySentinal); - this->CompileDefinitionsEntryBacktraces.push_back(cmListFileBacktrace()); if (!value) { + this->StateSnapshot.GetDirectory().ClearCompileOptions(); return; } cmListFileBacktrace lfbt = this->GetBacktrace(); - this->CompileOptionsEntries.push_back(value); - this->CompileOptionsEntryBacktraces.push_back(lfbt); + this->StateSnapshot.GetDirectory().SetCompileOptions(value, lfbt); return; } if (prop == "COMPILE_DEFINITIONS") { - this->CompileDefinitionsEntries.push_back(cmPropertySentinal); - this->CompileDefinitionsEntryBacktraces.push_back(cmListFileBacktrace()); if (!value) { + this->StateSnapshot.GetDirectory().ClearCompileDefinitions(); return; } cmListFileBacktrace lfbt = this->GetBacktrace(); - this->CompileDefinitionsEntries.push_back(value); - this->CompileDefinitionsEntryBacktraces.push_back(lfbt); + this->StateSnapshot.GetDirectory().SetCompileDefinitions(value, lfbt); return; } @@ -4274,22 +4182,21 @@ void cmMakefile::AppendProperty(const std::string& prop, if (prop == "INCLUDE_DIRECTORIES") { cmListFileBacktrace lfbt = this->GetBacktrace(); - this->IncludeDirectoriesEntries.push_back(value); - this->IncludeDirectoriesEntryBacktraces.push_back(lfbt); + this->StateSnapshot.GetDirectory().AppendIncludeDirectoriesEntry(value, + lfbt); return; } if (prop == "COMPILE_OPTIONS") { cmListFileBacktrace lfbt = this->GetBacktrace(); - this->CompileOptionsEntries.push_back(value); - this->CompileOptionsEntryBacktraces.push_back(lfbt); + this->StateSnapshot.GetDirectory().AppendCompileOptionsEntry(value, lfbt); return; } if (prop == "COMPILE_DEFINITIONS") { cmListFileBacktrace lfbt = this->GetBacktrace(); - this->CompileDefinitionsEntries.push_back(value); - this->CompileDefinitionsEntryBacktraces.push_back(lfbt); + this->StateSnapshot.GetDirectory().AppendCompileDefinitionsEntry(value, + lfbt); return; } @@ -4344,25 +4251,20 @@ const char *cmMakefile::GetProperty(const std::string& prop, } else if (prop == "INCLUDE_DIRECTORIES") { - std::vector::const_iterator it = - find_backwards(this->IncludeDirectoriesEntries, cmPropertySentinal); - output = cmJoin(cmMakeRange(it, this->IncludeDirectoriesEntries.end()), - ";"); + output = cmJoin(this->StateSnapshot.GetDirectory() + .GetIncludeDirectoriesEntries(), ";"); return output.c_str(); } else if (prop == "COMPILE_OPTIONS") { - std::vector::const_iterator it = - find_backwards(this->CompileOptionsEntries, cmPropertySentinal); - output = cmJoin(cmMakeRange(it, this->CompileOptionsEntries.end()), ";"); + output = cmJoin(this->StateSnapshot.GetDirectory() + .GetCompileOptionsEntries(), ";"); return output.c_str(); } else if (prop == "COMPILE_DEFINITIONS") { - std::vector::const_iterator it = - find_backwards(this->CompileDefinitionsEntries, cmPropertySentinal); - output = cmJoin(cmMakeRange(it, this->CompileDefinitionsEntries.end()), - ";"); + output = cmJoin(this->StateSnapshot.GetDirectory() + .GetCompileDefinitionsEntries(), ";"); return output.c_str(); } diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 27911a97c..c335a33cf 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -846,13 +846,6 @@ protected: std::vector HeaderFileExtensions; std::string DefineFlags; - std::vector IncludeDirectoriesEntries; - std::vector IncludeDirectoriesEntryBacktraces; - std::vector CompileOptionsEntries; - std::vector CompileOptionsEntryBacktraces; - std::vector CompileDefinitionsEntries; - std::vector CompileDefinitionsEntryBacktraces; - // Track the value of the computed DEFINITIONS property. void AddDefineFlag(const char*, std::string&); void RemoveDefineFlag(const char*, std::string::size_type, std::string&); diff --git a/Source/cmState.cxx b/Source/cmState.cxx index d73148df3..d8f8306f9 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -28,6 +28,9 @@ struct cmState::SnapshotDataType BuildSystemDirectory; std::string EntryPointCommand; long EntryPointLine; + std::vector::size_type IncludeDirectoryPosition; + std::vector::size_type CompileDefinitionsPosition; + std::vector::size_type CompileOptionsPosition; }; struct cmState::BuildsystemDirectoryStateType @@ -44,6 +47,15 @@ struct cmState::BuildsystemDirectoryStateType // safely by the build tools. std::string RelativePathTopSource; std::string RelativePathTopBinary; + + std::vector IncludeDirectories; + std::vector IncludeDirectoryBacktraces; + + std::vector CompileDefinitions; + std::vector CompileDefinitionsBacktraces; + + std::vector CompileOptions; + std::vector CompileOptionsBacktraces; }; cmState::cmState(cmake* cm) @@ -228,7 +240,16 @@ cmState::Snapshot cmState::Reset() this->GlobalProperties.clear(); this->PropertyDefinitions.clear(); - this->BuildsystemDirectory.Truncate(); + { + cmLinkedTree::iterator it = + this->BuildsystemDirectory.Truncate(); + it->IncludeDirectories.clear(); + it->IncludeDirectoryBacktraces.clear(); + it->CompileDefinitions.clear(); + it->CompileDefinitionsBacktraces.clear(); + it->CompileOptions.clear(); + it->CompileOptionsBacktraces.clear(); + } PositionType pos = this->SnapshotData.Truncate(); this->ExecutionListFiles.Truncate(); @@ -698,6 +719,9 @@ cmState::Snapshot cmState::CreateBaseSnapshot() this->BuildsystemDirectory.Extend(this->BuildsystemDirectory.Root()); pos->ExecutionListFile = this->ExecutionListFiles.Extend(this->ExecutionListFiles.Root()); + pos->IncludeDirectoryPosition = 0; + pos->CompileDefinitionsPosition = 0; + pos->CompileOptionsPosition = 0; return cmState::Snapshot(this, pos); } @@ -796,6 +820,13 @@ cmState::Snapshot cmState::Pop(cmState::Snapshot originSnapshot) PositionType pos = originSnapshot.Position; PositionType prevPos = pos; ++prevPos; + prevPos->IncludeDirectoryPosition = + prevPos->BuildSystemDirectory->IncludeDirectories.size(); + prevPos->CompileDefinitionsPosition = + prevPos->BuildSystemDirectory->CompileDefinitions.size(); + prevPos->CompileOptionsPosition = + prevPos->BuildSystemDirectory->CompileOptions.size(); + if (prevPos == this->SnapshotData.Root()) { return Snapshot(this, prevPos); @@ -949,6 +980,62 @@ cmState::Snapshot cmState::Snapshot::GetCallStackParent() const return snapshot; } +static const std::string cmPropertySentinal = std::string(); + +template +void InitializeContentFromParent(T& parentContent, + T& thisContent, + U& parentBacktraces, + U& thisBacktraces, + V& contentEndPosition) +{ + std::vector::const_iterator parentBegin = + parentContent.begin(); + std::vector::const_iterator parentEnd = + parentContent.end(); + + std::vector::const_reverse_iterator parentRbegin = + cmMakeReverseIterator(parentEnd); + std::vector::const_reverse_iterator parentRend = + parentContent.rend(); + parentRbegin = std::find(parentRbegin, parentRend, cmPropertySentinal); + std::vector::const_iterator parentIt = parentRbegin.base(); + + thisContent = std::vector(parentIt, parentEnd); + + std::vector::const_iterator btIt = + parentBacktraces.begin() + std::distance(parentBegin, parentIt); + std::vector::const_iterator btEnd = + parentBacktraces.end(); + + thisBacktraces = std::vector(btIt, btEnd); + + contentEndPosition = thisContent.size(); +} + +void cmState::Snapshot::InitializeFromParent() +{ + PositionType parent = this->Position->DirectoryParent; + + InitializeContentFromParent(parent->BuildSystemDirectory->IncludeDirectories, + this->Position->BuildSystemDirectory->IncludeDirectories, + parent->BuildSystemDirectory->IncludeDirectoryBacktraces, + this->Position->BuildSystemDirectory->IncludeDirectoryBacktraces, + this->Position->IncludeDirectoryPosition); + + InitializeContentFromParent(parent->BuildSystemDirectory->CompileDefinitions, + this->Position->BuildSystemDirectory->CompileDefinitions, + parent->BuildSystemDirectory->CompileDefinitionsBacktraces, + this->Position->BuildSystemDirectory->CompileDefinitionsBacktraces, + this->Position->CompileDefinitionsPosition); + + InitializeContentFromParent(parent->BuildSystemDirectory->CompileOptions, + this->Position->BuildSystemDirectory->CompileOptions, + parent->BuildSystemDirectory->CompileOptionsBacktraces, + this->Position->BuildSystemDirectory->CompileOptionsBacktraces, + this->Position->CompileOptionsPosition); +} + cmState* cmState::Snapshot::GetState() const { return this->State; @@ -966,3 +1053,220 @@ cmState::Directory::Directory( { } + +template +cmStringRange GetPropertyContent(T const& content, U contentEndPosition) +{ + std::vector::const_iterator end = + content.begin() + contentEndPosition; + + std::vector::const_reverse_iterator rbegin = + cmMakeReverseIterator(end); + rbegin = std::find(rbegin, content.rend(), cmPropertySentinal); + + return cmMakeRange(rbegin.base(), end); +} + +template +cmBacktraceRange GetPropertyBacktraces(T const& content, + U const& backtraces, + V contentEndPosition) +{ + std::vector::const_iterator entryEnd = + content.begin() + contentEndPosition; + + std::vector::const_reverse_iterator rbegin = + cmMakeReverseIterator(entryEnd); + rbegin = std::find(rbegin, content.rend(), cmPropertySentinal); + + std::vector::const_iterator it = + backtraces.begin() + std::distance(content.begin(), rbegin.base()); + + std::vector::const_iterator end = backtraces.end(); + return cmMakeRange(it, end); +} + +template +void AppendEntry(T& content, U& backtraces, V& endContentPosition, + const std::string& vec, const cmListFileBacktrace& lfbt) +{ + assert(endContentPosition == content.size()); + + content.push_back(vec); + backtraces.push_back(lfbt); + + endContentPosition = content.size(); +} + +template +void SetContent(T& content, U& backtraces, V& endContentPosition, + const std::string& vec, const cmListFileBacktrace& lfbt) +{ + assert(endContentPosition == content.size()); + + content.resize(content.size() + 2); + backtraces.resize(backtraces.size() + 2); + + content.back() = vec; + backtraces.back() = lfbt; + + endContentPosition = content.size(); +} + +template +void ClearContent(T& content, U& backtraces, V& endContentPosition) +{ + assert(endContentPosition == content.size()); + + content.resize(content.size() + 1); + backtraces.resize(backtraces.size() + 1); + + endContentPosition = content.size(); +} + +cmStringRange +cmState::Directory::GetIncludeDirectoriesEntries() const +{ + return GetPropertyContent(this->DirectoryState->IncludeDirectories, + this->Snapshot_.Position->IncludeDirectoryPosition); +} + +cmBacktraceRange +cmState::Directory::GetIncludeDirectoriesEntryBacktraces() const +{ + return GetPropertyBacktraces(this->DirectoryState->IncludeDirectories, + this->DirectoryState->IncludeDirectoryBacktraces, + this->Snapshot_.Position->IncludeDirectoryPosition); +} + +void cmState::Directory::AppendIncludeDirectoriesEntry( + const std::string& vec, const cmListFileBacktrace& lfbt) +{ + AppendEntry(this->DirectoryState->IncludeDirectories, + this->DirectoryState->IncludeDirectoryBacktraces, + this->Snapshot_.Position->IncludeDirectoryPosition, + vec, lfbt); +} + +void cmState::Directory::PrependIncludeDirectoriesEntry( + const std::string& vec, const cmListFileBacktrace& lfbt) +{ + std::vector::iterator entryEnd = + this->DirectoryState->IncludeDirectories.begin() + + this->Snapshot_.Position->IncludeDirectoryPosition; + + std::vector::const_reverse_iterator rend = + this->DirectoryState->IncludeDirectories.rend(); + std::vector::reverse_iterator rbegin = + cmMakeReverseIterator(entryEnd); + std::vector::const_reverse_iterator crbegin = rbegin; + crbegin = std::find(crbegin, rend, cmPropertySentinal); + + std::vector::const_iterator entryIt = crbegin.base(); + std::vector::const_iterator entryBegin = + this->DirectoryState->IncludeDirectories.begin(); + + std::vector::iterator btIt = + this->DirectoryState->IncludeDirectoryBacktraces.begin() + + std::distance(entryBegin, entryIt); + + this->DirectoryState->IncludeDirectories.insert(rbegin.base(), vec); + this->DirectoryState->IncludeDirectoryBacktraces.insert(btIt, lfbt); + + this->Snapshot_.Position->IncludeDirectoryPosition = + this->DirectoryState->IncludeDirectories.size(); +} + +void cmState::Directory::SetIncludeDirectories( + const std::string& vec, const cmListFileBacktrace& lfbt) +{ + SetContent(this->DirectoryState->IncludeDirectories, + this->DirectoryState->IncludeDirectoryBacktraces, + this->Snapshot_.Position->IncludeDirectoryPosition, + vec, lfbt); +} + +void cmState::Directory::ClearIncludeDirectories() +{ + ClearContent(this->DirectoryState->IncludeDirectories, + this->DirectoryState->IncludeDirectoryBacktraces, + this->Snapshot_.Position->IncludeDirectoryPosition); +} + +cmStringRange cmState::Directory::GetCompileDefinitionsEntries() const +{ + return GetPropertyContent(this->DirectoryState->CompileDefinitions, + this->Snapshot_.Position->CompileDefinitionsPosition); +} + +cmBacktraceRange +cmState::Directory::GetCompileDefinitionsEntryBacktraces() const +{ + return GetPropertyBacktraces(this->DirectoryState->CompileDefinitions, + this->DirectoryState->CompileDefinitionsBacktraces, + this->Snapshot_.Position->CompileDefinitionsPosition); +} + +void cmState::Directory::AppendCompileDefinitionsEntry(const std::string& vec, + const cmListFileBacktrace& lfbt) +{ + AppendEntry(this->DirectoryState->CompileDefinitions, + this->DirectoryState->CompileDefinitionsBacktraces, + this->Snapshot_.Position->CompileDefinitionsPosition, + vec, lfbt); +} + +void cmState::Directory::SetCompileDefinitions(const std::string& vec, + const cmListFileBacktrace& lfbt) +{ + SetContent(this->DirectoryState->CompileDefinitions, + this->DirectoryState->CompileDefinitionsBacktraces, + this->Snapshot_.Position->CompileDefinitionsPosition, + vec, lfbt); +} + +void cmState::Directory::ClearCompileDefinitions() +{ + ClearContent(this->DirectoryState->CompileDefinitions, + this->DirectoryState->CompileDefinitionsBacktraces, + this->Snapshot_.Position->CompileDefinitionsPosition); +} + +cmStringRange cmState::Directory::GetCompileOptionsEntries() const +{ + return GetPropertyContent(this->DirectoryState->CompileOptions, + this->Snapshot_.Position->CompileOptionsPosition); +} + +cmBacktraceRange cmState::Directory::GetCompileOptionsEntryBacktraces() const +{ + return GetPropertyBacktraces(this->DirectoryState->CompileOptions, + this->DirectoryState->CompileOptionsBacktraces, + this->Snapshot_.Position->CompileOptionsPosition); +} + +void +cmState::Directory::AppendCompileOptionsEntry(const std::string& vec, + const cmListFileBacktrace& lfbt) +{ + AppendEntry(this->DirectoryState->CompileOptions, + this->DirectoryState->CompileOptionsBacktraces, + this->Snapshot_.Position->CompileOptionsPosition, + vec, lfbt); +} + +void cmState::Directory::SetCompileOptions(const std::string& vec, + const cmListFileBacktrace& lfbt) +{ + SetContent(this->DirectoryState->CompileOptions, + this->DirectoryState->CompileOptionsBacktraces, + this->Snapshot_.Position->CompileOptionsPosition, + vec, lfbt); +} + +void cmState::Directory::ClearCompileOptions() +{ + ClearContent(this->DirectoryState->CompileOptions, + this->DirectoryState->CompileOptionsBacktraces, + this->Snapshot_.Position->CompileOptionsPosition); +} diff --git a/Source/cmState.h b/Source/cmState.h index 17ee6ecea..0d5300f75 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -16,6 +16,7 @@ #include "cmPropertyDefinitionMap.h" #include "cmPropertyMap.h" #include "cmLinkedTree.h" +#include "cmAlgorithms.h" class cmake; class cmCommand; @@ -56,6 +57,8 @@ public: Snapshot GetBuildsystemDirectoryParent() const; Snapshot GetCallStackParent() const; + void InitializeFromParent(); + cmState* GetState() const; Directory GetDirectory() const; @@ -87,6 +90,32 @@ public: void SetRelativePathTopSource(const char* dir); void SetRelativePathTopBinary(const char* dir); + cmStringRange GetIncludeDirectoriesEntries() const; + cmBacktraceRange GetIncludeDirectoriesEntryBacktraces() const; + void AppendIncludeDirectoriesEntry(std::string const& vec, + cmListFileBacktrace const& lfbt); + void PrependIncludeDirectoriesEntry(std::string const& vec, + cmListFileBacktrace const& lfbt); + void SetIncludeDirectories(std::string const& vec, + cmListFileBacktrace const& lfbt); + void ClearIncludeDirectories(); + + cmStringRange GetCompileDefinitionsEntries() const; + cmBacktraceRange GetCompileDefinitionsEntryBacktraces() const; + void AppendCompileDefinitionsEntry(std::string const& vec, + cmListFileBacktrace const& lfbt); + void SetCompileDefinitions(std::string const& vec, + cmListFileBacktrace const& lfbt); + void ClearCompileDefinitions(); + + cmStringRange GetCompileOptionsEntries() const; + cmBacktraceRange GetCompileOptionsEntryBacktraces() const; + void AppendCompileOptionsEntry(std::string const& vec, + cmListFileBacktrace const& lfbt); + void SetCompileOptions(std::string const& vec, + cmListFileBacktrace const& lfbt); + void ClearCompileOptions(); + private: void ComputeRelativePathTopSource(); void ComputeRelativePathTopBinary(); From bbb507aebcb3559ae6e7d34ef02443e2d6ec3869 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 22 Jul 2015 20:52:02 +0200 Subject: [PATCH 0404/1048] cmMakefile: Move the InitializeFromParent method --- Source/cmMakefile.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index c54f97240..9a28c7c49 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1554,13 +1554,13 @@ void cmMakefile::InitializeFromParent(cmMakefile* parent) // Initialize definitions with the closure of the parent scope. this->Internal->InitializeDefinitions(parent); + this->StateSnapshot.InitializeFromParent(); + this->AddDefinition("CMAKE_CURRENT_SOURCE_DIR", this->GetCurrentSourceDirectory()); this->AddDefinition("CMAKE_CURRENT_BINARY_DIR", this->GetCurrentBinaryDirectory()); - this->StateSnapshot.InitializeFromParent(); - this->SystemIncludeDirectories = parent->SystemIncludeDirectories; // define flags From 983d7b5c3a3dcacbad7a9ab2396aeb317d677006 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sun, 26 Jul 2015 00:01:05 -0400 Subject: [PATCH 0405/1048] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 59656b8bf..5e38af7fc 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 3) -set(CMake_VERSION_PATCH 20150725) +set(CMake_VERSION_PATCH 20150726) #set(CMake_VERSION_RC 1) From 317df61fc817d4013baf225242be905e434ff2f5 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Mon, 27 Jul 2015 00:01:06 -0400 Subject: [PATCH 0406/1048] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 5e38af7fc..f5c693a0c 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 3) -set(CMake_VERSION_PATCH 20150726) +set(CMake_VERSION_PATCH 20150727) #set(CMake_VERSION_RC 1) From 9d5082b26ebffe1e834c5c13e22bba02933e5c59 Mon Sep 17 00:00:00 2001 From: Roy Crihfield Date: Thu, 23 Jul 2015 14:44:30 -0400 Subject: [PATCH 0407/1048] cmake-mode.el: Minor clean-up Superficial changes to use more conventional Emacs Lisp idioms. --- Auxiliary/cmake-mode.el | 61 ++++++++++++++--------------------------- 1 file changed, 20 insertions(+), 41 deletions(-) diff --git a/Auxiliary/cmake-mode.el b/Auxiliary/cmake-mode.el index 51663a8e1..7051cc8c0 100644 --- a/Auxiliary/cmake-mode.el +++ b/Auxiliary/cmake-mode.el @@ -71,20 +71,16 @@ set the path with these commands: ;------------------------------------------------------------------------------ -;; -;; Helper functions for line indentation function. -;; +;; Line indentation helper functions + (defun cmake-line-starts-inside-string () "Determine whether the beginning of the current line is in a string." - (if (save-excursion - (beginning-of-line) - (let ((parse-end (point))) - (goto-char (point-min)) - (nth 3 (parse-partial-sexp (point) parse-end)) - ) - ) - t - nil + (save-excursion + (beginning-of-line) + (let ((parse-end (point))) + (goto-char (point-min)) + (nth 3 (parse-partial-sexp (point) parse-end)) + ) ) ) @@ -111,57 +107,40 @@ set the path with these commands: ;; Line indentation function. ;; (defun cmake-indent () - "Indent current line as CMAKE code." + "Indent current line as CMake code." (interactive) - (if (cmake-line-starts-inside-string) - () + (unless (cmake-line-starts-inside-string) (if (bobp) (cmake-indent-line-to 0) (let (cur-indent) - (save-excursion (beginning-of-line) - (let ((point-start (point)) (case-fold-search t) ;; case-insensitive token) - ; Search back for the last indented line. (cmake-find-last-indented-line) - ; Start with the indentation on this line. (setq cur-indent (current-indentation)) - ; Search forward counting tokens that adjust indentation. (while (re-search-forward cmake-regex-token point-start t) (setq token (match-string 0)) - (if (string-match (concat "^" cmake-regex-paren-left "$") token) - (setq cur-indent (+ cur-indent cmake-tab-width)) - ) - (if (string-match (concat "^" cmake-regex-paren-right "$") token) - (setq cur-indent (- cur-indent cmake-tab-width)) - ) - (if (and - (string-match cmake-regex-block-open token) - (looking-at (concat "[ \t]*" cmake-regex-paren-left)) - ) - (setq cur-indent (+ cur-indent cmake-tab-width)) - ) + (when (or (string-match (concat "^" cmake-regex-paren-left "$") token) + (and (string-match cmake-regex-block-open token) + (looking-at (concat "[ \t]*" cmake-regex-paren-left)))) + (setq cur-indent (+ cur-indent cmake-tab-width))) + (when (string-match (concat "^" cmake-regex-paren-right "$") token) + (setq cur-indent (- cur-indent cmake-tab-width))) ) (goto-char point-start) - - ; If this is the end of a block, decrease indentation. - (if (looking-at cmake-regex-block-close) - (setq cur-indent (- cur-indent cmake-tab-width)) + ;; If next token closes the block, decrease indentation + (when (looking-at cmake-regex-block-close) + (setq cur-indent (- cur-indent cmake-tab-width)) ) ) ) - ; Indent this line by the amount selected. - (if (< cur-indent 0) - (cmake-indent-line-to 0) - (cmake-indent-line-to cur-indent) - ) + (cmake-indent-line-to (max cur-indent 0)) ) ) ) From 63de609ef147e665ebd8d7622f580a74a417287b Mon Sep 17 00:00:00 2001 From: Roy Crihfield Date: Thu, 23 Jul 2015 14:47:29 -0400 Subject: [PATCH 0408/1048] cmake-mode.el: Use `rx' for regexps This allows the keywords be defined in a list and reused in different regexps. --- Auxiliary/cmake-mode.el | 42 +++++++++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 16 deletions(-) diff --git a/Auxiliary/cmake-mode.el b/Auxiliary/cmake-mode.el index 7051cc8c0..fe4a4c65a 100644 --- a/Auxiliary/cmake-mode.el +++ b/Auxiliary/cmake-mode.el @@ -43,7 +43,14 @@ set the path with these commands: (setenv \"PATH\" (concat (getenv \"PATH\") \":/usr/local/cmake/bin\"))" :type 'file :group 'cmake) -;; + +;; Keywords +(defconst cmake-keywords-block-open '("IF" "MACRO" "FOREACH" "ELSE" "ELSEIF" "WHILE" "FUNCTION")) +(defconst cmake-keywords-block-close '("ENDIF" "ENDFOREACH" "ENDMACRO" "ELSE" "ELSEIF" "ENDWHILE" "ENDFUNCTION")) +(defconst cmake-keywords + (let ((kwds (append cmake-keywords-block-open cmake-keywords-block-close nil))) + (delete-dups kwds))) + ;; Regular expressions used by line indentation function. ;; (defconst cmake-regex-blank "^[ \t]*$") @@ -51,23 +58,26 @@ set the path with these commands: (defconst cmake-regex-paren-left "(") (defconst cmake-regex-paren-right ")") (defconst cmake-regex-argument-quoted - "\"\\([^\"\\\\]\\|\\\\\\(.\\|\n\\)\\)*\"") + (rx ?\" (* (or (not (any ?\" ?\\)) (and ?\\ anything))) ?\")) (defconst cmake-regex-argument-unquoted - "\\([^ \t\r\n()#\"\\\\]\\|\\\\.\\)\\([^ \t\r\n()#\\\\]\\|\\\\.\\)*") -(defconst cmake-regex-token (concat "\\(" cmake-regex-comment - "\\|" cmake-regex-paren-left - "\\|" cmake-regex-paren-right - "\\|" cmake-regex-argument-unquoted - "\\|" cmake-regex-argument-quoted - "\\)")) -(defconst cmake-regex-indented (concat "^\\(" - cmake-regex-token - "\\|" "[ \t\r\n]" - "\\)*")) + (rx (or (not (any space "()#\"\\\n")) (and ?\\ nonl)) + (* (or (not (any space "()#\\\n")) (and ?\\ nonl))))) +(defconst cmake-regex-token + (rx-to-string `(group (or (regexp ,cmake-regex-comment) + ?( ?) + (regexp ,cmake-regex-argument-unquoted) + (regexp ,cmake-regex-argument-quoted))))) +(defconst cmake-regex-indented + (rx-to-string `(and bol (* (group (or (regexp ,cmake-regex-token) (any space ?\n))))))) (defconst cmake-regex-block-open - "^\\(if\\|macro\\|foreach\\|else\\|elseif\\|while\\|function\\)$") + (rx-to-string `(and bow (or ,@(append cmake-keywords-block-open + (mapcar 'downcase cmake-keywords-block-open))) eow))) (defconst cmake-regex-block-close - "^[ \t]*\\(endif\\|endforeach\\|endmacro\\|else\\|elseif\\|endwhile\\|endfunction\\)[ \t]*(") + (rx-to-string `(and bow (or ,@(append cmake-keywords-block-close + (mapcar 'downcase cmake-keywords-block-close))) eow))) +(defconst cmake-regex-close + (rx-to-string `(and bol (* space) (regexp ,cmake-regex-block-close) + (* space) (regexp ,cmake-regex-paren-left)))) ;------------------------------------------------------------------------------ @@ -134,7 +144,7 @@ set the path with these commands: ) (goto-char point-start) ;; If next token closes the block, decrease indentation - (when (looking-at cmake-regex-block-close) + (when (looking-at cmake-regex-close) (setq cur-indent (- cur-indent cmake-tab-width)) ) ) From 7987d9857e581b5266d98d79aa71a8f45611f203 Mon Sep 17 00:00:00 2001 From: Roy Crihfield Date: Fri, 6 Mar 2015 15:08:12 -0500 Subject: [PATCH 0409/1048] cmake-mode.el: Rename function to be consistent unscreamify-cmake-buffer => cmake-unscreamify-buffer While at it, wrap the operation in (save-excursion). --- Auxiliary/cmake-mode.el | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/Auxiliary/cmake-mode.el b/Auxiliary/cmake-mode.el index fe4a4c65a..ea2415ddb 100644 --- a/Auxiliary/cmake-mode.el +++ b/Auxiliary/cmake-mode.el @@ -172,17 +172,19 @@ the indentation. Otherwise it retains the same position on the line" ;; ;; Helper functions for buffer ;; -(defun unscreamify-cmake-buffer () +(defun cmake-unscreamify-buffer () "Convert all CMake commands to lowercase in buffer." (interactive) - (goto-char (point-min)) - (while (re-search-forward "^\\([ \t]*\\)\\(\\w+\\)\\([ \t]*(\\)" nil t) - (replace-match - (concat - (match-string 1) - (downcase (match-string 2)) - (match-string 3)) - t)) + (save-excursion + (goto-char (point-min)) + (while (re-search-forward "^\\([ \t]*\\)\\(\\w+\\)\\([ \t]*(\\)" nil t) + (replace-match + (concat + (match-string 1) + (downcase (match-string 2)) + (match-string 3)) + t)) + ) ) ;------------------------------------------------------------------------------ From 41d6044bcfed908a6197502b038bea86a5ad3526 Mon Sep 17 00:00:00 2001 From: Roy Crihfield Date: Fri, 6 Mar 2015 16:34:37 -0500 Subject: [PATCH 0410/1048] cmake-mode.el: Add font-lock for keywords and variables Control flow keywords will now be highlighted as such. Variable names will be also be recognized. Adjust function name highlighting to work in places other than the start of a line. --- Auxiliary/cmake-mode.el | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Auxiliary/cmake-mode.el b/Auxiliary/cmake-mode.el index ea2415ddb..6e1a23c5c 100644 --- a/Auxiliary/cmake-mode.el +++ b/Auxiliary/cmake-mode.el @@ -193,9 +193,17 @@ the indentation. Otherwise it retains the same position on the line" ;; Keyword highlighting regex-to-face map. ;; (defconst cmake-font-lock-keywords - (list '("^[ \t]*\\([[:word:]_]+\\)[ \t]*(" 1 font-lock-function-name-face)) - "Highlighting expressions for CMAKE mode." - ) + `((,(rx-to-string `(and symbol-start + (or ,@cmake-keywords + ,@(mapcar #'downcase cmake-keywords)) + symbol-end)) + . font-lock-keyword-face) + (,(rx symbol-start (group (+ (or word (syntax symbol)))) ?\() + 1 font-lock-function-name-face) + ("\\${?\\([[:alpha:]_][[:alnum:]_]*\\|[0-9]+\\|[$*_]\\)" + 1 font-lock-variable-name-face t) + ) + "Highlighting expressions for CMake mode.") ;------------------------------------------------------------------------------ From 5593f28fac6d2aeb909370c4daaa19f419e5d596 Mon Sep 17 00:00:00 2001 From: Roy Crihfield Date: Fri, 6 Mar 2015 16:36:09 -0500 Subject: [PATCH 0411/1048] cmake-mode.el: Derive cmake-mode from prog-mode Emacs 24 and above support a generic "prog-mode" to simplify definition of programming modes. Derive "cmake-mode" from it since we are a programming mode. --- Auxiliary/cmake-mode.el | 58 ++++++++++++++++------------------------- 1 file changed, 23 insertions(+), 35 deletions(-) diff --git a/Auxiliary/cmake-mode.el b/Auxiliary/cmake-mode.el index 6e1a23c5c..02f03855f 100644 --- a/Auxiliary/cmake-mode.el +++ b/Auxiliary/cmake-mode.el @@ -207,12 +207,18 @@ the indentation. Otherwise it retains the same position on the line" ;------------------------------------------------------------------------------ -;; -;; Syntax table for this mode. Initialize to nil so that it is -;; regenerated when the cmake-mode function is called. -;; -(defvar cmake-mode-syntax-table nil "Syntax table for cmake-mode.") -(setq cmake-mode-syntax-table nil) +;; Syntax table for this mode. +(defvar cmake-mode-syntax-table nil + "Syntax table for CMake mode.") +(or cmake-mode-syntax-table + (setq cmake-mode-syntax-table + (let ((table (make-syntax-table))) + (modify-syntax-entry ?\( "()" table) + (modify-syntax-entry ?\) ")(" table) + (modify-syntax-entry ?# "<" table) + (modify-syntax-entry ?\n ">" table) + (modify-syntax-entry ?$ "'" table) + table))) ;; ;; User hook entry point. @@ -226,41 +232,23 @@ the indentation. Otherwise it retains the same position on the line" ;------------------------------------------------------------------------------ -;; -;; CMake mode startup function. +;; For compatibility with Emacs < 24 +(defalias 'cmake--parent-mode + (if (fboundp 'prog-mode) 'prog-mode 'fundamental-mode)) + +;;------------------------------------------------------------------------------ +;; Mode definition. ;; ;;;###autoload -(defun cmake-mode () - "Major mode for editing CMake listfiles." - (interactive) - (kill-all-local-variables) - (setq major-mode 'cmake-mode) - (setq mode-name "CMAKE") - - ; Create the syntax table - (setq cmake-mode-syntax-table (make-syntax-table)) - (set-syntax-table cmake-mode-syntax-table) - (modify-syntax-entry ?\( "()" cmake-mode-syntax-table) - (modify-syntax-entry ?\) ")(" cmake-mode-syntax-table) - (modify-syntax-entry ?# "<" cmake-mode-syntax-table) - (modify-syntax-entry ?\n ">" cmake-mode-syntax-table) +(define-derived-mode cmake-mode cmake--parent-mode "CMake" + "Major mode for editing CMake source files." ; Setup font-lock mode. - (make-local-variable 'font-lock-defaults) - (setq font-lock-defaults '(cmake-font-lock-keywords)) - + (set (make-local-variable 'font-lock-defaults) '(cmake-font-lock-keywords)) ; Setup indentation function. - (make-local-variable 'indent-line-function) - (setq indent-line-function 'cmake-indent) - + (set (make-local-variable 'indent-line-function) 'cmake-indent) ; Setup comment syntax. - (make-local-variable 'comment-start) - (setq comment-start "#") - - ; Run user hooks. - (if (boundp 'prog-mode-hook) - (run-hooks 'prog-mode-hook 'cmake-mode-hook) - (run-hooks 'cmake-mode-hook))) + (set (make-local-variable 'comment-start) "#")) ; Help mode starts here From 096dd3c9634d331fcb0c4cdf74f6fcda04b755cf Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 22 Jul 2015 13:20:35 -0400 Subject: [PATCH 0412/1048] cmDependsFortranLexer: Remove trailing blank line --- Source/cmDependsFortranLexer.cxx | 1 - 1 file changed, 1 deletion(-) diff --git a/Source/cmDependsFortranLexer.cxx b/Source/cmDependsFortranLexer.cxx index 1eff1e4b4..745345241 100644 --- a/Source/cmDependsFortranLexer.cxx +++ b/Source/cmDependsFortranLexer.cxx @@ -2411,4 +2411,3 @@ YY_BUFFER_STATE cmDependsFortranLexer_GetCurrentBuffer(yyscan_t yyscanner) struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; return YY_CURRENT_BUFFER; } - From 98b9645bcebf009643cff4e265cfcd31b56d80f5 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Wed, 22 Jul 2015 13:21:45 -0400 Subject: [PATCH 0413/1048] Rename Fortran parser infrastructure to drop "Depends" prefix The parser can be re-used outside cmDependsFortran or the cmDepends class hierarchy so drop the "Depends" from its name: rename 's/DependsFortran([A-Za-z0-9_])/Fortran$1/' Source/*.* sed -i 's/DependsFortran\([A-Za-z0-9_]\)/Fortran\1/g' Source/*.* sed -i 's/FortranInternals/DependsFortranInternals/g' Source/*.* Also manually fix Source/CMakeLists.txt source file ordering. --- Source/CMakeLists.txt | 9 +- Source/cmDependsFortran.cxx | 142 +++--- Source/cmDependsFortran.h | 8 +- Source/cmDependsFortranParser.h | 96 ---- ...ndsFortranLexer.cxx => cmFortranLexer.cxx} | 450 +++++++++--------- ...DependsFortranLexer.h => cmFortranLexer.h} | 76 +-- ...sFortranLexer.in.l => cmFortranLexer.in.l} | 38 +- ...sFortranParser.cxx => cmFortranParser.cxx} | 206 ++++---- Source/cmFortranParser.h | 96 ++++ ...pendsFortranParser.y => cmFortranParser.y} | 140 +++--- ...ParserTokens.h => cmFortranParserTokens.h} | 4 +- 11 files changed, 633 insertions(+), 632 deletions(-) delete mode 100644 Source/cmDependsFortranParser.h rename Source/{cmDependsFortranLexer.cxx => cmFortranLexer.cxx} (83%) rename Source/{cmDependsFortranLexer.h => cmFortranLexer.h} (74%) rename Source/{cmDependsFortranLexer.in.l => cmFortranLexer.in.l} (78%) rename Source/{cmDependsFortranParser.cxx => cmFortranParser.cxx} (91%) create mode 100644 Source/cmFortranParser.h rename Source/{cmDependsFortranParser.y => cmFortranParser.y} (56%) rename Source/{cmDependsFortranParserTokens.h => cmFortranParserTokens.h} (97%) diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index d5fe7d19f..7e393863f 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -88,7 +88,7 @@ option(CMAKE_REGENERATE_YACCLEX "Regenerate YACC and LEXX files" OFF) mark_as_advanced(CMAKE_REGENERATE_YACCLEX) if(CMAKE_REGENERATE_YACCLEX) - set(parsersLexers cmDependsFortran cmCommandArgument cmExpr) + set(parsersLexers cmFortran cmCommandArgument cmExpr) find_program(YACC_EXECUTABLE NAMES yacc bison PATHS /usr/bin @@ -193,9 +193,6 @@ set(SRCS cmDependsC.h cmDependsFortran.cxx cmDependsFortran.h - cmDependsFortranLexer.cxx - cmDependsFortranParser.cxx - cmDependsFortranParser.h cmDependsJava.cxx cmDependsJava.h cmDependsJavaLexer.cxx @@ -243,6 +240,10 @@ set(SRCS cmFileLockResult.h cmFileTimeComparison.cxx cmFileTimeComparison.h + cmFortranLexer.cxx + cmFortranLexer.h + cmFortranParser.cxx + cmFortranParser.h cmGeneratedFileStream.cxx cmGeneratorExpressionContext.cxx cmGeneratorExpressionContext.h diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx index 1b2586c23..cbc8c8ba3 100644 --- a/Source/cmDependsFortran.cxx +++ b/Source/cmDependsFortran.cxx @@ -16,7 +16,7 @@ #include "cmMakefile.h" #include "cmGeneratedFileStream.h" -#include "cmDependsFortranParser.h" /* Interface to parser object. */ +#include "cmFortranParser.h" /* Interface to parser object. */ #include #include #include @@ -27,7 +27,7 @@ //---------------------------------------------------------------------------- // Information about a single source file. -class cmDependsFortranSourceInfo +class cmFortranSourceInfo { public: // The name of the source file. @@ -45,16 +45,16 @@ public: // Parser methods not included in generated interface. // Get the current buffer processed by the lexer. -YY_BUFFER_STATE cmDependsFortranLexer_GetCurrentBuffer(yyscan_t yyscanner); +YY_BUFFER_STATE cmFortranLexer_GetCurrentBuffer(yyscan_t yyscanner); // The parser entry point. -int cmDependsFortran_yyparse(yyscan_t); +int cmFortran_yyparse(yyscan_t); //---------------------------------------------------------------------------- // Define parser object internal structure. -struct cmDependsFortranFile +struct cmFortranFile { - cmDependsFortranFile(FILE* file, YY_BUFFER_STATE buffer, + cmFortranFile(FILE* file, YY_BUFFER_STATE buffer, const std::string& dir): File(file), Buffer(buffer), Directory(dir) {} FILE* File; @@ -62,12 +62,12 @@ struct cmDependsFortranFile std::string Directory; }; -struct cmDependsFortranParser_s +struct cmFortranParser_s { - cmDependsFortranParser_s(cmDependsFortran* self, + cmFortranParser_s(cmDependsFortran* self, std::set& ppDefines, - cmDependsFortranSourceInfo& info); - ~cmDependsFortranParser_s(); + cmFortranSourceInfo& info); + ~cmFortranParser_s(); // Pointer back to the main class. cmDependsFortran* Self; @@ -76,7 +76,7 @@ struct cmDependsFortranParser_s yyscan_t Scanner; // Stack of open files in the translation unit. - std::stack FileStack; + std::stack FileStack; // Buffer for string literals. std::string TokenString; @@ -90,7 +90,7 @@ struct cmDependsFortranParser_s std::stack SkipToEnd; // Information about the parsed source. - cmDependsFortranSourceInfo& Info; + cmFortranSourceInfo& Info; }; //---------------------------------------------------------------------------- @@ -105,18 +105,18 @@ public: TargetRequiresMap TargetRequires; // Information about each object file. - typedef std::map ObjectInfoMap; + typedef std::map ObjectInfoMap; ObjectInfoMap ObjectInfo; - cmDependsFortranSourceInfo& CreateObjectInfo(const char* obj, + cmFortranSourceInfo& CreateObjectInfo(const char* obj, const char* src) { - std::map::iterator i = + std::map::iterator i = this->ObjectInfo.find(obj); if(i == this->ObjectInfo.end()) { - std::map::value_type - entry(obj, cmDependsFortranSourceInfo()); + std::map::value_type + entry(obj, cmFortranSourceInfo()); i = this->ObjectInfo.insert(entry).first; i->second.Source = src; } @@ -192,7 +192,7 @@ bool cmDependsFortran::WriteDependencies( { const std::string& src = *it; // Get the information object for this source. - cmDependsFortranSourceInfo& info = + cmFortranSourceInfo& info = this->Internal->CreateObjectInfo(obj.c_str(), src.c_str()); // Make a copy of the macros defined via ADD_DEFINITIONS @@ -201,13 +201,13 @@ bool cmDependsFortran::WriteDependencies( // Create the parser object. The constructor takes ppMacro and info per // reference, so we may look into the resulting objects later. - cmDependsFortranParser parser(this, ppDefines, info); + cmFortranParser parser(this, ppDefines, info); // Push on the starting file. - cmDependsFortranParser_FilePush(&parser, src.c_str()); + cmFortranParser_FilePush(&parser, src.c_str()); // Parse the translation unit. - if(cmDependsFortran_yyparse(parser.Scanner) != 0) + if(cmFortran_yyparse(parser.Scanner) != 0) { // Failed to parse the file. Report failure to write dependencies. okay = false; @@ -318,7 +318,7 @@ void cmDependsFortran::LocateModules() for(ObjectInfoMap::const_iterator infoI = objInfo.begin(); infoI != objInfo.end(); ++infoI) { - cmDependsFortranSourceInfo const& info = infoI->second; + cmFortranSourceInfo const& info = infoI->second; // Include this module in the set provided by this target. this->Internal->TargetProvides.insert(info.Provides.begin(), info.Provides.end()); @@ -428,7 +428,7 @@ void cmDependsFortran::ConsiderModule(const char* name, bool cmDependsFortran ::WriteDependenciesReal(const char *obj, - cmDependsFortranSourceInfo const& info, + cmFortranSourceInfo const& info, const char* mod_dir, const char* stamp_dir, std::ostream& makeDepends, std::ostream& internalDepends) @@ -701,7 +701,7 @@ bool cmDependsFortran::CopyModule(const std::vector& args) // is later used for longer sequences it should be re-written using an // efficient string search algorithm such as Boyer-Moore. static -bool cmDependsFortranStreamContainsSequence(std::istream& ifs, +bool cmFortranStreamContainsSequence(std::istream& ifs, const char* seq, int len) { assert(len > 0); @@ -734,7 +734,7 @@ bool cmDependsFortranStreamContainsSequence(std::istream& ifs, //---------------------------------------------------------------------------- // Helper function to compare the remaining content in two streams. -static bool cmDependsFortranStreamsDiffer(std::istream& ifs1, +static bool cmFortranStreamsDiffer(std::istream& ifs1, std::istream& ifs2) { // Compare the remaining content. @@ -837,7 +837,7 @@ bool cmDependsFortran::ModulesDiffer(const char* modFile, const char seq[1] = {'\n'}; const int seqlen = 1; - if(!cmDependsFortranStreamContainsSequence(finModFile, seq, seqlen)) + if(!cmFortranStreamContainsSequence(finModFile, seq, seqlen)) { // The module is of unexpected format. Assume it is different. std::cerr << compilerId << " fortran module " << modFile @@ -845,7 +845,7 @@ bool cmDependsFortran::ModulesDiffer(const char* modFile, return true; } - if(!cmDependsFortranStreamContainsSequence(finStampFile, seq, seqlen)) + if(!cmFortranStreamContainsSequence(finStampFile, seq, seqlen)) { // The stamp must differ if the sequence is not contained. return true; @@ -857,7 +857,7 @@ bool cmDependsFortran::ModulesDiffer(const char* modFile, const char seq[2] = {'\n', '\0'}; const int seqlen = 2; - if(!cmDependsFortranStreamContainsSequence(finModFile, seq, seqlen)) + if(!cmFortranStreamContainsSequence(finModFile, seq, seqlen)) { // The module is of unexpected format. Assume it is different. std::cerr << compilerId << " fortran module " << modFile @@ -865,7 +865,7 @@ bool cmDependsFortran::ModulesDiffer(const char* modFile, return true; } - if(!cmDependsFortranStreamContainsSequence(finStampFile, seq, seqlen)) + if(!cmFortranStreamContainsSequence(finStampFile, seq, seqlen)) { // The stamp must differ if the sequence is not contained. return true; @@ -875,7 +875,7 @@ bool cmDependsFortran::ModulesDiffer(const char* modFile, // Compare the remaining content. If no compiler id matched above, // including the case none was given, this will compare the whole // content. - if(!cmDependsFortranStreamsDiffer(finModFile, finStampFile)) + if(!cmFortranStreamsDiffer(finModFile, finStampFile)) { return false; } @@ -926,34 +926,34 @@ bool cmDependsFortran::FindIncludeFile(const char* dir, } //---------------------------------------------------------------------------- -cmDependsFortranParser_s -::cmDependsFortranParser_s(cmDependsFortran* self, +cmFortranParser_s +::cmFortranParser_s(cmDependsFortran* self, std::set& ppDefines, - cmDependsFortranSourceInfo& info): + cmFortranSourceInfo& info): Self(self), PPDefinitions(ppDefines), Info(info) { this->InInterface = 0; this->InPPFalseBranch = 0; // Initialize the lexical scanner. - cmDependsFortran_yylex_init(&this->Scanner); - cmDependsFortran_yyset_extra(this, this->Scanner); + cmFortran_yylex_init(&this->Scanner); + cmFortran_yyset_extra(this, this->Scanner); // Create a dummy buffer that is never read but is the fallback // buffer when the last file is popped off the stack. YY_BUFFER_STATE buffer = - cmDependsFortran_yy_create_buffer(0, 4, this->Scanner); - cmDependsFortran_yy_switch_to_buffer(buffer, this->Scanner); + cmFortran_yy_create_buffer(0, 4, this->Scanner); + cmFortran_yy_switch_to_buffer(buffer, this->Scanner); } //---------------------------------------------------------------------------- -cmDependsFortranParser_s::~cmDependsFortranParser_s() +cmFortranParser_s::~cmFortranParser_s() { - cmDependsFortran_yylex_destroy(this->Scanner); + cmFortran_yylex_destroy(this->Scanner); } //---------------------------------------------------------------------------- -bool cmDependsFortranParser_FilePush(cmDependsFortranParser* parser, +bool cmFortranParser_FilePush(cmFortranParser* parser, const char* fname) { // Open the new file and push it onto the stack. Save the old @@ -961,12 +961,12 @@ bool cmDependsFortranParser_FilePush(cmDependsFortranParser* parser, if(FILE* file = cmsys::SystemTools::Fopen(fname, "rb")) { YY_BUFFER_STATE current = - cmDependsFortranLexer_GetCurrentBuffer(parser->Scanner); + cmFortranLexer_GetCurrentBuffer(parser->Scanner); std::string dir = cmSystemTools::GetParentDirectory(fname); - cmDependsFortranFile f(file, current, dir); + cmFortranFile f(file, current, dir); YY_BUFFER_STATE buffer = - cmDependsFortran_yy_create_buffer(0, 16384, parser->Scanner); - cmDependsFortran_yy_switch_to_buffer(buffer, parser->Scanner); + cmFortran_yy_create_buffer(0, 16384, parser->Scanner); + cmFortran_yy_switch_to_buffer(buffer, parser->Scanner); parser->FileStack.push(f); return 1; } @@ -977,7 +977,7 @@ bool cmDependsFortranParser_FilePush(cmDependsFortranParser* parser, } //---------------------------------------------------------------------------- -bool cmDependsFortranParser_FilePop(cmDependsFortranParser* parser) +bool cmFortranParser_FilePop(cmFortranParser* parser) { // Pop one file off the stack and close it. Switch the lexer back // to the next one on the stack. @@ -987,18 +987,18 @@ bool cmDependsFortranParser_FilePop(cmDependsFortranParser* parser) } else { - cmDependsFortranFile f = parser->FileStack.top(); parser->FileStack.pop(); + cmFortranFile f = parser->FileStack.top(); parser->FileStack.pop(); fclose(f.File); YY_BUFFER_STATE current = - cmDependsFortranLexer_GetCurrentBuffer(parser->Scanner); - cmDependsFortran_yy_delete_buffer(current, parser->Scanner); - cmDependsFortran_yy_switch_to_buffer(f.Buffer, parser->Scanner); + cmFortranLexer_GetCurrentBuffer(parser->Scanner); + cmFortran_yy_delete_buffer(current, parser->Scanner); + cmFortran_yy_switch_to_buffer(f.Buffer, parser->Scanner); return 1; } } //---------------------------------------------------------------------------- -int cmDependsFortranParser_Input(cmDependsFortranParser* parser, +int cmFortranParser_Input(cmFortranParser* parser, char* buffer, size_t bufferSize) { // Read from the file on top of the stack. If the stack is empty, @@ -1012,26 +1012,26 @@ int cmDependsFortranParser_Input(cmDependsFortranParser* parser, } //---------------------------------------------------------------------------- -void cmDependsFortranParser_StringStart(cmDependsFortranParser* parser) +void cmFortranParser_StringStart(cmFortranParser* parser) { parser->TokenString = ""; } //---------------------------------------------------------------------------- -const char* cmDependsFortranParser_StringEnd(cmDependsFortranParser* parser) +const char* cmFortranParser_StringEnd(cmFortranParser* parser) { return parser->TokenString.c_str(); } //---------------------------------------------------------------------------- -void cmDependsFortranParser_StringAppend(cmDependsFortranParser* parser, +void cmFortranParser_StringAppend(cmFortranParser* parser, char c) { parser->TokenString += c; } //---------------------------------------------------------------------------- -void cmDependsFortranParser_SetInInterface(cmDependsFortranParser* parser, +void cmFortranParser_SetInInterface(cmFortranParser* parser, bool in) { if(parser->InPPFalseBranch) @@ -1043,26 +1043,26 @@ void cmDependsFortranParser_SetInInterface(cmDependsFortranParser* parser, } //---------------------------------------------------------------------------- -bool cmDependsFortranParser_GetInInterface(cmDependsFortranParser* parser) +bool cmFortranParser_GetInInterface(cmFortranParser* parser) { return parser->InInterface; } //---------------------------------------------------------------------------- -void cmDependsFortranParser_SetOldStartcond(cmDependsFortranParser* parser, +void cmFortranParser_SetOldStartcond(cmFortranParser* parser, int arg) { parser->OldStartcond = arg; } //---------------------------------------------------------------------------- -int cmDependsFortranParser_GetOldStartcond(cmDependsFortranParser* parser) +int cmFortranParser_GetOldStartcond(cmFortranParser* parser) { return parser->OldStartcond; } //---------------------------------------------------------------------------- -void cmDependsFortranParser_Error(cmDependsFortranParser*, const char*) +void cmFortranParser_Error(cmFortranParser*, const char*) { // If there is a parser error just ignore it. The source will not // compile and the user will edit it. Then dependencies will have @@ -1070,7 +1070,7 @@ void cmDependsFortranParser_Error(cmDependsFortranParser*, const char*) } //---------------------------------------------------------------------------- -void cmDependsFortranParser_RuleUse(cmDependsFortranParser* parser, +void cmFortranParser_RuleUse(cmFortranParser* parser, const char* name) { if(!parser->InPPFalseBranch) @@ -1080,7 +1080,7 @@ void cmDependsFortranParser_RuleUse(cmDependsFortranParser* parser, } //---------------------------------------------------------------------------- -void cmDependsFortranParser_RuleInclude(cmDependsFortranParser* parser, +void cmFortranParser_RuleInclude(cmFortranParser* parser, const char* name) { if(parser->InPPFalseBranch) @@ -1106,12 +1106,12 @@ void cmDependsFortranParser_RuleInclude(cmDependsFortranParser* parser, parser->Info.Includes.insert(fullName); // Parse it immediately to translate the source inline. - cmDependsFortranParser_FilePush(parser, fullName.c_str()); + cmFortranParser_FilePush(parser, fullName.c_str()); } } //---------------------------------------------------------------------------- -void cmDependsFortranParser_RuleModule(cmDependsFortranParser* parser, +void cmFortranParser_RuleModule(cmFortranParser* parser, const char* name) { if(!parser->InPPFalseBranch && !parser->InInterface) @@ -1121,7 +1121,7 @@ void cmDependsFortranParser_RuleModule(cmDependsFortranParser* parser, } //---------------------------------------------------------------------------- -void cmDependsFortranParser_RuleDefine(cmDependsFortranParser* parser, +void cmFortranParser_RuleDefine(cmFortranParser* parser, const char* macro) { if(!parser->InPPFalseBranch) @@ -1131,7 +1131,7 @@ void cmDependsFortranParser_RuleDefine(cmDependsFortranParser* parser, } //---------------------------------------------------------------------------- -void cmDependsFortranParser_RuleUndef(cmDependsFortranParser* parser, +void cmFortranParser_RuleUndef(cmFortranParser* parser, const char* macro) { if(!parser->InPPFalseBranch) @@ -1146,7 +1146,7 @@ void cmDependsFortranParser_RuleUndef(cmDependsFortranParser* parser, } //---------------------------------------------------------------------------- -void cmDependsFortranParser_RuleIfdef(cmDependsFortranParser* parser, +void cmFortranParser_RuleIfdef(cmFortranParser* parser, const char* macro) { // A new PP branch has been opened @@ -1167,7 +1167,7 @@ void cmDependsFortranParser_RuleIfdef(cmDependsFortranParser* parser, } //---------------------------------------------------------------------------- -void cmDependsFortranParser_RuleIfndef(cmDependsFortranParser* parser, +void cmFortranParser_RuleIfndef(cmFortranParser* parser, const char* macro) { // A new PP branch has been opened @@ -1189,7 +1189,7 @@ void cmDependsFortranParser_RuleIfndef(cmDependsFortranParser* parser, } //---------------------------------------------------------------------------- -void cmDependsFortranParser_RuleIf(cmDependsFortranParser* parser) +void cmFortranParser_RuleIf(cmFortranParser* parser) { /* Note: The current parser is _not_ able to get statements like * #if 0 @@ -1223,10 +1223,10 @@ void cmDependsFortranParser_RuleIf(cmDependsFortranParser* parser) } //---------------------------------------------------------------------------- -void cmDependsFortranParser_RuleElif(cmDependsFortranParser* parser) +void cmFortranParser_RuleElif(cmFortranParser* parser) { /* Note: There are parser limitations. See the note at - * cmDependsFortranParser_RuleIf(..) + * cmFortranParser_RuleIf(..) */ // Always taken unless an #ifdef or #ifndef-branch has been taken @@ -1240,7 +1240,7 @@ void cmDependsFortranParser_RuleElif(cmDependsFortranParser* parser) } //---------------------------------------------------------------------------- -void cmDependsFortranParser_RuleElse(cmDependsFortranParser* parser) +void cmFortranParser_RuleElse(cmFortranParser* parser) { // if the parent branch is false do nothing! if(parser->InPPFalseBranch > 1) @@ -1262,7 +1262,7 @@ void cmDependsFortranParser_RuleElse(cmDependsFortranParser* parser) } //---------------------------------------------------------------------------- -void cmDependsFortranParser_RuleEndif(cmDependsFortranParser* parser) +void cmFortranParser_RuleEndif(cmFortranParser* parser) { if(!parser->SkipToEnd.empty()) { diff --git a/Source/cmDependsFortran.h b/Source/cmDependsFortran.h index cb40796c8..9f280886a 100644 --- a/Source/cmDependsFortran.h +++ b/Source/cmDependsFortran.h @@ -9,13 +9,13 @@ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the License for more information. ============================================================================*/ -#ifndef cmDependsFortran_h -#define cmDependsFortran_h +#ifndef cmFortran_h +#define cmFortran_h #include "cmDepends.h" class cmDependsFortranInternals; -class cmDependsFortranSourceInfo; +class cmFortranSourceInfo; /** \class cmDependsFortran * \brief Dependency scanner for Fortran object files. @@ -71,7 +71,7 @@ protected: // Actually write the depenencies to the streams. bool WriteDependenciesReal(const char *obj, - cmDependsFortranSourceInfo const& info, + cmFortranSourceInfo const& info, const char* mod_dir, const char* stamp_dir, std::ostream& makeDepends, std::ostream& internalDepends); diff --git a/Source/cmDependsFortranParser.h b/Source/cmDependsFortranParser.h deleted file mode 100644 index 399c3c8d9..000000000 --- a/Source/cmDependsFortranParser.h +++ /dev/null @@ -1,96 +0,0 @@ -/*============================================================================ - CMake - Cross Platform Makefile Generator - Copyright 2000-2009 Kitware, Inc., Insight Software Consortium - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ -#ifndef cmDependsFortranParser_h -#define cmDependsFortranParser_h - -#include /* size_t */ - -/* Forward declare parser object type. */ -typedef struct cmDependsFortranParser_s cmDependsFortranParser; - -/* Functions to enter/exit #include'd files in order. */ -bool cmDependsFortranParser_FilePush(cmDependsFortranParser* parser, - const char* fname); -bool cmDependsFortranParser_FilePop(cmDependsFortranParser* parser); - -/* Callbacks for lexer. */ -int cmDependsFortranParser_Input(cmDependsFortranParser* parser, - char* buffer, size_t bufferSize); - - -void cmDependsFortranParser_StringStart(cmDependsFortranParser* parser); -const char* cmDependsFortranParser_StringEnd(cmDependsFortranParser* parser); -void cmDependsFortranParser_StringAppend(cmDependsFortranParser* parser, - char c); - -void cmDependsFortranParser_SetInInterface(cmDependsFortranParser* parser, - bool is_in); -bool cmDependsFortranParser_GetInInterface(cmDependsFortranParser* parser); - - -void cmDependsFortranParser_SetInPPFalseBranch(cmDependsFortranParser* parser, - bool is_in); -bool cmDependsFortranParser_GetInPPFalseBranch(cmDependsFortranParser* parser); - - -void cmDependsFortranParser_SetOldStartcond(cmDependsFortranParser* parser, - int arg); -int cmDependsFortranParser_GetOldStartcond(cmDependsFortranParser* parser); - -/* Callbacks for parser. */ -void cmDependsFortranParser_Error(cmDependsFortranParser* parser, - const char* message); -void cmDependsFortranParser_RuleUse(cmDependsFortranParser* parser, - const char* name); -void cmDependsFortranParser_RuleInclude(cmDependsFortranParser* parser, - const char* name); -void cmDependsFortranParser_RuleModule(cmDependsFortranParser* parser, - const char* name); -void cmDependsFortranParser_RuleDefine(cmDependsFortranParser* parser, - const char* name); -void cmDependsFortranParser_RuleUndef(cmDependsFortranParser* parser, - const char* name); -void cmDependsFortranParser_RuleIfdef(cmDependsFortranParser* parser, - const char* name); -void cmDependsFortranParser_RuleIfndef(cmDependsFortranParser* parser, - const char* name); -void cmDependsFortranParser_RuleIf(cmDependsFortranParser* parser); -void cmDependsFortranParser_RuleElif(cmDependsFortranParser* parser); -void cmDependsFortranParser_RuleElse(cmDependsFortranParser* parser); -void cmDependsFortranParser_RuleEndif(cmDependsFortranParser* parser); - -/* Define the parser stack element type. */ -typedef union cmDependsFortran_yystype_u cmDependsFortran_yystype; -union cmDependsFortran_yystype_u -{ - char* string; -}; - -/* Setup the proper yylex interface. */ -#define YY_EXTRA_TYPE cmDependsFortranParser* -#define YY_DECL \ -int cmDependsFortran_yylex(YYSTYPE* yylvalp, yyscan_t yyscanner) -#define YYSTYPE cmDependsFortran_yystype -#define YYSTYPE_IS_DECLARED 1 -#if !defined(cmDependsFortranLexer_cxx) -# include "cmDependsFortranLexer.h" -#endif -#if !defined(cmDependsFortranLexer_cxx) -#if !defined(cmDependsFortranParser_cxx) -# undef YY_EXTRA_TYPE -# undef YY_DECL -# undef YYSTYPE -# undef YYSTYPE_IS_DECLARED -#endif -#endif - -#endif diff --git a/Source/cmDependsFortranLexer.cxx b/Source/cmFortranLexer.cxx similarity index 83% rename from Source/cmDependsFortranLexer.cxx rename to Source/cmFortranLexer.cxx index 745345241..b727f0ea1 100644 --- a/Source/cmDependsFortranLexer.cxx +++ b/Source/cmFortranLexer.cxx @@ -9,9 +9,9 @@ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the License for more information. ============================================================================*/ -#line 2 "cmDependsFortranLexer.cxx" +#line 2 "cmFortranLexer.cxx" -#line 4 "cmDependsFortranLexer.cxx" +#line 4 "cmFortranLexer.cxx" #define YY_INT_ALIGNED short int @@ -164,7 +164,7 @@ typedef void* yyscan_t; #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) /* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE cmDependsFortran_yyrestart(yyin ,yyscanner ) +#define YY_NEW_FILE cmFortran_yyrestart(yyin ,yyscanner ) #define YY_END_OF_BUFFER_CHAR 0 @@ -274,7 +274,7 @@ struct yy_buffer_state * possible backing-up. * * When we actually see the EOF, we change the status to "new" - * (via cmDependsFortran_yyrestart()), so that the user can continue scanning by + * (via cmFortran_yyrestart()), so that the user can continue scanning by * just pointing yyin at a new input file. */ #define YY_BUFFER_EOF_PENDING 2 @@ -297,36 +297,36 @@ struct yy_buffer_state */ #define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] -void cmDependsFortran_yyrestart (FILE *input_file ,yyscan_t yyscanner ); -void cmDependsFortran_yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); -YY_BUFFER_STATE cmDependsFortran_yy_create_buffer (FILE *file,int size ,yyscan_t yyscanner ); -void cmDependsFortran_yy_delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); -void cmDependsFortran_yy_flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); -void cmDependsFortran_yypush_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); -void cmDependsFortran_yypop_buffer_state (yyscan_t yyscanner ); +void cmFortran_yyrestart (FILE *input_file ,yyscan_t yyscanner ); +void cmFortran_yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); +YY_BUFFER_STATE cmFortran_yy_create_buffer (FILE *file,int size ,yyscan_t yyscanner ); +void cmFortran_yy_delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); +void cmFortran_yy_flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); +void cmFortran_yypush_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); +void cmFortran_yypop_buffer_state (yyscan_t yyscanner ); -static void cmDependsFortran_yyensure_buffer_stack (yyscan_t yyscanner ); -static void cmDependsFortran_yy_load_buffer_state (yyscan_t yyscanner ); -static void cmDependsFortran_yy_init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner ); +static void cmFortran_yyensure_buffer_stack (yyscan_t yyscanner ); +static void cmFortran_yy_load_buffer_state (yyscan_t yyscanner ); +static void cmFortran_yy_init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner ); -#define YY_FLUSH_BUFFER cmDependsFortran_yy_flush_buffer(YY_CURRENT_BUFFER ,yyscanner) +#define YY_FLUSH_BUFFER cmFortran_yy_flush_buffer(YY_CURRENT_BUFFER ,yyscanner) -YY_BUFFER_STATE cmDependsFortran_yy_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner ); -YY_BUFFER_STATE cmDependsFortran_yy_scan_string (yyconst char *yy_str ,yyscan_t yyscanner ); -YY_BUFFER_STATE cmDependsFortran_yy_scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner ); +YY_BUFFER_STATE cmFortran_yy_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner ); +YY_BUFFER_STATE cmFortran_yy_scan_string (yyconst char *yy_str ,yyscan_t yyscanner ); +YY_BUFFER_STATE cmFortran_yy_scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner ); -void *cmDependsFortran_yyalloc (yy_size_t ,yyscan_t yyscanner ); -void *cmDependsFortran_yyrealloc (void *,yy_size_t ,yyscan_t yyscanner ); -void cmDependsFortran_yyfree (void * ,yyscan_t yyscanner ); +void *cmFortran_yyalloc (yy_size_t ,yyscan_t yyscanner ); +void *cmFortran_yyrealloc (void *,yy_size_t ,yyscan_t yyscanner ); +void cmFortran_yyfree (void * ,yyscan_t yyscanner ); -#define yy_new_buffer cmDependsFortran_yy_create_buffer +#define yy_new_buffer cmFortran_yy_create_buffer #define yy_set_interactive(is_interactive) \ { \ if ( ! YY_CURRENT_BUFFER ){ \ - cmDependsFortran_yyensure_buffer_stack (yyscanner); \ + cmFortran_yyensure_buffer_stack (yyscanner); \ YY_CURRENT_BUFFER_LVALUE = \ - cmDependsFortran_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \ + cmFortran_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ } @@ -334,9 +334,9 @@ void cmDependsFortran_yyfree (void * ,yyscan_t yyscanner ); #define yy_set_bol(at_bol) \ { \ if ( ! YY_CURRENT_BUFFER ){\ - cmDependsFortran_yyensure_buffer_stack (yyscanner); \ + cmFortran_yyensure_buffer_stack (yyscanner); \ YY_CURRENT_BUFFER_LVALUE = \ - cmDependsFortran_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \ + cmFortran_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ } @@ -345,7 +345,7 @@ void cmDependsFortran_yyfree (void * ,yyscan_t yyscanner ); /* Begin user sect3 */ -#define cmDependsFortran_yywrap(n) 1 +#define cmFortran_yywrap(n) 1 #define YY_SKIP_YYWRAP typedef unsigned char YY_CHAR; @@ -622,8 +622,8 @@ static yyconst flex_int16_t yy_chk[547] = #define yymore() yymore_used_but_not_detected #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET -#line 1 "cmDependsFortranLexer.in.l" -#line 2 "cmDependsFortranLexer.in.l" +#line 1 "cmFortranLexer.in.l" +#line 2 "cmFortranLexer.in.l" /*============================================================================ CMake - Cross Platform Makefile Generator Copyright 2000-2009 Kitware, Inc., Insight Software Consortium @@ -651,17 +651,17 @@ This file must be translated to C and modified to build everywhere. Run flex like this: - flex -i --prefix=cmDependsFortran_yy --header-file=cmDependsFortranLexer.h -ocmDependsFortranLexer.cxx cmDependsFortranLexer.in.l + flex -i --prefix=cmFortran_yy --header-file=cmFortranLexer.h -ocmFortranLexer.cxx cmFortranLexer.in.l -Modify cmDependsFortranLexer.cxx: +Modify cmFortranLexer.cxx: - remove TABs - remove "yyscanner" argument from these methods: - yy_fatal_error, cmDependsFortran_yyalloc, cmDependsFortran_yyrealloc, cmDependsFortran_yyfree - - remove "yyscanner = NULL" from end of cmDependsFortran_yylex_destroy + yy_fatal_error, cmFortran_yyalloc, cmFortran_yyrealloc, cmFortran_yyfree + - remove "yyscanner = NULL" from end of cmFortran_yylex_destroy - remove all YY_BREAK lines occurring right after return statements - change while ( 1 ) to for(;;) -Modify cmDependsFortranLexer.h: +Modify cmFortranLexer.h: - remove TABs - remove the yy_init_globals function - remove the block that includes unistd.h @@ -671,21 +671,21 @@ Modify cmDependsFortranLexer.h: #include "cmStandardLexer.h" -#define cmDependsFortranLexer_cxx -#include "cmDependsFortranParser.h" /* Interface to parser object. */ +#define cmFortranLexer_cxx +#include "cmFortranParser.h" /* Interface to parser object. */ /* Replace the lexer input function. */ #undef YY_INPUT #define YY_INPUT(buf, result, max_size) \ - { result = cmDependsFortranParser_Input(yyextra, buf, max_size); } + { result = cmFortranParser_Input(yyextra, buf, max_size); } /* Include the set of tokens from the parser. */ -#include "cmDependsFortranParserTokens.h" +#include "cmFortranParserTokens.h" /*--------------------------------------------------------------------------*/ -#line 678 "cmDependsFortranLexer.cxx" +#line 678 "cmFortranLexer.cxx" #define INITIAL 0 #define free_fmt 1 @@ -741,38 +741,38 @@ struct yyguts_t static int yy_init_globals (yyscan_t yyscanner ); -int cmDependsFortran_yylex_init (yyscan_t* scanner); +int cmFortran_yylex_init (yyscan_t* scanner); -int cmDependsFortran_yylex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner); +int cmFortran_yylex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner); /* Accessor methods to globals. These are made visible to non-reentrant scanners for convenience. */ -int cmDependsFortran_yylex_destroy (yyscan_t yyscanner ); +int cmFortran_yylex_destroy (yyscan_t yyscanner ); -int cmDependsFortran_yyget_debug (yyscan_t yyscanner ); +int cmFortran_yyget_debug (yyscan_t yyscanner ); -void cmDependsFortran_yyset_debug (int debug_flag ,yyscan_t yyscanner ); +void cmFortran_yyset_debug (int debug_flag ,yyscan_t yyscanner ); -YY_EXTRA_TYPE cmDependsFortran_yyget_extra (yyscan_t yyscanner ); +YY_EXTRA_TYPE cmFortran_yyget_extra (yyscan_t yyscanner ); -void cmDependsFortran_yyset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner ); +void cmFortran_yyset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner ); -FILE *cmDependsFortran_yyget_in (yyscan_t yyscanner ); +FILE *cmFortran_yyget_in (yyscan_t yyscanner ); -void cmDependsFortran_yyset_in (FILE * in_str ,yyscan_t yyscanner ); +void cmFortran_yyset_in (FILE * in_str ,yyscan_t yyscanner ); -FILE *cmDependsFortran_yyget_out (yyscan_t yyscanner ); +FILE *cmFortran_yyget_out (yyscan_t yyscanner ); -void cmDependsFortran_yyset_out (FILE * out_str ,yyscan_t yyscanner ); +void cmFortran_yyset_out (FILE * out_str ,yyscan_t yyscanner ); -int cmDependsFortran_yyget_leng (yyscan_t yyscanner ); +int cmFortran_yyget_leng (yyscan_t yyscanner ); -char *cmDependsFortran_yyget_text (yyscan_t yyscanner ); +char *cmFortran_yyget_text (yyscan_t yyscanner ); -int cmDependsFortran_yyget_lineno (yyscan_t yyscanner ); +int cmFortran_yyget_lineno (yyscan_t yyscanner ); -void cmDependsFortran_yyset_lineno (int line_number ,yyscan_t yyscanner ); +void cmFortran_yyset_lineno (int line_number ,yyscan_t yyscanner ); /* Macros after this point can all be overridden by user definitions in * section 1. @@ -780,9 +780,9 @@ void cmDependsFortran_yyset_lineno (int line_number ,yyscan_t yyscanner ); #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus -extern "C" int cmDependsFortran_yywrap (yyscan_t yyscanner ); +extern "C" int cmFortran_yywrap (yyscan_t yyscanner ); #else -extern int cmDependsFortran_yywrap (yyscan_t yyscanner ); +extern int cmFortran_yywrap (yyscan_t yyscanner ); #endif #endif @@ -886,9 +886,9 @@ static int input (yyscan_t yyscanner ); #ifndef YY_DECL #define YY_DECL_IS_OURS 1 -extern int cmDependsFortran_yylex (yyscan_t yyscanner); +extern int cmFortran_yylex (yyscan_t yyscanner); -#define YY_DECL int cmDependsFortran_yylex (yyscan_t yyscanner) +#define YY_DECL int cmFortran_yylex (yyscan_t yyscanner) #endif /* !YY_DECL */ /* Code executed at the beginning of each rule, after yytext and yyleng @@ -918,10 +918,10 @@ YY_DECL int yy_act; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; -#line 71 "cmDependsFortranLexer.in.l" +#line 71 "cmFortranLexer.in.l" -#line 914 "cmDependsFortranLexer.cxx" +#line 914 "cmFortranLexer.cxx" if ( !yyg->yy_init ) { @@ -941,12 +941,12 @@ YY_DECL yyout = stdout; if ( ! YY_CURRENT_BUFFER ) { - cmDependsFortran_yyensure_buffer_stack (yyscanner); + cmFortran_yyensure_buffer_stack (yyscanner); YY_CURRENT_BUFFER_LVALUE = - cmDependsFortran_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); + cmFortran_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); } - cmDependsFortran_yy_load_buffer_state(yyscanner ); + cmFortran_yy_load_buffer_state(yyscanner ); } for(;;) /* loops until end-of-file is reached */ @@ -1007,47 +1007,47 @@ do_action: /* This label is used only to access EOF actions. */ case 1: YY_RULE_SETUP -#line 73 "cmDependsFortranLexer.in.l" +#line 73 "cmFortranLexer.in.l" { - cmDependsFortranParser_StringStart(yyextra); - cmDependsFortranParser_SetOldStartcond(yyextra, YY_START); + cmFortranParser_StringStart(yyextra); + cmFortranParser_SetOldStartcond(yyextra, YY_START); BEGIN(str_dq); } YY_BREAK case 2: YY_RULE_SETUP -#line 79 "cmDependsFortranLexer.in.l" +#line 79 "cmFortranLexer.in.l" { - cmDependsFortranParser_StringStart(yyextra); - cmDependsFortranParser_SetOldStartcond(yyextra, YY_START); + cmFortranParser_StringStart(yyextra); + cmFortranParser_SetOldStartcond(yyextra, YY_START); BEGIN(str_sq); } YY_BREAK case 3: -#line 86 "cmDependsFortranLexer.in.l" +#line 86 "cmFortranLexer.in.l" case 4: YY_RULE_SETUP -#line 86 "cmDependsFortranLexer.in.l" +#line 86 "cmFortranLexer.in.l" { - BEGIN(cmDependsFortranParser_GetOldStartcond(yyextra) ); - yylvalp->string = strdup(cmDependsFortranParser_StringEnd(yyextra)); + BEGIN(cmFortranParser_GetOldStartcond(yyextra) ); + yylvalp->string = strdup(cmFortranParser_StringEnd(yyextra)); return STRING; } case 5: /* rule 5 can match eol */ -#line 93 "cmDependsFortranLexer.in.l" +#line 93 "cmFortranLexer.in.l" case 6: /* rule 6 can match eol */ YY_RULE_SETUP -#line 93 "cmDependsFortranLexer.in.l" +#line 93 "cmFortranLexer.in.l" /* Ignore (continued strings, free fmt) */ YY_BREAK case 7: /* rule 7 can match eol */ YY_RULE_SETUP -#line 95 "cmDependsFortranLexer.in.l" +#line 95 "cmFortranLexer.in.l" { - if (cmDependsFortranParser_GetOldStartcond(yyextra) == fixed_fmt) + if (cmFortranParser_GetOldStartcond(yyextra) == fixed_fmt) ; /* Ignore (cont. strings, fixed fmt) */ else { @@ -1058,7 +1058,7 @@ YY_RULE_SETUP case 8: /* rule 8 can match eol */ YY_RULE_SETUP -#line 105 "cmDependsFortranLexer.in.l" +#line 105 "cmFortranLexer.in.l" { unput ('\n'); BEGIN(INITIAL); @@ -1066,25 +1066,25 @@ YY_RULE_SETUP } case 9: YY_RULE_SETUP -#line 111 "cmDependsFortranLexer.in.l" +#line 111 "cmFortranLexer.in.l" { - cmDependsFortranParser_StringAppend(yyextra, yytext[0]); + cmFortranParser_StringAppend(yyextra, yytext[0]); } YY_BREAK case 10: /* rule 10 can match eol */ YY_RULE_SETUP -#line 115 "cmDependsFortranLexer.in.l" +#line 115 "cmFortranLexer.in.l" { return EOSTMT; } /* Treat comments like */ case 11: /* rule 11 can match eol */ YY_RULE_SETUP -#line 116 "cmDependsFortranLexer.in.l" +#line 116 "cmFortranLexer.in.l" { return EOSTMT; } /* empty lines */ case 12: /* rule 12 can match eol */ YY_RULE_SETUP -#line 118 "cmDependsFortranLexer.in.l" +#line 118 "cmFortranLexer.in.l" { yytext[yyleng-1] = 0; yylvalp->string = strdup(strchr(yytext, '<')+1); @@ -1092,149 +1092,149 @@ YY_RULE_SETUP } case 13: YY_RULE_SETUP -#line 123 "cmDependsFortranLexer.in.l" +#line 123 "cmFortranLexer.in.l" { return CPP_INCLUDE; } case 14: YY_RULE_SETUP -#line 124 "cmDependsFortranLexer.in.l" +#line 124 "cmFortranLexer.in.l" { return F90PPR_INCLUDE; } case 15: YY_RULE_SETUP -#line 125 "cmDependsFortranLexer.in.l" +#line 125 "cmFortranLexer.in.l" { return COCO_INCLUDE; } case 16: YY_RULE_SETUP -#line 127 "cmDependsFortranLexer.in.l" +#line 127 "cmFortranLexer.in.l" { return CPP_DEFINE; } case 17: YY_RULE_SETUP -#line 128 "cmDependsFortranLexer.in.l" +#line 128 "cmFortranLexer.in.l" { return F90PPR_DEFINE; } case 18: YY_RULE_SETUP -#line 130 "cmDependsFortranLexer.in.l" +#line 130 "cmFortranLexer.in.l" { return CPP_UNDEF; } case 19: YY_RULE_SETUP -#line 131 "cmDependsFortranLexer.in.l" +#line 131 "cmFortranLexer.in.l" { return F90PPR_UNDEF; } case 20: YY_RULE_SETUP -#line 133 "cmDependsFortranLexer.in.l" +#line 133 "cmFortranLexer.in.l" { return CPP_IFDEF; } case 21: YY_RULE_SETUP -#line 134 "cmDependsFortranLexer.in.l" +#line 134 "cmFortranLexer.in.l" { return CPP_IFNDEF; } case 22: YY_RULE_SETUP -#line 135 "cmDependsFortranLexer.in.l" +#line 135 "cmFortranLexer.in.l" { return CPP_IF; } case 23: YY_RULE_SETUP -#line 136 "cmDependsFortranLexer.in.l" +#line 136 "cmFortranLexer.in.l" { return CPP_ELIF; } case 24: YY_RULE_SETUP -#line 137 "cmDependsFortranLexer.in.l" +#line 137 "cmFortranLexer.in.l" { return CPP_ELSE; } case 25: YY_RULE_SETUP -#line 138 "cmDependsFortranLexer.in.l" +#line 138 "cmFortranLexer.in.l" { return CPP_ENDIF; } case 26: YY_RULE_SETUP -#line 140 "cmDependsFortranLexer.in.l" +#line 140 "cmFortranLexer.in.l" { return F90PPR_IFDEF; } case 27: YY_RULE_SETUP -#line 141 "cmDependsFortranLexer.in.l" +#line 141 "cmFortranLexer.in.l" { return F90PPR_IFNDEF; } case 28: YY_RULE_SETUP -#line 142 "cmDependsFortranLexer.in.l" +#line 142 "cmFortranLexer.in.l" { return F90PPR_IF; } case 29: YY_RULE_SETUP -#line 143 "cmDependsFortranLexer.in.l" +#line 143 "cmFortranLexer.in.l" { return F90PPR_ELIF; } case 30: YY_RULE_SETUP -#line 144 "cmDependsFortranLexer.in.l" +#line 144 "cmFortranLexer.in.l" { return F90PPR_ELSE; } case 31: YY_RULE_SETUP -#line 145 "cmDependsFortranLexer.in.l" +#line 145 "cmFortranLexer.in.l" { return F90PPR_ENDIF; } /* Line continuations, possible involving comments. */ case 32: /* rule 32 can match eol */ YY_RULE_SETUP -#line 148 "cmDependsFortranLexer.in.l" +#line 148 "cmFortranLexer.in.l" YY_BREAK case 33: /* rule 33 can match eol */ YY_RULE_SETUP -#line 149 "cmDependsFortranLexer.in.l" +#line 149 "cmFortranLexer.in.l" YY_BREAK case 34: YY_RULE_SETUP -#line 151 "cmDependsFortranLexer.in.l" +#line 151 "cmFortranLexer.in.l" { return COMMA; } case 35: YY_RULE_SETUP -#line 153 "cmDependsFortranLexer.in.l" +#line 153 "cmFortranLexer.in.l" { return DCOLON; } case 36: /* rule 36 can match eol */ YY_RULE_SETUP -#line 155 "cmDependsFortranLexer.in.l" +#line 155 "cmFortranLexer.in.l" { return GARBAGE; } case 37: YY_RULE_SETUP -#line 157 "cmDependsFortranLexer.in.l" +#line 157 "cmFortranLexer.in.l" { return ASSIGNMENT_OP; } case 38: YY_RULE_SETUP -#line 159 "cmDependsFortranLexer.in.l" +#line 159 "cmFortranLexer.in.l" { yylvalp->string = strdup(yytext); return WORD; } case 39: YY_RULE_SETUP -#line 164 "cmDependsFortranLexer.in.l" +#line 164 "cmFortranLexer.in.l" { return GARBAGE; } case 40: /* rule 40 can match eol */ YY_RULE_SETUP -#line 166 "cmDependsFortranLexer.in.l" +#line 166 "cmFortranLexer.in.l" { return EOSTMT; } case 41: YY_RULE_SETUP -#line 169 "cmDependsFortranLexer.in.l" +#line 169 "cmFortranLexer.in.l" /* Ignore */ YY_BREAK case 42: /* rule 42 can match eol */ YY_RULE_SETUP -#line 170 "cmDependsFortranLexer.in.l" +#line 170 "cmFortranLexer.in.l" /* Ignore line-endings preceeded by \ */ YY_BREAK case 43: YY_RULE_SETUP -#line 172 "cmDependsFortranLexer.in.l" +#line 172 "cmFortranLexer.in.l" { return *yytext; } case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(free_fmt): case YY_STATE_EOF(fixed_fmt): case YY_STATE_EOF(str_sq): case YY_STATE_EOF(str_dq): -#line 174 "cmDependsFortranLexer.in.l" +#line 174 "cmFortranLexer.in.l" { - if(!cmDependsFortranParser_FilePop(yyextra) ) + if(!cmFortranParser_FilePop(yyextra) ) { return YY_NULL; } @@ -1242,10 +1242,10 @@ case YY_STATE_EOF(str_dq): YY_BREAK case 44: YY_RULE_SETUP -#line 181 "cmDependsFortranLexer.in.l" +#line 181 "cmFortranLexer.in.l" ECHO; YY_BREAK -#line 1270 "cmDependsFortranLexer.cxx" +#line 1270 "cmFortranLexer.cxx" case YY_END_OF_BUFFER: { @@ -1261,7 +1261,7 @@ ECHO; /* We're scanning a new file or input source. It's * possible that this happened because the user * just pointed yyin at a new source and called - * cmDependsFortran_yylex(). If so, then we have to assure + * cmFortran_yylex(). If so, then we have to assure * consistency between YY_CURRENT_BUFFER and our * globals. Here is the right place to do so, because * this is the first action (other than possibly a @@ -1321,7 +1321,7 @@ ECHO; { yyg->yy_did_buffer_switch_on_eof = 0; - if ( cmDependsFortran_yywrap(yyscanner ) ) + if ( cmFortran_yywrap(yyscanner ) ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up @@ -1374,7 +1374,7 @@ ECHO; "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ -} /* end of cmDependsFortran_yylex */ +} /* end of cmFortran_yylex */ /* yy_get_next_buffer - try to read in a new buffer * @@ -1453,7 +1453,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) b->yy_ch_buf = (char *) /* Include room in for 2 EOB chars. */ - cmDependsFortran_yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner ); + cmFortran_yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner ); } else /* Can't grow it, we don't own it. */ @@ -1485,7 +1485,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) if ( number_to_move == YY_MORE_ADJ ) { ret_val = EOB_ACT_END_OF_FILE; - cmDependsFortran_yyrestart(yyin ,yyscanner); + cmFortran_yyrestart(yyin ,yyscanner); } else @@ -1502,7 +1502,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { /* Extend the array by 50%, plus the number we really need. */ yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1); - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) cmDependsFortran_yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner ); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) cmFortran_yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner ); if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); } @@ -1656,13 +1656,13 @@ static int yy_get_next_buffer (yyscan_t yyscanner) */ /* Reset buffer status. */ - cmDependsFortran_yyrestart(yyin ,yyscanner); + cmFortran_yyrestart(yyin ,yyscanner); /*FALLTHROUGH*/ case EOB_ACT_END_OF_FILE: { - if ( cmDependsFortran_yywrap(yyscanner ) ) + if ( cmFortran_yywrap(yyscanner ) ) return EOF; if ( ! yyg->yy_did_buffer_switch_on_eof ) @@ -1696,34 +1696,34 @@ static int yy_get_next_buffer (yyscan_t yyscanner) * @param yyscanner The scanner object. * @note This function does not reset the start condition to @c INITIAL . */ - void cmDependsFortran_yyrestart (FILE * input_file , yyscan_t yyscanner) + void cmFortran_yyrestart (FILE * input_file , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; if ( ! YY_CURRENT_BUFFER ){ - cmDependsFortran_yyensure_buffer_stack (yyscanner); + cmFortran_yyensure_buffer_stack (yyscanner); YY_CURRENT_BUFFER_LVALUE = - cmDependsFortran_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); + cmFortran_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); } - cmDependsFortran_yy_init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner); - cmDependsFortran_yy_load_buffer_state(yyscanner ); + cmFortran_yy_init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner); + cmFortran_yy_load_buffer_state(yyscanner ); } /** Switch to a different input buffer. * @param new_buffer The new input buffer. * @param yyscanner The scanner object. */ - void cmDependsFortran_yy_switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) + void cmFortran_yy_switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* TODO. We should be able to replace this entire function body * with - * cmDependsFortran_yypop_buffer_state(); - * cmDependsFortran_yypush_buffer_state(new_buffer); + * cmFortran_yypop_buffer_state(); + * cmFortran_yypush_buffer_state(new_buffer); */ - cmDependsFortran_yyensure_buffer_stack (yyscanner); + cmFortran_yyensure_buffer_stack (yyscanner); if ( YY_CURRENT_BUFFER == new_buffer ) return; @@ -1736,17 +1736,17 @@ static int yy_get_next_buffer (yyscan_t yyscanner) } YY_CURRENT_BUFFER_LVALUE = new_buffer; - cmDependsFortran_yy_load_buffer_state(yyscanner ); + cmFortran_yy_load_buffer_state(yyscanner ); /* We don't actually know whether we did this switch during - * EOF (cmDependsFortran_yywrap()) processing, but the only time this flag - * is looked at is after cmDependsFortran_yywrap() is called, so it's safe + * EOF (cmFortran_yywrap()) processing, but the only time this flag + * is looked at is after cmFortran_yywrap() is called, so it's safe * to go ahead and always set it. */ yyg->yy_did_buffer_switch_on_eof = 1; } -static void cmDependsFortran_yy_load_buffer_state (yyscan_t yyscanner) +static void cmFortran_yy_load_buffer_state (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; @@ -1761,35 +1761,35 @@ static void cmDependsFortran_yy_load_buffer_state (yyscan_t yyscanner) * @param yyscanner The scanner object. * @return the allocated buffer state. */ - YY_BUFFER_STATE cmDependsFortran_yy_create_buffer (FILE * file, int size , yyscan_t yyscanner) + YY_BUFFER_STATE cmFortran_yy_create_buffer (FILE * file, int size , yyscan_t yyscanner) { YY_BUFFER_STATE b; - b = (YY_BUFFER_STATE) cmDependsFortran_yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner ); + b = (YY_BUFFER_STATE) cmFortran_yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner ); if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in cmDependsFortran_yy_create_buffer()" ); + YY_FATAL_ERROR( "out of dynamic memory in cmFortran_yy_create_buffer()" ); b->yy_buf_size = size; /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. */ - b->yy_ch_buf = (char *) cmDependsFortran_yyalloc(b->yy_buf_size + 2 ,yyscanner ); + b->yy_ch_buf = (char *) cmFortran_yyalloc(b->yy_buf_size + 2 ,yyscanner ); if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in cmDependsFortran_yy_create_buffer()" ); + YY_FATAL_ERROR( "out of dynamic memory in cmFortran_yy_create_buffer()" ); b->yy_is_our_buffer = 1; - cmDependsFortran_yy_init_buffer(b,file ,yyscanner); + cmFortran_yy_init_buffer(b,file ,yyscanner); return b; } /** Destroy the buffer. - * @param b a buffer created with cmDependsFortran_yy_create_buffer() + * @param b a buffer created with cmFortran_yy_create_buffer() * @param yyscanner The scanner object. */ - void cmDependsFortran_yy_delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) + void cmFortran_yy_delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; @@ -1800,9 +1800,9 @@ static void cmDependsFortran_yy_load_buffer_state (yyscan_t yyscanner) YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; if ( b->yy_is_our_buffer ) - cmDependsFortran_yyfree((void *) b->yy_ch_buf ,yyscanner ); + cmFortran_yyfree((void *) b->yy_ch_buf ,yyscanner ); - cmDependsFortran_yyfree((void *) b ,yyscanner ); + cmFortran_yyfree((void *) b ,yyscanner ); } #ifndef __cplusplus @@ -1811,21 +1811,21 @@ extern int isatty (int ); /* Initializes or reinitializes a buffer. * This function is sometimes called more than once on the same buffer, - * such as during a cmDependsFortran_yyrestart() or at EOF. + * such as during a cmFortran_yyrestart() or at EOF. */ - static void cmDependsFortran_yy_init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner) + static void cmFortran_yy_init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner) { int oerrno = errno; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - cmDependsFortran_yy_flush_buffer(b ,yyscanner); + cmFortran_yy_flush_buffer(b ,yyscanner); b->yy_input_file = file; b->yy_fill_buffer = 1; - /* If b is the current buffer, then cmDependsFortran_yy_init_buffer was _probably_ - * called from cmDependsFortran_yyrestart() or through yy_get_next_buffer. + /* If b is the current buffer, then cmFortran_yy_init_buffer was _probably_ + * called from cmFortran_yyrestart() or through yy_get_next_buffer. * In that case, we don't want to reset the lineno or column. */ if (b != YY_CURRENT_BUFFER){ @@ -1842,7 +1842,7 @@ extern int isatty (int ); * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. * @param yyscanner The scanner object. */ - void cmDependsFortran_yy_flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) + void cmFortran_yy_flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; if ( ! b ) @@ -1863,7 +1863,7 @@ extern int isatty (int ); b->yy_buffer_status = YY_BUFFER_NEW; if ( b == YY_CURRENT_BUFFER ) - cmDependsFortran_yy_load_buffer_state(yyscanner ); + cmFortran_yy_load_buffer_state(yyscanner ); } /** Pushes the new state onto the stack. The new state becomes @@ -1872,15 +1872,15 @@ extern int isatty (int ); * @param new_buffer The new state. * @param yyscanner The scanner object. */ -void cmDependsFortran_yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) +void cmFortran_yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; if (new_buffer == NULL) return; - cmDependsFortran_yyensure_buffer_stack(yyscanner); + cmFortran_yyensure_buffer_stack(yyscanner); - /* This block is copied from cmDependsFortran_yy_switch_to_buffer. */ + /* This block is copied from cmFortran_yy_switch_to_buffer. */ if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ @@ -1894,8 +1894,8 @@ void cmDependsFortran_yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyg->yy_buffer_stack_top++; YY_CURRENT_BUFFER_LVALUE = new_buffer; - /* copied from cmDependsFortran_yy_switch_to_buffer. */ - cmDependsFortran_yy_load_buffer_state(yyscanner ); + /* copied from cmFortran_yy_switch_to_buffer. */ + cmFortran_yy_load_buffer_state(yyscanner ); yyg->yy_did_buffer_switch_on_eof = 1; } @@ -1903,19 +1903,19 @@ void cmDependsFortran_yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t * The next element becomes the new top. * @param yyscanner The scanner object. */ -void cmDependsFortran_yypop_buffer_state (yyscan_t yyscanner) +void cmFortran_yypop_buffer_state (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; if (!YY_CURRENT_BUFFER) return; - cmDependsFortran_yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner); + cmFortran_yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner); YY_CURRENT_BUFFER_LVALUE = NULL; if (yyg->yy_buffer_stack_top > 0) --yyg->yy_buffer_stack_top; if (YY_CURRENT_BUFFER) { - cmDependsFortran_yy_load_buffer_state(yyscanner ); + cmFortran_yy_load_buffer_state(yyscanner ); yyg->yy_did_buffer_switch_on_eof = 1; } } @@ -1923,7 +1923,7 @@ void cmDependsFortran_yypop_buffer_state (yyscan_t yyscanner) /* Allocates the stack if it does not exist. * Guarantees space for at least one push. */ -static void cmDependsFortran_yyensure_buffer_stack (yyscan_t yyscanner) +static void cmFortran_yyensure_buffer_stack (yyscan_t yyscanner) { int num_to_alloc; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; @@ -1935,11 +1935,11 @@ static void cmDependsFortran_yyensure_buffer_stack (yyscan_t yyscanner) * immediate realloc on the next call. */ num_to_alloc = 1; - yyg->yy_buffer_stack = (struct yy_buffer_state**)cmDependsFortran_yyalloc + yyg->yy_buffer_stack = (struct yy_buffer_state**)cmFortran_yyalloc (num_to_alloc * sizeof(struct yy_buffer_state*) , yyscanner); if ( ! yyg->yy_buffer_stack ) - YY_FATAL_ERROR( "out of dynamic memory in cmDependsFortran_yyensure_buffer_stack()" ); + YY_FATAL_ERROR( "out of dynamic memory in cmFortran_yyensure_buffer_stack()" ); memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*)); @@ -1954,12 +1954,12 @@ static void cmDependsFortran_yyensure_buffer_stack (yyscan_t yyscanner) int grow_size = 8 /* arbitrary grow size */; num_to_alloc = yyg->yy_buffer_stack_max + grow_size; - yyg->yy_buffer_stack = (struct yy_buffer_state**)cmDependsFortran_yyrealloc + yyg->yy_buffer_stack = (struct yy_buffer_state**)cmFortran_yyrealloc (yyg->yy_buffer_stack, num_to_alloc * sizeof(struct yy_buffer_state*) , yyscanner); if ( ! yyg->yy_buffer_stack ) - YY_FATAL_ERROR( "out of dynamic memory in cmDependsFortran_yyensure_buffer_stack()" ); + YY_FATAL_ERROR( "out of dynamic memory in cmFortran_yyensure_buffer_stack()" ); /* zero only the new slots.*/ memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*)); @@ -1973,7 +1973,7 @@ static void cmDependsFortran_yyensure_buffer_stack (yyscan_t yyscanner) * @param yyscanner The scanner object. * @return the newly allocated buffer state object. */ -YY_BUFFER_STATE cmDependsFortran_yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner) +YY_BUFFER_STATE cmFortran_yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner) { YY_BUFFER_STATE b; @@ -1983,9 +1983,9 @@ YY_BUFFER_STATE cmDependsFortran_yy_scan_buffer (char * base, yy_size_t size , /* They forgot to leave room for the EOB's. */ return 0; - b = (YY_BUFFER_STATE) cmDependsFortran_yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner ); + b = (YY_BUFFER_STATE) cmFortran_yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner ); if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in cmDependsFortran_yy_scan_buffer()" ); + YY_FATAL_ERROR( "out of dynamic memory in cmFortran_yy_scan_buffer()" ); b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ b->yy_buf_pos = b->yy_ch_buf = base; @@ -1997,33 +1997,33 @@ YY_BUFFER_STATE cmDependsFortran_yy_scan_buffer (char * base, yy_size_t size , b->yy_fill_buffer = 0; b->yy_buffer_status = YY_BUFFER_NEW; - cmDependsFortran_yy_switch_to_buffer(b ,yyscanner ); + cmFortran_yy_switch_to_buffer(b ,yyscanner ); return b; } -/** Setup the input buffer state to scan a string. The next call to cmDependsFortran_yylex() will +/** Setup the input buffer state to scan a string. The next call to cmFortran_yylex() will * scan from a @e copy of @a str. * @param yystr a NUL-terminated string to scan * @param yyscanner The scanner object. * @return the newly allocated buffer state object. * @note If you want to scan bytes that may contain NUL values, then use - * cmDependsFortran_yy_scan_bytes() instead. + * cmFortran_yy_scan_bytes() instead. */ -YY_BUFFER_STATE cmDependsFortran_yy_scan_string (yyconst char * yystr , yyscan_t yyscanner) +YY_BUFFER_STATE cmFortran_yy_scan_string (yyconst char * yystr , yyscan_t yyscanner) { - return cmDependsFortran_yy_scan_bytes(yystr,strlen(yystr) ,yyscanner); + return cmFortran_yy_scan_bytes(yystr,strlen(yystr) ,yyscanner); } -/** Setup the input buffer state to scan the given bytes. The next call to cmDependsFortran_yylex() will +/** Setup the input buffer state to scan the given bytes. The next call to cmFortran_yylex() will * scan from a @e copy of @a bytes. * @param yybytes the byte buffer to scan * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. * @param yyscanner The scanner object. * @return the newly allocated buffer state object. */ -YY_BUFFER_STATE cmDependsFortran_yy_scan_bytes (yyconst char * yybytes, int _yybytes_len , yyscan_t yyscanner) +YY_BUFFER_STATE cmFortran_yy_scan_bytes (yyconst char * yybytes, int _yybytes_len , yyscan_t yyscanner) { YY_BUFFER_STATE b; char *buf; @@ -2032,18 +2032,18 @@ YY_BUFFER_STATE cmDependsFortran_yy_scan_bytes (yyconst char * yybytes, int _y /* Get memory for full buffer, including space for trailing EOB's. */ n = _yybytes_len + 2; - buf = (char *) cmDependsFortran_yyalloc(n ,yyscanner ); + buf = (char *) cmFortran_yyalloc(n ,yyscanner ); if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in cmDependsFortran_yy_scan_bytes()" ); + YY_FATAL_ERROR( "out of dynamic memory in cmFortran_yy_scan_bytes()" ); for ( i = 0; i < _yybytes_len; ++i ) buf[i] = yybytes[i]; buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; - b = cmDependsFortran_yy_scan_buffer(buf,n ,yyscanner); + b = cmFortran_yy_scan_buffer(buf,n ,yyscanner); if ( ! b ) - YY_FATAL_ERROR( "bad buffer in cmDependsFortran_yy_scan_bytes()" ); + YY_FATAL_ERROR( "bad buffer in cmFortran_yy_scan_bytes()" ); /* It's okay to grow etc. this buffer, and we should throw it * away when we're done. @@ -2085,7 +2085,7 @@ static void yy_fatal_error (yyconst char* msg , yyscan_t) /** Get the user-defined data for this scanner. * @param yyscanner The scanner object. */ -YY_EXTRA_TYPE cmDependsFortran_yyget_extra (yyscan_t yyscanner) +YY_EXTRA_TYPE cmFortran_yyget_extra (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; return yyextra; @@ -2094,7 +2094,7 @@ YY_EXTRA_TYPE cmDependsFortran_yyget_extra (yyscan_t yyscanner) /** Get the current line number. * @param yyscanner The scanner object. */ -int cmDependsFortran_yyget_lineno (yyscan_t yyscanner) +int cmFortran_yyget_lineno (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; @@ -2107,7 +2107,7 @@ int cmDependsFortran_yyget_lineno (yyscan_t yyscanner) /** Get the current column number. * @param yyscanner The scanner object. */ -int cmDependsFortran_yyget_column (yyscan_t yyscanner) +int cmFortran_yyget_column (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; @@ -2120,7 +2120,7 @@ int cmDependsFortran_yyget_column (yyscan_t yyscanner) /** Get the input stream. * @param yyscanner The scanner object. */ -FILE *cmDependsFortran_yyget_in (yyscan_t yyscanner) +FILE *cmFortran_yyget_in (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; return yyin; @@ -2129,7 +2129,7 @@ FILE *cmDependsFortran_yyget_in (yyscan_t yyscanner) /** Get the output stream. * @param yyscanner The scanner object. */ -FILE *cmDependsFortran_yyget_out (yyscan_t yyscanner) +FILE *cmFortran_yyget_out (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; return yyout; @@ -2138,7 +2138,7 @@ FILE *cmDependsFortran_yyget_out (yyscan_t yyscanner) /** Get the length of the current token. * @param yyscanner The scanner object. */ -int cmDependsFortran_yyget_leng (yyscan_t yyscanner) +int cmFortran_yyget_leng (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; return yyleng; @@ -2148,7 +2148,7 @@ int cmDependsFortran_yyget_leng (yyscan_t yyscanner) * @param yyscanner The scanner object. */ -char *cmDependsFortran_yyget_text (yyscan_t yyscanner) +char *cmFortran_yyget_text (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; return yytext; @@ -2158,7 +2158,7 @@ char *cmDependsFortran_yyget_text (yyscan_t yyscanner) * @param user_defined The data to be associated with this scanner. * @param yyscanner The scanner object. */ -void cmDependsFortran_yyset_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner) +void cmFortran_yyset_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; yyextra = user_defined ; @@ -2168,13 +2168,13 @@ void cmDependsFortran_yyset_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscan * @param line_number The line number to set. * @param yyscanner The scanner object. */ -void cmDependsFortran_yyset_lineno (int line_number , yyscan_t yyscanner) +void cmFortran_yyset_lineno (int line_number , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* lineno is only valid if an input buffer exists. */ if (! YY_CURRENT_BUFFER ) - yy_fatal_error( "cmDependsFortran_yyset_lineno called with no buffer" , yyscanner); + yy_fatal_error( "cmFortran_yyset_lineno called with no buffer" , yyscanner); yylineno = line_number; } @@ -2183,13 +2183,13 @@ void cmDependsFortran_yyset_lineno (int line_number , yyscan_t yyscanner) * @param column_no The column number to set. * @param yyscanner The scanner object. */ -void cmDependsFortran_yyset_column (int column_no , yyscan_t yyscanner) +void cmFortran_yyset_column (int column_no , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* column is only valid if an input buffer exists. */ if (! YY_CURRENT_BUFFER ) - yy_fatal_error( "cmDependsFortran_yyset_column called with no buffer" , yyscanner); + yy_fatal_error( "cmFortran_yyset_column called with no buffer" , yyscanner); yycolumn = column_no; } @@ -2198,27 +2198,27 @@ void cmDependsFortran_yyset_column (int column_no , yyscan_t yyscanner) * input buffer. * @param in_str A readable stream. * @param yyscanner The scanner object. - * @see cmDependsFortran_yy_switch_to_buffer + * @see cmFortran_yy_switch_to_buffer */ -void cmDependsFortran_yyset_in (FILE * in_str , yyscan_t yyscanner) +void cmFortran_yyset_in (FILE * in_str , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; yyin = in_str ; } -void cmDependsFortran_yyset_out (FILE * out_str , yyscan_t yyscanner) +void cmFortran_yyset_out (FILE * out_str , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; yyout = out_str ; } -int cmDependsFortran_yyget_debug (yyscan_t yyscanner) +int cmFortran_yyget_debug (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; return yy_flex_debug; } -void cmDependsFortran_yyset_debug (int bdebug , yyscan_t yyscanner) +void cmFortran_yyset_debug (int bdebug , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; yy_flex_debug = bdebug ; @@ -2228,12 +2228,12 @@ void cmDependsFortran_yyset_debug (int bdebug , yyscan_t yyscanner) /* User-visible API */ -/* cmDependsFortran_yylex_init is special because it creates the scanner itself, so it is +/* cmFortran_yylex_init is special because it creates the scanner itself, so it is * the ONLY reentrant function that doesn't take the scanner as the last argument. * That's why we explicitly handle the declaration, instead of using our macros. */ -int cmDependsFortran_yylex_init(yyscan_t* ptr_yy_globals) +int cmFortran_yylex_init(yyscan_t* ptr_yy_globals) { if (ptr_yy_globals == NULL){ @@ -2241,7 +2241,7 @@ int cmDependsFortran_yylex_init(yyscan_t* ptr_yy_globals) return 1; } - *ptr_yy_globals = (yyscan_t) cmDependsFortran_yyalloc ( sizeof( struct yyguts_t ), NULL ); + *ptr_yy_globals = (yyscan_t) cmFortran_yyalloc ( sizeof( struct yyguts_t ), NULL ); if (*ptr_yy_globals == NULL){ errno = ENOMEM; @@ -2254,27 +2254,27 @@ int cmDependsFortran_yylex_init(yyscan_t* ptr_yy_globals) return yy_init_globals ( *ptr_yy_globals ); } -/* cmDependsFortran_yylex_init_extra has the same functionality as cmDependsFortran_yylex_init, but follows the +/* cmFortran_yylex_init_extra has the same functionality as cmFortran_yylex_init, but follows the * convention of taking the scanner as the last argument. Note however, that * this is a *pointer* to a scanner, as it will be allocated by this call (and * is the reason, too, why this function also must handle its own declaration). - * The user defined value in the first argument will be available to cmDependsFortran_yyalloc in + * The user defined value in the first argument will be available to cmFortran_yyalloc in * the yyextra field. */ -int cmDependsFortran_yylex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals ) +int cmFortran_yylex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals ) { struct yyguts_t dummy_yyguts; - cmDependsFortran_yyset_extra (yy_user_defined, &dummy_yyguts); + cmFortran_yyset_extra (yy_user_defined, &dummy_yyguts); if (ptr_yy_globals == NULL){ errno = EINVAL; return 1; } - *ptr_yy_globals = (yyscan_t) cmDependsFortran_yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts ); + *ptr_yy_globals = (yyscan_t) cmFortran_yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts ); if (*ptr_yy_globals == NULL){ errno = ENOMEM; @@ -2285,7 +2285,7 @@ int cmDependsFortran_yylex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* pt yy_init_globals. Leave at 0x00 for releases. */ memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); - cmDependsFortran_yyset_extra (yy_user_defined, *ptr_yy_globals); + cmFortran_yyset_extra (yy_user_defined, *ptr_yy_globals); return yy_init_globals ( *ptr_yy_globals ); } @@ -2294,7 +2294,7 @@ static int yy_init_globals (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* Initialization is the same as for the non-reentrant scanner. - * This function is called from cmDependsFortran_yylex_destroy(), so don't allocate here. + * This function is called from cmFortran_yylex_destroy(), so don't allocate here. */ yyg->yy_buffer_stack = 0; @@ -2318,37 +2318,37 @@ static int yy_init_globals (yyscan_t yyscanner) #endif /* For future reference: Set errno on error, since we are called by - * cmDependsFortran_yylex_init() + * cmFortran_yylex_init() */ return 0; } -/* cmDependsFortran_yylex_destroy is for both reentrant and non-reentrant scanners. */ -int cmDependsFortran_yylex_destroy (yyscan_t yyscanner) +/* cmFortran_yylex_destroy is for both reentrant and non-reentrant scanners. */ +int cmFortran_yylex_destroy (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* Pop the buffer stack, destroying each element. */ while(YY_CURRENT_BUFFER){ - cmDependsFortran_yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner ); + cmFortran_yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner ); YY_CURRENT_BUFFER_LVALUE = NULL; - cmDependsFortran_yypop_buffer_state(yyscanner); + cmFortran_yypop_buffer_state(yyscanner); } /* Destroy the stack itself. */ - cmDependsFortran_yyfree(yyg->yy_buffer_stack ,yyscanner); + cmFortran_yyfree(yyg->yy_buffer_stack ,yyscanner); yyg->yy_buffer_stack = NULL; /* Destroy the start condition stack. */ - cmDependsFortran_yyfree(yyg->yy_start_stack ,yyscanner ); + cmFortran_yyfree(yyg->yy_start_stack ,yyscanner ); yyg->yy_start_stack = NULL; /* Reset the globals. This is important in a non-reentrant scanner so the next time - * cmDependsFortran_yylex() is called, initialization will occur. */ + * cmFortran_yylex() is called, initialization will occur. */ yy_init_globals( yyscanner); /* Destroy the main struct (reentrant only). */ - cmDependsFortran_yyfree ( yyscanner , yyscanner ); + cmFortran_yyfree ( yyscanner , yyscanner ); return 0; } @@ -2376,12 +2376,12 @@ static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner) } #endif -void *cmDependsFortran_yyalloc (yy_size_t size , yyscan_t) +void *cmFortran_yyalloc (yy_size_t size , yyscan_t) { return (void *) malloc( size ); } -void *cmDependsFortran_yyrealloc (void * ptr, yy_size_t size , yyscan_t) +void *cmFortran_yyrealloc (void * ptr, yy_size_t size , yyscan_t) { /* The cast to (char *) in the following accommodates both * implementations that use char* generic pointers, and those @@ -2393,19 +2393,19 @@ void *cmDependsFortran_yyrealloc (void * ptr, yy_size_t size , yyscan_t) return (void *) realloc( (char *) ptr, size ); } -void cmDependsFortran_yyfree (void * ptr , yyscan_t) +void cmFortran_yyfree (void * ptr , yyscan_t) { - free( (char *) ptr ); /* see cmDependsFortran_yyrealloc() for (char *) cast */ + free( (char *) ptr ); /* see cmFortran_yyrealloc() for (char *) cast */ } #define YYTABLES_NAME "yytables" -#line 181 "cmDependsFortranLexer.in.l" +#line 181 "cmFortranLexer.in.l" /*--------------------------------------------------------------------------*/ -YY_BUFFER_STATE cmDependsFortranLexer_GetCurrentBuffer(yyscan_t yyscanner) +YY_BUFFER_STATE cmFortranLexer_GetCurrentBuffer(yyscan_t yyscanner) { /* Hack into the internal flex-generated scanner to get the buffer. */ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; diff --git a/Source/cmDependsFortranLexer.h b/Source/cmFortranLexer.h similarity index 74% rename from Source/cmDependsFortranLexer.h rename to Source/cmFortranLexer.h index 8e24cfd80..c67e332fc 100644 --- a/Source/cmDependsFortranLexer.h +++ b/Source/cmFortranLexer.h @@ -9,9 +9,9 @@ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the License for more information. ============================================================================*/ -#ifndef cmDependsFortran_yyHEADER_H -#define cmDependsFortran_yyHEADER_H 1 -#define cmDependsFortran_yyIN_HEADER 1 +#ifndef cmFortran_yyHEADER_H +#define cmFortran_yyHEADER_H 1 +#define cmFortran_yyIN_HEADER 1 #define YY_INT_ALIGNED short int @@ -211,25 +211,25 @@ struct yy_buffer_state }; #endif /* !YY_STRUCT_YY_BUFFER_STATE */ -void cmDependsFortran_yyrestart (FILE *input_file ,yyscan_t yyscanner ); -void cmDependsFortran_yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); -YY_BUFFER_STATE cmDependsFortran_yy_create_buffer (FILE *file,int size ,yyscan_t yyscanner ); -void cmDependsFortran_yy_delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); -void cmDependsFortran_yy_flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); -void cmDependsFortran_yypush_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); -void cmDependsFortran_yypop_buffer_state (yyscan_t yyscanner ); +void cmFortran_yyrestart (FILE *input_file ,yyscan_t yyscanner ); +void cmFortran_yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); +YY_BUFFER_STATE cmFortran_yy_create_buffer (FILE *file,int size ,yyscan_t yyscanner ); +void cmFortran_yy_delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); +void cmFortran_yy_flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); +void cmFortran_yypush_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); +void cmFortran_yypop_buffer_state (yyscan_t yyscanner ); -YY_BUFFER_STATE cmDependsFortran_yy_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner ); -YY_BUFFER_STATE cmDependsFortran_yy_scan_string (yyconst char *yy_str ,yyscan_t yyscanner ); -YY_BUFFER_STATE cmDependsFortran_yy_scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner ); +YY_BUFFER_STATE cmFortran_yy_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner ); +YY_BUFFER_STATE cmFortran_yy_scan_string (yyconst char *yy_str ,yyscan_t yyscanner ); +YY_BUFFER_STATE cmFortran_yy_scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner ); -void *cmDependsFortran_yyalloc (yy_size_t ,yyscan_t yyscanner ); -void *cmDependsFortran_yyrealloc (void *,yy_size_t ,yyscan_t yyscanner ); -void cmDependsFortran_yyfree (void * ,yyscan_t yyscanner ); +void *cmFortran_yyalloc (yy_size_t ,yyscan_t yyscanner ); +void *cmFortran_yyrealloc (void *,yy_size_t ,yyscan_t yyscanner ); +void cmFortran_yyfree (void * ,yyscan_t yyscanner ); /* Begin user sect3 */ -#define cmDependsFortran_yywrap(n) 1 +#define cmFortran_yywrap(n) 1 #define YY_SKIP_YYWRAP #define yytext_ptr yytext_r @@ -247,38 +247,38 @@ void cmDependsFortran_yyfree (void * ,yyscan_t yyscanner ); #define YY_EXTRA_TYPE void * #endif -int cmDependsFortran_yylex_init (yyscan_t* scanner); +int cmFortran_yylex_init (yyscan_t* scanner); -int cmDependsFortran_yylex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner); +int cmFortran_yylex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner); /* Accessor methods to globals. These are made visible to non-reentrant scanners for convenience. */ -int cmDependsFortran_yylex_destroy (yyscan_t yyscanner ); +int cmFortran_yylex_destroy (yyscan_t yyscanner ); -int cmDependsFortran_yyget_debug (yyscan_t yyscanner ); +int cmFortran_yyget_debug (yyscan_t yyscanner ); -void cmDependsFortran_yyset_debug (int debug_flag ,yyscan_t yyscanner ); +void cmFortran_yyset_debug (int debug_flag ,yyscan_t yyscanner ); -YY_EXTRA_TYPE cmDependsFortran_yyget_extra (yyscan_t yyscanner ); +YY_EXTRA_TYPE cmFortran_yyget_extra (yyscan_t yyscanner ); -void cmDependsFortran_yyset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner ); +void cmFortran_yyset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner ); -FILE *cmDependsFortran_yyget_in (yyscan_t yyscanner ); +FILE *cmFortran_yyget_in (yyscan_t yyscanner ); -void cmDependsFortran_yyset_in (FILE * in_str ,yyscan_t yyscanner ); +void cmFortran_yyset_in (FILE * in_str ,yyscan_t yyscanner ); -FILE *cmDependsFortran_yyget_out (yyscan_t yyscanner ); +FILE *cmFortran_yyget_out (yyscan_t yyscanner ); -void cmDependsFortran_yyset_out (FILE * out_str ,yyscan_t yyscanner ); +void cmFortran_yyset_out (FILE * out_str ,yyscan_t yyscanner ); -int cmDependsFortran_yyget_leng (yyscan_t yyscanner ); +int cmFortran_yyget_leng (yyscan_t yyscanner ); -char *cmDependsFortran_yyget_text (yyscan_t yyscanner ); +char *cmFortran_yyget_text (yyscan_t yyscanner ); -int cmDependsFortran_yyget_lineno (yyscan_t yyscanner ); +int cmFortran_yyget_lineno (yyscan_t yyscanner ); -void cmDependsFortran_yyset_lineno (int line_number ,yyscan_t yyscanner ); +void cmFortran_yyset_lineno (int line_number ,yyscan_t yyscanner ); /* Macros after this point can all be overridden by user definitions in * section 1. @@ -286,9 +286,9 @@ void cmDependsFortran_yyset_lineno (int line_number ,yyscan_t yyscanner ); #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus -extern "C" int cmDependsFortran_yywrap (yyscan_t yyscanner ); +extern "C" int cmFortran_yywrap (yyscan_t yyscanner ); #else -extern int cmDependsFortran_yywrap (yyscan_t yyscanner ); +extern int cmFortran_yywrap (yyscan_t yyscanner ); #endif #endif @@ -325,9 +325,9 @@ static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner); #ifndef YY_DECL #define YY_DECL_IS_OURS 1 -extern int cmDependsFortran_yylex (yyscan_t yyscanner); +extern int cmFortran_yylex (yyscan_t yyscanner); -#define YY_DECL int cmDependsFortran_yylex (yyscan_t yyscanner) +#define YY_DECL int cmFortran_yylex (yyscan_t yyscanner) #endif /* !YY_DECL */ /* yy_get_previous_state - get the state just before the EOB char was reached */ @@ -344,5 +344,5 @@ extern int cmDependsFortran_yylex (yyscan_t yyscanner); #undef YY_DECL #endif -#undef cmDependsFortran_yyIN_HEADER -#endif /* cmDependsFortran_yyHEADER_H */ +#undef cmFortran_yyIN_HEADER +#endif /* cmFortran_yyHEADER_H */ diff --git a/Source/cmDependsFortranLexer.in.l b/Source/cmFortranLexer.in.l similarity index 78% rename from Source/cmDependsFortranLexer.in.l rename to Source/cmFortranLexer.in.l index 01488024e..03fa90c60 100644 --- a/Source/cmDependsFortranLexer.in.l +++ b/Source/cmFortranLexer.in.l @@ -26,18 +26,18 @@ This file must be translated to C and modified to build everywhere. Run flex like this: - flex -i --prefix=cmDependsFortran_yy --header-file=cmDependsFortranLexer.h -ocmDependsFortranLexer.cxx cmDependsFortranLexer.in.l + flex -i --prefix=cmFortran_yy --header-file=cmFortranLexer.h -ocmFortranLexer.cxx cmFortranLexer.in.l -Modify cmDependsFortranLexer.cxx: +Modify cmFortranLexer.cxx: - remove TABs - remove use of the 'register' storage class specifier - remove "yyscanner" argument from these methods: - yy_fatal_error, cmDependsFortran_yyalloc, cmDependsFortran_yyrealloc, cmDependsFortran_yyfree - - remove "yyscanner = NULL" from end of cmDependsFortran_yylex_destroy + yy_fatal_error, cmFortran_yyalloc, cmFortran_yyrealloc, cmFortran_yyfree + - remove "yyscanner = NULL" from end of cmFortran_yylex_destroy - remove all YY_BREAK lines occurring right after return statements - change while ( 1 ) to for(;;) -Modify cmDependsFortranLexer.h: +Modify cmFortranLexer.h: - remove TABs - remove the yy_init_globals function - remove the block that includes unistd.h @@ -47,16 +47,16 @@ Modify cmDependsFortranLexer.h: #include "cmStandardLexer.h" -#define cmDependsFortranLexer_cxx -#include "cmDependsFortranParser.h" /* Interface to parser object. */ +#define cmFortranLexer_cxx +#include "cmFortranParser.h" /* Interface to parser object. */ /* Replace the lexer input function. */ #undef YY_INPUT #define YY_INPUT(buf, result, max_size) \ - { result = cmDependsFortranParser_Input(yyextra, buf, max_size); } + { result = cmFortranParser_Input(yyextra, buf, max_size); } /* Include the set of tokens from the parser. */ -#include "cmDependsFortranParserTokens.h" +#include "cmFortranParserTokens.h" /*--------------------------------------------------------------------------*/ %} @@ -72,21 +72,21 @@ Modify cmDependsFortranLexer.h: %% \" { - cmDependsFortranParser_StringStart(yyextra); - cmDependsFortranParser_SetOldStartcond(yyextra, YY_START); + cmFortranParser_StringStart(yyextra); + cmFortranParser_SetOldStartcond(yyextra, YY_START); BEGIN(str_dq); } ' { - cmDependsFortranParser_StringStart(yyextra); - cmDependsFortranParser_SetOldStartcond(yyextra, YY_START); + cmFortranParser_StringStart(yyextra); + cmFortranParser_SetOldStartcond(yyextra, YY_START); BEGIN(str_sq); } \" | ' { - BEGIN(cmDependsFortranParser_GetOldStartcond(yyextra) ); - yylvalp->string = strdup(cmDependsFortranParser_StringEnd(yyextra)); + BEGIN(cmFortranParser_GetOldStartcond(yyextra) ); + yylvalp->string = strdup(cmFortranParser_StringEnd(yyextra)); return STRING; } @@ -94,7 +94,7 @@ Modify cmDependsFortranLexer.h: &[ \t]*\n[ \t]*& /* Ignore (continued strings, free fmt) */ \n[ ]{5}[^ \t\n] { - if (cmDependsFortranParser_GetOldStartcond(yyextra) == fixed_fmt) + if (cmFortranParser_GetOldStartcond(yyextra) == fixed_fmt) ; /* Ignore (cont. strings, fixed fmt) */ else { @@ -110,7 +110,7 @@ Modify cmDependsFortranLexer.h: } . { - cmDependsFortranParser_StringAppend(yyextra, yytext[0]); + cmFortranParser_StringAppend(yyextra, yytext[0]); } !.*\n { return EOSTMT; } /* Treat comments like */ @@ -173,7 +173,7 @@ $[ \t]*endif { return F90PPR_ENDIF; } . { return *yytext; } <> { - if(!cmDependsFortranParser_FilePop(yyextra) ) + if(!cmFortranParser_FilePop(yyextra) ) { return YY_NULL; } @@ -182,7 +182,7 @@ $[ \t]*endif { return F90PPR_ENDIF; } %% /*--------------------------------------------------------------------------*/ -YY_BUFFER_STATE cmDependsFortranLexer_GetCurrentBuffer(yyscan_t yyscanner) +YY_BUFFER_STATE cmFortranLexer_GetCurrentBuffer(yyscan_t yyscanner) { /* Hack into the internal flex-generated scanner to get the buffer. */ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; diff --git a/Source/cmDependsFortranParser.cxx b/Source/cmFortranParser.cxx similarity index 91% rename from Source/cmDependsFortranParser.cxx rename to Source/cmFortranParser.cxx index 9d51025dd..871b9c3c5 100644 --- a/Source/cmDependsFortranParser.cxx +++ b/Source/cmFortranParser.cxx @@ -62,19 +62,19 @@ #define YYLSP_NEEDED 0 /* Substitute the variable and function names. */ -#define yyparse cmDependsFortran_yyparse -#define yylex cmDependsFortran_yylex -#define yyerror cmDependsFortran_yyerror -#define yylval cmDependsFortran_yylval -#define yychar cmDependsFortran_yychar -#define yydebug cmDependsFortran_yydebug -#define yynerrs cmDependsFortran_yynerrs +#define yyparse cmFortran_yyparse +#define yylex cmFortran_yylex +#define yyerror cmFortran_yyerror +#define yylval cmFortran_yylval +#define yychar cmFortran_yychar +#define yydebug cmFortran_yydebug +#define yynerrs cmFortran_yynerrs /* Copy the first part of user declarations. */ /* Line 268 of yacc.c */ -#line 1 "cmDependsFortranParser.y" +#line 1 "cmFortranParser.y" /*============================================================================ CMake - Cross Platform Makefile Generator @@ -103,20 +103,20 @@ This file must be translated to C and modified to build everywhere. Run bison like this: - bison --yacc --name-prefix=cmDependsFortran_yy - --defines=cmDependsFortranParserTokens.h - -ocmDependsFortranParser.cxx - cmDependsFortranParser.y + bison --yacc --name-prefix=cmFortran_yy + --defines=cmFortranParserTokens.h + -ocmFortranParser.cxx + cmFortranParser.y -Modify cmDependsFortranParser.cxx: +Modify cmFortranParser.cxx: - remove TABs - Remove the yyerrorlab block in range ["goto yyerrlab1", "yyerrlab1:"] */ /*-------------------------------------------------------------------------*/ -#define cmDependsFortranParser_cxx -#include "cmDependsFortranParser.h" /* Interface to parser object. */ -#include "cmDependsFortranParserTokens.h" /* Need YYSTYPE for YY_DECL. */ +#define cmFortranParser_cxx +#include "cmFortranParser.h" /* Interface to parser object. */ +#include "cmFortranParserTokens.h" /* Need YYSTYPE for YY_DECL. */ #include @@ -124,20 +124,20 @@ Modify cmDependsFortranParser.cxx: #define YYPARSE_PARAM yyscanner #define YYLEX_PARAM yyscanner #define YYERROR_VERBOSE 1 -#define cmDependsFortran_yyerror(x) \ - cmDependsFortranError(yyscanner, x) +#define cmFortran_yyerror(x) \ + cmFortranError(yyscanner, x) /* Forward declare the lexer entry point. */ YY_DECL; /* Helper function to forward error callback. */ -static void cmDependsFortranError(yyscan_t yyscanner, const char* message) +static void cmFortranError(yyscan_t yyscanner, const char* message) { - cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner); - cmDependsFortranParser_Error(parser, message); + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); + cmFortranParser_Error(parser, message); } -static bool cmDependsFortranParserIsKeyword(const char* word, +static bool cmFortranParserIsKeyword(const char* word, const char* keyword) { return cmsysString_strcasecmp(word, keyword) == 0; @@ -155,7 +155,7 @@ static bool cmDependsFortranParserIsKeyword(const char* word, /* Line 268 of yacc.c */ -#line 165 "cmDependsFortranParser.cxx" +#line 165 "cmFortranParser.cxx" /* Enabling traces. */ #ifndef YYDEBUG @@ -252,14 +252,14 @@ typedef union YYSTYPE { /* Line 293 of yacc.c */ -#line 89 "cmDependsFortranParser.y" +#line 89 "cmFortranParser.y" char* string; /* Line 293 of yacc.c */ -#line 269 "cmDependsFortranParser.cxx" +#line 269 "cmFortranParser.cxx" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ @@ -271,7 +271,7 @@ typedef union YYSTYPE /* Line 343 of yacc.c */ -#line 281 "cmDependsFortranParser.cxx" +#line 281 "cmFortranParser.cxx" #ifdef short # undef short @@ -1610,7 +1610,7 @@ yyreduce: case 6: /* Line 1806 of yacc.c */ -#line 116 "cmDependsFortranParser.y" +#line 116 "cmFortranParser.y" { free((yyvsp[(1) - (4)].string)); } @@ -1619,13 +1619,13 @@ yyreduce: case 7: /* Line 1806 of yacc.c */ -#line 122 "cmDependsFortranParser.y" +#line 122 "cmFortranParser.y" { - if (cmDependsFortranParserIsKeyword((yyvsp[(1) - (2)].string), "interface")) + if (cmFortranParserIsKeyword((yyvsp[(1) - (2)].string), "interface")) { - cmDependsFortranParser* parser = - cmDependsFortran_yyget_extra(yyscanner); - cmDependsFortranParser_SetInInterface(parser, true); + cmFortranParser* parser = + cmFortran_yyget_extra(yyscanner); + cmFortranParser_SetInInterface(parser, true); } free((yyvsp[(1) - (2)].string)); } @@ -1634,32 +1634,32 @@ yyreduce: case 8: /* Line 1806 of yacc.c */ -#line 132 "cmDependsFortranParser.y" +#line 132 "cmFortranParser.y" { - if (cmDependsFortranParserIsKeyword((yyvsp[(1) - (4)].string), "use")) + if (cmFortranParserIsKeyword((yyvsp[(1) - (4)].string), "use")) { - cmDependsFortranParser* parser = - cmDependsFortran_yyget_extra(yyscanner); - cmDependsFortranParser_RuleUse(parser, (yyvsp[(2) - (4)].string)); + cmFortranParser* parser = + cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleUse(parser, (yyvsp[(2) - (4)].string)); } - else if (cmDependsFortranParserIsKeyword((yyvsp[(1) - (4)].string), "module")) + else if (cmFortranParserIsKeyword((yyvsp[(1) - (4)].string), "module")) { - cmDependsFortranParser* parser = - cmDependsFortran_yyget_extra(yyscanner); - cmDependsFortranParser_RuleModule(parser, (yyvsp[(2) - (4)].string)); + cmFortranParser* parser = + cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleModule(parser, (yyvsp[(2) - (4)].string)); } - else if (cmDependsFortranParserIsKeyword((yyvsp[(1) - (4)].string), "interface")) + else if (cmFortranParserIsKeyword((yyvsp[(1) - (4)].string), "interface")) { - cmDependsFortranParser* parser = - cmDependsFortran_yyget_extra(yyscanner); - cmDependsFortranParser_SetInInterface(parser, true); + cmFortranParser* parser = + cmFortran_yyget_extra(yyscanner); + cmFortranParser_SetInInterface(parser, true); } - else if (cmDependsFortranParserIsKeyword((yyvsp[(2) - (4)].string), "interface") && - cmDependsFortranParserIsKeyword((yyvsp[(1) - (4)].string), "end")) + else if (cmFortranParserIsKeyword((yyvsp[(2) - (4)].string), "interface") && + cmFortranParserIsKeyword((yyvsp[(1) - (4)].string), "end")) { - cmDependsFortranParser* parser = - cmDependsFortran_yyget_extra(yyscanner); - cmDependsFortranParser_SetInInterface(parser, false); + cmFortranParser* parser = + cmFortran_yyget_extra(yyscanner); + cmFortranParser_SetInInterface(parser, false); } free((yyvsp[(1) - (4)].string)); free((yyvsp[(2) - (4)].string)); @@ -1669,13 +1669,13 @@ yyreduce: case 9: /* Line 1806 of yacc.c */ -#line 162 "cmDependsFortranParser.y" +#line 162 "cmFortranParser.y" { - if (cmDependsFortranParserIsKeyword((yyvsp[(1) - (5)].string), "use")) + if (cmFortranParserIsKeyword((yyvsp[(1) - (5)].string), "use")) { - cmDependsFortranParser* parser = - cmDependsFortran_yyget_extra(yyscanner); - cmDependsFortranParser_RuleUse(parser, (yyvsp[(3) - (5)].string)); + cmFortranParser* parser = + cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleUse(parser, (yyvsp[(3) - (5)].string)); } free((yyvsp[(1) - (5)].string)); free((yyvsp[(3) - (5)].string)); @@ -1685,14 +1685,14 @@ yyreduce: case 10: /* Line 1806 of yacc.c */ -#line 173 "cmDependsFortranParser.y" +#line 173 "cmFortranParser.y" { - if (cmDependsFortranParserIsKeyword((yyvsp[(1) - (7)].string), "use") && - cmDependsFortranParserIsKeyword((yyvsp[(3) - (7)].string), "non_intrinsic") ) + if (cmFortranParserIsKeyword((yyvsp[(1) - (7)].string), "use") && + cmFortranParserIsKeyword((yyvsp[(3) - (7)].string), "non_intrinsic") ) { - cmDependsFortranParser* parser = - cmDependsFortran_yyget_extra(yyscanner); - cmDependsFortranParser_RuleUse(parser, (yyvsp[(5) - (7)].string)); + cmFortranParser* parser = + cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleUse(parser, (yyvsp[(5) - (7)].string)); } free((yyvsp[(1) - (7)].string)); free((yyvsp[(3) - (7)].string)); @@ -1703,13 +1703,13 @@ yyreduce: case 11: /* Line 1806 of yacc.c */ -#line 186 "cmDependsFortranParser.y" +#line 186 "cmFortranParser.y" { - if (cmDependsFortranParserIsKeyword((yyvsp[(1) - (4)].string), "include")) + if (cmFortranParserIsKeyword((yyvsp[(1) - (4)].string), "include")) { - cmDependsFortranParser* parser = - cmDependsFortran_yyget_extra(yyscanner); - cmDependsFortranParser_RuleInclude(parser, (yyvsp[(2) - (4)].string)); + cmFortranParser* parser = + cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleInclude(parser, (yyvsp[(2) - (4)].string)); } free((yyvsp[(1) - (4)].string)); free((yyvsp[(2) - (4)].string)); @@ -1719,11 +1719,11 @@ yyreduce: case 12: /* Line 1806 of yacc.c */ -#line 197 "cmDependsFortranParser.y" +#line 197 "cmFortranParser.y" { - cmDependsFortranParser* parser = - cmDependsFortran_yyget_extra(yyscanner); - cmDependsFortranParser_RuleInclude(parser, (yyvsp[(1) - (3)].string)); + cmFortranParser* parser = + cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleInclude(parser, (yyvsp[(1) - (3)].string)); free((yyvsp[(1) - (3)].string)); } break; @@ -1731,11 +1731,11 @@ yyreduce: case 13: /* Line 1806 of yacc.c */ -#line 204 "cmDependsFortranParser.y" +#line 204 "cmFortranParser.y" { - cmDependsFortranParser* parser = - cmDependsFortran_yyget_extra(yyscanner); - cmDependsFortranParser_RuleInclude(parser, (yyvsp[(2) - (4)].string)); + cmFortranParser* parser = + cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleInclude(parser, (yyvsp[(2) - (4)].string)); free((yyvsp[(2) - (4)].string)); } break; @@ -1743,10 +1743,10 @@ yyreduce: case 14: /* Line 1806 of yacc.c */ -#line 211 "cmDependsFortranParser.y" +#line 211 "cmFortranParser.y" { - cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner); - cmDependsFortranParser_RuleDefine(parser, (yyvsp[(2) - (4)].string)); + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleDefine(parser, (yyvsp[(2) - (4)].string)); free((yyvsp[(2) - (4)].string)); } break; @@ -1754,10 +1754,10 @@ yyreduce: case 15: /* Line 1806 of yacc.c */ -#line 217 "cmDependsFortranParser.y" +#line 217 "cmFortranParser.y" { - cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner); - cmDependsFortranParser_RuleUndef(parser, (yyvsp[(2) - (4)].string)); + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleUndef(parser, (yyvsp[(2) - (4)].string)); free((yyvsp[(2) - (4)].string)); } break; @@ -1765,10 +1765,10 @@ yyreduce: case 16: /* Line 1806 of yacc.c */ -#line 223 "cmDependsFortranParser.y" +#line 223 "cmFortranParser.y" { - cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner); - cmDependsFortranParser_RuleIfdef(parser, (yyvsp[(2) - (4)].string)); + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleIfdef(parser, (yyvsp[(2) - (4)].string)); free((yyvsp[(2) - (4)].string)); } break; @@ -1776,10 +1776,10 @@ yyreduce: case 17: /* Line 1806 of yacc.c */ -#line 229 "cmDependsFortranParser.y" +#line 229 "cmFortranParser.y" { - cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner); - cmDependsFortranParser_RuleIfndef(parser, (yyvsp[(2) - (4)].string)); + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleIfndef(parser, (yyvsp[(2) - (4)].string)); free((yyvsp[(2) - (4)].string)); } break; @@ -1787,47 +1787,47 @@ yyreduce: case 18: /* Line 1806 of yacc.c */ -#line 235 "cmDependsFortranParser.y" +#line 235 "cmFortranParser.y" { - cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner); - cmDependsFortranParser_RuleIf(parser); + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleIf(parser); } break; case 19: /* Line 1806 of yacc.c */ -#line 240 "cmDependsFortranParser.y" +#line 240 "cmFortranParser.y" { - cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner); - cmDependsFortranParser_RuleElif(parser); + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleElif(parser); } break; case 20: /* Line 1806 of yacc.c */ -#line 245 "cmDependsFortranParser.y" +#line 245 "cmFortranParser.y" { - cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner); - cmDependsFortranParser_RuleElse(parser); + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleElse(parser); } break; case 21: /* Line 1806 of yacc.c */ -#line 250 "cmDependsFortranParser.y" +#line 250 "cmFortranParser.y" { - cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner); - cmDependsFortranParser_RuleEndif(parser); + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleEndif(parser); } break; case 22: /* Line 1806 of yacc.c */ -#line 255 "cmDependsFortranParser.y" +#line 255 "cmFortranParser.y" { free((yyvsp[(1) - (4)].string)); } @@ -1836,21 +1836,21 @@ yyreduce: case 47: /* Line 1806 of yacc.c */ -#line 277 "cmDependsFortranParser.y" +#line 277 "cmFortranParser.y" { free ((yyvsp[(1) - (1)].string)); } break; case 48: /* Line 1806 of yacc.c */ -#line 278 "cmDependsFortranParser.y" +#line 278 "cmFortranParser.y" { free ((yyvsp[(1) - (1)].string)); } break; /* Line 1806 of yacc.c */ -#line 1860 "cmDependsFortranParser.cxx" +#line 1860 "cmFortranParser.cxx" default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -2083,6 +2083,6 @@ yyreturn: /* Line 2067 of yacc.c */ -#line 286 "cmDependsFortranParser.y" +#line 286 "cmFortranParser.y" /* End of grammar */ diff --git a/Source/cmFortranParser.h b/Source/cmFortranParser.h new file mode 100644 index 000000000..4c28fd0a3 --- /dev/null +++ b/Source/cmFortranParser.h @@ -0,0 +1,96 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2009 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#ifndef cmFortranParser_h +#define cmFortranParser_h + +#include /* size_t */ + +/* Forward declare parser object type. */ +typedef struct cmFortranParser_s cmFortranParser; + +/* Functions to enter/exit #include'd files in order. */ +bool cmFortranParser_FilePush(cmFortranParser* parser, + const char* fname); +bool cmFortranParser_FilePop(cmFortranParser* parser); + +/* Callbacks for lexer. */ +int cmFortranParser_Input(cmFortranParser* parser, + char* buffer, size_t bufferSize); + + +void cmFortranParser_StringStart(cmFortranParser* parser); +const char* cmFortranParser_StringEnd(cmFortranParser* parser); +void cmFortranParser_StringAppend(cmFortranParser* parser, + char c); + +void cmFortranParser_SetInInterface(cmFortranParser* parser, + bool is_in); +bool cmFortranParser_GetInInterface(cmFortranParser* parser); + + +void cmFortranParser_SetInPPFalseBranch(cmFortranParser* parser, + bool is_in); +bool cmFortranParser_GetInPPFalseBranch(cmFortranParser* parser); + + +void cmFortranParser_SetOldStartcond(cmFortranParser* parser, + int arg); +int cmFortranParser_GetOldStartcond(cmFortranParser* parser); + +/* Callbacks for parser. */ +void cmFortranParser_Error(cmFortranParser* parser, + const char* message); +void cmFortranParser_RuleUse(cmFortranParser* parser, + const char* name); +void cmFortranParser_RuleInclude(cmFortranParser* parser, + const char* name); +void cmFortranParser_RuleModule(cmFortranParser* parser, + const char* name); +void cmFortranParser_RuleDefine(cmFortranParser* parser, + const char* name); +void cmFortranParser_RuleUndef(cmFortranParser* parser, + const char* name); +void cmFortranParser_RuleIfdef(cmFortranParser* parser, + const char* name); +void cmFortranParser_RuleIfndef(cmFortranParser* parser, + const char* name); +void cmFortranParser_RuleIf(cmFortranParser* parser); +void cmFortranParser_RuleElif(cmFortranParser* parser); +void cmFortranParser_RuleElse(cmFortranParser* parser); +void cmFortranParser_RuleEndif(cmFortranParser* parser); + +/* Define the parser stack element type. */ +typedef union cmFortran_yystype_u cmFortran_yystype; +union cmFortran_yystype_u +{ + char* string; +}; + +/* Setup the proper yylex interface. */ +#define YY_EXTRA_TYPE cmFortranParser* +#define YY_DECL \ +int cmFortran_yylex(YYSTYPE* yylvalp, yyscan_t yyscanner) +#define YYSTYPE cmFortran_yystype +#define YYSTYPE_IS_DECLARED 1 +#if !defined(cmFortranLexer_cxx) +# include "cmFortranLexer.h" +#endif +#if !defined(cmFortranLexer_cxx) +#if !defined(cmFortranParser_cxx) +# undef YY_EXTRA_TYPE +# undef YY_DECL +# undef YYSTYPE +# undef YYSTYPE_IS_DECLARED +#endif +#endif + +#endif diff --git a/Source/cmDependsFortranParser.y b/Source/cmFortranParser.y similarity index 56% rename from Source/cmDependsFortranParser.y rename to Source/cmFortranParser.y index a987c13bc..31c268d22 100644 --- a/Source/cmDependsFortranParser.y +++ b/Source/cmFortranParser.y @@ -26,21 +26,21 @@ This file must be translated to C and modified to build everywhere. Run bison like this: - bison --yacc --name-prefix=cmDependsFortran_yy - --defines=cmDependsFortranParserTokens.h - -ocmDependsFortranParser.cxx - cmDependsFortranParser.y + bison --yacc --name-prefix=cmFortran_yy + --defines=cmFortranParserTokens.h + -ocmFortranParser.cxx + cmFortranParser.y -Modify cmDependsFortranParser.cxx: +Modify cmFortranParser.cxx: - remove TABs - remove use of the 'register' storage class specifier - Remove the yyerrorlab block in range ["goto yyerrlab1", "yyerrlab1:"] */ /*-------------------------------------------------------------------------*/ -#define cmDependsFortranParser_cxx -#include "cmDependsFortranParser.h" /* Interface to parser object. */ -#include "cmDependsFortranParserTokens.h" /* Need YYSTYPE for YY_DECL. */ +#define cmFortranParser_cxx +#include "cmFortranParser.h" /* Interface to parser object. */ +#include "cmFortranParserTokens.h" /* Need YYSTYPE for YY_DECL. */ #include @@ -48,20 +48,20 @@ Modify cmDependsFortranParser.cxx: #define YYPARSE_PARAM yyscanner #define YYLEX_PARAM yyscanner #define YYERROR_VERBOSE 1 -#define cmDependsFortran_yyerror(x) \ - cmDependsFortranError(yyscanner, x) +#define cmFortran_yyerror(x) \ + cmFortranError(yyscanner, x) /* Forward declare the lexer entry point. */ YY_DECL; /* Helper function to forward error callback. */ -static void cmDependsFortranError(yyscan_t yyscanner, const char* message) +static void cmFortranError(yyscan_t yyscanner, const char* message) { - cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner); - cmDependsFortranParser_Error(parser, message); + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); + cmFortranParser_Error(parser, message); } -static bool cmDependsFortranParserIsKeyword(const char* word, +static bool cmFortranParserIsKeyword(const char* word, const char* keyword) { return cmsysString_strcasecmp(word, keyword) == 0; @@ -115,63 +115,63 @@ assignment_stmt: WORD ASSIGNMENT_OP other EOSTMT /* Ignore */ keyword_stmt: WORD EOSTMT { - if (cmDependsFortranParserIsKeyword($1, "interface")) + if (cmFortranParserIsKeyword($1, "interface")) { - cmDependsFortranParser* parser = - cmDependsFortran_yyget_extra(yyscanner); - cmDependsFortranParser_SetInInterface(parser, true); + cmFortranParser* parser = + cmFortran_yyget_extra(yyscanner); + cmFortranParser_SetInInterface(parser, true); } free($1); } | WORD WORD other EOSTMT { - if (cmDependsFortranParserIsKeyword($1, "use")) + if (cmFortranParserIsKeyword($1, "use")) { - cmDependsFortranParser* parser = - cmDependsFortran_yyget_extra(yyscanner); - cmDependsFortranParser_RuleUse(parser, $2); + cmFortranParser* parser = + cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleUse(parser, $2); } - else if (cmDependsFortranParserIsKeyword($1, "module")) + else if (cmFortranParserIsKeyword($1, "module")) { - cmDependsFortranParser* parser = - cmDependsFortran_yyget_extra(yyscanner); - cmDependsFortranParser_RuleModule(parser, $2); + cmFortranParser* parser = + cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleModule(parser, $2); } - else if (cmDependsFortranParserIsKeyword($1, "interface")) + else if (cmFortranParserIsKeyword($1, "interface")) { - cmDependsFortranParser* parser = - cmDependsFortran_yyget_extra(yyscanner); - cmDependsFortranParser_SetInInterface(parser, true); + cmFortranParser* parser = + cmFortran_yyget_extra(yyscanner); + cmFortranParser_SetInInterface(parser, true); } - else if (cmDependsFortranParserIsKeyword($2, "interface") && - cmDependsFortranParserIsKeyword($1, "end")) + else if (cmFortranParserIsKeyword($2, "interface") && + cmFortranParserIsKeyword($1, "end")) { - cmDependsFortranParser* parser = - cmDependsFortran_yyget_extra(yyscanner); - cmDependsFortranParser_SetInInterface(parser, false); + cmFortranParser* parser = + cmFortran_yyget_extra(yyscanner); + cmFortranParser_SetInInterface(parser, false); } free($1); free($2); } | WORD DCOLON WORD other EOSTMT { - if (cmDependsFortranParserIsKeyword($1, "use")) + if (cmFortranParserIsKeyword($1, "use")) { - cmDependsFortranParser* parser = - cmDependsFortran_yyget_extra(yyscanner); - cmDependsFortranParser_RuleUse(parser, $3); + cmFortranParser* parser = + cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleUse(parser, $3); } free($1); free($3); } | WORD COMMA WORD DCOLON WORD other EOSTMT { - if (cmDependsFortranParserIsKeyword($1, "use") && - cmDependsFortranParserIsKeyword($3, "non_intrinsic") ) + if (cmFortranParserIsKeyword($1, "use") && + cmFortranParserIsKeyword($3, "non_intrinsic") ) { - cmDependsFortranParser* parser = - cmDependsFortran_yyget_extra(yyscanner); - cmDependsFortranParser_RuleUse(parser, $5); + cmFortranParser* parser = + cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleUse(parser, $5); } free($1); free($3); @@ -179,72 +179,72 @@ keyword_stmt: } | WORD STRING other EOSTMT /* Ignore */ { - if (cmDependsFortranParserIsKeyword($1, "include")) + if (cmFortranParserIsKeyword($1, "include")) { - cmDependsFortranParser* parser = - cmDependsFortran_yyget_extra(yyscanner); - cmDependsFortranParser_RuleInclude(parser, $2); + cmFortranParser* parser = + cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleInclude(parser, $2); } free($1); free($2); } | CPP_INCLUDE_ANGLE other EOSTMT { - cmDependsFortranParser* parser = - cmDependsFortran_yyget_extra(yyscanner); - cmDependsFortranParser_RuleInclude(parser, $1); + cmFortranParser* parser = + cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleInclude(parser, $1); free($1); } | include STRING other EOSTMT { - cmDependsFortranParser* parser = - cmDependsFortran_yyget_extra(yyscanner); - cmDependsFortranParser_RuleInclude(parser, $2); + cmFortranParser* parser = + cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleInclude(parser, $2); free($2); } | define WORD other EOSTMT { - cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner); - cmDependsFortranParser_RuleDefine(parser, $2); + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleDefine(parser, $2); free($2); } | undef WORD other EOSTMT { - cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner); - cmDependsFortranParser_RuleUndef(parser, $2); + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleUndef(parser, $2); free($2); } | ifdef WORD other EOSTMT { - cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner); - cmDependsFortranParser_RuleIfdef(parser, $2); + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleIfdef(parser, $2); free($2); } | ifndef WORD other EOSTMT { - cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner); - cmDependsFortranParser_RuleIfndef(parser, $2); + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleIfndef(parser, $2); free($2); } | if other EOSTMT { - cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner); - cmDependsFortranParser_RuleIf(parser); + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleIf(parser); } | elif other EOSTMT { - cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner); - cmDependsFortranParser_RuleElif(parser); + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleElif(parser); } | else other EOSTMT { - cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner); - cmDependsFortranParser_RuleElse(parser); + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleElse(parser); } | endif other EOSTMT { - cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner); - cmDependsFortranParser_RuleEndif(parser); + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleEndif(parser); } | WORD GARBAGE other EOSTMT /* Ignore */ { diff --git a/Source/cmDependsFortranParserTokens.h b/Source/cmFortranParserTokens.h similarity index 97% rename from Source/cmDependsFortranParserTokens.h rename to Source/cmFortranParserTokens.h index 941eda09c..cfbdd1ea5 100644 --- a/Source/cmDependsFortranParserTokens.h +++ b/Source/cmFortranParserTokens.h @@ -107,14 +107,14 @@ typedef union YYSTYPE { /* Line 2068 of yacc.c */ -#line 89 "cmDependsFortranParser.y" +#line 89 "cmFortranParser.y" char* string; /* Line 2068 of yacc.c */ -#line 118 "cmDependsFortranParserTokens.h" +#line 118 "cmFortranParserTokens.h" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ From 295480b923338de82bdaa965aed9960d582a1750 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 22 Jul 2015 13:41:32 -0400 Subject: [PATCH 0414/1048] cmDependsFortran: Move FindIncludeFile method into parser class This drops the only awareness of cmDependsFortran that cmFortranParser needed. --- Source/cmDependsFortran.cxx | 31 +++++++++++++++++-------------- Source/cmDependsFortran.h | 6 ------ 2 files changed, 17 insertions(+), 20 deletions(-) diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx index cbc8c8ba3..ea45e3c09 100644 --- a/Source/cmDependsFortran.cxx +++ b/Source/cmDependsFortran.cxx @@ -64,13 +64,16 @@ struct cmFortranFile struct cmFortranParser_s { - cmFortranParser_s(cmDependsFortran* self, - std::set& ppDefines, - cmFortranSourceInfo& info); + cmFortranParser_s(std::vector const& includes, + std::set& ppDefines, + cmFortranSourceInfo& info); ~cmFortranParser_s(); - // Pointer back to the main class. - cmDependsFortran* Self; + bool FindIncludeFile(const char* dir, const char* includeName, + std::string& fileName); + + // The include file search path. + std::vector IncludePath; // Lexical scanner instance. yyscan_t Scanner; @@ -201,7 +204,7 @@ bool cmDependsFortran::WriteDependencies( // Create the parser object. The constructor takes ppMacro and info per // reference, so we may look into the resulting objects later. - cmFortranParser parser(this, ppDefines, info); + cmFortranParser parser(this->IncludePath, ppDefines, info); // Push on the starting file. cmFortranParser_FilePush(&parser, src.c_str()); @@ -885,9 +888,9 @@ bool cmDependsFortran::ModulesDiffer(const char* modFile, } //---------------------------------------------------------------------------- -bool cmDependsFortran::FindIncludeFile(const char* dir, - const char* includeName, - std::string& fileName) +bool cmFortranParser_s::FindIncludeFile(const char* dir, + const char* includeName, + std::string& fileName) { // If the file is a full path, include it directly. if(cmSystemTools::FileIsFullPath(includeName)) @@ -927,10 +930,10 @@ bool cmDependsFortran::FindIncludeFile(const char* dir, //---------------------------------------------------------------------------- cmFortranParser_s -::cmFortranParser_s(cmDependsFortran* self, - std::set& ppDefines, - cmFortranSourceInfo& info): - Self(self), PPDefinitions(ppDefines), Info(info) +::cmFortranParser_s(std::vector const& includes, + std::set& ppDefines, + cmFortranSourceInfo& info): + IncludePath(includes), PPDefinitions(ppDefines), Info(info) { this->InInterface = 0; this->InPPFalseBranch = 0; @@ -1100,7 +1103,7 @@ void cmFortranParser_RuleInclude(cmFortranParser* parser, // problem because either the source will not compile or the user // does not care about depending on this included source. std::string fullName; - if(parser->Self->FindIncludeFile(dir.c_str(), name, fullName)) + if(parser->FindIncludeFile(dir.c_str(), name, fullName)) { // Found the included file. Save it in the set of included files. parser->Info.Includes.insert(fullName); diff --git a/Source/cmDependsFortran.h b/Source/cmDependsFortran.h index 9f280886a..db2df1967 100644 --- a/Source/cmDependsFortran.h +++ b/Source/cmDependsFortran.h @@ -46,12 +46,6 @@ public: static bool ModulesDiffer(const char* modFile, const char* stampFile, const char* compilerId); - /** Method to find an included file in the include path. Fortran - always searches the directory containing the including source - first. */ - bool FindIncludeFile(const char* dir, const char* includeName, - std::string& fileName); - protected: // Finalize the dependency information for the target. virtual bool Finalize(std::ostream& makeDepends, From fd1944580266c3c84234b28e2102fc787ed5c00d Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 22 Jul 2015 13:45:28 -0400 Subject: [PATCH 0415/1048] cmDependsFortran: Simplify storage of preprocessor definitions Collect the original preprocessor definitions in a std::set<> so that it can be copied directly by cmFortranParser's constructor instead of making a copy on the stack. --- Source/cmDependsFortran.cxx | 20 ++++++++------------ Source/cmDependsFortran.h | 2 +- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx index ea45e3c09..a422a989f 100644 --- a/Source/cmDependsFortran.cxx +++ b/Source/cmDependsFortran.cxx @@ -65,7 +65,7 @@ struct cmFortranFile struct cmFortranParser_s { cmFortranParser_s(std::vector const& includes, - std::set& ppDefines, + std::set const& defines, cmFortranSourceInfo& info); ~cmFortranParser_s(); @@ -129,7 +129,7 @@ public: //---------------------------------------------------------------------------- cmDependsFortran::cmDependsFortran(): - PPDefinitions(0), Internal(0) + Internal(0) { } @@ -162,7 +162,7 @@ cmDependsFortran { def = it->substr(0, assignment); } - this->PPDefinitions.push_back(def); + this->PPDefinitions.insert(def); } } @@ -198,13 +198,9 @@ bool cmDependsFortran::WriteDependencies( cmFortranSourceInfo& info = this->Internal->CreateObjectInfo(obj.c_str(), src.c_str()); - // Make a copy of the macros defined via ADD_DEFINITIONS - std::set ppDefines(this->PPDefinitions.begin(), - this->PPDefinitions.end()); - - // Create the parser object. The constructor takes ppMacro and info per - // reference, so we may look into the resulting objects later. - cmFortranParser parser(this->IncludePath, ppDefines, info); + // Create the parser object. The constructor takes info by reference, + // so we may look into the resulting objects later. + cmFortranParser parser(this->IncludePath, this->PPDefinitions, info); // Push on the starting file. cmFortranParser_FilePush(&parser, src.c_str()); @@ -931,9 +927,9 @@ bool cmFortranParser_s::FindIncludeFile(const char* dir, //---------------------------------------------------------------------------- cmFortranParser_s ::cmFortranParser_s(std::vector const& includes, - std::set& ppDefines, + std::set const& defines, cmFortranSourceInfo& info): - IncludePath(includes), PPDefinitions(ppDefines), Info(info) + IncludePath(includes), PPDefinitions(defines), Info(info) { this->InInterface = 0; this->InPPFalseBranch = 0; diff --git a/Source/cmDependsFortran.h b/Source/cmDependsFortran.h index db2df1967..d6ec7d7eb 100644 --- a/Source/cmDependsFortran.h +++ b/Source/cmDependsFortran.h @@ -73,7 +73,7 @@ protected: // The source file from which to start scanning. std::string SourceFile; - std::vector PPDefinitions; + std::set PPDefinitions; // Internal implementation details. cmDependsFortranInternals* Internal; From eebe732bb61bb69f50edae9b7fb171266b216752 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 22 Jul 2015 14:03:00 -0400 Subject: [PATCH 0416/1048] cmFortranParser: Factor out of cmDependsFortran Move the main parser class and method implementations out of cmDependsFortran.cxx and into separate source files. --- Source/CMakeLists.txt | 1 + Source/cmDependsFortran.cxx | 465 --------------------------------- Source/cmFortranParser.h | 79 ++++++ Source/cmFortranParserImpl.cxx | 408 +++++++++++++++++++++++++++++ 4 files changed, 488 insertions(+), 465 deletions(-) create mode 100644 Source/cmFortranParserImpl.cxx diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 7e393863f..92fee8aba 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -244,6 +244,7 @@ set(SRCS cmFortranLexer.h cmFortranParser.cxx cmFortranParser.h + cmFortranParserImpl.cxx cmGeneratedFileStream.cxx cmGeneratorExpressionContext.cxx cmGeneratorExpressionContext.h diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx index a422a989f..13c6409d9 100644 --- a/Source/cmDependsFortran.cxx +++ b/Source/cmDependsFortran.cxx @@ -19,83 +19,11 @@ #include "cmFortranParser.h" /* Interface to parser object. */ #include #include -#include // TODO: Test compiler for the case of the mod file. Some always // use lower case and some always use upper case. I do not know if any // use the case from the source code. -//---------------------------------------------------------------------------- -// Information about a single source file. -class cmFortranSourceInfo -{ -public: - // The name of the source file. - std::string Source; - - // Set of provided and required modules. - std::set Provides; - std::set Requires; - - // Set of files included in the translation unit. - std::set Includes; -}; - -//---------------------------------------------------------------------------- -// Parser methods not included in generated interface. - -// Get the current buffer processed by the lexer. -YY_BUFFER_STATE cmFortranLexer_GetCurrentBuffer(yyscan_t yyscanner); - -// The parser entry point. -int cmFortran_yyparse(yyscan_t); - -//---------------------------------------------------------------------------- -// Define parser object internal structure. -struct cmFortranFile -{ - cmFortranFile(FILE* file, YY_BUFFER_STATE buffer, - const std::string& dir): - File(file), Buffer(buffer), Directory(dir) {} - FILE* File; - YY_BUFFER_STATE Buffer; - std::string Directory; -}; - -struct cmFortranParser_s -{ - cmFortranParser_s(std::vector const& includes, - std::set const& defines, - cmFortranSourceInfo& info); - ~cmFortranParser_s(); - - bool FindIncludeFile(const char* dir, const char* includeName, - std::string& fileName); - - // The include file search path. - std::vector IncludePath; - - // Lexical scanner instance. - yyscan_t Scanner; - - // Stack of open files in the translation unit. - std::stack FileStack; - - // Buffer for string literals. - std::string TokenString; - - // Flag for whether lexer is reading from inside an interface. - bool InInterface; - - int OldStartcond; - std::set PPDefinitions; - size_t InPPFalseBranch; - std::stack SkipToEnd; - - // Information about the parsed source. - cmFortranSourceInfo& Info; -}; - //---------------------------------------------------------------------------- class cmDependsFortranInternals { @@ -882,396 +810,3 @@ bool cmDependsFortran::ModulesDiffer(const char* modFile, // The modules are different. return true; } - -//---------------------------------------------------------------------------- -bool cmFortranParser_s::FindIncludeFile(const char* dir, - const char* includeName, - std::string& fileName) -{ - // If the file is a full path, include it directly. - if(cmSystemTools::FileIsFullPath(includeName)) - { - fileName = includeName; - return cmSystemTools::FileExists(fileName.c_str(), true); - } - else - { - // Check for the file in the directory containing the including - // file. - std::string fullName = dir; - fullName += "/"; - fullName += includeName; - if(cmSystemTools::FileExists(fullName.c_str(), true)) - { - fileName = fullName; - return true; - } - - // Search the include path for the file. - for(std::vector::const_iterator i = - this->IncludePath.begin(); i != this->IncludePath.end(); ++i) - { - fullName = *i; - fullName += "/"; - fullName += includeName; - if(cmSystemTools::FileExists(fullName.c_str(), true)) - { - fileName = fullName; - return true; - } - } - } - return false; -} - -//---------------------------------------------------------------------------- -cmFortranParser_s -::cmFortranParser_s(std::vector const& includes, - std::set const& defines, - cmFortranSourceInfo& info): - IncludePath(includes), PPDefinitions(defines), Info(info) -{ - this->InInterface = 0; - this->InPPFalseBranch = 0; - - // Initialize the lexical scanner. - cmFortran_yylex_init(&this->Scanner); - cmFortran_yyset_extra(this, this->Scanner); - - // Create a dummy buffer that is never read but is the fallback - // buffer when the last file is popped off the stack. - YY_BUFFER_STATE buffer = - cmFortran_yy_create_buffer(0, 4, this->Scanner); - cmFortran_yy_switch_to_buffer(buffer, this->Scanner); -} - -//---------------------------------------------------------------------------- -cmFortranParser_s::~cmFortranParser_s() -{ - cmFortran_yylex_destroy(this->Scanner); -} - -//---------------------------------------------------------------------------- -bool cmFortranParser_FilePush(cmFortranParser* parser, - const char* fname) -{ - // Open the new file and push it onto the stack. Save the old - // buffer with it on the stack. - if(FILE* file = cmsys::SystemTools::Fopen(fname, "rb")) - { - YY_BUFFER_STATE current = - cmFortranLexer_GetCurrentBuffer(parser->Scanner); - std::string dir = cmSystemTools::GetParentDirectory(fname); - cmFortranFile f(file, current, dir); - YY_BUFFER_STATE buffer = - cmFortran_yy_create_buffer(0, 16384, parser->Scanner); - cmFortran_yy_switch_to_buffer(buffer, parser->Scanner); - parser->FileStack.push(f); - return 1; - } - else - { - return 0; - } -} - -//---------------------------------------------------------------------------- -bool cmFortranParser_FilePop(cmFortranParser* parser) -{ - // Pop one file off the stack and close it. Switch the lexer back - // to the next one on the stack. - if(parser->FileStack.empty()) - { - return 0; - } - else - { - cmFortranFile f = parser->FileStack.top(); parser->FileStack.pop(); - fclose(f.File); - YY_BUFFER_STATE current = - cmFortranLexer_GetCurrentBuffer(parser->Scanner); - cmFortran_yy_delete_buffer(current, parser->Scanner); - cmFortran_yy_switch_to_buffer(f.Buffer, parser->Scanner); - return 1; - } -} - -//---------------------------------------------------------------------------- -int cmFortranParser_Input(cmFortranParser* parser, - char* buffer, size_t bufferSize) -{ - // Read from the file on top of the stack. If the stack is empty, - // the end of the translation unit has been reached. - if(!parser->FileStack.empty()) - { - FILE* file = parser->FileStack.top().File; - return (int)fread(buffer, 1, bufferSize, file); - } - return 0; -} - -//---------------------------------------------------------------------------- -void cmFortranParser_StringStart(cmFortranParser* parser) -{ - parser->TokenString = ""; -} - -//---------------------------------------------------------------------------- -const char* cmFortranParser_StringEnd(cmFortranParser* parser) -{ - return parser->TokenString.c_str(); -} - -//---------------------------------------------------------------------------- -void cmFortranParser_StringAppend(cmFortranParser* parser, - char c) -{ - parser->TokenString += c; -} - -//---------------------------------------------------------------------------- -void cmFortranParser_SetInInterface(cmFortranParser* parser, - bool in) -{ - if(parser->InPPFalseBranch) - { - return; - } - - parser->InInterface = in; -} - -//---------------------------------------------------------------------------- -bool cmFortranParser_GetInInterface(cmFortranParser* parser) -{ - return parser->InInterface; -} - -//---------------------------------------------------------------------------- -void cmFortranParser_SetOldStartcond(cmFortranParser* parser, - int arg) -{ - parser->OldStartcond = arg; -} - -//---------------------------------------------------------------------------- -int cmFortranParser_GetOldStartcond(cmFortranParser* parser) -{ - return parser->OldStartcond; -} - -//---------------------------------------------------------------------------- -void cmFortranParser_Error(cmFortranParser*, const char*) -{ - // If there is a parser error just ignore it. The source will not - // compile and the user will edit it. Then dependencies will have - // to be regenerated anyway. -} - -//---------------------------------------------------------------------------- -void cmFortranParser_RuleUse(cmFortranParser* parser, - const char* name) -{ - if(!parser->InPPFalseBranch) - { - parser->Info.Requires.insert(cmSystemTools::LowerCase(name) ); - } -} - -//---------------------------------------------------------------------------- -void cmFortranParser_RuleInclude(cmFortranParser* parser, - const char* name) -{ - if(parser->InPPFalseBranch) - { - return; - } - - // If processing an include statement there must be an open file. - assert(!parser->FileStack.empty()); - - // Get the directory containing the source in which the include - // statement appears. This is always the first search location for - // Fortran include files. - std::string dir = parser->FileStack.top().Directory; - - // Find the included file. If it cannot be found just ignore the - // problem because either the source will not compile or the user - // does not care about depending on this included source. - std::string fullName; - if(parser->FindIncludeFile(dir.c_str(), name, fullName)) - { - // Found the included file. Save it in the set of included files. - parser->Info.Includes.insert(fullName); - - // Parse it immediately to translate the source inline. - cmFortranParser_FilePush(parser, fullName.c_str()); - } -} - -//---------------------------------------------------------------------------- -void cmFortranParser_RuleModule(cmFortranParser* parser, - const char* name) -{ - if(!parser->InPPFalseBranch && !parser->InInterface) - { - parser->Info.Provides.insert(cmSystemTools::LowerCase(name)); - } -} - -//---------------------------------------------------------------------------- -void cmFortranParser_RuleDefine(cmFortranParser* parser, - const char* macro) -{ - if(!parser->InPPFalseBranch) - { - parser->PPDefinitions.insert(macro); - } -} - -//---------------------------------------------------------------------------- -void cmFortranParser_RuleUndef(cmFortranParser* parser, - const char* macro) -{ - if(!parser->InPPFalseBranch) - { - std::set::iterator match; - match = parser->PPDefinitions.find(macro); - if(match != parser->PPDefinitions.end()) - { - parser->PPDefinitions.erase(match); - } - } -} - -//---------------------------------------------------------------------------- -void cmFortranParser_RuleIfdef(cmFortranParser* parser, - const char* macro) -{ - // A new PP branch has been opened - parser->SkipToEnd.push(false); - - if (parser->InPPFalseBranch) - { - parser->InPPFalseBranch++; - } - else if(parser->PPDefinitions.find(macro) == parser->PPDefinitions.end()) - { - parser->InPPFalseBranch=1; - } - else - { - parser->SkipToEnd.top() = true; - } -} - -//---------------------------------------------------------------------------- -void cmFortranParser_RuleIfndef(cmFortranParser* parser, - const char* macro) -{ - // A new PP branch has been opened - parser->SkipToEnd.push(false); - - if (parser->InPPFalseBranch) - { - parser->InPPFalseBranch++; - } - else if(parser->PPDefinitions.find(macro) != parser->PPDefinitions.end()) - { - parser->InPPFalseBranch = 1; - } - else - { - // ignore other branches - parser->SkipToEnd.top() = true; - } -} - -//---------------------------------------------------------------------------- -void cmFortranParser_RuleIf(cmFortranParser* parser) -{ - /* Note: The current parser is _not_ able to get statements like - * #if 0 - * #if 1 - * #if MYSMBOL - * #if defined(MYSYMBOL) - * #if defined(MYSYMBOL) && ... - * right. The same for #elif. Thus in - * #if SYMBOL_1 - * .. - * #elif SYMBOL_2 - * ... - * ... - * #elif SYMBOL_N - * .. - * #else - * .. - * #endif - * _all_ N+1 branches are considered. If you got something like this - * #if defined(MYSYMBOL) - * #if !defined(MYSYMBOL) - * use - * #ifdef MYSYMBOL - * #ifndef MYSYMBOL - * instead. - */ - - // A new PP branch has been opened - // Never skip! See note above. - parser->SkipToEnd.push(false); -} - -//---------------------------------------------------------------------------- -void cmFortranParser_RuleElif(cmFortranParser* parser) -{ - /* Note: There are parser limitations. See the note at - * cmFortranParser_RuleIf(..) - */ - - // Always taken unless an #ifdef or #ifndef-branch has been taken - // already. If the second condition isn't meet already - // (parser->InPPFalseBranch == 0) correct it. - if(!parser->SkipToEnd.empty() && - parser->SkipToEnd.top() && !parser->InPPFalseBranch) - { - parser->InPPFalseBranch = 1; - } -} - -//---------------------------------------------------------------------------- -void cmFortranParser_RuleElse(cmFortranParser* parser) -{ - // if the parent branch is false do nothing! - if(parser->InPPFalseBranch > 1) - { - return; - } - - // parser->InPPFalseBranch is either 0 or 1. We change it depending on - // parser->SkipToEnd.top() - if(!parser->SkipToEnd.empty() && - parser->SkipToEnd.top()) - { - parser->InPPFalseBranch = 1; - } - else - { - parser->InPPFalseBranch = 0; - } -} - -//---------------------------------------------------------------------------- -void cmFortranParser_RuleEndif(cmFortranParser* parser) -{ - if(!parser->SkipToEnd.empty()) - { - parser->SkipToEnd.pop(); - } - - // #endif doesn't know if there was a "#else" in before, so it - // always decreases InPPFalseBranch - if(parser->InPPFalseBranch) - { - parser->InPPFalseBranch--; - } -} diff --git a/Source/cmFortranParser.h b/Source/cmFortranParser.h index 4c28fd0a3..156c38a74 100644 --- a/Source/cmFortranParser.h +++ b/Source/cmFortranParser.h @@ -12,6 +12,10 @@ #ifndef cmFortranParser_h #define cmFortranParser_h +#if !defined(cmFortranLexer_cxx) && !defined(cmFortranParser_cxx) +# include "cmStandardIncludes.h" +#endif + #include /* size_t */ /* Forward declare parser object type. */ @@ -93,4 +97,79 @@ int cmFortran_yylex(YYSTYPE* yylvalp, yyscan_t yyscanner) #endif #endif +#if !defined(cmFortranLexer_cxx) && !defined(cmFortranParser_cxx) +#include + +//---------------------------------------------------------------------------- +// Information about a single source file. +class cmFortranSourceInfo +{ +public: + // The name of the source file. + std::string Source; + + // Set of provided and required modules. + std::set Provides; + std::set Requires; + + // Set of files included in the translation unit. + std::set Includes; +}; + +//---------------------------------------------------------------------------- +// Parser methods not included in generated interface. + +// Get the current buffer processed by the lexer. +YY_BUFFER_STATE cmFortranLexer_GetCurrentBuffer(yyscan_t yyscanner); + +// The parser entry point. +int cmFortran_yyparse(yyscan_t); + +//---------------------------------------------------------------------------- +// Define parser object internal structure. +struct cmFortranFile +{ + cmFortranFile(FILE* file, YY_BUFFER_STATE buffer, + const std::string& dir): + File(file), Buffer(buffer), Directory(dir) {} + FILE* File; + YY_BUFFER_STATE Buffer; + std::string Directory; +}; + +struct cmFortranParser_s +{ + cmFortranParser_s(std::vector const& includes, + std::set const& defines, + cmFortranSourceInfo& info); + ~cmFortranParser_s(); + + bool FindIncludeFile(const char* dir, const char* includeName, + std::string& fileName); + + // The include file search path. + std::vector IncludePath; + + // Lexical scanner instance. + yyscan_t Scanner; + + // Stack of open files in the translation unit. + std::stack FileStack; + + // Buffer for string literals. + std::string TokenString; + + // Flag for whether lexer is reading from inside an interface. + bool InInterface; + + int OldStartcond; + std::set PPDefinitions; + size_t InPPFalseBranch; + std::stack SkipToEnd; + + // Information about the parsed source. + cmFortranSourceInfo& Info; +}; +#endif + #endif diff --git a/Source/cmFortranParserImpl.cxx b/Source/cmFortranParserImpl.cxx new file mode 100644 index 000000000..a09c54598 --- /dev/null +++ b/Source/cmFortranParserImpl.cxx @@ -0,0 +1,408 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2015 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#include "cmFortranParser.h" + +#include "cmSystemTools.h" +#include + +//---------------------------------------------------------------------------- +bool cmFortranParser_s::FindIncludeFile(const char* dir, + const char* includeName, + std::string& fileName) +{ + // If the file is a full path, include it directly. + if(cmSystemTools::FileIsFullPath(includeName)) + { + fileName = includeName; + return cmSystemTools::FileExists(fileName.c_str(), true); + } + else + { + // Check for the file in the directory containing the including + // file. + std::string fullName = dir; + fullName += "/"; + fullName += includeName; + if(cmSystemTools::FileExists(fullName.c_str(), true)) + { + fileName = fullName; + return true; + } + + // Search the include path for the file. + for(std::vector::const_iterator i = + this->IncludePath.begin(); i != this->IncludePath.end(); ++i) + { + fullName = *i; + fullName += "/"; + fullName += includeName; + if(cmSystemTools::FileExists(fullName.c_str(), true)) + { + fileName = fullName; + return true; + } + } + } + return false; +} + +//---------------------------------------------------------------------------- +cmFortranParser_s +::cmFortranParser_s(std::vector const& includes, + std::set const& defines, + cmFortranSourceInfo& info): + IncludePath(includes), PPDefinitions(defines), Info(info) +{ + this->InInterface = 0; + this->InPPFalseBranch = 0; + + // Initialize the lexical scanner. + cmFortran_yylex_init(&this->Scanner); + cmFortran_yyset_extra(this, this->Scanner); + + // Create a dummy buffer that is never read but is the fallback + // buffer when the last file is popped off the stack. + YY_BUFFER_STATE buffer = + cmFortran_yy_create_buffer(0, 4, this->Scanner); + cmFortran_yy_switch_to_buffer(buffer, this->Scanner); +} + +//---------------------------------------------------------------------------- +cmFortranParser_s::~cmFortranParser_s() +{ + cmFortran_yylex_destroy(this->Scanner); +} + +//---------------------------------------------------------------------------- +bool cmFortranParser_FilePush(cmFortranParser* parser, + const char* fname) +{ + // Open the new file and push it onto the stack. Save the old + // buffer with it on the stack. + if(FILE* file = cmsys::SystemTools::Fopen(fname, "rb")) + { + YY_BUFFER_STATE current = + cmFortranLexer_GetCurrentBuffer(parser->Scanner); + std::string dir = cmSystemTools::GetParentDirectory(fname); + cmFortranFile f(file, current, dir); + YY_BUFFER_STATE buffer = + cmFortran_yy_create_buffer(0, 16384, parser->Scanner); + cmFortran_yy_switch_to_buffer(buffer, parser->Scanner); + parser->FileStack.push(f); + return 1; + } + else + { + return 0; + } +} + +//---------------------------------------------------------------------------- +bool cmFortranParser_FilePop(cmFortranParser* parser) +{ + // Pop one file off the stack and close it. Switch the lexer back + // to the next one on the stack. + if(parser->FileStack.empty()) + { + return 0; + } + else + { + cmFortranFile f = parser->FileStack.top(); parser->FileStack.pop(); + fclose(f.File); + YY_BUFFER_STATE current = + cmFortranLexer_GetCurrentBuffer(parser->Scanner); + cmFortran_yy_delete_buffer(current, parser->Scanner); + cmFortran_yy_switch_to_buffer(f.Buffer, parser->Scanner); + return 1; + } +} + +//---------------------------------------------------------------------------- +int cmFortranParser_Input(cmFortranParser* parser, + char* buffer, size_t bufferSize) +{ + // Read from the file on top of the stack. If the stack is empty, + // the end of the translation unit has been reached. + if(!parser->FileStack.empty()) + { + FILE* file = parser->FileStack.top().File; + return (int)fread(buffer, 1, bufferSize, file); + } + return 0; +} + +//---------------------------------------------------------------------------- +void cmFortranParser_StringStart(cmFortranParser* parser) +{ + parser->TokenString = ""; +} + +//---------------------------------------------------------------------------- +const char* cmFortranParser_StringEnd(cmFortranParser* parser) +{ + return parser->TokenString.c_str(); +} + +//---------------------------------------------------------------------------- +void cmFortranParser_StringAppend(cmFortranParser* parser, + char c) +{ + parser->TokenString += c; +} + +//---------------------------------------------------------------------------- +void cmFortranParser_SetInInterface(cmFortranParser* parser, + bool in) +{ + if(parser->InPPFalseBranch) + { + return; + } + + parser->InInterface = in; +} + +//---------------------------------------------------------------------------- +bool cmFortranParser_GetInInterface(cmFortranParser* parser) +{ + return parser->InInterface; +} + +//---------------------------------------------------------------------------- +void cmFortranParser_SetOldStartcond(cmFortranParser* parser, + int arg) +{ + parser->OldStartcond = arg; +} + +//---------------------------------------------------------------------------- +int cmFortranParser_GetOldStartcond(cmFortranParser* parser) +{ + return parser->OldStartcond; +} + +//---------------------------------------------------------------------------- +void cmFortranParser_Error(cmFortranParser*, const char*) +{ + // If there is a parser error just ignore it. The source will not + // compile and the user will edit it. Then dependencies will have + // to be regenerated anyway. +} + +//---------------------------------------------------------------------------- +void cmFortranParser_RuleUse(cmFortranParser* parser, + const char* name) +{ + if(!parser->InPPFalseBranch) + { + parser->Info.Requires.insert(cmSystemTools::LowerCase(name) ); + } +} + +//---------------------------------------------------------------------------- +void cmFortranParser_RuleInclude(cmFortranParser* parser, + const char* name) +{ + if(parser->InPPFalseBranch) + { + return; + } + + // If processing an include statement there must be an open file. + assert(!parser->FileStack.empty()); + + // Get the directory containing the source in which the include + // statement appears. This is always the first search location for + // Fortran include files. + std::string dir = parser->FileStack.top().Directory; + + // Find the included file. If it cannot be found just ignore the + // problem because either the source will not compile or the user + // does not care about depending on this included source. + std::string fullName; + if(parser->FindIncludeFile(dir.c_str(), name, fullName)) + { + // Found the included file. Save it in the set of included files. + parser->Info.Includes.insert(fullName); + + // Parse it immediately to translate the source inline. + cmFortranParser_FilePush(parser, fullName.c_str()); + } +} + +//---------------------------------------------------------------------------- +void cmFortranParser_RuleModule(cmFortranParser* parser, + const char* name) +{ + if(!parser->InPPFalseBranch && !parser->InInterface) + { + parser->Info.Provides.insert(cmSystemTools::LowerCase(name)); + } +} + +//---------------------------------------------------------------------------- +void cmFortranParser_RuleDefine(cmFortranParser* parser, + const char* macro) +{ + if(!parser->InPPFalseBranch) + { + parser->PPDefinitions.insert(macro); + } +} + +//---------------------------------------------------------------------------- +void cmFortranParser_RuleUndef(cmFortranParser* parser, + const char* macro) +{ + if(!parser->InPPFalseBranch) + { + std::set::iterator match; + match = parser->PPDefinitions.find(macro); + if(match != parser->PPDefinitions.end()) + { + parser->PPDefinitions.erase(match); + } + } +} + +//---------------------------------------------------------------------------- +void cmFortranParser_RuleIfdef(cmFortranParser* parser, + const char* macro) +{ + // A new PP branch has been opened + parser->SkipToEnd.push(false); + + if (parser->InPPFalseBranch) + { + parser->InPPFalseBranch++; + } + else if(parser->PPDefinitions.find(macro) == parser->PPDefinitions.end()) + { + parser->InPPFalseBranch=1; + } + else + { + parser->SkipToEnd.top() = true; + } +} + +//---------------------------------------------------------------------------- +void cmFortranParser_RuleIfndef(cmFortranParser* parser, + const char* macro) +{ + // A new PP branch has been opened + parser->SkipToEnd.push(false); + + if (parser->InPPFalseBranch) + { + parser->InPPFalseBranch++; + } + else if(parser->PPDefinitions.find(macro) != parser->PPDefinitions.end()) + { + parser->InPPFalseBranch = 1; + } + else + { + // ignore other branches + parser->SkipToEnd.top() = true; + } +} + +//---------------------------------------------------------------------------- +void cmFortranParser_RuleIf(cmFortranParser* parser) +{ + /* Note: The current parser is _not_ able to get statements like + * #if 0 + * #if 1 + * #if MYSMBOL + * #if defined(MYSYMBOL) + * #if defined(MYSYMBOL) && ... + * right. The same for #elif. Thus in + * #if SYMBOL_1 + * .. + * #elif SYMBOL_2 + * ... + * ... + * #elif SYMBOL_N + * .. + * #else + * .. + * #endif + * _all_ N+1 branches are considered. If you got something like this + * #if defined(MYSYMBOL) + * #if !defined(MYSYMBOL) + * use + * #ifdef MYSYMBOL + * #ifndef MYSYMBOL + * instead. + */ + + // A new PP branch has been opened + // Never skip! See note above. + parser->SkipToEnd.push(false); +} + +//---------------------------------------------------------------------------- +void cmFortranParser_RuleElif(cmFortranParser* parser) +{ + /* Note: There are parser limitations. See the note at + * cmFortranParser_RuleIf(..) + */ + + // Always taken unless an #ifdef or #ifndef-branch has been taken + // already. If the second condition isn't meet already + // (parser->InPPFalseBranch == 0) correct it. + if(!parser->SkipToEnd.empty() && + parser->SkipToEnd.top() && !parser->InPPFalseBranch) + { + parser->InPPFalseBranch = 1; + } +} + +//---------------------------------------------------------------------------- +void cmFortranParser_RuleElse(cmFortranParser* parser) +{ + // if the parent branch is false do nothing! + if(parser->InPPFalseBranch > 1) + { + return; + } + + // parser->InPPFalseBranch is either 0 or 1. We change it depending on + // parser->SkipToEnd.top() + if(!parser->SkipToEnd.empty() && + parser->SkipToEnd.top()) + { + parser->InPPFalseBranch = 1; + } + else + { + parser->InPPFalseBranch = 0; + } +} + +//---------------------------------------------------------------------------- +void cmFortranParser_RuleEndif(cmFortranParser* parser) +{ + if(!parser->SkipToEnd.empty()) + { + parser->SkipToEnd.pop(); + } + + // #endif doesn't know if there was a "#else" in before, so it + // always decreases InPPFalseBranch + if(parser->InPPFalseBranch) + { + parser->InPPFalseBranch--; + } +} From ecca8fd90806158dd61f769bd7882e7ee73f3f48 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 22 Jul 2015 15:08:43 -0400 Subject: [PATCH 0417/1048] cmFortranParser: Port to bison 3 Use %-directives to specify the scanner/lexer arguments and update the yyerror signature. Reduce the list of post-bison modifications needed. --- Source/cmFortranParser.cxx | 957 +++++++++++++-------------------- Source/cmFortranParser.y | 23 +- Source/cmFortranParserTokens.h | 105 ++-- 3 files changed, 448 insertions(+), 637 deletions(-) diff --git a/Source/cmFortranParser.cxx b/Source/cmFortranParser.cxx index 871b9c3c5..0230f021b 100644 --- a/Source/cmFortranParser.cxx +++ b/Source/cmFortranParser.cxx @@ -1,8 +1,8 @@ -/* A Bison parser, made by GNU Bison 2.5. */ +/* A Bison parser, made by GNU Bison 3.0.2. */ /* Bison implementation for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -44,7 +44,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.5" +#define YYBISON_VERSION "3.0.2" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -58,23 +58,17 @@ /* Pull parsers. */ #define YYPULL 1 -/* Using locations. */ -#define YYLSP_NEEDED 0 /* Substitute the variable and function names. */ #define yyparse cmFortran_yyparse #define yylex cmFortran_yylex #define yyerror cmFortran_yyerror -#define yylval cmFortran_yylval -#define yychar cmFortran_yychar #define yydebug cmFortran_yydebug #define yynerrs cmFortran_yynerrs /* Copy the first part of user declarations. */ - -/* Line 268 of yacc.c */ -#line 1 "cmFortranParser.y" +#line 1 "cmFortranParser.y" /* yacc.c:339 */ /*============================================================================ CMake - Cross Platform Makefile Generator @@ -109,8 +103,7 @@ Run bison like this: cmFortranParser.y Modify cmFortranParser.cxx: - - remove TABs - - Remove the yyerrorlab block in range ["goto yyerrlab1", "yyerrlab1:"] + - "#if 0" out yyerrorlab block in range ["goto yyerrlab1", "yyerrlab1:"] */ /*-------------------------------------------------------------------------*/ @@ -120,18 +113,11 @@ Modify cmFortranParser.cxx: #include -/* Configure the parser to use a lexer object. */ -#define YYPARSE_PARAM yyscanner -#define YYLEX_PARAM yyscanner -#define YYERROR_VERBOSE 1 -#define cmFortran_yyerror(x) \ - cmFortranError(yyscanner, x) - /* Forward declare the lexer entry point. */ YY_DECL; -/* Helper function to forward error callback. */ -static void cmFortranError(yyscan_t yyscanner, const char* message) +/* Helper function to forward error callback from parser. */ +static void cmFortran_yyerror(yyscan_t yyscanner, const char* message) { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_Error(parser, message); @@ -153,65 +139,71 @@ static bool cmFortranParserIsKeyword(const char* word, # pragma warning (disable: 4244) /* Conversion to smaller type, data loss. */ #endif +#line 143 "cmFortranParser.cxx" /* yacc.c:339 */ -/* Line 268 of yacc.c */ -#line 165 "cmFortranParser.cxx" - -/* Enabling traces. */ -#ifndef YYDEBUG -# define YYDEBUG 0 -#endif +# ifndef YY_NULLPTR +# if defined __cplusplus && 201103L <= __cplusplus +# define YY_NULLPTR nullptr +# else +# define YY_NULLPTR 0 +# endif +# endif /* Enabling verbose error messages. */ #ifdef YYERROR_VERBOSE # undef YYERROR_VERBOSE # define YYERROR_VERBOSE 1 #else -# define YYERROR_VERBOSE 0 +# define YYERROR_VERBOSE 1 #endif -/* Enabling the token table. */ -#ifndef YYTOKEN_TABLE -# define YYTOKEN_TABLE 0 +/* In a future release of Bison, this section will be replaced + by #include "cmFortranParserTokens.h". */ +#ifndef YY_CMFORTRAN_YY_CMFORTRANPARSERTOKENS_H_INCLUDED +# define YY_CMFORTRAN_YY_CMFORTRANPARSERTOKENS_H_INCLUDED +/* Debug traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif +#if YYDEBUG +extern int cmFortran_yydebug; #endif - -/* Tokens. */ +/* Token type. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - EOSTMT = 258, - ASSIGNMENT_OP = 259, - GARBAGE = 260, - CPP_INCLUDE = 261, - F90PPR_INCLUDE = 262, - COCO_INCLUDE = 263, - F90PPR_DEFINE = 264, - CPP_DEFINE = 265, - F90PPR_UNDEF = 266, - CPP_UNDEF = 267, - CPP_IFDEF = 268, - CPP_IFNDEF = 269, - CPP_IF = 270, - CPP_ELSE = 271, - CPP_ELIF = 272, - CPP_ENDIF = 273, - F90PPR_IFDEF = 274, - F90PPR_IFNDEF = 275, - F90PPR_IF = 276, - F90PPR_ELSE = 277, - F90PPR_ELIF = 278, - F90PPR_ENDIF = 279, - COMMA = 280, - DCOLON = 281, - CPP_TOENDL = 282, - UNTERMINATED_STRING = 283, - STRING = 284, - WORD = 285, - CPP_INCLUDE_ANGLE = 286 - }; + enum yytokentype + { + EOSTMT = 258, + ASSIGNMENT_OP = 259, + GARBAGE = 260, + CPP_INCLUDE = 261, + F90PPR_INCLUDE = 262, + COCO_INCLUDE = 263, + F90PPR_DEFINE = 264, + CPP_DEFINE = 265, + F90PPR_UNDEF = 266, + CPP_UNDEF = 267, + CPP_IFDEF = 268, + CPP_IFNDEF = 269, + CPP_IF = 270, + CPP_ELSE = 271, + CPP_ELIF = 272, + CPP_ENDIF = 273, + F90PPR_IFDEF = 274, + F90PPR_IFNDEF = 275, + F90PPR_IF = 276, + F90PPR_ELSE = 277, + F90PPR_ELIF = 278, + F90PPR_ENDIF = 279, + COMMA = 280, + DCOLON = 281, + CPP_TOENDL = 282, + UNTERMINATED_STRING = 283, + STRING = 284, + WORD = 285, + CPP_INCLUDE_ANGLE = 286 + }; #endif /* Tokens. */ #define EOSTMT 258 @@ -244,34 +236,30 @@ static bool cmFortranParserIsKeyword(const char* word, #define WORD 285 #define CPP_INCLUDE_ANGLE 286 - - - +/* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE +typedef union YYSTYPE YYSTYPE; +union YYSTYPE { - -/* Line 293 of yacc.c */ -#line 89 "cmFortranParser.y" +#line 81 "cmFortranParser.y" /* yacc.c:355 */ char* string; - - -/* Line 293 of yacc.c */ -#line 269 "cmFortranParser.cxx" -} YYSTYPE; +#line 249 "cmFortranParser.cxx" /* yacc.c:355 */ +}; # define YYSTYPE_IS_TRIVIAL 1 -# define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 #endif + +int cmFortran_yyparse (yyscan_t yyscanner); + +#endif /* !YY_CMFORTRAN_YY_CMFORTRANPARSERTOKENS_H_INCLUDED */ + /* Copy the second part of user declarations. */ - -/* Line 343 of yacc.c */ -#line 281 "cmFortranParser.cxx" +#line 263 "cmFortranParser.cxx" /* yacc.c:358 */ #ifdef short # undef short @@ -285,11 +273,8 @@ typedef unsigned char yytype_uint8; #ifdef YYTYPE_INT8 typedef YYTYPE_INT8 yytype_int8; -#elif (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -typedef signed char yytype_int8; #else -typedef short int yytype_int8; +typedef signed char yytype_int8; #endif #ifdef YYTYPE_UINT16 @@ -309,8 +294,7 @@ typedef short int yytype_int16; # define YYSIZE_T __SIZE_TYPE__ # elif defined size_t # define YYSIZE_T size_t -# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +# elif ! defined YYSIZE_T # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else @@ -324,38 +308,67 @@ typedef short int yytype_int16; # if defined YYENABLE_NLS && YYENABLE_NLS # if ENABLE_NLS # include /* INFRINGES ON USER NAME SPACE */ -# define YY_(msgid) dgettext ("bison-runtime", msgid) +# define YY_(Msgid) dgettext ("bison-runtime", Msgid) # endif # endif # ifndef YY_ -# define YY_(msgid) msgid +# define YY_(Msgid) Msgid +# endif +#endif + +#ifndef YY_ATTRIBUTE +# if (defined __GNUC__ \ + && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ + || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C +# define YY_ATTRIBUTE(Spec) __attribute__(Spec) +# else +# define YY_ATTRIBUTE(Spec) /* empty */ +# endif +#endif + +#ifndef YY_ATTRIBUTE_PURE +# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) +#endif + +#ifndef YY_ATTRIBUTE_UNUSED +# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) +#endif + +#if !defined _Noreturn \ + && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) +# if defined _MSC_VER && 1200 <= _MSC_VER +# define _Noreturn __declspec (noreturn) +# else +# define _Noreturn YY_ATTRIBUTE ((__noreturn__)) # endif #endif /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ -# define YYUSE(e) ((void) (e)) +# define YYUSE(E) ((void) (E)) #else -# define YYUSE(e) /* empty */ +# define YYUSE(E) /* empty */ #endif -/* Identity function, used to suppress warnings about constant conditions. */ -#ifndef lint -# define YYID(n) (n) +#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ +/* Suppress an incorrect diagnostic about yylval being uninitialized. */ +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ + _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") +# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ + _Pragma ("GCC diagnostic pop") #else -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static int -YYID (int yyi) -#else -static int -YYID (yyi) - int yyi; +# define YY_INITIAL_VALUE(Value) Value #endif -{ - return yyi; -} +#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_END #endif +#ifndef YY_INITIAL_VALUE +# define YY_INITIAL_VALUE(Value) /* Nothing. */ +#endif + #if ! defined yyoverflow || YYERROR_VERBOSE @@ -374,9 +387,9 @@ YYID (yyi) # define alloca _alloca # else # define YYSTACK_ALLOC alloca -# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS # include /* INFRINGES ON USER NAME SPACE */ + /* Use EXIT_SUCCESS as a witness for stdlib.h. */ # ifndef EXIT_SUCCESS # define EXIT_SUCCESS 0 # endif @@ -386,8 +399,8 @@ YYID (yyi) # endif # ifdef YYSTACK_ALLOC - /* Pacify GCC's `empty if-body' warning. */ -# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) + /* Pacify GCC's 'empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) # ifndef YYSTACK_ALLOC_MAXIMUM /* The OS might guarantee only one guard page at the bottom of the stack, and a page size can be as small as 4096 bytes. So we cannot safely @@ -411,15 +424,13 @@ YYID (yyi) # endif # ifndef YYMALLOC # define YYMALLOC malloc -# if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +# if ! defined malloc && ! defined EXIT_SUCCESS void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ # endif # endif # ifndef YYFREE # define YYFREE free -# if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +# if ! defined free && ! defined EXIT_SUCCESS void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif # endif @@ -463,26 +474,26 @@ union yyalloc yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ - while (YYID (0)) + while (0) #endif #if defined YYCOPY_NEEDED && YYCOPY_NEEDED -/* Copy COUNT objects from FROM to TO. The source and destination do +/* Copy COUNT objects from SRC to DST. The source and destination do not overlap. */ # ifndef YYCOPY # if defined __GNUC__ && 1 < __GNUC__ -# define YYCOPY(To, From, Count) \ - __builtin_memcpy (To, From, (Count) * sizeof (*(From))) +# define YYCOPY(Dst, Src, Count) \ + __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) # else -# define YYCOPY(To, From, Count) \ +# define YYCOPY(Dst, Src, Count) \ do \ { \ YYSIZE_T yyi; \ for (yyi = 0; yyi < (Count); yyi++) \ - (To)[yyi] = (From)[yyi]; \ + (Dst)[yyi] = (Src)[yyi]; \ } \ - while (YYID (0)) + while (0) # endif # endif #endif /* !YYCOPY_NEEDED */ @@ -498,17 +509,19 @@ union yyalloc #define YYNNTS 16 /* YYNRULES -- Number of rules. */ #define YYNRULES 53 -/* YYNRULES -- Number of states. */ +/* YYNSTATES -- Number of states. */ #define YYNSTATES 97 -/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ +/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned + by yylex, with out-of-bounds checking. */ #define YYUNDEFTOK 2 #define YYMAXUTOK 286 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) -/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ +/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM + as returned by yylex, without out-of-bounds checking. */ static const yytype_uint8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -543,52 +556,19 @@ static const yytype_uint8 yytranslate[] = }; #if YYDEBUG -/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in - YYRHS. */ -static const yytype_uint8 yyprhs[] = -{ - 0, 0, 3, 4, 7, 9, 11, 16, 19, 24, - 30, 38, 43, 47, 52, 57, 62, 67, 72, 76, - 80, 84, 88, 93, 97, 99, 101, 103, 105, 107, - 109, 111, 113, 115, 117, 119, 121, 123, 125, 127, - 129, 131, 133, 135, 137, 139, 140, 143, 145, 147, - 149, 151, 153, 155 -}; - -/* YYRHS -- A `-1'-separated list of the rules' RHS. */ -static const yytype_int8 yyrhs[] = -{ - 33, 0, -1, -1, 33, 34, -1, 36, -1, 35, - -1, 30, 4, 46, 3, -1, 30, 3, -1, 30, - 30, 46, 3, -1, 30, 26, 30, 46, 3, -1, - 30, 25, 30, 26, 30, 46, 3, -1, 30, 29, - 46, 3, -1, 31, 46, 3, -1, 37, 29, 46, - 3, -1, 38, 30, 46, 3, -1, 39, 30, 46, - 3, -1, 40, 30, 46, 3, -1, 41, 30, 46, - 3, -1, 42, 46, 3, -1, 43, 46, 3, -1, - 44, 46, 3, -1, 45, 46, 3, -1, 30, 5, - 46, 3, -1, 5, 46, 3, -1, 3, -1, 1, - -1, 6, -1, 7, -1, 8, -1, 10, -1, 9, - -1, 12, -1, 11, -1, 13, -1, 19, -1, 14, - -1, 20, -1, 15, -1, 21, -1, 17, -1, 23, - -1, 16, -1, 22, -1, 18, -1, 24, -1, -1, - 46, 47, -1, 30, -1, 29, -1, 5, -1, 4, - -1, 26, -1, 25, -1, 28, -1 -}; - -/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ + /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 111, 111, 111, 113, 113, 115, 121, 131, 161, - 172, 185, 196, 203, 210, 216, 222, 228, 234, 239, - 244, 249, 254, 258, 259, 260, 265, 265, 265, 266, - 266, 267, 267, 268, 268, 269, 269, 270, 270, 271, - 271, 272, 272, 273, 273, 274, 274, 277, 278, 279, - 280, 281, 282, 283 + 0, 103, 103, 103, 105, 105, 107, 113, 123, 153, + 164, 177, 188, 195, 202, 208, 214, 220, 226, 231, + 236, 241, 246, 250, 251, 252, 257, 257, 257, 258, + 258, 259, 259, 260, 260, 261, 261, 262, 262, 263, + 263, 264, 264, 265, 265, 266, 266, 269, 270, 271, + 272, 273, 274, 275 }; #endif -#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE +#if YYDEBUG || YYERROR_VERBOSE || 1 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = @@ -601,13 +581,13 @@ static const char *const yytname[] = "F90PPR_ENDIF", "COMMA", "DCOLON", "CPP_TOENDL", "UNTERMINATED_STRING", "STRING", "WORD", "CPP_INCLUDE_ANGLE", "$accept", "code", "stmt", "assignment_stmt", "keyword_stmt", "include", "define", "undef", "ifdef", - "ifndef", "if", "elif", "else", "endif", "other", "misc_code", 0 + "ifndef", "if", "elif", "else", "endif", "other", "misc_code", YY_NULLPTR }; #endif # ifdef YYPRINT -/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to - token YYLEX-NUM. */ +/* YYTOKNUM[NUM] -- (External) token number corresponding to the + (internal) symbol number NUM (which must be that of a token). */ static const yytype_uint16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, @@ -617,55 +597,18 @@ static const yytype_uint16 yytoknum[] = }; # endif -/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const yytype_uint8 yyr1[] = -{ - 0, 32, 33, 33, 34, 34, 35, 36, 36, 36, - 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, - 36, 36, 36, 36, 36, 36, 37, 37, 37, 38, - 38, 39, 39, 40, 40, 41, 41, 42, 42, 43, - 43, 44, 44, 45, 45, 46, 46, 47, 47, 47, - 47, 47, 47, 47 -}; - -/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ -static const yytype_uint8 yyr2[] = -{ - 0, 2, 0, 2, 1, 1, 4, 2, 4, 5, - 7, 4, 3, 4, 4, 4, 4, 4, 3, 3, - 3, 3, 4, 3, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 0, 2, 1, 1, 1, - 1, 1, 1, 1 -}; - -/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM. - Performed when YYTABLE doesn't specify something else to do. Zero - means the default is an error. */ -static const yytype_uint8 yydefact[] = -{ - 2, 0, 1, 25, 24, 45, 26, 27, 28, 30, - 29, 32, 31, 33, 35, 37, 41, 39, 43, 34, - 36, 38, 42, 40, 44, 0, 45, 3, 5, 4, - 0, 0, 0, 0, 0, 45, 45, 45, 45, 0, - 7, 45, 45, 0, 0, 45, 45, 0, 45, 45, - 45, 45, 45, 0, 0, 0, 0, 23, 50, 49, - 52, 51, 53, 48, 47, 46, 0, 0, 0, 45, - 0, 0, 12, 0, 0, 0, 0, 0, 18, 19, - 20, 21, 6, 22, 0, 0, 11, 8, 13, 14, - 15, 16, 17, 45, 9, 0, 10 -}; - -/* YYDEFGOTO[NTERM-NUM]. */ -static const yytype_int8 yydefgoto[] = -{ - -1, 1, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 65 -}; - -/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing - STATE-NUM. */ #define YYPACT_NINF -29 + +#define yypact_value_is_default(Yystate) \ + (!!((Yystate) == (-29))) + +#define YYTABLE_NINF -1 + +#define yytable_value_is_error(Yytable_value) \ + 0 + + /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ static const yytype_int16 yypact[] = { -29, 39, -29, -29, -29, -29, -29, -29, -29, -29, @@ -680,17 +623,40 @@ static const yytype_int16 yypact[] = -29, -29, -29, -29, -29, 218, -29 }; -/* YYPGOTO[NTERM-NUM]. */ + /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. + Performed when YYTABLE does not specify something else to do. Zero + means the default is an error. */ +static const yytype_uint8 yydefact[] = +{ + 2, 0, 1, 25, 24, 45, 26, 27, 28, 30, + 29, 32, 31, 33, 35, 37, 41, 39, 43, 34, + 36, 38, 42, 40, 44, 0, 45, 3, 5, 4, + 0, 0, 0, 0, 0, 45, 45, 45, 45, 0, + 7, 45, 45, 0, 0, 45, 45, 0, 45, 45, + 45, 45, 45, 0, 0, 0, 0, 23, 50, 49, + 52, 51, 53, 48, 47, 46, 0, 0, 0, 45, + 0, 0, 12, 0, 0, 0, 0, 0, 18, 19, + 20, 21, 6, 22, 0, 0, 11, 8, 13, 14, + 15, 16, 17, 45, 9, 0, 10 +}; + + /* YYPGOTO[NTERM-NUM]. */ static const yytype_int8 yypgoto[] = { -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -26, -29 }; -/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If - positive, shift that token. If negative, reduce the rule which - number is the opposite. If YYTABLE_NINF, syntax error. */ -#define YYTABLE_NINF -1 + /* YYDEFGOTO[NTERM-NUM]. */ +static const yytype_int8 yydefgoto[] = +{ + -1, 1, 27, 28, 29, 30, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 65 +}; + + /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule whose + number is the opposite. If YYTABLE_NINF, syntax error. */ static const yytype_uint8 yytable[] = { 47, 48, 84, 49, 0, 57, 58, 59, 50, 53, @@ -723,12 +689,6 @@ static const yytype_uint8 yytable[] = 0, 43, 44, 0, 0, 45, 46 }; -#define yypact_value_is_default(yystate) \ - ((yystate) == (-29)) - -#define yytable_value_is_error(yytable_value) \ - YYID (0) - static const yytype_int8 yycheck[] = { 26, 29, 26, 30, -1, 3, 4, 5, 30, 35, @@ -761,8 +721,8 @@ static const yytype_int8 yycheck[] = -1, 25, 26, -1, -1, 29, 30 }; -/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing - symbol of state STATE-NUM. */ + /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { 0, 33, 0, 1, 3, 5, 6, 7, 8, 9, @@ -777,6 +737,29 @@ static const yytype_uint8 yystos[] = 3, 3, 3, 30, 3, 46, 3 }; + /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const yytype_uint8 yyr1[] = +{ + 0, 32, 33, 33, 34, 34, 35, 36, 36, 36, + 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, + 36, 36, 36, 36, 36, 36, 37, 37, 37, 38, + 38, 39, 39, 40, 40, 41, 41, 42, 42, 43, + 43, 44, 44, 45, 45, 46, 46, 47, 47, 47, + 47, 47, 47, 47 +}; + + /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ +static const yytype_uint8 yyr2[] = +{ + 0, 2, 0, 2, 1, 1, 4, 2, 4, 5, + 7, 4, 3, 4, 4, 4, 4, 4, 3, 3, + 3, 3, 4, 3, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 0, 2, 1, 1, 1, + 1, 1, 1, 1 +}; + + #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) #define YYEMPTY (-2) @@ -787,84 +770,30 @@ static const yytype_uint8 yystos[] = #define YYERROR goto yyerrorlab -/* Like YYERROR except do call yyerror. This remains here temporarily - to ease the transition to the new meaning of YYERROR, for GCC. - Once GCC version 2 has supplanted version 1, this can go. However, - YYFAIL appears to be in use. Nevertheless, it is formally deprecated - in Bison 2.4.2's NEWS entry, where a plan to phase it out is - discussed. */ - -#define YYFAIL goto yyerrlab -#if defined YYFAIL - /* This is here to suppress warnings from the GCC cpp's - -Wunused-macros. Normally we don't worry about that warning, but - some users do, and we want to make it easy for users to remove - YYFAIL uses, which will produce warnings from Bison 2.5. */ -#endif - #define YYRECOVERING() (!!yyerrstatus) #define YYBACKUP(Token, Value) \ do \ - if (yychar == YYEMPTY && yylen == 1) \ + if (yychar == YYEMPTY) \ { \ yychar = (Token); \ yylval = (Value); \ - YYPOPSTACK (1); \ + YYPOPSTACK (yylen); \ + yystate = *yyssp; \ goto yybackup; \ } \ else \ { \ - yyerror (YY_("syntax error: cannot back up")); \ + yyerror (yyscanner, YY_("syntax error: cannot back up")); \ YYERROR; \ } \ -while (YYID (0)) - +while (0) +/* Error token number */ #define YYTERROR 1 #define YYERRCODE 256 -/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. - If N is 0, then set CURRENT to the empty location which ends - the previous symbol: RHS[0] (always defined). */ - -#define YYRHSLOC(Rhs, K) ((Rhs)[K]) -#ifndef YYLLOC_DEFAULT -# define YYLLOC_DEFAULT(Current, Rhs, N) \ - do \ - if (YYID (N)) \ - { \ - (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ - (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ - (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ - (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ - } \ - else \ - { \ - (Current).first_line = (Current).last_line = \ - YYRHSLOC (Rhs, 0).last_line; \ - (Current).first_column = (Current).last_column = \ - YYRHSLOC (Rhs, 0).last_column; \ - } \ - while (YYID (0)) -#endif - - -/* This macro is provided for backward compatibility. */ - -#ifndef YY_LOCATION_PRINT -# define YY_LOCATION_PRINT(File, Loc) ((void) 0) -#endif - - -/* YYLEX -- calling `yylex' with the right arguments. */ - -#ifdef YYLEX_PARAM -# define YYLEX yylex (&yylval, YYLEX_PARAM) -#else -# define YYLEX yylex (&yylval) -#endif /* Enable debugging if requested. */ #if YYDEBUG @@ -878,7 +807,13 @@ while (YYID (0)) do { \ if (yydebug) \ YYFPRINTF Args; \ -} while (YYID (0)) +} while (0) + +/* This macro is provided for backward compatibility. */ +#ifndef YY_LOCATION_PRINT +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +#endif + # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ do { \ @@ -886,42 +821,29 @@ do { \ { \ YYFPRINTF (stderr, "%s ", Title); \ yy_symbol_print (stderr, \ - Type, Value); \ + Type, Value, yyscanner); \ YYFPRINTF (stderr, "\n"); \ } \ -} while (YYID (0)) +} while (0) -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ +/*----------------------------------------. +| Print this symbol's value on YYOUTPUT. | +`----------------------------------------*/ -/*ARGSUSED*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static void -yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) -#else -static void -yy_symbol_value_print (yyoutput, yytype, yyvaluep) - FILE *yyoutput; - int yytype; - YYSTYPE const * const yyvaluep; -#endif +yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, yyscan_t yyscanner) { + FILE *yyo = yyoutput; + YYUSE (yyo); + YYUSE (yyscanner); if (!yyvaluep) return; # ifdef YYPRINT if (yytype < YYNTOKENS) YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); -# else - YYUSE (yyoutput); # endif - switch (yytype) - { - default: - break; - } + YYUSE (yytype); } @@ -929,24 +851,13 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep) | Print this symbol on YYOUTPUT. | `--------------------------------*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static void -yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) -#else -static void -yy_symbol_print (yyoutput, yytype, yyvaluep) - FILE *yyoutput; - int yytype; - YYSTYPE const * const yyvaluep; -#endif +yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, yyscan_t yyscanner) { - if (yytype < YYNTOKENS) - YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); - else - YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); + YYFPRINTF (yyoutput, "%s %s (", + yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); - yy_symbol_value_print (yyoutput, yytype, yyvaluep); + yy_symbol_value_print (yyoutput, yytype, yyvaluep, yyscanner); YYFPRINTF (yyoutput, ")"); } @@ -955,16 +866,8 @@ yy_symbol_print (yyoutput, yytype, yyvaluep) | TOP (included). | `------------------------------------------------------------------*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static void yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) -#else -static void -yy_stack_print (yybottom, yytop) - yytype_int16 *yybottom; - yytype_int16 *yytop; -#endif { YYFPRINTF (stderr, "Stack now"); for (; yybottom <= yytop; yybottom++) @@ -979,36 +882,29 @@ yy_stack_print (yybottom, yytop) do { \ if (yydebug) \ yy_stack_print ((Bottom), (Top)); \ -} while (YYID (0)) +} while (0) /*------------------------------------------------. | Report that the YYRULE is going to be reduced. | `------------------------------------------------*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static void -yy_reduce_print (YYSTYPE *yyvsp, int yyrule) -#else -static void -yy_reduce_print (yyvsp, yyrule) - YYSTYPE *yyvsp; - int yyrule; -#endif +yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule, yyscan_t yyscanner) { + unsigned long int yylno = yyrline[yyrule]; int yynrhs = yyr2[yyrule]; int yyi; - unsigned long int yylno = yyrline[yyrule]; YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", yyrule - 1, yylno); /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { YYFPRINTF (stderr, " $%d = ", yyi + 1); - yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], + yy_symbol_print (stderr, + yystos[yyssp[yyi + 1 - yynrhs]], &(yyvsp[(yyi + 1) - (yynrhs)]) - ); + , yyscanner); YYFPRINTF (stderr, "\n"); } } @@ -1016,8 +912,8 @@ yy_reduce_print (yyvsp, yyrule) # define YY_REDUCE_PRINT(Rule) \ do { \ if (yydebug) \ - yy_reduce_print (yyvsp, Rule); \ -} while (YYID (0)) + yy_reduce_print (yyssp, yyvsp, Rule, yyscanner); \ +} while (0) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ @@ -1054,15 +950,8 @@ int yydebug; # define yystrlen strlen # else /* Return the length of YYSTR. */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static YYSIZE_T yystrlen (const char *yystr) -#else -static YYSIZE_T -yystrlen (yystr) - const char *yystr; -#endif { YYSIZE_T yylen; for (yylen = 0; yystr[yylen]; yylen++) @@ -1078,16 +967,8 @@ yystrlen (yystr) # else /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in YYDEST. */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static char * yystpcpy (char *yydest, const char *yysrc) -#else -static char * -yystpcpy (yydest, yysrc) - char *yydest; - const char *yysrc; -#endif { char *yyd = yydest; const char *yys = yysrc; @@ -1160,12 +1041,11 @@ static int yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, yytype_int16 *yyssp, int yytoken) { - YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]); + YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); YYSIZE_T yysize = yysize0; - YYSIZE_T yysize1; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; /* Internationalized format string. */ - const char *yyformat = 0; + const char *yyformat = YY_NULLPTR; /* Arguments of yyformat. */ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; /* Number of reported tokens (one for the "unexpected", one per @@ -1173,10 +1053,6 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, int yycount = 0; /* There are many possibilities here to consider: - - Assume YYFAIL is not used. It's too flawed to consider. See - - for details. YYERROR is fine as it does not invoke this - function. - If this state is a consistent state with a default action, then the only way this function was invoked is if the default action is an error action. In that case, don't check for expected @@ -1225,11 +1101,13 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, break; } yyarg[yycount++] = yytname[yyx]; - yysize1 = yysize + yytnamerr (0, yytname[yyx]); - if (! (yysize <= yysize1 - && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) - return 2; - yysize = yysize1; + { + YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); + if (! (yysize <= yysize1 + && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + } } } } @@ -1249,10 +1127,12 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, # undef YYCASE_ } - yysize1 = yysize + yystrlen (yyformat); - if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) - return 2; - yysize = yysize1; + { + YYSIZE_T yysize1 = yysize + yystrlen (yyformat); + if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + } if (*yymsg_alloc < yysize) { @@ -1289,81 +1169,39 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, | Release the memory associated to this symbol. | `-----------------------------------------------*/ -/*ARGSUSED*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static void -yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) -#else -static void -yydestruct (yymsg, yytype, yyvaluep) - const char *yymsg; - int yytype; - YYSTYPE *yyvaluep; -#endif +yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, yyscan_t yyscanner) { YYUSE (yyvaluep); - + YYUSE (yyscanner); if (!yymsg) yymsg = "Deleting"; YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); - switch (yytype) - { - - default: - break; - } + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + YYUSE (yytype); + YY_IGNORE_MAYBE_UNINITIALIZED_END } -/* Prevent warnings from -Wmissing-prototypes. */ -#ifdef YYPARSE_PARAM -#if defined __STDC__ || defined __cplusplus -int yyparse (void *YYPARSE_PARAM); -#else -int yyparse (); -#endif -#else /* ! YYPARSE_PARAM */ -#if defined __STDC__ || defined __cplusplus -int yyparse (void); -#else -int yyparse (); -#endif -#endif /* ! YYPARSE_PARAM */ /*----------. | yyparse. | `----------*/ -#ifdef YYPARSE_PARAM -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) int -yyparse (void *YYPARSE_PARAM) -#else -int -yyparse (YYPARSE_PARAM) - void *YYPARSE_PARAM; -#endif -#else /* ! YYPARSE_PARAM */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -int -yyparse (void) -#else -int -yyparse () - -#endif -#endif +yyparse (yyscan_t yyscanner) { /* The lookahead symbol. */ int yychar; + /* The semantic value of the lookahead symbol. */ -YYSTYPE yylval; +/* Default value used for initialization, for pacifying older GCCs + or non-GCC compilers. */ +YY_INITIAL_VALUE (static YYSTYPE yyval_default;) +YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); /* Number of syntax errors so far. */ int yynerrs; @@ -1373,10 +1211,10 @@ YYSTYPE yylval; int yyerrstatus; /* The stacks and their tools: - `yyss': related to states. - `yyvs': related to semantic values. + 'yyss': related to states. + 'yyvs': related to semantic values. - Refer to the stacks thru separate pointers, to allow yyoverflow + Refer to the stacks through separate pointers, to allow yyoverflow to reallocate them elsewhere. */ /* The state stack. */ @@ -1394,7 +1232,7 @@ YYSTYPE yylval; int yyn; int yyresult; /* Lookahead token as an internal (translated) token number. */ - int yytoken; + int yytoken = 0; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; @@ -1412,9 +1250,8 @@ YYSTYPE yylval; Keep to zero when no symbol should be popped. */ int yylen = 0; - yytoken = 0; - yyss = yyssa; - yyvs = yyvsa; + yyssp = yyss = yyssa; + yyvsp = yyvs = yyvsa; yystacksize = YYINITDEPTH; YYDPRINTF ((stderr, "Starting parse\n")); @@ -1423,14 +1260,6 @@ YYSTYPE yylval; yyerrstatus = 0; yynerrs = 0; yychar = YYEMPTY; /* Cause a token to be read. */ - - /* Initialize stack pointers. - Waste one element of value and location stack - so that they stay on the same level as the state stack. - The wasted elements are never initialized. */ - yyssp = yyss; - yyvsp = yyvs; - goto yysetstate; /*------------------------------------------------------------. @@ -1531,7 +1360,7 @@ yybackup: if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); - yychar = YYLEX; + yychar = yylex (&yylval, yyscanner); } if (yychar <= YYEOF) @@ -1571,7 +1400,9 @@ yybackup: yychar = YYEMPTY; yystate = yyn; + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END goto yynewstate; @@ -1594,7 +1425,7 @@ yyreduce: yylen = yyr2[yyn]; /* If YYLEN is nonzero, implement the default value of the action: - `$$ = $1'. + '$$ = $1'. Otherwise, the following line sets YYVAL to garbage. This behavior is undocumented and Bison @@ -1608,249 +1439,228 @@ yyreduce: switch (yyn) { case 6: - -/* Line 1806 of yacc.c */ -#line 116 "cmFortranParser.y" +#line 108 "cmFortranParser.y" /* yacc.c:1646 */ { - free((yyvsp[(1) - (4)].string)); + free((yyvsp[-3].string)); } +#line 1447 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 7: - -/* Line 1806 of yacc.c */ -#line 122 "cmFortranParser.y" +#line 114 "cmFortranParser.y" /* yacc.c:1646 */ { - if (cmFortranParserIsKeyword((yyvsp[(1) - (2)].string), "interface")) + if (cmFortranParserIsKeyword((yyvsp[-1].string), "interface")) { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_SetInInterface(parser, true); } - free((yyvsp[(1) - (2)].string)); + free((yyvsp[-1].string)); } +#line 1461 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 8: - -/* Line 1806 of yacc.c */ -#line 132 "cmFortranParser.y" +#line 124 "cmFortranParser.y" /* yacc.c:1646 */ { - if (cmFortranParserIsKeyword((yyvsp[(1) - (4)].string), "use")) + if (cmFortranParserIsKeyword((yyvsp[-3].string), "use")) { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); - cmFortranParser_RuleUse(parser, (yyvsp[(2) - (4)].string)); + cmFortranParser_RuleUse(parser, (yyvsp[-2].string)); } - else if (cmFortranParserIsKeyword((yyvsp[(1) - (4)].string), "module")) + else if (cmFortranParserIsKeyword((yyvsp[-3].string), "module")) { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); - cmFortranParser_RuleModule(parser, (yyvsp[(2) - (4)].string)); + cmFortranParser_RuleModule(parser, (yyvsp[-2].string)); } - else if (cmFortranParserIsKeyword((yyvsp[(1) - (4)].string), "interface")) + else if (cmFortranParserIsKeyword((yyvsp[-3].string), "interface")) { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_SetInInterface(parser, true); } - else if (cmFortranParserIsKeyword((yyvsp[(2) - (4)].string), "interface") && - cmFortranParserIsKeyword((yyvsp[(1) - (4)].string), "end")) + else if (cmFortranParserIsKeyword((yyvsp[-2].string), "interface") && + cmFortranParserIsKeyword((yyvsp[-3].string), "end")) { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_SetInInterface(parser, false); } - free((yyvsp[(1) - (4)].string)); - free((yyvsp[(2) - (4)].string)); + free((yyvsp[-3].string)); + free((yyvsp[-2].string)); } +#line 1495 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 9: - -/* Line 1806 of yacc.c */ -#line 162 "cmFortranParser.y" +#line 154 "cmFortranParser.y" /* yacc.c:1646 */ { - if (cmFortranParserIsKeyword((yyvsp[(1) - (5)].string), "use")) + if (cmFortranParserIsKeyword((yyvsp[-4].string), "use")) { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); - cmFortranParser_RuleUse(parser, (yyvsp[(3) - (5)].string)); + cmFortranParser_RuleUse(parser, (yyvsp[-2].string)); } - free((yyvsp[(1) - (5)].string)); - free((yyvsp[(3) - (5)].string)); + free((yyvsp[-4].string)); + free((yyvsp[-2].string)); } +#line 1510 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 10: - -/* Line 1806 of yacc.c */ -#line 173 "cmFortranParser.y" +#line 165 "cmFortranParser.y" /* yacc.c:1646 */ { - if (cmFortranParserIsKeyword((yyvsp[(1) - (7)].string), "use") && - cmFortranParserIsKeyword((yyvsp[(3) - (7)].string), "non_intrinsic") ) + if (cmFortranParserIsKeyword((yyvsp[-6].string), "use") && + cmFortranParserIsKeyword((yyvsp[-4].string), "non_intrinsic") ) { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); - cmFortranParser_RuleUse(parser, (yyvsp[(5) - (7)].string)); + cmFortranParser_RuleUse(parser, (yyvsp[-2].string)); } - free((yyvsp[(1) - (7)].string)); - free((yyvsp[(3) - (7)].string)); - free((yyvsp[(5) - (7)].string)); + free((yyvsp[-6].string)); + free((yyvsp[-4].string)); + free((yyvsp[-2].string)); } +#line 1527 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 11: - -/* Line 1806 of yacc.c */ -#line 186 "cmFortranParser.y" +#line 178 "cmFortranParser.y" /* yacc.c:1646 */ { - if (cmFortranParserIsKeyword((yyvsp[(1) - (4)].string), "include")) + if (cmFortranParserIsKeyword((yyvsp[-3].string), "include")) { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); - cmFortranParser_RuleInclude(parser, (yyvsp[(2) - (4)].string)); + cmFortranParser_RuleInclude(parser, (yyvsp[-2].string)); } - free((yyvsp[(1) - (4)].string)); - free((yyvsp[(2) - (4)].string)); + free((yyvsp[-3].string)); + free((yyvsp[-2].string)); } +#line 1542 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 12: - -/* Line 1806 of yacc.c */ -#line 197 "cmFortranParser.y" +#line 189 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); - cmFortranParser_RuleInclude(parser, (yyvsp[(1) - (3)].string)); - free((yyvsp[(1) - (3)].string)); + cmFortranParser_RuleInclude(parser, (yyvsp[-2].string)); + free((yyvsp[-2].string)); } +#line 1553 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 13: - -/* Line 1806 of yacc.c */ -#line 204 "cmFortranParser.y" +#line 196 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); - cmFortranParser_RuleInclude(parser, (yyvsp[(2) - (4)].string)); - free((yyvsp[(2) - (4)].string)); + cmFortranParser_RuleInclude(parser, (yyvsp[-2].string)); + free((yyvsp[-2].string)); } +#line 1564 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 14: - -/* Line 1806 of yacc.c */ -#line 211 "cmFortranParser.y" +#line 203 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); - cmFortranParser_RuleDefine(parser, (yyvsp[(2) - (4)].string)); - free((yyvsp[(2) - (4)].string)); + cmFortranParser_RuleDefine(parser, (yyvsp[-2].string)); + free((yyvsp[-2].string)); } +#line 1574 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 15: - -/* Line 1806 of yacc.c */ -#line 217 "cmFortranParser.y" +#line 209 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); - cmFortranParser_RuleUndef(parser, (yyvsp[(2) - (4)].string)); - free((yyvsp[(2) - (4)].string)); + cmFortranParser_RuleUndef(parser, (yyvsp[-2].string)); + free((yyvsp[-2].string)); } +#line 1584 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 16: - -/* Line 1806 of yacc.c */ -#line 223 "cmFortranParser.y" +#line 215 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); - cmFortranParser_RuleIfdef(parser, (yyvsp[(2) - (4)].string)); - free((yyvsp[(2) - (4)].string)); + cmFortranParser_RuleIfdef(parser, (yyvsp[-2].string)); + free((yyvsp[-2].string)); } +#line 1594 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 17: - -/* Line 1806 of yacc.c */ -#line 229 "cmFortranParser.y" +#line 221 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); - cmFortranParser_RuleIfndef(parser, (yyvsp[(2) - (4)].string)); - free((yyvsp[(2) - (4)].string)); + cmFortranParser_RuleIfndef(parser, (yyvsp[-2].string)); + free((yyvsp[-2].string)); } +#line 1604 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 18: - -/* Line 1806 of yacc.c */ -#line 235 "cmFortranParser.y" +#line 227 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleIf(parser); } +#line 1613 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 19: - -/* Line 1806 of yacc.c */ -#line 240 "cmFortranParser.y" +#line 232 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleElif(parser); } +#line 1622 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 20: - -/* Line 1806 of yacc.c */ -#line 245 "cmFortranParser.y" +#line 237 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleElse(parser); } +#line 1631 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 21: - -/* Line 1806 of yacc.c */ -#line 250 "cmFortranParser.y" +#line 242 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleEndif(parser); } +#line 1640 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 22: - -/* Line 1806 of yacc.c */ -#line 255 "cmFortranParser.y" +#line 247 "cmFortranParser.y" /* yacc.c:1646 */ { - free((yyvsp[(1) - (4)].string)); + free((yyvsp[-3].string)); } +#line 1648 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 47: - -/* Line 1806 of yacc.c */ -#line 277 "cmFortranParser.y" - { free ((yyvsp[(1) - (1)].string)); } +#line 269 "cmFortranParser.y" /* yacc.c:1646 */ + { free ((yyvsp[0].string)); } +#line 1654 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 48: - -/* Line 1806 of yacc.c */ -#line 278 "cmFortranParser.y" - { free ((yyvsp[(1) - (1)].string)); } +#line 270 "cmFortranParser.y" /* yacc.c:1646 */ + { free ((yyvsp[0].string)); } +#line 1660 "cmFortranParser.cxx" /* yacc.c:1646 */ break; - -/* Line 1806 of yacc.c */ -#line 1860 "cmFortranParser.cxx" +#line 1664 "cmFortranParser.cxx" /* yacc.c:1646 */ default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -1872,7 +1682,7 @@ yyreduce: *++yyvsp = yyval; - /* Now `shift' the result of the reduction. Determine what state + /* Now 'shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ @@ -1887,9 +1697,9 @@ yyreduce: goto yynewstate; -/*------------------------------------. -| yyerrlab -- here on detecting error | -`------------------------------------*/ +/*--------------------------------------. +| yyerrlab -- here on detecting error. | +`--------------------------------------*/ yyerrlab: /* Make sure we have latest lookahead translation. See comments at user semantic actions for why this is necessary. */ @@ -1900,7 +1710,7 @@ yyerrlab: { ++yynerrs; #if ! YYERROR_VERBOSE - yyerror (YY_("syntax error")); + yyerror (yyscanner, YY_("syntax error")); #else # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ yyssp, yytoken) @@ -1927,7 +1737,7 @@ yyerrlab: yymsgp = yymsg; } } - yyerror (yymsgp); + yyerror (yyscanner, yymsgp); if (yysyntax_error_status == 2) goto yyexhaustedlab; } @@ -1951,7 +1761,7 @@ yyerrlab: else { yydestruct ("Error: discarding", - yytoken, &yylval); + yytoken, &yylval, yyscanner); yychar = YYEMPTY; } } @@ -1973,7 +1783,7 @@ yyerrorlab: if (/*CONSTCOND*/ 0) goto yyerrorlab; - /* Do not reclaim the symbols of the rule which action triggered + /* Do not reclaim the symbols of the rule whose action triggered this YYERROR. */ YYPOPSTACK (yylen); yylen = 0; @@ -2009,13 +1819,15 @@ yyerrlab1: yydestruct ("Error: popping", - yystos[yystate], yyvsp); + yystos[yystate], yyvsp, yyscanner); YYPOPSTACK (1); yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); } + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END /* Shift the error token. */ @@ -2039,12 +1851,12 @@ yyabortlab: yyresult = 1; goto yyreturn; -#if !defined(yyoverflow) || YYERROR_VERBOSE +#if !defined yyoverflow || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ yyexhaustedlab: - yyerror (YY_("memory exhausted")); + yyerror (yyscanner, YY_("memory exhausted")); yyresult = 2; /* Fall through. */ #endif @@ -2056,16 +1868,16 @@ yyreturn: user semantic actions for why this is necessary. */ yytoken = YYTRANSLATE (yychar); yydestruct ("Cleanup: discarding lookahead", - yytoken, &yylval); + yytoken, &yylval, yyscanner); } - /* Do not reclaim the symbols of the rule which action triggered + /* Do not reclaim the symbols of the rule whose action triggered this YYABORT or YYACCEPT. */ YYPOPSTACK (yylen); YY_STACK_PRINT (yyss, yyssp); while (yyssp != yyss) { yydestruct ("Cleanup: popping", - yystos[*yyssp], yyvsp); + yystos[*yyssp], yyvsp, yyscanner); YYPOPSTACK (1); } #ifndef yyoverflow @@ -2076,13 +1888,8 @@ yyreturn: if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); #endif - /* Make sure YYID is used. */ - return YYID (yyresult); + return yyresult; } - - - -/* Line 2067 of yacc.c */ -#line 286 "cmFortranParser.y" +#line 278 "cmFortranParser.y" /* yacc.c:1906 */ /* End of grammar */ diff --git a/Source/cmFortranParser.y b/Source/cmFortranParser.y index 31c268d22..996bef6ad 100644 --- a/Source/cmFortranParser.y +++ b/Source/cmFortranParser.y @@ -32,9 +32,7 @@ Run bison like this: cmFortranParser.y Modify cmFortranParser.cxx: - - remove TABs - - remove use of the 'register' storage class specifier - - Remove the yyerrorlab block in range ["goto yyerrlab1", "yyerrlab1:"] + - "#if 0" out yyerrorlab block in range ["goto yyerrlab1", "yyerrlab1:"] */ /*-------------------------------------------------------------------------*/ @@ -44,18 +42,11 @@ Modify cmFortranParser.cxx: #include -/* Configure the parser to use a lexer object. */ -#define YYPARSE_PARAM yyscanner -#define YYLEX_PARAM yyscanner -#define YYERROR_VERBOSE 1 -#define cmFortran_yyerror(x) \ - cmFortranError(yyscanner, x) - /* Forward declare the lexer entry point. */ YY_DECL; -/* Helper function to forward error callback. */ -static void cmFortranError(yyscan_t yyscanner, const char* message) +/* Helper function to forward error callback from parser. */ +static void cmFortran_yyerror(yyscan_t yyscanner, const char* message) { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_Error(parser, message); @@ -79,7 +70,13 @@ static bool cmFortranParserIsKeyword(const char* word, %} /* Generate a reentrant parser object. */ -%pure-parser +%define api.pure + +/* Configure the parser to use a lexer object. */ +%lex-param {yyscan_t yyscanner} +%parse-param {yyscan_t yyscanner} + +%define parse.error verbose %union { char* string; diff --git a/Source/cmFortranParserTokens.h b/Source/cmFortranParserTokens.h index cfbdd1ea5..df1aec3b2 100644 --- a/Source/cmFortranParserTokens.h +++ b/Source/cmFortranParserTokens.h @@ -1,8 +1,8 @@ -/* A Bison parser, made by GNU Bison 2.5. */ +/* A Bison parser, made by GNU Bison 3.0.2. */ /* Bison interface for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -30,43 +30,51 @@ This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ +#ifndef YY_CMFORTRAN_YY_CMFORTRANPARSERTOKENS_H_INCLUDED +# define YY_CMFORTRAN_YY_CMFORTRANPARSERTOKENS_H_INCLUDED +/* Debug traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif +#if YYDEBUG +extern int cmFortran_yydebug; +#endif -/* Tokens. */ +/* Token type. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - EOSTMT = 258, - ASSIGNMENT_OP = 259, - GARBAGE = 260, - CPP_INCLUDE = 261, - F90PPR_INCLUDE = 262, - COCO_INCLUDE = 263, - F90PPR_DEFINE = 264, - CPP_DEFINE = 265, - F90PPR_UNDEF = 266, - CPP_UNDEF = 267, - CPP_IFDEF = 268, - CPP_IFNDEF = 269, - CPP_IF = 270, - CPP_ELSE = 271, - CPP_ELIF = 272, - CPP_ENDIF = 273, - F90PPR_IFDEF = 274, - F90PPR_IFNDEF = 275, - F90PPR_IF = 276, - F90PPR_ELSE = 277, - F90PPR_ELIF = 278, - F90PPR_ENDIF = 279, - COMMA = 280, - DCOLON = 281, - CPP_TOENDL = 282, - UNTERMINATED_STRING = 283, - STRING = 284, - WORD = 285, - CPP_INCLUDE_ANGLE = 286 - }; + enum yytokentype + { + EOSTMT = 258, + ASSIGNMENT_OP = 259, + GARBAGE = 260, + CPP_INCLUDE = 261, + F90PPR_INCLUDE = 262, + COCO_INCLUDE = 263, + F90PPR_DEFINE = 264, + CPP_DEFINE = 265, + F90PPR_UNDEF = 266, + CPP_UNDEF = 267, + CPP_IFDEF = 268, + CPP_IFNDEF = 269, + CPP_IF = 270, + CPP_ELSE = 271, + CPP_ELIF = 272, + CPP_ENDIF = 273, + F90PPR_IFDEF = 274, + F90PPR_IFNDEF = 275, + F90PPR_IF = 276, + F90PPR_ELSE = 277, + F90PPR_ELIF = 278, + F90PPR_ENDIF = 279, + COMMA = 280, + DCOLON = 281, + CPP_TOENDL = 282, + UNTERMINATED_STRING = 283, + STRING = 284, + WORD = 285, + CPP_INCLUDE_ANGLE = 286 + }; #endif /* Tokens. */ #define EOSTMT 258 @@ -99,24 +107,23 @@ #define WORD 285 #define CPP_INCLUDE_ANGLE 286 - - - +/* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE +typedef union YYSTYPE YYSTYPE; +union YYSTYPE { - -/* Line 2068 of yacc.c */ -#line 89 "cmFortranParser.y" +#line 81 "cmFortranParser.y" /* yacc.c:1909 */ char* string; - - -/* Line 2068 of yacc.c */ -#line 118 "cmFortranParserTokens.h" -} YYSTYPE; +#line 120 "cmFortranParserTokens.h" /* yacc.c:1909 */ +}; # define YYSTYPE_IS_TRIVIAL 1 -# define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 #endif + + + +int cmFortran_yyparse (yyscan_t yyscanner); + +#endif /* !YY_CMFORTRAN_YY_CMFORTRANPARSERTOKENS_H_INCLUDED */ From cd530df88ff17a3b150ab62b930fab0da2df8605 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 15 Jul 2015 14:16:11 -0400 Subject: [PATCH 0418/1048] cmNinjaTargetGenerator: Factor out compile command exporter --- Source/cmNinjaTargetGenerator.cxx | 152 +++++++++++++++++------------- Source/cmNinjaTargetGenerator.h | 11 +++ 2 files changed, 98 insertions(+), 65 deletions(-) diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 74f262c59..4bc6b9888 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -546,22 +546,39 @@ cmNinjaTargetGenerator ::WriteObjectBuildStatement( cmSourceFile const* source, bool writeOrderDependsTargetForTarget) { + std::string const language = source->GetLanguage(); + std::string const sourceFileName = + language=="RC" ? source->GetFullPath() : this->GetSourceFilePath(source); + std::string const objectDir = this->Target->GetSupportDirectory(); + std::string const objectFileName = this->GetObjectFilePath(source); + std::string const objectFileDir = + cmSystemTools::GetFilenamePath(objectFileName); + + cmNinjaVars vars; + vars["FLAGS"] = this->ComputeFlagsForObject(source, language); + vars["DEFINES"] = this->ComputeDefines(source, language); + vars["INCLUDES"] = this->GetIncludes(language); + if (!this->NeedDepTypeMSVC(language)) + { + vars["DEP_FILE"] = + cmGlobalNinjaGenerator::EncodeDepfileSpace(objectFileName + ".d"); + } + + this->ExportObjectCompileCommand( + language, sourceFileName, + objectDir, objectFileName, objectFileDir, + vars["FLAGS"], vars["DEFINES"], vars["INCLUDES"] + ); + std::string comment; - const std::string language = source->GetLanguage(); std::string rule = this->LanguageCompilerRule(language); cmNinjaDeps outputs; - std::string objectFileName = this->GetObjectFilePath(source); outputs.push_back(objectFileName); // Add this object to the list of object files. this->Objects.push_back(objectFileName); cmNinjaDeps explicitDeps; - std::string sourceFileName; - if (language == "RC") - sourceFileName = source->GetFullPath(); - else - sourceFileName = this->GetSourceFilePath(source); explicitDeps.push_back(sourceFileName); cmNinjaDeps implicitDeps; @@ -596,21 +613,11 @@ cmNinjaTargetGenerator orderOnlyDeps); } - cmNinjaVars vars; - vars["FLAGS"] = this->ComputeFlagsForObject(source, language); - vars["DEFINES"] = this->ComputeDefines(source, language); - vars["INCLUDES"] = this->GetIncludes(language); - if (!this->NeedDepTypeMSVC(language)) { - vars["DEP_FILE"] = - cmGlobalNinjaGenerator::EncodeDepfileSpace(objectFileName + ".d"); - } EnsureParentDirectoryExists(objectFileName); - std::string objectDir = this->Target->GetSupportDirectory(); vars["OBJECT_DIR"] = this->GetLocalGenerator()->ConvertToOutputFormat( ConvertToNinjaPath(objectDir), cmLocalGenerator::SHELL); - std::string objectFileDir = cmSystemTools::GetFilenamePath(objectFileName); vars["OBJECT_FILE_DIR"] = this->GetLocalGenerator()->ConvertToOutputFormat( ConvertToNinjaPath(objectFileDir), cmLocalGenerator::SHELL); @@ -619,54 +626,6 @@ cmNinjaTargetGenerator this->SetMsvcTargetPdbVariable(vars); - if(this->Makefile->IsOn("CMAKE_EXPORT_COMPILE_COMMANDS")) - { - cmLocalGenerator::RuleVariables compileObjectVars; - std::string lang = language; - compileObjectVars.Language = lang.c_str(); - - std::string escapedSourceFileName = sourceFileName; - - if (!cmSystemTools::FileIsFullPath(sourceFileName.c_str())) - { - escapedSourceFileName = cmSystemTools::CollapseFullPath( - escapedSourceFileName, - this->GetGlobalGenerator()->GetCMakeInstance()-> - GetHomeOutputDirectory()); - } - - escapedSourceFileName = - this->LocalGenerator->ConvertToOutputFormat( - escapedSourceFileName, cmLocalGenerator::SHELL); - - compileObjectVars.Source = escapedSourceFileName.c_str(); - compileObjectVars.Object = objectFileName.c_str(); - compileObjectVars.ObjectDir = objectDir.c_str(); - compileObjectVars.ObjectFileDir = objectFileDir.c_str(); - compileObjectVars.Flags = vars["FLAGS"].c_str(); - compileObjectVars.Defines = vars["DEFINES"].c_str(); - compileObjectVars.Includes = vars["INCLUDES"].c_str(); - - // Rule for compiling object file. - std::string compileCmdVar = "CMAKE_"; - compileCmdVar += language; - compileCmdVar += "_COMPILE_OBJECT"; - std::string compileCmd = - this->GetMakefile()->GetRequiredDefinition(compileCmdVar); - std::vector compileCmds; - cmSystemTools::ExpandListArgument(compileCmd, compileCmds); - - for (std::vector::iterator i = compileCmds.begin(); - i != compileCmds.end(); ++i) - this->GetLocalGenerator()->ExpandRuleVariables(*i, compileObjectVars); - - std::string cmdLine = - this->GetLocalGenerator()->BuildCommandLine(compileCmds); - - this->GetGlobalGenerator()->AddCXXCompileCommand(cmdLine, - sourceFileName); - } - this->GetGlobalGenerator()->WriteBuild(this->GetBuildFileStream(), comment, rule, @@ -688,6 +647,69 @@ cmNinjaTargetGenerator } } +void +cmNinjaTargetGenerator +::ExportObjectCompileCommand( + std::string const& language, + std::string const& sourceFileName, + std::string const& objectDir, + std::string const& objectFileName, + std::string const& objectFileDir, + std::string const& flags, + std::string const& defines, + std::string const& includes + ) +{ + if(!this->Makefile->IsOn("CMAKE_EXPORT_COMPILE_COMMANDS")) + { + return; + } + + cmLocalGenerator::RuleVariables compileObjectVars; + compileObjectVars.Language = language.c_str(); + + std::string escapedSourceFileName = sourceFileName; + + if (!cmSystemTools::FileIsFullPath(sourceFileName.c_str())) + { + escapedSourceFileName = cmSystemTools::CollapseFullPath( + escapedSourceFileName, + this->GetGlobalGenerator()->GetCMakeInstance()-> + GetHomeOutputDirectory()); + } + + escapedSourceFileName = + this->LocalGenerator->ConvertToOutputFormat( + escapedSourceFileName, cmLocalGenerator::SHELL); + + compileObjectVars.Source = escapedSourceFileName.c_str(); + compileObjectVars.Object = objectFileName.c_str(); + compileObjectVars.ObjectDir = objectDir.c_str(); + compileObjectVars.ObjectFileDir = objectFileDir.c_str(); + compileObjectVars.Flags = flags.c_str(); + compileObjectVars.Defines = defines.c_str(); + compileObjectVars.Includes = includes.c_str(); + + // Rule for compiling object file. + std::string compileCmdVar = "CMAKE_"; + compileCmdVar += language; + compileCmdVar += "_COMPILE_OBJECT"; + std::string compileCmd = + this->GetMakefile()->GetRequiredDefinition(compileCmdVar); + std::vector compileCmds; + cmSystemTools::ExpandListArgument(compileCmd, compileCmds); + + for (std::vector::iterator i = compileCmds.begin(); + i != compileCmds.end(); ++i) + this->GetLocalGenerator()->ExpandRuleVariables(*i, compileObjectVars); + + std::string cmdLine = + this->GetLocalGenerator()->BuildCommandLine(compileCmds); + + this->GetGlobalGenerator()->AddCXXCompileCommand(cmdLine, + sourceFileName); +} + void cmNinjaTargetGenerator ::EnsureDirectoryExists(const std::string& path) const diff --git a/Source/cmNinjaTargetGenerator.h b/Source/cmNinjaTargetGenerator.h index 89124316d..a10ceba7b 100644 --- a/Source/cmNinjaTargetGenerator.h +++ b/Source/cmNinjaTargetGenerator.h @@ -114,6 +114,17 @@ protected: void WriteObjectBuildStatement(cmSourceFile const* source, bool writeOrderDependsTargetForTarget); + void ExportObjectCompileCommand( + std::string const& language, + std::string const& sourceFileName, + std::string const& objectDir, + std::string const& objectFileName, + std::string const& objectFileDir, + std::string const& flags, + std::string const& defines, + std::string const& includes + ); + cmNinjaDeps GetObjects() const { return this->Objects; } From 42f0155bb9f7cb65c7af103ec1170f4193244d69 Mon Sep 17 00:00:00 2001 From: Konstantin Podsvirov Date: Fri, 24 Jul 2015 10:15:06 +0300 Subject: [PATCH 0419/1048] cmake-gui: Install Qt5 Windows platform plugin Qt5 requires a platform-specific runtime-loaded plugin. We already install it for OS X. Install it for Windows too. --- Source/QtDialog/CMakeLists.txt | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/Source/QtDialog/CMakeLists.txt b/Source/QtDialog/CMakeLists.txt index 038c41170..ba993eb28 100644 --- a/Source/QtDialog/CMakeLists.txt +++ b/Source/QtDialog/CMakeLists.txt @@ -36,17 +36,22 @@ if (Qt5Widgets_FOUND) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}") - # We need to install Cocoa platform plugin and add qt.conf for Qt5 on Mac. + # We need to install platform plugin and add qt.conf for Qt5 on Mac and Windows. # FIXME: This should be part of Qt5 CMake scripts, but unfortunatelly - # Qt5 Mac support is missing there. - if(APPLE) + # Qt5 support is missing there. + if(APPLE OR WIN32) macro(install_qt5_plugin _qt_plugin_name _qt_plugins_var) get_target_property(_qt_plugin_path "${_qt_plugin_name}" LOCATION) if(EXISTS "${_qt_plugin_path}") get_filename_component(_qt_plugin_file "${_qt_plugin_path}" NAME) get_filename_component(_qt_plugin_type "${_qt_plugin_path}" PATH) get_filename_component(_qt_plugin_type "${_qt_plugin_type}" NAME) - set(_qt_plugin_dest "PlugIns/${_qt_plugin_type}") + if(APPLE) + set(_qt_plugin_dir "PlugIns") + elseif(WIN32) + set(_qt_plugin_dir "plugins") + endif() + set(_qt_plugin_dest "${_qt_plugin_dir}/${_qt_plugin_type}") install(FILES "${_qt_plugin_path}" DESTINATION "${_qt_plugin_dest}" ${COMPONENT}) @@ -56,12 +61,21 @@ if (Qt5Widgets_FOUND) message(FATAL_ERROR "QT plugin ${_qt_plugin_name} not found") endif() endmacro() - install_qt5_plugin("Qt5::QCocoaIntegrationPlugin" QT_PLUGINS) - file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/qt.conf" - "[Paths]\nPlugins = PlugIns\n") - install(FILES "${CMAKE_CURRENT_BINARY_DIR}/qt.conf" - DESTINATION "${CMAKE_INSTALL_PREFIX}/Resources" - ${COMPONENT}) + if(APPLE) + install_qt5_plugin("Qt5::QCocoaIntegrationPlugin" QT_PLUGINS) + file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/qt.conf" + "[Paths]\nPlugins = ${_qt_plugin_dir}\n") + install(FILES "${CMAKE_CURRENT_BINARY_DIR}/qt.conf" + DESTINATION "${CMAKE_INSTALL_PREFIX}/Resources" + ${COMPONENT}) + elseif(WIN32) + install_qt5_plugin("Qt5::QWindowsIntegrationPlugin" QT_PLUGINS) + file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/qt.conf" + "[Paths]\nPlugins = ../${_qt_plugin_dir}\n") + install(FILES "${CMAKE_CURRENT_BINARY_DIR}/qt.conf" + DESTINATION bin + ${COMPONENT}) + endif() endif() if(WIN32 AND TARGET Qt5::Core) From 068e7962bb8a90ae9ae6b7d6da520a70701820af Mon Sep 17 00:00:00 2001 From: Konstantin Podsvirov Date: Fri, 24 Jul 2015 10:15:06 +0300 Subject: [PATCH 0420/1048] CMake: Add CMake_INSTALL_DEPENDENCIES option By default this option is ON. Turn OFF to disable installing runtime 3rd-party dependencies. --- CMakeCPack.cmake | 4 +++- CMakeLists.txt | 5 +++++ Source/QtDialog/CMakeLists.txt | 4 ++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CMakeCPack.cmake b/CMakeCPack.cmake index ce10ad0ed..a0aadcc9f 100644 --- a/CMakeCPack.cmake +++ b/CMakeCPack.cmake @@ -22,7 +22,9 @@ if(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake") set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS ON) endif() - include(${CMake_SOURCE_DIR}/Modules/InstallRequiredSystemLibraries.cmake) + if(CMake_INSTALL_DEPENDENCIES) + include(${CMake_SOURCE_DIR}/Modules/InstallRequiredSystemLibraries.cmake) + endif() endif() set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "CMake is a build tool") diff --git a/CMakeLists.txt b/CMakeLists.txt index 5e9402847..a47c2ade7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -70,6 +70,11 @@ macro(CMake_OPTIONAL_COMPONENT NAME) endif() endmacro() +# option to disable installing 3rd-party dependencies +option(CMake_INSTALL_DEPENDENCIES + "Whether to install 3rd-party runtime dependencies" ON) +mark_as_advanced(CMake_INSTALL_DEPENDENCIES) + #----------------------------------------------------------------------- # a macro to deal with system libraries, implemented as a macro # simply to improve readability of the main script diff --git a/Source/QtDialog/CMakeLists.txt b/Source/QtDialog/CMakeLists.txt index ba993eb28..ad6a7fb62 100644 --- a/Source/QtDialog/CMakeLists.txt +++ b/Source/QtDialog/CMakeLists.txt @@ -39,7 +39,7 @@ if (Qt5Widgets_FOUND) # We need to install platform plugin and add qt.conf for Qt5 on Mac and Windows. # FIXME: This should be part of Qt5 CMake scripts, but unfortunatelly # Qt5 support is missing there. - if(APPLE OR WIN32) + if(CMake_INSTALL_DEPENDENCIES AND (APPLE OR WIN32)) macro(install_qt5_plugin _qt_plugin_name _qt_plugins_var) get_target_property(_qt_plugin_path "${_qt_plugin_name}" LOCATION) if(EXISTS "${_qt_plugin_path}") @@ -213,7 +213,7 @@ if(APPLE) " ${COMPONENT}) endif() -if(APPLE OR WIN32) +if(CMake_INSTALL_DEPENDENCIES AND (APPLE OR WIN32)) # install rules for including 3rd party libs such as Qt # if a system Qt is used (e.g. installed in /usr/lib/), it will not be included in the installation set(fixup_exe "\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/bin/cmake-gui${CMAKE_EXECUTABLE_SUFFIX}") From e7d5c142c6ed1aca4eff85781bb03ebba8fb69bc Mon Sep 17 00:00:00 2001 From: Sebastian Schuberth Date: Mon, 27 Jul 2015 16:58:54 +0200 Subject: [PATCH 0421/1048] cmConditionEvaluator: Remove superfluous spaces in expressions --- Source/cmConditionEvaluator.cxx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Source/cmConditionEvaluator.cxx b/Source/cmConditionEvaluator.cxx index 61847d42b..420bfdf36 100644 --- a/Source/cmConditionEvaluator.cxx +++ b/Source/cmConditionEvaluator.cxx @@ -299,11 +299,11 @@ void cmConditionEvaluator::IncrementArguments(cmArgumentList &newArgs, cmArgumentList::iterator &argP1, cmArgumentList::iterator &argP2) const { - if (argP1 != newArgs.end()) + if (argP1 != newArgs.end()) { argP1++; argP2 = argP1; - if (argP1 != newArgs.end()) + if (argP1 != newArgs.end()) { argP2++; } @@ -442,35 +442,35 @@ bool cmConditionEvaluator::HandleLevel1(cmArgumentList &newArgs, argP1 = arg; this->IncrementArguments(newArgs,argP1,argP2); // does a file exist - if (this->IsKeyword("EXISTS", *arg) && argP1 != newArgs.end()) + if (this->IsKeyword("EXISTS", *arg) && argP1 != newArgs.end()) { this->HandlePredicate( cmSystemTools::FileExists(argP1->c_str()), reducible, arg, newArgs, argP1, argP2); } // does a directory with this name exist - if (this->IsKeyword("IS_DIRECTORY", *arg) && argP1 != newArgs.end()) + if (this->IsKeyword("IS_DIRECTORY", *arg) && argP1 != newArgs.end()) { this->HandlePredicate( cmSystemTools::FileIsDirectory(argP1->c_str()), reducible, arg, newArgs, argP1, argP2); } // does a symlink with this name exist - if (this->IsKeyword("IS_SYMLINK", *arg) && argP1 != newArgs.end()) + if (this->IsKeyword("IS_SYMLINK", *arg) && argP1 != newArgs.end()) { this->HandlePredicate( cmSystemTools::FileIsSymlink(argP1->c_str()), reducible, arg, newArgs, argP1, argP2); } // is the given path an absolute path ? - if (this->IsKeyword("IS_ABSOLUTE", *arg) && argP1 != newArgs.end()) + if (this->IsKeyword("IS_ABSOLUTE", *arg) && argP1 != newArgs.end()) { this->HandlePredicate( cmSystemTools::FileIsFullPath(argP1->c_str()), reducible, arg, newArgs, argP1, argP2); } // does a command exist - if (this->IsKeyword("COMMAND", *arg) && argP1 != newArgs.end()) + if (this->IsKeyword("COMMAND", *arg) && argP1 != newArgs.end()) { cmCommand* command = this->Makefile.GetState()->GetCommand(argP1->c_str()); @@ -494,7 +494,7 @@ bool cmConditionEvaluator::HandleLevel1(cmArgumentList &newArgs, reducible, arg, newArgs, argP1, argP2); } // is a variable defined - if (this->IsKeyword("DEFINED", *arg) && argP1 != newArgs.end()) + if (this->IsKeyword("DEFINED", *arg) && argP1 != newArgs.end()) { size_t argP1len = argP1->GetValue().size(); bool bdef = false; From d568eefe104e480706a2e6ceb16df4376d4becbf Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 25 Jul 2015 17:52:10 +0200 Subject: [PATCH 0422/1048] cmCustomCommandGenerator: Require cmLocalGenerator in API. --- Source/cmCustomCommandGenerator.cxx | 22 +++++++++++++--------- Source/cmCustomCommandGenerator.h | 6 +++--- Source/cmGeneratorTarget.cxx | 3 ++- Source/cmGlobalXCodeGenerator.cxx | 4 ++-- Source/cmLocalNinjaGenerator.cxx | 2 +- Source/cmLocalUnixMakefileGenerator3.cxx | 6 ++---- Source/cmLocalVisualStudio6Generator.cxx | 4 ++-- Source/cmLocalVisualStudio7Generator.cxx | 4 ++-- Source/cmMakefileTargetGenerator.cxx | 5 +++-- Source/cmNinjaNormalTargetGenerator.cxx | 2 +- Source/cmNinjaTargetGenerator.cxx | 2 +- Source/cmNinjaUtilityTargetGenerator.cxx | 4 ++-- Source/cmVisualStudio10TargetGenerator.cxx | 4 ++-- 13 files changed, 36 insertions(+), 32 deletions(-) diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx index f654eb9e4..8483a9170 100644 --- a/Source/cmCustomCommandGenerator.cxx +++ b/Source/cmCustomCommandGenerator.cxx @@ -12,14 +12,15 @@ #include "cmCustomCommandGenerator.h" #include "cmMakefile.h" +#include "cmLocalGenerator.h" #include "cmCustomCommand.h" #include "cmOutputConverter.h" #include "cmGeneratorExpression.h" //---------------------------------------------------------------------------- cmCustomCommandGenerator::cmCustomCommandGenerator( - cmCustomCommand const& cc, const std::string& config, cmMakefile* mf): - CC(cc), Config(config), Makefile(mf), + cmCustomCommand const& cc, const std::string& config, cmLocalGenerator* lg): + CC(cc), Config(config), LG(lg), OldStyle(cc.GetEscapeOldStyle()), MakeVars(cc.GetEscapeAllowMakeVars()), GE(new cmGeneratorExpression(cc.GetBacktrace())), DependsDone(false) { @@ -41,13 +42,15 @@ unsigned int cmCustomCommandGenerator::GetNumberOfCommands() const std::string cmCustomCommandGenerator::GetCommand(unsigned int c) const { std::string const& argv0 = this->CC.GetCommandLines()[c][0]; - cmTarget* target = this->Makefile->FindTargetToUse(argv0); + cmTarget* target = this->LG->GetMakefile()->FindTargetToUse(argv0); if(target && target->GetType() == cmTarget::EXECUTABLE && - (target->IsImported() || !this->Makefile->IsOn("CMAKE_CROSSCOMPILING"))) + (target->IsImported() + || !this->LG->GetMakefile()->IsOn("CMAKE_CROSSCOMPILING"))) { return target->GetLocation(this->Config); } - return this->GE->Parse(argv0)->Evaluate(this->Makefile, this->Config); + return this->GE->Parse(argv0)->Evaluate(this->LG->GetMakefile(), + this->Config); } //---------------------------------------------------------------------------- @@ -87,8 +90,9 @@ cmCustomCommandGenerator cmCustomCommandLine const& commandLine = this->CC.GetCommandLines()[c]; for(unsigned int j=1;j < commandLine.size(); ++j) { - std::string arg = this->GE->Parse(commandLine[j])->Evaluate(this->Makefile, - this->Config); + std::string arg = + this->GE->Parse(commandLine[j])->Evaluate(this->LG->GetMakefile(), + this->Config); cmd += " "; if(this->OldStyle) { @@ -96,7 +100,7 @@ cmCustomCommandGenerator } else { - cmOutputConverter converter(this->Makefile->GetStateSnapshot()); + cmOutputConverter converter(this->LG->GetMakefile()->GetStateSnapshot()); cmd += converter.EscapeForShell(arg, this->MakeVars); } } @@ -141,7 +145,7 @@ std::vector const& cmCustomCommandGenerator::GetDepends() const = this->GE->Parse(*i); std::vector result; cmSystemTools::ExpandListArgument( - cge->Evaluate(this->Makefile, this->Config), result); + cge->Evaluate(this->LG->GetMakefile(), this->Config), result); for (std::vector::iterator it = result.begin(); it != result.end(); ++it) { diff --git a/Source/cmCustomCommandGenerator.h b/Source/cmCustomCommandGenerator.h index 7ad95d1d8..a637fed7c 100644 --- a/Source/cmCustomCommandGenerator.h +++ b/Source/cmCustomCommandGenerator.h @@ -15,14 +15,14 @@ #include "cmStandardIncludes.h" class cmCustomCommand; -class cmMakefile; +class cmLocalGenerator; class cmGeneratorExpression; class cmCustomCommandGenerator { cmCustomCommand const& CC; std::string Config; - cmMakefile* Makefile; + cmLocalGenerator* LG; bool OldStyle; bool MakeVars; cmGeneratorExpression* GE; @@ -31,7 +31,7 @@ class cmCustomCommandGenerator public: cmCustomCommandGenerator(cmCustomCommand const& cc, const std::string& config, - cmMakefile* mf); + cmLocalGenerator* lg); ~cmCustomCommandGenerator(); cmCustomCommand const& GetCC() const { return this->CC; } unsigned int GetNumberOfCommands() const; diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index e6f7a43df..dc5a2a15a 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -938,7 +938,8 @@ void cmTargetTraceDependencies::FollowCommandDepends(cmCustomCommand const& cc, const std::string& config, std::set& emitted) { - cmCustomCommandGenerator ccg(cc, config, this->Makefile); + cmCustomCommandGenerator ccg(cc, config, + this->GeneratorTarget->LocalGenerator); const std::vector& depends = ccg.GetDepends(); diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 21075bba5..6e46bc01e 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -1668,7 +1668,7 @@ void cmGlobalXCodeGenerator for(std::vector::const_iterator i = commands.begin(); i != commands.end(); ++i) { - cmCustomCommandGenerator ccg(*i, configName, this->CurrentMakefile); + cmCustomCommandGenerator ccg(*i, configName, this->CurrentLocalGenerator); if(ccg.GetNumberOfCommands() > 0) { const std::vector& outputs = ccg.GetOutputs(); @@ -1694,7 +1694,7 @@ void cmGlobalXCodeGenerator for(std::vector::const_iterator i = commands.begin(); i != commands.end(); ++i) { - cmCustomCommandGenerator ccg(*i, configName, this->CurrentMakefile); + cmCustomCommandGenerator ccg(*i, configName, this->CurrentLocalGenerator); if(ccg.GetNumberOfCommands() > 0) { makefileStream << "\n"; diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index a293d061c..9889bd4c2 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -404,7 +404,7 @@ cmLocalNinjaGenerator::WriteCustomCommandBuildStatement( if (this->GetGlobalNinjaGenerator()->SeenCustomCommand(cc)) return; - cmCustomCommandGenerator ccg(*cc, this->GetConfigName(), this->Makefile); + cmCustomCommandGenerator ccg(*cc, this->GetConfigName(), this); const std::vector &outputs = ccg.GetOutputs(); const std::vector &byproducts = ccg.GetByproducts(); diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 077d4d93a..de86c6b45 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -1007,8 +1007,7 @@ cmLocalUnixMakefileGenerator3 for(std::vector::const_iterator i = ccs.begin(); i != ccs.end(); ++i) { - cmCustomCommandGenerator ccg(*i, this->ConfigName, - this->Makefile); + cmCustomCommandGenerator ccg(*i, this->ConfigName, this); this->AppendCustomDepend(depends, ccg); } } @@ -1043,8 +1042,7 @@ cmLocalUnixMakefileGenerator3 for(std::vector::const_iterator i = ccs.begin(); i != ccs.end(); ++i) { - cmCustomCommandGenerator ccg(*i, this->ConfigName, - this->Makefile); + cmCustomCommandGenerator ccg(*i, this->ConfigName, this); this->AppendCustomCommand(commands, ccg, target, true, relative); } } diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index a26a1dd08..92630531a 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -62,7 +62,7 @@ public: } void Write(cmCustomCommand const& cc) { - cmCustomCommandGenerator ccg(cc, this->Config, this->LG->GetMakefile()); + cmCustomCommandGenerator ccg(cc, this->Config, this->LG); if(this->First) { this->Code += this->Event + "_Cmds="; @@ -625,7 +625,7 @@ cmLocalVisualStudio6Generator for(i = this->Configurations.begin(); i != this->Configurations.end(); ++i) { std::string config = this->GetConfigName(*i); - cmCustomCommandGenerator ccg(command, config, this->Makefile); + cmCustomCommandGenerator ccg(command, config, this); std::string comment = this->ConstructComment(ccg, "Building Custom Rule $(InputPath)"); if(comment == "") diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 0e5e7a57e..bf82c870f 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -619,7 +619,7 @@ public: } void Write(cmCustomCommand const& cc) { - cmCustomCommandGenerator ccg(cc, this->Config, this->LG->GetMakefile()); + cmCustomCommandGenerator ccg(cc, this->Config, this->LG); if(this->First) { const char* comment = ccg.GetComment(); @@ -1903,7 +1903,7 @@ WriteCustomRule(std::ostream& fout, for (std::vector::const_iterator i = configs.begin(); i != configs.end(); ++i) { - cmCustomCommandGenerator ccg(command, *i, this->Makefile); + cmCustomCommandGenerator ccg(command, *i, this); cmLVS7GFileConfig const& fc = fcinfo.FileConfigMap[*i]; fout << "\t\t\t\tGetCustomCommand(), this->ConfigName, - this->Makefile); + this->LocalGenerator); this->GenerateCustomRuleFile(ccg); if (clean) { @@ -1182,7 +1182,8 @@ cmMakefileTargetGenerator { if(cmCustomCommand* cc = (*source)->GetCustomCommand()) { - cmCustomCommandGenerator ccg(*cc, this->ConfigName, this->Makefile); + cmCustomCommandGenerator ccg(*cc, this->ConfigName, + this->LocalGenerator); const std::vector& outputs = ccg.GetOutputs(); depends.insert(depends.end(), outputs.begin(), outputs.end()); } diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index 88da09bab..ea2816b41 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -608,7 +608,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() ci = cmdLists[i]->begin(); ci != cmdLists[i]->end(); ++ci) { - cmCustomCommandGenerator ccg(*ci, cfgName, mf); + cmCustomCommandGenerator ccg(*ci, cfgName, this->GetLocalGenerator()); localGen.AppendCustomCommandLines(ccg, *cmdLineLists[i]); std::vector const& ccByproducts = ccg.GetByproducts(); std::transform(ccByproducts.begin(), ccByproducts.end(), diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 74f262c59..1479d0bc6 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -509,7 +509,7 @@ cmNinjaTargetGenerator { cmCustomCommand const* cc = *cci; cmCustomCommandGenerator ccg(*cc, this->GetConfigName(), - this->GetMakefile()); + this->GetLocalGenerator()); const std::vector& ccoutputs = ccg.GetOutputs(); const std::vector& ccbyproducts= ccg.GetByproducts(); std::transform(ccoutputs.begin(), ccoutputs.end(), diff --git a/Source/cmNinjaUtilityTargetGenerator.cxx b/Source/cmNinjaUtilityTargetGenerator.cxx index c3bf01133..58b901a9f 100644 --- a/Source/cmNinjaUtilityTargetGenerator.cxx +++ b/Source/cmNinjaUtilityTargetGenerator.cxx @@ -44,7 +44,7 @@ void cmNinjaUtilityTargetGenerator::Generate() for (std::vector::const_iterator ci = cmdLists[i]->begin(); ci != cmdLists[i]->end(); ++ci) { cmCustomCommandGenerator ccg(*ci, this->GetConfigName(), - this->GetMakefile()); + this->GetLocalGenerator()); this->GetLocalGenerator()->AppendCustomCommandDeps(ccg, deps); this->GetLocalGenerator()->AppendCustomCommandLines(ccg, commands); std::vector const& ccByproducts = ccg.GetByproducts(); @@ -65,7 +65,7 @@ void cmNinjaUtilityTargetGenerator::Generate() if(cmCustomCommand* cc = (*source)->GetCustomCommand()) { cmCustomCommandGenerator ccg(*cc, this->GetConfigName(), - this->GetMakefile()); + this->GetLocalGenerator()); this->GetLocalGenerator()->AddCustomCommandTarget(cc, this->GetTarget()); // Depend on all custom command outputs. diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 67d52b8d1..71785e954 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -890,7 +890,7 @@ cmVisualStudio10TargetGenerator::WriteCustomRule(cmSourceFile const* source, i = this->Configurations.begin(); i != this->Configurations.end(); ++i) { - cmCustomCommandGenerator ccg(command, *i, this->Makefile); + cmCustomCommandGenerator ccg(command, *i, this->LocalGenerator); std::string comment = lg->ConstructComment(ccg); comment = cmVS10EscapeComment(comment); std::string script = @@ -2794,7 +2794,7 @@ void cmVisualStudio10TargetGenerator::WriteEvent( for(std::vector::const_iterator i = commands.begin(); i != commands.end(); ++i) { - cmCustomCommandGenerator ccg(*i, configName, this->Makefile); + cmCustomCommandGenerator ccg(*i, configName, this->LocalGenerator); comment += pre; comment += lg->ConstructComment(ccg); script += pre; From a8e5d838edcb692ff69c2073cf692d7067f52c67 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 25 Jul 2015 17:55:34 +0200 Subject: [PATCH 0423/1048] cmCPackPropertiesGenerator: Require cmLocalGenerator in API. --- Source/cmCPackPropertiesGenerator.cxx | 10 ++++++---- Source/cmCPackPropertiesGenerator.h | 6 ++++-- Source/cmGlobalGenerator.cxx | 5 +++-- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/Source/cmCPackPropertiesGenerator.cxx b/Source/cmCPackPropertiesGenerator.cxx index 368a0e6de..cbcdd815e 100644 --- a/Source/cmCPackPropertiesGenerator.cxx +++ b/Source/cmCPackPropertiesGenerator.cxx @@ -1,13 +1,14 @@ #include "cmCPackPropertiesGenerator.h" #include "cmOutputConverter.h" +#include "cmLocalGenerator.h" cmCPackPropertiesGenerator::cmCPackPropertiesGenerator( - cmMakefile* mf, + cmLocalGenerator* lg, cmInstalledFile const& installedFile, std::vector const& configurations): cmScriptGenerator("CPACK_BUILD_CONFIG", configurations), - Makefile(mf), + LG(lg), InstalledFile(installedFile) { this->ActionsPerConfig = true; @@ -17,7 +18,8 @@ void cmCPackPropertiesGenerator::GenerateScriptForConfig(std::ostream& os, const std::string& config, Indent const& indent) { std::string const& expandedFileName = - this->InstalledFile.GetNameExpression().Evaluate(this->Makefile, config); + this->InstalledFile.GetNameExpression().Evaluate(this->LG->GetMakefile(), + config); cmInstalledFile::PropertyMapType const& properties = this->InstalledFile.GetProperties(); @@ -36,7 +38,7 @@ void cmCPackPropertiesGenerator::GenerateScriptForConfig(std::ostream& os, j = property.ValueExpressions.begin(); j != property.ValueExpressions.end(); ++j) { - std::string value = (*j)->Evaluate(this->Makefile, config); + std::string value = (*j)->Evaluate(LG->GetMakefile(), config); os << " " << cmOutputConverter::EscapeForCMake(value); } diff --git a/Source/cmCPackPropertiesGenerator.h b/Source/cmCPackPropertiesGenerator.h index 71e2eaa42..eec3df092 100644 --- a/Source/cmCPackPropertiesGenerator.h +++ b/Source/cmCPackPropertiesGenerator.h @@ -15,6 +15,8 @@ #include "cmScriptGenerator.h" #include "cmInstalledFile.h" +class cmLocalGenerator; + /** \class cmCPackPropertiesGenerator * \brief Support class for generating CPackProperties.cmake. * @@ -23,7 +25,7 @@ class cmCPackPropertiesGenerator: public cmScriptGenerator { public: cmCPackPropertiesGenerator( - cmMakefile* mf, + cmLocalGenerator* lg, cmInstalledFile const& installedFile, std::vector const& configurations); @@ -31,7 +33,7 @@ protected: virtual void GenerateScriptForConfig(std::ostream& os, const std::string& config, Indent const& indent); - cmMakefile* Makefile; + cmLocalGenerator* LG; cmInstalledFile const& InstalledFile; }; diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 88ac0bcd4..fcb59982b 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -3050,7 +3050,8 @@ bool cmGlobalGenerator::GenerateCPackPropertiesFile() cmake::InstalledFilesMap const& installedFiles = this->CMakeInstance->GetInstalledFiles(); - cmMakefile* mf = this->LocalGenerators[0]->GetMakefile(); + cmLocalGenerator* lg = this->LocalGenerators[0]; + cmMakefile* mf = lg->GetMakefile(); std::vector configs; std::string config = mf->GetConfigurations(configs, false); @@ -3072,7 +3073,7 @@ bool cmGlobalGenerator::GenerateCPackPropertiesFile() cmInstalledFile const& installedFile = i->second; cmCPackPropertiesGenerator cpackPropertiesGenerator( - mf, installedFile, configs); + lg, installedFile, configs); cpackPropertiesGenerator.Generate(file, config, configs); } From 0e0258c8b9c6cab7c55c90687b30d65a83783c2f Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 25 Jul 2015 19:58:20 +0200 Subject: [PATCH 0424/1048] cmGlobalGenerator: Split creation of generator object from initialization. --- Source/cmGlobalGenerator.cxx | 15 ++++++++++++++- Source/cmGlobalGenerator.h | 1 + 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index fcb59982b..45ef3998c 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1242,6 +1242,7 @@ void cmGlobalGenerator::Generate() // Create per-target generator information. this->CreateGeneratorTargets(); + this->InitGeneratorTargets(); #ifdef CMAKE_BUILD_WITH_CMAKE for (AutogensType::iterator it = autogens.begin(); it != autogens.end(); @@ -1471,7 +1472,6 @@ void cmGlobalGenerator::CreateGeneratorTargets(cmLocalGenerator *lg) { cmTarget* t = &ti->second; cmGeneratorTarget* gt = new cmGeneratorTarget(t, lg); - this->ComputeTargetObjectDirectory(gt); this->GeneratorTargets[t] = gt; generatorTargets[t] = gt; } @@ -1487,6 +1487,19 @@ void cmGlobalGenerator::CreateGeneratorTargets(cmLocalGenerator *lg) mf->SetGeneratorTargets(generatorTargets); } +//---------------------------------------------------------------------------- +void cmGlobalGenerator::InitGeneratorTargets() +{ + for(cmGeneratorTargetsType::iterator ti = + this->GeneratorTargets.begin(); ti != this->GeneratorTargets.end(); ++ti) + { + if (!ti->second->Target->IsImported()) + { + this->ComputeTargetObjectDirectory(ti->second); + } + } +} + //---------------------------------------------------------------------------- void cmGlobalGenerator::CreateGeneratorTargets() { diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 398335b6f..b9a32bf7b 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -485,6 +485,7 @@ private: cmGeneratorTargetsType GeneratorTargets; friend class cmake; void CreateGeneratorTargets(cmLocalGenerator* lg); + void InitGeneratorTargets(); void CreateGeneratorTargets(); void ClearGeneratorMembers(); From 57a69f934173eceaaf87e15074baf4e19402a687 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 25 Jul 2015 20:00:27 +0200 Subject: [PATCH 0425/1048] cmGlobalGenerator: Extract method to create generator objects. --- Source/cmGlobalGenerator.cxx | 10 ++++++++-- Source/cmGlobalGenerator.h | 2 ++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 45ef3998c..8550d0d31 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1151,6 +1151,13 @@ void cmGlobalGenerator::Configure() } } +void cmGlobalGenerator::CreateGenerationObjects() +{ + cmDeleteAll(this->GeneratorTargets); + this->GeneratorTargets.clear(); + this->CreateGeneratorTargets(); +} + cmExportBuildFileGenerator* cmGlobalGenerator::GetExportedTargetsFile(const std::string &filename) const { @@ -1240,8 +1247,7 @@ void cmGlobalGenerator::Generate() this->LocalGenerators[i]->AddHelperCommands(); } - // Create per-target generator information. - this->CreateGeneratorTargets(); + this->CreateGenerationObjects(); this->InitGeneratorTargets(); #ifdef CMAKE_BUILD_WITH_CMAKE diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index b9a32bf7b..7d9bb4c55 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -86,6 +86,8 @@ public: */ virtual void Configure(); + void CreateGenerationObjects(); + /** * Generate the all required files for building this project/tree. This * basically creates a series of LocalGenerators for each directory and From 58811998fb63975cc92abab23044630bc11cd26d Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 25 Jul 2015 20:42:28 +0200 Subject: [PATCH 0426/1048] cmGlobalGenerator: Add global targets at the end of Configure. Rather than at the start of Generate. --- Source/cmGlobalGenerator.cxx | 39 +++++++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 8550d0d31..f5ddd1090 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1149,6 +1149,25 @@ void cmGlobalGenerator::Configure() } this->CMakeInstance->UpdateProgress(msg.str().c_str(), -1); } + + unsigned int i; + + // Put a copy of each global target in every directory. + cmTargets globalTargets; + this->CreateDefaultGlobalTargets(&globalTargets); + + for (i = 0; i < this->LocalGenerators.size(); ++i) + { + cmMakefile* mf = this->LocalGenerators[i]->GetMakefile(); + cmTargets* targets = &(mf->GetTargets()); + cmTargets::iterator tit; + for ( tit = globalTargets.begin(); tit != globalTargets.end(); ++ tit ) + { + (*targets)[tit->first] = tit->second; + (*targets)[tit->first].SetMakefile(mf); + } + } + } void cmGlobalGenerator::CreateGenerationObjects() @@ -1222,23 +1241,11 @@ void cmGlobalGenerator::Generate() this->CreateQtAutoGeneratorsTargets(autogens); #endif - // For each existing cmLocalGenerator unsigned int i; - // Put a copy of each global target in every directory. - cmTargets globalTargets; - this->CreateDefaultGlobalTargets(&globalTargets); for (i = 0; i < this->LocalGenerators.size(); ++i) { this->LocalGenerators[i]->ComputeObjectMaxPath(); - cmMakefile* mf = this->LocalGenerators[i]->GetMakefile(); - cmTargets* targets = &(mf->GetTargets()); - cmTargets::iterator tit; - for ( tit = globalTargets.begin(); tit != globalTargets.end(); ++ tit ) - { - (*targets)[tit->first] = tit->second; - (*targets)[tit->first].SetMakefile(mf); - } } // Add generator specific helper commands @@ -1384,6 +1391,10 @@ void cmGlobalGenerator::CreateQtAutoGeneratorsTargets(AutogensType &autogens) for(cmTargets::iterator ti = targets.begin(); ti != targets.end(); ++ti) { + if (ti->second.GetType() == cmTarget::GLOBAL_TARGET) + { + continue; + } targetNames.push_back(ti->second.GetName()); } for(std::vector::iterator ti = targetNames.begin(); @@ -1432,6 +1443,10 @@ void cmGlobalGenerator::FinalizeTargetCompileInfo() ti != targets.end(); ++ti) { cmTarget* t = &ti->second; + if (t->GetType() == cmTarget::GLOBAL_TARGET) + { + continue; + } t->AppendBuildInterfaceIncludes(); From 72f43fa13ddb544f84891f14619e622baf29ae38 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 26 Jul 2015 10:11:44 +0200 Subject: [PATCH 0427/1048] cmLocalGenerator: Remove CreateCustomTargetsAndCommands method. It loops over cmGeneratorTargets, but at the point it is called, there are no cmGeneratorTargets. This must be dead code. --- Source/cmLocalGenerator.cxx | 42 ------------------------ Source/cmLocalGenerator.h | 6 ---- Source/cmLocalVisualStudio6Generator.cxx | 8 ----- Source/cmLocalVisualStudio6Generator.h | 1 - Source/cmLocalVisualStudio7Generator.cxx | 9 ----- 5 files changed, 66 deletions(-) diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 7e4b4700b..25f33d7e3 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -626,48 +626,6 @@ void cmLocalGenerator::AddBuildTargetRule(const std::string& llang, target.Target->AddSource(targetFullPath); } - -void cmLocalGenerator -::CreateCustomTargetsAndCommands(std::set const& lang) -{ - cmGeneratorTargetsType tgts = this->Makefile->GetGeneratorTargets(); - for(cmGeneratorTargetsType::iterator l = tgts.begin(); - l != tgts.end(); l++) - { - if (l->first->IsImported()) - { - continue; - } - cmGeneratorTarget& target = *l->second; - switch(target.GetType()) - { - case cmTarget::STATIC_LIBRARY: - case cmTarget::SHARED_LIBRARY: - case cmTarget::MODULE_LIBRARY: - case cmTarget::EXECUTABLE: - { - std::string llang = target.Target->GetLinkerLanguage(); - if(llang.empty()) - { - cmSystemTools::Error - ("CMake can not determine linker language for target: ", - target.Target->GetName().c_str()); - return; - } - // if the language is not in the set lang then create custom - // commands to build the target - if(lang.count(llang) == 0) - { - this->AddBuildTargetRule(llang, target); - } - } - break; - default: - break; - } - } -} - // List of variables that are replaced when // rules are expanced. These variables are // replaced in the form with GetSafeDefinition(var). diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 2dfe825e8..fee242042 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -338,12 +338,6 @@ protected: const std::string& lang, cmSourceFile& source, cmGeneratorTarget& target); - // Create Custom Targets and commands for unsupported languages - // The set passed in should contain the languages supported by the - // generator directly. Any targets containing files that are not - // of the types listed will be compiled as custom commands and added - // to a custom target. - void CreateCustomTargetsAndCommands(std::set const&); // Handle old-style install rules stored in the targets. void GenerateTargetInstallRules( diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index 92630531a..f1c8def41 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -82,14 +82,6 @@ private: std::string Event; }; -void cmLocalVisualStudio6Generator::AddHelperCommands() -{ - std::set lang; - lang.insert("C"); - lang.insert("CXX"); - this->CreateCustomTargetsAndCommands(lang); -} - void cmLocalVisualStudio6Generator::AddCMakeListsRules() { cmTargets &tgts = this->Makefile->GetTargets(); diff --git a/Source/cmLocalVisualStudio6Generator.h b/Source/cmLocalVisualStudio6Generator.h index 8f4d521eb..a44e61d3d 100644 --- a/Source/cmLocalVisualStudio6Generator.h +++ b/Source/cmLocalVisualStudio6Generator.h @@ -35,7 +35,6 @@ public: virtual ~cmLocalVisualStudio6Generator(); - virtual void AddHelperCommands(); virtual void AddCMakeListsRules(); /** diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index bf82c870f..f199a41c0 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -68,15 +68,6 @@ cmLocalVisualStudio7Generator::~cmLocalVisualStudio7Generator() void cmLocalVisualStudio7Generator::AddHelperCommands() { - std::set lang; - lang.insert("C"); - lang.insert("CXX"); - lang.insert("RC"); - lang.insert("IDL"); - lang.insert("DEF"); - lang.insert("Fortran"); - this->CreateCustomTargetsAndCommands(lang); - // Now create GUIDs for targets cmTargets &tgts = this->Makefile->GetTargets(); From e4dc83ade5f8b44d44f21d3f90185bf0264e5d9d Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 27 Jul 2015 20:57:39 +0200 Subject: [PATCH 0428/1048] cmLocalGenerator: Remove unused AddBuildTargetRule method. --- Source/cmLocalGenerator.cxx | 100 ------------------------------------ Source/cmLocalGenerator.h | 5 -- 2 files changed, 105 deletions(-) diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 25f33d7e3..cce10ce77 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -526,106 +526,6 @@ void cmLocalGenerator::AddCustomCommandToCreateObject(const char* ofname, ); } -void cmLocalGenerator::AddBuildTargetRule(const std::string& llang, - cmGeneratorTarget& target) -{ - std::string objs; - std::vector objVector; - std::string config = this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); - // Add all the sources outputs to the depends of the target - std::vector classes; - target.GetSourceFiles(classes, config); - for(std::vector::const_iterator i = classes.begin(); - i != classes.end(); ++i) - { - cmSourceFile* sf = *i; - if(!sf->GetCustomCommand() && - !sf->GetPropertyAsBool("HEADER_FILE_ONLY") && - !sf->GetPropertyAsBool("EXTERNAL_OBJECT")) - { - std::string dir_max; - dir_max += this->StateSnapshot.GetDirectory().GetCurrentBinary(); - dir_max += "/"; - std::string obj = this->GetObjectFileNameWithoutTarget(*sf, dir_max); - if(!obj.empty()) - { - std::string ofname = - this->StateSnapshot.GetDirectory().GetCurrentBinary(); - ofname += "/"; - ofname += obj; - objVector.push_back(ofname); - this->AddCustomCommandToCreateObject(ofname.c_str(), - llang, *(*i), target); - objs += this->Convert(ofname,START_OUTPUT,SHELL); - objs += " "; - } - } - } - std::string createRule = target.GetCreateRuleVariable(llang, config); - bool useWatcomQuote = this->Makefile->IsOn(createRule+"_USE_WATCOM_QUOTE"); - std::string targetName = target.Target->GetFullName(); - // Executable : - // Shared Library: - // Static Library: - // Shared Module: - std::string linkLibs; // should be set - std::string frameworkPath; - std::string linkPath; - std::string flags; // should be set - std::string linkFlags; // should be set - this->GetTargetFlags(linkLibs, frameworkPath, linkPath, flags, linkFlags, - &target, useWatcomQuote); - linkLibs = frameworkPath + linkPath + linkLibs; - cmLocalGenerator::RuleVariables vars; - vars.Language = llang.c_str(); - vars.Objects = objs.c_str(); - vars.ObjectDir = "."; - vars.Target = targetName.c_str(); - vars.LinkLibraries = linkLibs.c_str(); - vars.Flags = flags.c_str(); - vars.LinkFlags = linkFlags.c_str(); - - std::string langFlags; - this->AddLanguageFlags(langFlags, llang, ""); - this->AddArchitectureFlags(langFlags, &target, llang, ""); - vars.LanguageCompileFlags = langFlags.c_str(); - - cmCustomCommandLines commandLines; - std::vector rules; - rules.push_back(this->Makefile->GetRequiredDefinition(createRule)); - std::vector commands; - cmSystemTools::ExpandList(rules, commands); - for(std::vector::iterator i = commands.begin(); - i != commands.end(); ++i) - { - // Expand the full command line string. - this->ExpandRuleVariables(*i, vars); - // Parse the string to get the custom command line. - cmCustomCommandLine commandLine; - std::vector cmd = cmSystemTools::ParseArguments(i->c_str()); - commandLine.insert(commandLine.end(), cmd.begin(), cmd.end()); - - // Store this command line. - commandLines.push_back(commandLine); - } - std::string targetFullPath = target.Target->GetFullPath(); - // Generate a meaningful comment for the command. - std::string comment = "Linking "; - comment += llang; - comment += " target "; - comment += this->Convert(targetFullPath, START_OUTPUT); - this->Makefile->AddCustomCommandToOutput( - targetFullPath, - objVector, - "", - commandLines, - comment.c_str(), - this->StateSnapshot.GetDirectory().GetCurrentBinary() - ); - this->Makefile->GetSource(targetFullPath); - target.Target->AddSource(targetFullPath); -} - // List of variables that are replaced when // rules are expanced. These variables are // replaced in the form with GetSafeDefinition(var). diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index fee242042..429d5fcf3 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -328,11 +328,6 @@ protected: void InsertRuleLauncher(std::string& s, cmTarget* target, const std::string& prop); - - /** Convert a target to a utility target for unsupported - * languages of a generator */ - void AddBuildTargetRule(const std::string& llang, - cmGeneratorTarget& target); ///! add a custom command to build a .o file that is part of a target void AddCustomCommandToCreateObject(const char* ofname, const std::string& lang, From bbad6ba53771dc77bfdf74bab7173374084d434c Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 27 Jul 2015 20:58:28 +0200 Subject: [PATCH 0429/1048] cmLocalGenerator: Remove unused AddCustomCommandToCreateObject method. --- Source/cmLocalGenerator.cxx | 78 ------------------------------------- Source/cmLocalGenerator.h | 6 --- 2 files changed, 84 deletions(-) diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index cce10ce77..91e37c4a1 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -448,84 +448,6 @@ cmState::Snapshot cmLocalGenerator::GetStateSnapshot() const return this->StateSnapshot; } -void cmLocalGenerator::AddCustomCommandToCreateObject(const char* ofname, - const std::string& lang, - cmSourceFile& source, - cmGeneratorTarget& target) -{ - std::string objectDir = cmSystemTools::GetFilenamePath(std::string(ofname)); - objectDir = this->Convert(objectDir,START_OUTPUT,SHELL); - std::string objectFile = this->Convert(ofname,START_OUTPUT,SHELL); - std::string sourceFile = - this->ConvertToOutputFormat(source.GetFullPath(), SHELL); - std::string varString = "CMAKE_"; - varString += lang; - varString += "_COMPILE_OBJECT"; - std::vector rules; - rules.push_back(this->Makefile->GetRequiredDefinition(varString)); - varString = "CMAKE_"; - varString += lang; - varString += "_FLAGS"; - std::string flags; - flags += this->Makefile->GetSafeDefinition(varString); - flags += " "; - { - std::vector includes; - this->GetIncludeDirectories(includes, &target, lang); - flags += this->GetIncludeFlags(includes, &target, lang); - } - flags += this->Makefile->GetDefineFlags(); - - // Construct the command lines. - cmCustomCommandLines commandLines; - std::vector commands; - cmSystemTools::ExpandList(rules, commands); - cmLocalGenerator::RuleVariables vars; - vars.Language = lang.c_str(); - vars.Source = sourceFile.c_str(); - vars.Object = objectFile.c_str(); - vars.ObjectDir = objectDir.c_str(); - vars.Flags = flags.c_str(); - for(std::vector::iterator i = commands.begin(); - i != commands.end(); ++i) - { - // Expand the full command line string. - this->ExpandRuleVariables(*i, vars); - - // Parse the string to get the custom command line. - cmCustomCommandLine commandLine; - std::vector cmd = cmSystemTools::ParseArguments(i->c_str()); - commandLine.insert(commandLine.end(), cmd.begin(), cmd.end()); - - // Store this command line. - commandLines.push_back(commandLine); - } - - // Check for extra object-file dependencies. - std::vector depends; - const char* additionalDeps = source.GetProperty("OBJECT_DEPENDS"); - if(additionalDeps) - { - cmSystemTools::ExpandListArgument(additionalDeps, depends); - } - - // Generate a meaningful comment for the command. - std::string comment = "Building "; - comment += lang; - comment += " object "; - comment += this->Convert(ofname, START_OUTPUT); - - // Add the custom command to build the object file. - this->Makefile->AddCustomCommandToOutput( - ofname, - depends, - source.GetFullPath(), - commandLines, - comment.c_str(), - this->StateSnapshot.GetDirectory().GetCurrentBinary() - ); -} - // List of variables that are replaced when // rules are expanced. These variables are // replaced in the form with GetSafeDefinition(var). diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 429d5fcf3..297157429 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -328,12 +328,6 @@ protected: void InsertRuleLauncher(std::string& s, cmTarget* target, const std::string& prop); - ///! add a custom command to build a .o file that is part of a target - void AddCustomCommandToCreateObject(const char* ofname, - const std::string& lang, - cmSourceFile& source, - cmGeneratorTarget& target); - // Handle old-style install rules stored in the targets. void GenerateTargetInstallRules( std::ostream& os, const std::string& config, From 611220f77af9e2c5e174aa7ff9fa8bba982374ef Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 25 Jul 2015 22:51:53 +0200 Subject: [PATCH 0430/1048] cmTarget: Use reliable test for CMP0024 and CMP0026 OLD. Check whether the Makefile is fully configured instead of checking whether generator targets exist. --- Source/cmTarget.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 3d8adae9e..da57c4cbe 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -723,7 +723,7 @@ void cmTarget::GetSourceFiles(std::vector &files, { assert(this->GetType() != INTERFACE_LIBRARY); - if (this->Makefile->GetGeneratorTargets().empty()) + if (!this->Makefile->IsConfigured()) { // At configure-time, this method can be called as part of getting the // LOCATION property or to export() a file to be include()d. However @@ -5249,7 +5249,7 @@ void cmTarget::GetLanguages(std::set& languages, std::vector objectLibraries; std::vector externalObjects; - if (this->Makefile->GetGeneratorTargets().empty()) + if (!this->Makefile->IsConfigured()) { this->GetObjectLibrariesCMP0026(objectLibraries); } From de80993a2020e64259f12f608d11d1ace9a719a6 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 25 Jul 2015 20:58:55 +0200 Subject: [PATCH 0431/1048] cmGlobalGenerator: Create cmGeneratorTargets earlier. --- Source/cmGlobalGenerator.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index f5ddd1090..936ef74a5 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1240,6 +1240,7 @@ void cmGlobalGenerator::Generate() AutogensType autogens; this->CreateQtAutoGeneratorsTargets(autogens); #endif + this->CreateGenerationObjects(); unsigned int i; @@ -1254,7 +1255,6 @@ void cmGlobalGenerator::Generate() this->LocalGenerators[i]->AddHelperCommands(); } - this->CreateGenerationObjects(); this->InitGeneratorTargets(); #ifdef CMAKE_BUILD_WITH_CMAKE From 496f4cd07d20e91750ec920e05a4aef4e4bdc9ba Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 25 Jul 2015 23:19:36 +0200 Subject: [PATCH 0432/1048] cmGlobalGenerator: Create cmGeneratorTargets before QtAutomoc. Add cmGeneratorTargets as needed in the QtAutomoc processing. --- Source/cmGlobalGenerator.cxx | 6 ++++-- Source/cmGlobalGenerator.h | 5 +++++ Source/cmMakefile.h | 4 ++++ Source/cmQtAutoGenerators.cxx | 7 ++++++- Source/cmQtAutoGenerators.h | 3 ++- 5 files changed, 21 insertions(+), 4 deletions(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 936ef74a5..a77a02a1a 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1234,13 +1234,14 @@ void cmGlobalGenerator::Generate() this->FinalizeTargetCompileInfo(); + this->CreateGenerationObjects(); + #ifdef CMAKE_BUILD_WITH_CMAKE // Iterate through all targets and set up automoc for those which have // the AUTOMOC, AUTOUIC or AUTORCC property set AutogensType autogens; this->CreateQtAutoGeneratorsTargets(autogens); #endif - this->CreateGenerationObjects(); unsigned int i; @@ -1414,7 +1415,8 @@ void cmGlobalGenerator::CreateQtAutoGeneratorsTargets(AutogensType &autogens) && !target.IsImported()) { cmQtAutoGenerators autogen; - if(autogen.InitializeAutogenTarget(&target)) + if(autogen.InitializeAutogenTarget(this->LocalGenerators[i], + &target)) { autogens.push_back(std::make_pair(autogen, &target)); } diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 7d9bb4c55..95b0ef163 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -300,6 +300,11 @@ public: /** Get per-target generator information. */ cmGeneratorTarget* GetGeneratorTarget(cmTarget const*) const; + void AddGeneratorTarget(cmTarget* t, cmGeneratorTarget* gt) + { + this->GeneratorTargets[t] = gt; + } + const std::map >& GetProjectMap() const {return this->ProjectMap;} diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 2fc4d78a8..f5cd74d0c 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -415,6 +415,10 @@ public: { this->GeneratorTargets = targets; } + void AddGeneratorTarget(cmTarget* t, cmGeneratorTarget* gt) + { + this->GeneratorTargets[t] = gt; + } cmTarget* FindTarget(const std::string& name, bool excludeAliases = false) const; diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index 58f4bf414..ae21561ec 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -287,7 +287,8 @@ std::string cmQtAutoGenerators::ListQt4RccInputs(cmSourceFile* sf, return entriesList; } -bool cmQtAutoGenerators::InitializeAutogenTarget(cmTarget* target) +bool cmQtAutoGenerators::InitializeAutogenTarget(cmLocalGenerator* lg, + cmTarget* target) { cmMakefile* makefile = target->GetMakefile(); // don't do anything if there is no Qt4 or Qt5Core (which contains moc): @@ -474,6 +475,10 @@ bool cmQtAutoGenerators::InitializeAutogenTarget(cmTarget* target) /*byproducts=*/rcc_output, depends, commandLines, false, autogenComment.c_str()); + cmGeneratorTarget* gt = new cmGeneratorTarget(autogenTarget, lg); + lg->GetGlobalGenerator()->AddGeneratorTarget(autogenTarget, gt); + makefile->AddGeneratorTarget(autogenTarget, gt); + // Set target folder const char* autogenFolder = makefile->GetState() ->GetGlobalProperty("AUTOMOC_TARGETS_FOLDER"); diff --git a/Source/cmQtAutoGenerators.h b/Source/cmQtAutoGenerators.h index 4c0fcbcb4..4f033481c 100644 --- a/Source/cmQtAutoGenerators.h +++ b/Source/cmQtAutoGenerators.h @@ -18,6 +18,7 @@ class cmGlobalGenerator; class cmMakefile; +class cmLocalGenerator; class cmQtAutoGenerators { @@ -25,7 +26,7 @@ public: cmQtAutoGenerators(); bool Run(const std::string& targetDirectory, const std::string& config); - bool InitializeAutogenTarget(cmTarget* target); + bool InitializeAutogenTarget(cmLocalGenerator* lg, cmTarget* target); void SetupAutoGenerateTarget(cmTarget const* target); void SetupSourceFiles(cmTarget const* target); From 5ab3a946518870d0dbd1fe606d1bc89d336769c4 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 25 Jul 2015 21:06:37 +0200 Subject: [PATCH 0433/1048] cmTarget: Inline GetLocation into deprecated callers. --- Source/cmTarget.cxx | 43 ++++++++++++++++++++++++++++++++++++------- 1 file changed, 36 insertions(+), 7 deletions(-) diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index da57c4cbe..352b2def5 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -2917,11 +2917,21 @@ const char *cmTarget::GetProperty(const std::string& prop, // For an imported target this is the location of an arbitrary // available configuration. // - // For a non-imported target this is deprecated because it - // cannot take into account the per-configuration name of the - // target because the configuration type may not be known at - // CMake time. - this->Properties.SetProperty(propLOCATION, this->GetLocationForBuild()); + if(this->IsImported()) + { + this->Properties.SetProperty( + propLOCATION, this->ImportedGetFullPath("", false).c_str()); + } + else + { + // For a non-imported target this is deprecated because it + // cannot take into account the per-configuration name of the + // target because the configuration type may not be known at + // CMake time. + this->Properties.SetProperty( + propLOCATION, this->GetLocationForBuild()); + } + } // Support "LOCATION_". @@ -2932,7 +2942,17 @@ const char *cmTarget::GetProperty(const std::string& prop, return 0; } const char* configName = prop.c_str() + 9; - this->Properties.SetProperty(prop, this->GetLocation(configName)); + + if (this->IsImported()) + { + this->Properties.SetProperty( + prop, this->ImportedGetFullPath(configName, false).c_str()); + } + else + { + this->Properties.SetProperty( + prop, this->GetFullPath(configName, false).c_str()); + } } // Support "_LOCATION". else if(cmHasLiteralSuffix(prop, "_LOCATION")) @@ -2944,7 +2964,16 @@ const char *cmTarget::GetProperty(const std::string& prop, { return 0; } - this->Properties.SetProperty(prop, this->GetLocation(configName)); + if (this->IsImported()) + { + this->Properties.SetProperty( + prop, this->ImportedGetFullPath(configName, false).c_str()); + } + else + { + this->Properties.SetProperty( + prop, this->GetFullPath(configName, false).c_str()); + } } } } From ba2668588213688243174a9cc8d7f034661b2a73 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 25 Jul 2015 21:10:31 +0200 Subject: [PATCH 0434/1048] cmTarget: Create cmGeneratorTargets before reading deprecated LOCATION. The intention is to move generation-semantic cmTarget API to cmGeneratorTarget and then use the latter for generator expressions. This means that each time we read a deprecated LOCATION property, we have to clear and re-populate the container. That must be done each time because the result can change through the configure process, which is why this is deprecated in the first place. --- Source/cmTarget.cxx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 352b2def5..295c86255 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -2950,8 +2950,11 @@ const char *cmTarget::GetProperty(const std::string& prop, } else { + cmGlobalGenerator* gg = this->Makefile->GetGlobalGenerator(); + gg->CreateGenerationObjects(); + cmGeneratorTarget* gt = gg->GetGeneratorTarget(this); this->Properties.SetProperty( - prop, this->GetFullPath(configName, false).c_str()); + prop, gt->Target->GetFullPath(configName, false).c_str()); } } // Support "_LOCATION". @@ -2971,8 +2974,11 @@ const char *cmTarget::GetProperty(const std::string& prop, } else { + cmGlobalGenerator* gg = this->Makefile->GetGlobalGenerator(); + gg->CreateGenerationObjects(); + cmGeneratorTarget* gt = gg->GetGeneratorTarget(this); this->Properties.SetProperty( - prop, this->GetFullPath(configName, false).c_str()); + prop, gt->Target->GetFullPath(configName, false).c_str()); } } } From 50b17a6112704ad3897b1ccc87a0061cf7949ee7 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 26 Jul 2015 10:24:15 +0200 Subject: [PATCH 0435/1048] cmIncludeCommand: Populate the cmGeneratorTargets in deprecated path. --- Source/cmIncludeCommand.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/Source/cmIncludeCommand.cxx b/Source/cmIncludeCommand.cxx index b94ad2555..8890e2b0a 100644 --- a/Source/cmIncludeCommand.cxx +++ b/Source/cmIncludeCommand.cxx @@ -125,6 +125,7 @@ bool cmIncludeCommand return false; } } + gg->CreateGenerationObjects(); gg->GenerateImportFile(fname_abs); } From 5b60eaf619baf4dfa2bc1a3f1109ff742a04f532 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 10 Mar 2014 14:42:27 +0100 Subject: [PATCH 0436/1048] cmTarget: Restore the ImportedGetLocation method. It was removed in commit f154475b (cmTarget: Refactor GetLocation API, 2014-03-08), but it is more readable for targets we know are imported. --- Source/cmQtAutoGenerators.cxx | 16 ++++++++++------ Source/cmTarget.cxx | 9 +++++++++ Source/cmTarget.h | 1 + 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index ae21561ec..979db911d 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -809,7 +809,8 @@ void cmQtAutoGenerators::SetupAutoMocTarget(cmTarget const* target, autogenTargetName.c_str()); return; } - makefile->AddDefinition("_qt_moc_executable", qt5Moc->GetLocation("")); + makefile->AddDefinition("_qt_moc_executable", + qt5Moc->ImportedGetLocation("")); } else if (strcmp(qtVersion, "4") == 0) { @@ -820,7 +821,8 @@ void cmQtAutoGenerators::SetupAutoMocTarget(cmTarget const* target, autogenTargetName.c_str()); return; } - makefile->AddDefinition("_qt_moc_executable", qt4Moc->GetLocation("")); + makefile->AddDefinition("_qt_moc_executable", + qt4Moc->ImportedGetLocation("")); } else { @@ -967,7 +969,8 @@ void cmQtAutoGenerators::SetupAutoUicTarget(cmTarget const* target, } else { - makefile->AddDefinition("_qt_uic_executable", qt5Uic->GetLocation("")); + makefile->AddDefinition("_qt_uic_executable", + qt5Uic->ImportedGetLocation("")); } } else if (strcmp(qtVersion, "4") == 0) @@ -979,7 +982,8 @@ void cmQtAutoGenerators::SetupAutoUicTarget(cmTarget const* target, targetName.c_str()); return; } - makefile->AddDefinition("_qt_uic_executable", qt4Uic->GetLocation("")); + makefile->AddDefinition("_qt_uic_executable", + qt4Uic->ImportedGetLocation("")); } else { @@ -1171,7 +1175,7 @@ std::string cmQtAutoGenerators::GetRccExecutable(cmTarget const* target) targetName.c_str()); return std::string(); } - return qt5Rcc->GetLocation(""); + return qt5Rcc->ImportedGetLocation(""); } else if (strcmp(qtVersion, "4") == 0) { @@ -1182,7 +1186,7 @@ std::string cmQtAutoGenerators::GetRccExecutable(cmTarget const* target) targetName.c_str()); return std::string(); } - return qt4Rcc->GetLocation(""); + return qt4Rcc->ImportedGetLocation(""); } cmSystemTools::Error("The CMAKE_AUTORCC feature supports only Qt 4 and " diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 295c86255..e4cd4f342 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -2753,6 +2753,15 @@ const char* cmTarget::GetLocation(const std::string& config) const return location.c_str(); } +//---------------------------------------------------------------------------- +const char* cmTarget::ImportedGetLocation(const std::string& config) const +{ + static std::string location; + assert(this->IsImported()); + location = this->ImportedGetFullPath(config, false); + return location.c_str(); +} + //---------------------------------------------------------------------------- const char* cmTarget::GetLocationForBuild() const { diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 192031255..a0198e2e4 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -377,6 +377,7 @@ public: /** Get the location of the target in the build tree for the given configuration. */ const char* GetLocation(const std::string& config) const; + const char* ImportedGetLocation(const std::string& config) const; /** Get the location of the target in the build tree with a placeholder referencing the configuration in the native build system. This From c7a8e74b8c7ade9efb68b8bd36fd6d741f2dba7e Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 25 Jul 2015 21:28:36 +0200 Subject: [PATCH 0437/1048] Always access target location from a cmGeneratorTarget instance. --- Source/cmCustomCommandGenerator.cxx | 7 ++++--- Source/cmExtraCodeBlocksGenerator.cxx | 4 +++- Source/cmGlobalKdevelopGenerator.cxx | 8 ++++---- Source/cmLocalGenerator.cxx | 7 ++++--- 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx index 8483a9170..086c9f958 100644 --- a/Source/cmCustomCommandGenerator.cxx +++ b/Source/cmCustomCommandGenerator.cxx @@ -42,12 +42,13 @@ unsigned int cmCustomCommandGenerator::GetNumberOfCommands() const std::string cmCustomCommandGenerator::GetCommand(unsigned int c) const { std::string const& argv0 = this->CC.GetCommandLines()[c][0]; - cmTarget* target = this->LG->GetMakefile()->FindTargetToUse(argv0); + cmGeneratorTarget* target = + this->LG->GetMakefile()->FindGeneratorTargetToUse(argv0); if(target && target->GetType() == cmTarget::EXECUTABLE && - (target->IsImported() + (target->Target->IsImported() || !this->LG->GetMakefile()->IsOn("CMAKE_CROSSCOMPILING"))) { - return target->GetLocation(this->Config); + return target->Target->GetLocation(this->Config); } return this->GE->Parse(argv0)->Evaluate(this->LG->GetMakefile(), this->Config); diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx index a31e83242..6d145a212 100644 --- a/Source/cmExtraCodeBlocksGenerator.cxx +++ b/Source/cmExtraCodeBlocksGenerator.cxx @@ -591,7 +591,9 @@ void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout, } else { - location = target->GetLocation(buildType); + cmGeneratorTarget* gt = + this->GlobalGenerator->GetGeneratorTarget(target); + location = gt->Target->GetLocation(buildType); } fout<<"