summaryrefslogtreecommitdiffstats
path: root/Source/cmake.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-03-07 13:24:33 (GMT)
committerKitware Robot <kwrobot@kitware.com>2017-03-07 13:24:37 (GMT)
commite66eec143c86cb36bc468b78583f689840156d99 (patch)
tree56039b52e3954e8306613621df9bf4864e384862 /Source/cmake.cxx
parent632534104c4c094d07ab085fc10f2e3e35961ae0 (diff)
parentaba92ffd92bb1cc4bbe898b7abe65347b0468d33 (diff)
downloadCMake-e66eec143c86cb36bc468b78583f689840156d99.zip
CMake-e66eec143c86cb36bc468b78583f689840156d99.tar.gz
CMake-e66eec143c86cb36bc468b78583f689840156d99.tar.bz2
Merge topic 'working-directory-fixes'
aba92ffd cmWorkingDirectory: use the new class 047a5e4d cmWorkingDirectory: add class for changing the workdir 89891bcb cmCTest, cmCTestCoverageHandler: remove cwd dance c3304fa5 OSXScriptLauncher: remove unused variable Acked-by: Kitware Robot <kwrobot@kitware.com> Reviewed-by: Brad King <brad.king@kitware.com> Merge-request: !540
Diffstat (limited to 'Source/cmake.cxx')
-rw-r--r--Source/cmake.cxx30
1 files changed, 15 insertions, 15 deletions
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index b2384cd..3af3be6 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -23,6 +23,7 @@
#include "cmTargetLinkLibraryType.h"
#include "cmUtils.hxx"
#include "cmVersionConfig.h"
+#include "cmWorkingDirectory.h"
#include "cm_auto_ptr.hxx"
#if defined(CMAKE_BUILD_WITH_CMAKE)
@@ -2199,24 +2200,23 @@ int cmake::GetSystemInformation(std::vector<std::string>& args)
resultFile += "/__cmake_systeminformation/results.txt";
}
- // now run cmake on the CMakeLists file
- cmSystemTools::ChangeDirectory(destPath);
- std::vector<std::string> args2;
- args2.push_back(args[0]);
- args2.push_back(destPath);
- std::string resultArg = "-DRESULT_FILE=";
- resultArg += resultFile;
- args2.push_back(resultArg);
- int res = this->Run(args2, false);
+ {
+ // now run cmake on the CMakeLists file
+ cmWorkingDirectory workdir(destPath);
+ std::vector<std::string> args2;
+ args2.push_back(args[0]);
+ args2.push_back(destPath);
+ std::string resultArg = "-DRESULT_FILE=";
+ resultArg += resultFile;
+ args2.push_back(resultArg);
+ int res = this->Run(args2, false);
- if (res != 0) {
- std::cerr << "Error: --system-information failed on internal CMake!\n";
- return res;
+ if (res != 0) {
+ std::cerr << "Error: --system-information failed on internal CMake!\n";
+ return res;
+ }
}
- // change back to the original directory
- cmSystemTools::ChangeDirectory(cwd);
-
// echo results to stdout if needed
if (writeToStdout) {
FILE* fin = cmsys::SystemTools::Fopen(resultFile, "r");