|
@@ -430,6 +430,11 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
|
|
}
|
|
}
|
|
// Register fake project commands that hint misuse in script mode.
|
|
// Register fake project commands that hint misuse in script mode.
|
|
GetProjectCommandsInScriptMode(this->GetState());
|
|
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);
|
|
this->ReadListFile(args, path);
|
|
} else if (arg.find("--find-package", 0) == 0) {
|
|
} else if (arg.find("--find-package", 0) == 0) {
|
|
findPackageMode = true;
|
|
findPackageMode = true;
|
|
@@ -459,15 +464,9 @@ void cmake::ReadListFile(const std::vector<std::string>& args,
|
|
// read in the list file to fill the cache
|
|
// read in the list file to fill the cache
|
|
if (!path.empty()) {
|
|
if (!path.empty()) {
|
|
this->CurrentSnapshot = this->State->Reset();
|
|
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();
|
|
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();
|
|
snapshot.SetDefaultDefinitions();
|
|
cmMakefile mf(gg, snapshot);
|
|
cmMakefile mf(gg, snapshot);
|
|
if (this->GetWorkingMode() != NORMAL_MODE) {
|
|
if (this->GetWorkingMode() != NORMAL_MODE) {
|
|
@@ -480,8 +479,6 @@ void cmake::ReadListFile(const std::vector<std::string>& args,
|
|
if (!mf.ReadListFile(path)) {
|
|
if (!mf.ReadListFile(path)) {
|
|
cmSystemTools::Error("Error processing file: " + path);
|
|
cmSystemTools::Error("Error processing file: " + path);
|
|
}
|
|
}
|
|
- this->SetHomeDirectory(homeDir);
|
|
|
|
- this->SetHomeOutputDirectory(homeOutputDir);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
// free generic one if generated
|
|
// free generic one if generated
|