summaryrefslogtreecommitdiffstats
path: root/Source/cmake.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-08-27 15:23:03 (GMT)
committerKitware Robot <kwrobot@kitware.com>2019-08-27 15:23:22 (GMT)
commit843ab7544e319597306a6d9cea4ab8be3296e6c4 (patch)
tree62262c4ccae447a0838c50a50db76c8baf9b9c37 /Source/cmake.cxx
parent57fc6c587ad766135f9f2b62a870374e9251281c (diff)
parent4ca0526f8a78e7abbd08e9978d4110f836ccef9b (diff)
downloadCMake-843ab7544e319597306a6d9cea4ab8be3296e6c4.zip
CMake-843ab7544e319597306a6d9cea4ab8be3296e6c4.tar.gz
CMake-843ab7544e319597306a6d9cea4ab8be3296e6c4.tar.bz2
Merge topic 'cmake-initial-cache-dirs'
4ca0526f8a cmake: Pass -S and -B into PreLoad.cmake and -C scripts Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !3709
Diffstat (limited to 'Source/cmake.cxx')
-rw-r--r--Source/cmake.cxx17
1 files changed, 7 insertions, 10 deletions
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 4fa98b3..1746082 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -431,6 +431,11 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
}
// Register fake project commands that hint misuse in script mode.
GetProjectCommandsInScriptMode(this->GetState());
+ // Documented behaviour of CMAKE{,_CURRENT}_{SOURCE,BINARY}_DIR is to be
+ // set to $PWD for -P mode.
+ this->SetHomeDirectory(cmSystemTools::GetCurrentWorkingDirectory());
+ this->SetHomeOutputDirectory(
+ cmSystemTools::GetCurrentWorkingDirectory());
this->ReadListFile(args, path);
} else if (arg.find("--find-package", 0) == 0) {
findPackageMode = true;
@@ -460,15 +465,9 @@ void cmake::ReadListFile(const std::vector<std::string>& args,
// read in the list file to fill the cache
if (!path.empty()) {
this->CurrentSnapshot = this->State->Reset();
- std::string homeDir = this->GetHomeDirectory();
- std::string homeOutputDir = this->GetHomeOutputDirectory();
- this->SetHomeDirectory(cmSystemTools::GetCurrentWorkingDirectory());
- this->SetHomeOutputDirectory(cmSystemTools::GetCurrentWorkingDirectory());
cmStateSnapshot snapshot = this->GetCurrentSnapshot();
- snapshot.GetDirectory().SetCurrentBinary(
- cmSystemTools::GetCurrentWorkingDirectory());
- snapshot.GetDirectory().SetCurrentSource(
- cmSystemTools::GetCurrentWorkingDirectory());
+ snapshot.GetDirectory().SetCurrentBinary(this->GetHomeOutputDirectory());
+ snapshot.GetDirectory().SetCurrentSource(this->GetHomeDirectory());
snapshot.SetDefaultDefinitions();
cmMakefile mf(gg, snapshot);
if (this->GetWorkingMode() != NORMAL_MODE) {
@@ -481,8 +480,6 @@ void cmake::ReadListFile(const std::vector<std::string>& args,
if (!mf.ReadListFile(path)) {
cmSystemTools::Error("Error processing file: " + path);
}
- this->SetHomeDirectory(homeDir);
- this->SetHomeOutputDirectory(homeOutputDir);
}
// free generic one if generated