summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2009-07-31 13:19:19 (GMT)
committerBrad King <brad.king@kitware.com>2009-07-31 13:19:19 (GMT)
commita48f29c904a0b2ae409b511e4b4436a85da68292 (patch)
tree924a4623fe9c803c222ff3eba7293824d1bb14d5
parent36bb624907cd2eec30c8bbfe4787e29685b80947 (diff)
downloadCMake-a48f29c904a0b2ae409b511e4b4436a85da68292.zip
CMake-a48f29c904a0b2ae409b511e4b4436a85da68292.tar.gz
CMake-a48f29c904a0b2ae409b511e4b4436a85da68292.tar.bz2
Set current directory variables in CTest scripts
The commit "Fix get_filename_component ABSOLUTE mode" broke the code get_filename_component(cwd . ABSOLUTE) because CTest scripts did not make cmMakefile::GetCurrentDirectory() available. This commit fixes the problem by setting the proper information on CTest script instances of cmMakefile. This also makes CMAKE_CURRENT_SOURCE_DIR and CMAKE_CURRENT_BINARY_DIR available to CTest scripts. They are set to the working directory at script startup.
-rw-r--r--Source/CTest/cmCTestScriptHandler.cxx6
1 files changed, 6 insertions, 0 deletions
diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx
index 4ba9e68..0890fd1 100644
--- a/Source/CTest/cmCTestScriptHandler.cxx
+++ b/Source/CTest/cmCTestScriptHandler.cxx
@@ -337,6 +337,12 @@ void cmCTestScriptHandler::CreateCMake()
this->LocalGenerator = this->GlobalGenerator->CreateLocalGenerator();
this->Makefile = this->LocalGenerator->GetMakefile();
+ // Set CMAKE_CURRENT_SOURCE_DIR and CMAKE_CURRENT_BINARY_DIR.
+ // Also, some commands need Makefile->GetCurrentDirectory().
+ std::string cwd = cmSystemTools::GetCurrentWorkingDirectory();
+ this->Makefile->SetStartDirectory(cwd.c_str());
+ this->Makefile->SetStartOutputDirectory(cwd.c_str());
+
// remove all cmake commands which are not scriptable, since they can't be
// used in ctest scripts
this->CMake->RemoveUnscriptableCommands();