summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2015-04-18 12:50:32 (GMT)
committerStephen Kelly <steveire@gmail.com>2015-04-18 13:29:17 (GMT)
commita2f2aeee2f4d4af1f25f4a5b86bacb8a81a7dec4 (patch)
treedd46c44fb1a2267149352ff1a95b09b72ce737f8 /Source
parent68f791cd06983e8fd375edfba74a9d821231e269 (diff)
downloadCMake-a2f2aeee2f4d4af1f25f4a5b86bacb8a81a7dec4.zip
CMake-a2f2aeee2f4d4af1f25f4a5b86bacb8a81a7dec4.tar.gz
CMake-a2f2aeee2f4d4af1f25f4a5b86bacb8a81a7dec4.tar.bz2
cmMakefile: Add wrapper for reading listfiles which have an origin.
Such files are delegates from other files, and so they set the CMAKE_PARENT_LIST_FILE to the originator. They also may set a policy scope.
Diffstat (limited to 'Source')
-rw-r--r--Source/CTest/cmCTestTestHandler.cxx8
-rw-r--r--Source/cmCTest.cxx3
-rw-r--r--Source/cmFindPackageCommand.cxx4
-rw-r--r--Source/cmGlobalVisualStudio6Generator.cxx2
-rw-r--r--Source/cmIncludeCommand.cxx3
-rw-r--r--Source/cmMakefile.cxx6
-rw-r--r--Source/cmMakefile.h2
-rw-r--r--Source/cmProjectCommand.cxx3
8 files changed, 16 insertions, 15 deletions
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx
index c50ea88..59c5e92 100644
--- a/Source/CTest/cmCTestTestHandler.cxx
+++ b/Source/CTest/cmCTestTestHandler.cxx
@@ -117,9 +117,7 @@ bool cmCTestSubdirCommand
}
fname += "/";
fname += testFilename;
- bool readit =
- this->Makefile->ReadListFile(this->Makefile->GetCurrentListFile(),
- fname.c_str());
+ bool readit = this->Makefile->ReadDependentFile(fname.c_str());
cmSystemTools::ChangeDirectory(cwd);
if(!readit)
{
@@ -205,9 +203,7 @@ bool cmCTestAddSubdirectoryCommand
}
fname += "/";
fname += testFilename;
- bool readit =
- this->Makefile->ReadListFile(this->Makefile->GetCurrentListFile(),
- fname.c_str());
+ bool readit = this->Makefile->ReadDependentFile(fname.c_str());
cmSystemTools::ChangeDirectory(cwd);
if(!readit)
{
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index cd2cd7c..91ae889 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -687,8 +687,7 @@ bool cmCTest::InitializeFromCommand(cmCTestStartCommand* command)
{
cmCTestOptionalLog(this, OUTPUT, " Reading ctest configuration file: "
<< fname << std::endl, command->ShouldBeQuiet());
- bool readit = mf->ReadListFile(mf->GetCurrentListFile(),
- fname.c_str() );
+ bool readit = mf->ReadDependentFile(fname.c_str());
if(!readit)
{
std::string m = "Could not find include file: ";
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index af99b1c..aecd230 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -999,8 +999,8 @@ bool cmFindPackageCommand::FindAppBundleConfig()
//----------------------------------------------------------------------------
bool cmFindPackageCommand::ReadListFile(const char* f, PolicyScopeRule psr)
{
- if(this->Makefile->ReadListFile(this->Makefile->GetCurrentListFile(), f,
- !this->PolicyScope || psr == NoPolicyScope))
+ const bool noPolicyScope = !this->PolicyScope || psr == NoPolicyScope;
+ if(this->Makefile->ReadDependentFile(f, noPolicyScope))
{
return true;
}
diff --git a/Source/cmGlobalVisualStudio6Generator.cxx b/Source/cmGlobalVisualStudio6Generator.cxx
index e2b2bbd4..e268852 100644
--- a/Source/cmGlobalVisualStudio6Generator.cxx
+++ b/Source/cmGlobalVisualStudio6Generator.cxx
@@ -60,7 +60,7 @@ void cmGlobalVisualStudio6Generator::GenerateConfigurations(cmMakefile* mf)
fname += "/Templates";
}
fname += "/CMakeVisualStudio6Configurations.cmake";
- if(!mf->ReadListFile(mf->GetCurrentListFile(), fname.c_str()))
+ if(!mf->ReadDependentFile(fname.c_str()))
{
cmSystemTools::Error("Cannot open ", fname.c_str(),
". Please copy this file from the main "
diff --git a/Source/cmIncludeCommand.cxx b/Source/cmIncludeCommand.cxx
index 0c2e73a..18e3585 100644
--- a/Source/cmIncludeCommand.cxx
+++ b/Source/cmIncludeCommand.cxx
@@ -131,8 +131,7 @@ bool cmIncludeCommand
}
bool readit =
- this->Makefile->ReadListFile( this->Makefile->GetCurrentListFile(),
- fname.c_str(), noPolicyScope);
+ this->Makefile->ReadDependentFile(fname.c_str(), noPolicyScope);
// add the location of the included file if a result variable was given
if (!resultVarName.empty())
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index b08725e..29e564f 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -528,6 +528,12 @@ bool cmMakefile::ProcessBuildsystemFile(const char* listfile)
this->cmStartDirectory == this->cmHomeDirectory);
}
+bool cmMakefile::ReadDependentFile(const char* listfile, bool noPolicyScope)
+{
+ return this->ReadListFile(this->GetCurrentListFile(), listfile,
+ noPolicyScope);
+}
+
//----------------------------------------------------------------------------
// Parse the given CMakeLists.txt file executing all commands
//
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 33c4b20..3d925fa 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -90,6 +90,8 @@ public:
bool noPolicyScope = true,
bool requireProjectCommand = false);
+ bool ReadDependentFile(const char* listfile, bool noPolicyScope = true);
+
bool ProcessBuildsystemFile(const char* listfile);
/**
diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx
index 601dc54..43b02bc 100644
--- a/Source/cmProjectCommand.cxx
+++ b/Source/cmProjectCommand.cxx
@@ -236,8 +236,7 @@ bool cmProjectCommand
{
std::string fullFilePath;
bool readit =
- this->Makefile->ReadListFile( this->Makefile->GetCurrentListFile(),
- include);
+ this->Makefile->ReadDependentFile(include);
if(!readit && !cmSystemTools::GetFatalErrorOccured())
{
std::string m =