summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Help/prop_dir/INCLUDE_REGULAR_EXPRESSION.rst5
-rw-r--r--Modules/CMakeExpandImportedTargets.cmake16
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/cmCustomCommandGenerator.cxx2
-rw-r--r--Source/cmExtraCodeLiteGenerator.cxx18
-rw-r--r--Source/cmFileCommand.cxx4
-rw-r--r--Source/cmGeneratorExpression.cxx6
-rw-r--r--Source/cmGeneratorExpression.h5
-rw-r--r--Source/cmGeneratorExpressionEvaluationFile.cxx2
-rw-r--r--Source/cmGeneratorExpressionNode.cxx2
-rw-r--r--Source/cmGeneratorTarget.cxx2
-rw-r--r--Source/cmGetCMakePropertyCommand.cxx5
-rw-r--r--Source/cmGlobalVisualStudio7Generator.cxx16
-rw-r--r--Source/cmInstalledFile.cxx4
-rw-r--r--Source/cmListFileCache.cxx4
-rw-r--r--Source/cmListFileCache.h4
-rw-r--r--Source/cmLocalGenerator.cxx43
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx16
-rw-r--r--Source/cmMakeDepend.cxx2
-rw-r--r--Source/cmMakefile.cxx118
-rw-r--r--Source/cmMakefile.h12
-rw-r--r--Source/cmOutputConverter.cxx34
-rw-r--r--Source/cmState.cxx84
-rw-r--r--Source/cmState.h54
-rw-r--r--Source/cmTarget.cxx36
-rw-r--r--Source/cmTestGenerator.cxx2
26 files changed, 260 insertions, 238 deletions
diff --git a/Help/prop_dir/INCLUDE_REGULAR_EXPRESSION.rst b/Help/prop_dir/INCLUDE_REGULAR_EXPRESSION.rst
index befafa5..bb90c61 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/Modules/CMakeExpandImportedTargets.cmake b/Modules/CMakeExpandImportedTargets.cmake
index 8ac3364..28f2e46 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 <cmake-generator-expressions(7)>`
+# cannot be evaluated during configuration.
+#
# ::
#
# CMAKE_EXPAND_IMPORTED_TARGETS(<var> 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:
#
# ::
#
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 0c41745..ebceff9 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 20150721)
#set(CMake_VERSION_RC 1)
diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx
index 11308c6..f654eb9 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/cmExtraCodeLiteGenerator.cxx b/Source/cmExtraCodeLiteGenerator.cxx
index 9705d2b..c2cff14 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<std::string> outputFiles = mf->GetOutputFiles();
- std::string projectName = mf->GetProjectName();
- std::string incDirs;
- std::vector<cmValueWithOrigin> incDirsVec =
- mf->GetIncludeDirectoriesEntries();
- std::vector<cmValueWithOrigin>::const_iterator iterInc = incDirsVec.begin();
-
- //std::cout << "GetIncludeDirectories:" << std::endl;
- for(; iterInc != incDirsVec.end(); ++iterInc )
- {
- //std::cout << (*ItStrVec) << std::endl;
- incDirs += iterInc->Value + " ";
- }
-
////////////////////////////////////
fout << "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
"<CodeLite_Project Name=\"" << mf->GetProjectName()
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index f740020..3d84f38 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<cmCompiledGeneratorExpression> outputCge
= outputGe.Parse(outputExpr);
- cmGeneratorExpression conditionGe(&lfbt);
+ cmGeneratorExpression conditionGe(lfbt);
cmsys::auto_ptr<cmCompiledGeneratorExpression> conditionCge
= conditionGe.Parse(condition);
diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx
index 3655a87..80a4f81 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<cmCompiledGeneratorExpression>
cmGeneratorExpression::Parse(std::string const& input)
{
return cmsys::auto_ptr<cmCompiledGeneratorExpression>(
- new cmCompiledGeneratorExpression(
- this->Backtrace ? *this->Backtrace : cmListFileBacktrace(),
- input));
+ new cmCompiledGeneratorExpression(this->Backtrace, input));
}
//----------------------------------------------------------------------------
diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h
index 11c27fd..cd19bc0 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<cmCompiledGeneratorExpression> 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 c726995..92ff314 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<cmCompiledGeneratorExpression> inputExpression
= contentGE.Parse(inputContent);
diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx
index 293eb41..90c82c2 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<cmCompiledGeneratorExpression> 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 4494553..e6f7a43 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<cmTarget*> targets;
diff --git a/Source/cmGetCMakePropertyCommand.cxx b/Source/cmGetCMakePropertyCommand.cxx
index 99e2867..248ce59 100644
--- a/Source/cmGetCMakePropertyCommand.cxx
+++ b/Source/cmGetCMakePropertyCommand.cxx
@@ -32,10 +32,9 @@ bool cmGetCMakePropertyCommand
if ( args[1] == "VARIABLES" )
{
- std::vector<std::string> 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" )
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index 1674e98..f8d882c 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<std::string> propKeys =
+ root->GetMakefile()->GetPropertyKeys();
+ for(std::vector<std::string>::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<std::string> keyValuePairs;
- cmSystemTools::ExpandListArgument(itProp->second.GetValue(),
- keyValuePairs);
+ cmSystemTools::ExpandListArgument(
+ root->GetMakefile()->GetProperty(it->c_str()),
+ keyValuePairs);
for(std::vector<std::string>::const_iterator itPair =
keyValuePairs.begin(); itPair != keyValuePairs.end(); ++itPair)
{
diff --git a/Source/cmInstalledFile.cxx b/Source/cmInstalledFile.cxx
index 8c52b48..fa5e815 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/cmListFileCache.cxx b/Source/cmListFileCache.cxx
index 1097dc2..bff2986 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 aa8a34c..0afd7f5 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;
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 5c9ee0e..7e4b470 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<std::string>& 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 5d17a40..077d4d9 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<std::string> emittedTargets;
- if (this->Parent)
+ if (!this->GetMakefile()->IsRootMakefile())
{
// write our targets, and while doing it collect up the object
// file rules
@@ -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";
@@ -888,7 +888,7 @@ void cmLocalUnixMakefileGenerator3
std::vector<std::string> no_depends;
std::vector<std::string> commands;
commands.push_back(runRule);
- if(this->Parent)
+ if(!this->GetMakefile()->IsRootMakefile())
{
this->CreateCDCommand(commands,
this->Makefile->GetHomeOutputDirectory(),
@@ -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/cmMakeDepend.cxx b/Source/cmMakeDepend.cxx
index a6d4e58..cbc7e02 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 14ef934..ae69b24 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"
@@ -150,7 +151,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
@@ -260,7 +261,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())
{
@@ -455,7 +456,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 +498,6 @@ cmMakefile::IncludeScope::~IncludeScope()
this->EnforceCMP0011();
}
}
- this->Makefile->ListFileStack.pop_back();
}
//----------------------------------------------------------------------------
@@ -514,7 +513,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 +526,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());
}
@@ -593,7 +592,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 +616,6 @@ public:
this->Makefile->PopFunctionBlockerBarrier(this->ReportError);
this->Makefile->PopPolicyBarrier(this->ReportError);
- this->Makefile->ListFileStack.pop_back();
}
void Quiet() { this->ReportError = false; }
@@ -1589,7 +1586,6 @@ void cmMakefile::InitializeFromParent(cmMakefile* parent)
this->ProjectName = parent->ProjectName;
// Copy include regular expressions.
- this->IncludeFileRegularExpression = parent->IncludeFileRegularExpression;
this->ComplainFileRegularExpression = parent->ComplainFileRegularExpression;
// Imported targets.
@@ -1680,18 +1676,16 @@ 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);
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->GetCMakeInstance()->SetCurrentSnapshot(this->Snapshot);
this->GG->SetCurrentMakefile(mf);
#if defined(CMAKE_BUILD_WITH_CMAKE)
this->GG->GetFileLockPool().PushFileScope();
@@ -1724,11 +1718,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());
@@ -1860,27 +1855,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();
}
//----------------------------------------------------------------------------
@@ -3428,10 +3423,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();
}
@@ -4129,10 +4120,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));
@@ -4141,10 +4132,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;
@@ -4162,22 +4153,6 @@ void cmMakefile::SetProperty(const std::string& prop, const char* value)
return;
}
- if ( prop == "INCLUDE_REGULAR_EXPRESSION" )
- {
- this->SetIncludeRegularExpression(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);
}
@@ -4229,18 +4204,21 @@ const char *cmMakefile::GetProperty(const std::string& prop,
this->StateSnapshot.GetBuildsystemDirectoryParent();
if(parent.IsValid())
{
- return parent.GetCurrentSourceDirectory();
+ return parent.GetDirectory().GetCurrentSource();
}
return "";
}
- else if (prop == "INCLUDE_REGULAR_EXPRESSION" )
- {
- output = this->GetIncludeRegularExpression();
- return output.c_str();
- }
else if (prop == "LISTFILE_STACK")
{
- output = cmJoin(this->ListFileStack, ";");
+ std::vector<std::string> 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" )
@@ -4315,6 +4293,18 @@ bool cmMakefile::GetPropertyAsBool(const std::string& prop) const
return cmSystemTools::IsOn(this->GetProperty(prop));
}
+std::vector<std::string> cmMakefile::GetPropertyKeys() const
+{
+ std::vector<std::string> 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
{
@@ -4387,14 +4377,22 @@ void cmMakefile::AddCMakeDependFilesFromUser()
std::string cmMakefile::FormatListFileStack() const
{
+ std::vector<std::string> 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<std::string>::const_iterator it = this->ListFileStack.end();
+ std::vector<std::string>::const_iterator it = listFiles.end();
do
{
- if (depth != this->ListFileStack.size())
+ if (depth != listFiles.size())
{
tmp << "\n ";
}
@@ -4405,7 +4403,7 @@ std::string cmMakefile::FormatListFileStack() const
tmp << *it;
depth--;
}
- while (it != this->ListFileStack.begin());
+ while (it != listFiles.begin());
}
return tmp.str();
}
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 489a8b1..2fc4d78 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -373,11 +373,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");
}
/**
@@ -675,9 +675,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;
-
- // Get the properties
- cmPropertyMap &GetProperties() { return this->Properties; }
+ std::vector<std::string> GetPropertyKeys() const;
///! Initialize a makefile from its parent
void InitializeFromParent(cmMakefile* parent);
@@ -848,7 +846,6 @@ protected:
std::vector<cmInstallGenerator*> InstallGenerators;
std::vector<cmTestGenerator*> TestGenerators;
- std::string IncludeFileRegularExpression;
std::string ComplainFileRegularExpression;
std::vector<std::string> SourceFileExtensions;
std::vector<std::string> HeaderFileExtensions;
@@ -907,9 +904,6 @@ private:
cmPropertyMap Properties;
- // stack of list files being read
- std::vector<std::string> ListFileStack;
-
std::vector<cmCommandContext const*> ContextStack;
std::vector<cmExecutionStatus*> ExecutionStatusStack;
friend class cmMakefileCall;
diff --git a/Source/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx
index 7cd6a47..91f3c0a 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<std::string>& 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 2d8b935..9cbb841 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<std::string> cacheKeys = this->GetCacheEntryKeys();
@@ -611,13 +609,13 @@ std::vector<std::string> 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<cmState::Snapshot> snapshots;
snapshots.push_back(snapshot);
while (true)
@@ -633,23 +631,23 @@ void cmState::Snapshot::ComputeRelativePathTopSource()
}
}
- std::string result = snapshots.front().GetCurrentSourceDirectory();
+ std::string result = snapshots.front().GetDirectory().GetCurrentSource();
for (std::vector<cmState::Snapshot>::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<cmState::Snapshot> snapshots;
snapshots.push_back(snapshot);
while (true)
@@ -666,12 +664,12 @@ void cmState::Snapshot::ComputeRelativePathTopBinary()
}
std::string result =
- snapshots.front().GetCurrentBinaryDirectory();
+ snapshots.front().GetDirectory().GetCurrentBinary();
for (std::vector<cmState::Snapshot>::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 +681,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 +810,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 +852,35 @@ void cmState::Snapshot::SetListFile(const std::string& listfile)
}
std::vector<std::string> const&
-cmState::Snapshot::GetCurrentSourceDirectoryComponents() const
+cmState::Directory::GetCurrentSourceComponents() const
{
- return this->Position->BuildSystemDirectory
- ->CurrentSourceDirectoryComponents;
+ return this->DirectoryState->CurrentSourceDirectoryComponents;
}
std::vector<std::string> 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 +947,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<BuildsystemDirectoryStateType>::iterator iter,
+ const cmState::Snapshot& snapshot)
+ : DirectoryState(iter), Snapshot_(snapshot)
+{
+
+}
diff --git a/Source/cmState.h b/Source/cmState.h
index 473a194..acd23a5 100644
--- a/Source/cmState.h
+++ b/Source/cmState.h
@@ -23,6 +23,7 @@ class cmCommand;
class cmState
{
struct SnapshotDataType;
+ struct BuildsystemDirectoryStateType;
typedef cmLinkedTree<SnapshotDataType>::iterator PositionType;
friend class Snapshot;
public:
@@ -38,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<std::string> const&
- GetCurrentSourceDirectoryComponents() const;
- std::vector<std::string> 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;
@@ -69,16 +57,45 @@ public:
cmState* GetState() const;
- private:
- void ComputeRelativePathTopSource();
- void ComputeRelativePathTopBinary();
+ Directory GetDirectory() const;
private:
friend class cmState;
+ friend class Directory;
cmState* State;
cmState::PositionType Position;
};
+ class Directory
+ {
+ Directory(cmLinkedTree<BuildsystemDirectoryStateType>::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<std::string> const&
+ GetCurrentSourceComponents() const;
+ std::vector<std::string> 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:
+ cmLinkedTree<BuildsystemDirectoryStateType>::iterator DirectoryState;
+ Snapshot Snapshot_;
+ friend class Snapshot;
+ };
+
Snapshot CreateBaseSnapshot();
Snapshot
CreateBuildsystemDirectorySnapshot(Snapshot originSnapshot,
@@ -203,7 +220,6 @@ private:
cmPropertyMap GlobalProperties;
cmake* CMakeInstance;
- struct BuildsystemDirectoryStateType;
cmLinkedTree<BuildsystemDirectoryStateType> BuildsystemDirectory;
cmLinkedTree<std::string> ExecutionListFiles;
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 0303f1e..46e9ed4 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -916,7 +916,7 @@ void cmTarget::AddTracedSources(std::vector<std::string> const& srcs)
this->Internal->SourceFilesMap.clear();
this->LinkImplementationLanguageIsContextDependent = true;
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
- cmGeneratorExpression ge(&lfbt);
+ cmGeneratorExpression ge(lfbt);
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(srcFiles);
cge->SetEvaluateForBuildsystem(true);
this->Internal->SourceEntries.push_back(
@@ -956,7 +956,7 @@ void cmTarget::AddSources(std::vector<std::string> const& srcs)
this->Internal->SourceFilesMap.clear();
this->LinkImplementationLanguageIsContextDependent = true;
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
- cmGeneratorExpression ge(&lfbt);
+ cmGeneratorExpression ge(lfbt);
cmsys::auto_ptr<cmCompiledGeneratorExpression> 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<cmCompiledGeneratorExpression> 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<cmCompiledGeneratorExpression> 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<cmCompiledGeneratorExpression> 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<cmCompiledGeneratorExpression> 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<cmCompiledGeneratorExpression> 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<cmCompiledGeneratorExpression> 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<cmCompiledGeneratorExpression> 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<cmTargetInternals::TargetPropertyEntry*>::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<cmTargetInternals::TargetPropertyEntry*>::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 =
"$<TARGET_PROPERTY:" + *it + "," + prop + ">";
- cmGeneratorExpression ge(&it->Backtrace);
+ cmGeneratorExpression ge(it->Backtrace);
cmsys::auto_ptr<cmCompiledGeneratorExpression> 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<cmCompiledGeneratorExpression> const cge =
ge.Parse(le->Value);
std::string const evaluated =
diff --git a/Source/cmTestGenerator.cxx b/Source/cmTestGenerator.cxx
index 546ad71..65d3b6a 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() << " ";