summaryrefslogtreecommitdiffstats
path: root/Source/cmDepends.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmDepends.cxx')
-rw-r--r--Source/cmDepends.cxx14
1 files changed, 2 insertions, 12 deletions
diff --git a/Source/cmDepends.cxx b/Source/cmDepends.cxx
index c189419..b8c76b9 100644
--- a/Source/cmDepends.cxx
+++ b/Source/cmDepends.cxx
@@ -7,6 +7,7 @@
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
#include "cmSystemTools.h"
+#include "cmWorkingDirectory.h"
#include <cmsys/FStream.hxx>
#include <sstream>
@@ -75,13 +76,7 @@ bool cmDepends::Check(const char* makeFile, const char* internalFile,
std::map<std::string, DependencyVector>& validDeps)
{
// Dependency checks must be done in proper working directory.
- std::string oldcwd = ".";
- if (this->CompileDirectory != ".") {
- // Get the CWD but do not call CollapseFullPath because
- // we only need it to cd back, and the form does not matter
- oldcwd = cmSystemTools::GetCurrentWorkingDirectory(false);
- cmSystemTools::ChangeDirectory(this->CompileDirectory);
- }
+ cmWorkingDirectory workdir(this->CompileDirectory);
// Check whether dependencies must be regenerated.
bool okay = true;
@@ -93,11 +88,6 @@ bool cmDepends::Check(const char* makeFile, const char* internalFile,
okay = false;
}
- // Restore working directory.
- if (oldcwd != ".") {
- cmSystemTools::ChangeDirectory(oldcwd);
- }
-
return okay;
}