diff options
author | Ken Martin <ken.martin@kitware.com> | 2004-05-04 18:18:56 (GMT) |
---|---|---|
committer | Ken Martin <ken.martin@kitware.com> | 2004-05-04 18:18:56 (GMT) |
commit | ee897e6a3c3ef2b20d0bb0d06e33201be597926e (patch) | |
tree | c3afe4ee6c2eace9091093b489477715e8cf6f76 | |
parent | ea8dc0769d58b6e713f140416215a038655cbb5d (diff) | |
download | CMake-ee897e6a3c3ef2b20d0bb0d06e33201be597926e.zip CMake-ee897e6a3c3ef2b20d0bb0d06e33201be597926e.tar.gz CMake-ee897e6a3c3ef2b20d0bb0d06e33201be597926e.tar.bz2 |
support in source builds and arg passing
-rw-r--r-- | Source/cmCTest.cxx | 53 |
1 files changed, 50 insertions, 3 deletions
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 9c08544..821a346 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -3473,8 +3473,19 @@ int cmCTest::RunConfigurationScript() return res; } -int cmCTest::RunConfigurationScript(const std::string& script) +int cmCTest::RunConfigurationScript(const std::string& total_script_arg) { + // if the argument has a , in it then it needs to be broken into the fist + // argument (which is the script) and the second argument which will be passed + // into the scripts as S_ARG + std::string script = total_script_arg; + std::string script_arg; + if (total_script_arg.find(",") != std::string::npos) + { + script = total_script_arg.substr(0,total_script_arg.find(",")); + script_arg = total_script_arg.substr(total_script_arg.find(",")+1); + } + // make sure the file exists if (!cmSystemTools::FileExists(script.c_str())) { @@ -3482,7 +3493,6 @@ int cmCTest::RunConfigurationScript(const std::string& script) return 1; } - // create a cmake instance to read the configuration script cmake cm; cmGlobalGenerator gg; @@ -3499,6 +3509,12 @@ int cmCTest::RunConfigurationScript(const std::string& script) lg->GetMakefile()->AddDefinition("CTEST_SCRIPT_NAME", cmSystemTools::GetFilenameName( script).c_str()); + // add the script arg if defined + if (script_arg.size()) + { + lg->GetMakefile()->AddDefinition("CTEST_SCRIPT_ARG", + script_arg.c_str()); + } if (!lg->GetMakefile()->ReadListFile(0, script.c_str())) { return 2; @@ -3617,7 +3633,38 @@ int cmCTest::RunConfigurationScript(const std::string& script) } } - + // if the binary directory and the source directory are the same, + // and we are starting with an empty binary directory, then that means + // we must check out the source tree + if (mf->IsOn("CTEST_START_WITH_EMPTY_BINARY_DIRECTORY") && + !strcmp(srcDir, binDir)) + { + // make sure we have the required info + if (!cvsCheckOut) + { + cmSystemTools::Error("You have specified the source and binary directories to be the same (an in source build). You have also specified that the binary directory is to be erased. This means that the source will have to be checked out from CVS. But you have not specified CTEST_CVS_CHECKOUT"); + return 8; + } + + // we must now checkout the src dir + output = ""; + if ( m_Verbose ) + { + std::cerr << "Run cvs: " << cvsCheckOut << std::endl; + } + res = cmSystemTools::RunSingleCommand(cvsCheckOut, &output, + &retVal, ctestRoot, + m_Verbose, 0 /*m_TimeOut*/); + if (!res || retVal != 0) + { + cmSystemTools::Error("Unable to perform cvs checkout "); + this->RestoreBackupDirectories(backup, srcDir, binDir, + backupSrcDir.c_str(), + backupBinDir.c_str()); + return 6; + } + } + // do an initial cvs update as required if (cvsCmd) { |