summaryrefslogtreecommitdiffstats
path: root/Source/cmCTest.cxx
diff options
context:
space:
mode:
authorJean-Christophe Fillion-Robin <jchris.fillionr@kitware.com>2011-10-27 02:48:36 (GMT)
committerDavid Cole <david.cole@kitware.com>2011-10-27 03:23:03 (GMT)
commit76ecdd8d169fd2565466669875b5ed7e7c5c1963 (patch)
treea1ffce44c88ac6ca471a948a02830af948fd3c64 /Source/cmCTest.cxx
parent2b0f8c7de0c922c98753a3a13d251306aabc9bdb (diff)
downloadCMake-76ecdd8d169fd2565466669875b5ed7e7c5c1963.zip
CMake-76ecdd8d169fd2565466669875b5ed7e7c5c1963.tar.gz
CMake-76ecdd8d169fd2565466669875b5ed7e7c5c1963.tar.bz2
CTest: Look for CTestConfig.cmake in build dir first, then source dir
Provide the ability to configure CTest with settings different from the ones available in the source tree by checking first if CTestConfig.cmake exists in the build tree. The motivation is to allow build system checking out external project to test and/or package them and submit the associated results to a different dashboard than the one specified (or not) in the source of the external project. For example, the build system of Slicer can checkout, build, test and package what I will call "extensions". These extensions can be developed by third parties who can test and submit to their own dashboard / project. When checked out by Slicer build system, the default dashboard can now be overwritten by adding a custom CTestConfig.cmake to the build directory. And if not overwritten, it would avoid to create CTestConfig.cmake within the source checkout of the extension.
Diffstat (limited to 'Source/cmCTest.cxx')
-rw-r--r--Source/cmCTest.cxx32
1 files changed, 26 insertions, 6 deletions
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index 702ba10..aa75453 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -655,10 +655,26 @@ bool cmCTest::InitializeFromCommand(cmCTestStartCommand* command)
}
cmMakefile* mf = command->GetMakefile();
- std::string fname = src_dir;
- fname += "/CTestConfig.cmake";
- cmSystemTools::ConvertToUnixSlashes(fname);
- if ( cmSystemTools::FileExists(fname.c_str()) )
+ std::string fname;
+
+ std::string src_dir_fname = src_dir;
+ src_dir_fname += "/CTestConfig.cmake";
+ cmSystemTools::ConvertToUnixSlashes(src_dir_fname);
+
+ std::string bld_dir_fname = bld_dir;
+ bld_dir_fname += "/CTestConfig.cmake";
+ cmSystemTools::ConvertToUnixSlashes(bld_dir_fname);
+
+ if ( cmSystemTools::FileExists(bld_dir_fname.c_str()) )
+ {
+ fname = bld_dir_fname;
+ }
+ else if ( cmSystemTools::FileExists(src_dir_fname.c_str()) )
+ {
+ fname = src_dir_fname;
+ }
+
+ if ( !fname.empty() )
{
cmCTestLog(this, OUTPUT, " Reading ctest configuration file: "
<< fname.c_str() << std::endl);
@@ -674,8 +690,12 @@ bool cmCTest::InitializeFromCommand(cmCTestStartCommand* command)
}
else
{
- cmCTestLog(this, WARNING, "Cannot locate CTest configuration: "
- << fname.c_str() << std::endl);
+ cmCTestLog(this, WARNING,
+ "Cannot locate CTest configuration: in BuildDirectory: "
+ << bld_dir_fname.c_str() << std::endl);
+ cmCTestLog(this, WARNING,
+ "Cannot locate CTest configuration: in SourceDirectory: "
+ << src_dir_fname.c_str() << std::endl);
}
this->SetCTestConfigurationFromCMakeVariable(mf, "NightlyStartTime",