diff options
author | Stephen Kelly <steveire@gmail.com> | 2015-04-16 09:24:16 +0200 |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2015-04-21 09:41:27 -0400 |
commit | 8dc3a67c9c3c5b49fe7a3b69dab7d60475414c59 (patch) | |
tree | 2ab020aa20fb8dd6a8a33ba5cba661318b36628b | |
parent | 0f3c8cfa96a3b7c426e5a9cc341410fefd2baf75 (diff) | |
download | cmake-8dc3a67c9c3c5b49fe7a3b69dab7d60475414c59.tar.gz |
cmMakefile: Out-of-line the directory methods.
-rw-r--r-- | Source/cmMakefile.cxx | 31 | ||||
-rw-r--r-- | Source/cmMakefile.h | 41 |
2 files changed, 35 insertions, 37 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 3bbc5d8653..7beb932b90 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1667,6 +1667,37 @@ void cmMakefile::AddSubDirectory(const std::string& srcPath, } } +void cmMakefile::SetCurrentSourceDirectory(const std::string& dir) +{ + this->cmStartDirectory = dir; + cmSystemTools::ConvertToUnixSlashes(this->cmStartDirectory); + this->cmStartDirectory = + cmSystemTools::CollapseFullPath(this->cmStartDirectory); + this->AddDefinition("CMAKE_CURRENT_SOURCE_DIR", + this->cmStartDirectory.c_str()); +} + +const char* cmMakefile::GetCurrentSourceDirectory() const +{ + return this->cmStartDirectory.c_str(); +} + +void cmMakefile::SetCurrentBinaryDirectory(const std::string& dir) +{ + this->StartOutputDirectory = dir; + cmSystemTools::ConvertToUnixSlashes(this->StartOutputDirectory); + this->StartOutputDirectory = + cmSystemTools::CollapseFullPath(this->StartOutputDirectory); + cmSystemTools::MakeDirectory(this->StartOutputDirectory.c_str()); + this->AddDefinition("CMAKE_CURRENT_BINARY_DIR", + this->StartOutputDirectory.c_str()); +} + +const char* cmMakefile::GetCurrentBinaryDirectory() const +{ + return this->StartOutputDirectory.c_str(); +} + //---------------------------------------------------------------------------- void cmMakefile::AddIncludeDirectories(const std::vector<std::string> &incs, bool before) diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 8472825a05..55b2cbdacd 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -447,43 +447,10 @@ public: */ void SetArgcArgv(const std::vector<std::string>& args); - //@{ - /** - * Set/Get the start directory (or output directory). The start directory - * is the directory of the CMakeLists.txt file that started the current - * round of processing. Remember that CMake processes CMakeLists files by - * recursing up the tree starting at the StartDirectory and going up until - * it reaches the HomeDirectory. - */ - void SetCurrentSourceDirectory(const std::string& dir) - { - this->cmStartDirectory = dir; - cmSystemTools::ConvertToUnixSlashes(this->cmStartDirectory); - this->cmStartDirectory = - cmSystemTools::CollapseFullPath(this->cmStartDirectory); - this->AddDefinition("CMAKE_CURRENT_SOURCE_DIR", - this->cmStartDirectory.c_str()); - } - void SetCurrentBinaryDirectory(const std::string& dir) - { - this->StartOutputDirectory = dir; - cmSystemTools::ConvertToUnixSlashes(this->StartOutputDirectory); - this->StartOutputDirectory = - cmSystemTools::CollapseFullPath(this->StartOutputDirectory); - cmSystemTools::MakeDirectory(this->StartOutputDirectory.c_str()); - this->AddDefinition("CMAKE_CURRENT_BINARY_DIR", - this->StartOutputDirectory.c_str()); - } - //@} - - const char* GetCurrentSourceDirectory() const - { - return this->cmStartDirectory.c_str(); - } - const char* GetCurrentBinaryDirectory() const - { - return this->StartOutputDirectory.c_str(); - } + void SetCurrentSourceDirectory(const std::string& dir); + const char* GetCurrentSourceDirectory() const; + void SetCurrentBinaryDirectory(const std::string& dir); + const char* GetCurrentBinaryDirectory() const; /* Get the current CMakeLists.txt file that is being processed. This * is just used in order to be able to 'branch' from one file to a second |