summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2018-03-26 07:48:15 -0400
committerBrad King <brad.king@kitware.com>2018-03-26 07:48:15 -0400
commit188c5c2a46173b0bcff928098fb406ad925fb3db (patch)
tree9316d81cb400fe459b4853fe5600b98b3740f41b
parent218471a35c59f134051058e0dc2e0947df0052b4 (diff)
parent70c50aa23cc993a502cd3c87be8afb79d973b50e (diff)
downloadcmake-188c5c2a46173b0bcff928098fb406ad925fb3db.tar.gz
Merge branch 'revert-CTestTestfile-removal-again' into release-3.11
Merge-request: !1887
-rw-r--r--Source/cmLocalGenerator.cxx11
-rw-r--r--Tests/RunCMake/CTest/CTestTestfile.cmake.in1
-rw-r--r--Tests/RunCMake/CTest/NotOn-check.cmake8
-rw-r--r--Tests/RunCMake/CTest/NotOn.cmake3
-rw-r--r--Tests/RunCMake/CTest/RunCMakeTest.cmake2
5 files changed, 18 insertions, 7 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index cee540bdb8..e942ff4d96 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -224,14 +224,7 @@ void cmLocalGenerator::TraceDependencies()
void cmLocalGenerator::GenerateTestFiles()
{
- std::string file = this->StateSnapshot.GetDirectory().GetCurrentBinary();
- file += "/";
- file += "CTestTestfile.cmake";
-
if (!this->Makefile->IsOn("CMAKE_TESTING_ENABLED")) {
- if (cmSystemTools::FileExists(file)) {
- cmSystemTools::RemoveFile(file);
- }
return;
}
@@ -240,6 +233,10 @@ void cmLocalGenerator::GenerateTestFiles()
const std::string& config =
this->Makefile->GetConfigurations(configurationTypes, false);
+ std::string file = this->StateSnapshot.GetDirectory().GetCurrentBinary();
+ file += "/";
+ file += "CTestTestfile.cmake";
+
cmGeneratedFileStream fout(file.c_str());
fout.SetCopyIfDifferent(true);
diff --git a/Tests/RunCMake/CTest/CTestTestfile.cmake.in b/Tests/RunCMake/CTest/CTestTestfile.cmake.in
new file mode 100644
index 0000000000..07632445c0
--- /dev/null
+++ b/Tests/RunCMake/CTest/CTestTestfile.cmake.in
@@ -0,0 +1 @@
+# Created manually
diff --git a/Tests/RunCMake/CTest/NotOn-check.cmake b/Tests/RunCMake/CTest/NotOn-check.cmake
new file mode 100644
index 0000000000..b68218af05
--- /dev/null
+++ b/Tests/RunCMake/CTest/NotOn-check.cmake
@@ -0,0 +1,8 @@
+set(f "${RunCMake_TEST_BINARY_DIR}/CTestTestfile.cmake")
+if(NOT EXISTS "${f}")
+ set(RunCMake_TEST_FAILED "File does not exist:\n ${f}")
+endif()
+file(READ ${f} content)
+if(NOT "${content}" MATCHES "^# Created manually")
+ set(RunCMake_TEST_FAILED "File:\n ${f}\nhas unexpected content:\n ${content}")
+endif()
diff --git a/Tests/RunCMake/CTest/NotOn.cmake b/Tests/RunCMake/CTest/NotOn.cmake
new file mode 100644
index 0000000000..7fba019b69
--- /dev/null
+++ b/Tests/RunCMake/CTest/NotOn.cmake
@@ -0,0 +1,3 @@
+set(BUILD_TESTING OFF CACHE BOOL "Build the testing tree.")
+include(CTest)
+configure_file(CTestTestfile.cmake.in CTestTestfile.cmake)
diff --git a/Tests/RunCMake/CTest/RunCMakeTest.cmake b/Tests/RunCMake/CTest/RunCMakeTest.cmake
index a6f684224f..13922401eb 100644
--- a/Tests/RunCMake/CTest/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CTest/RunCMakeTest.cmake
@@ -3,3 +3,5 @@ include(RunCMake)
set(RunCMake_TEST_OPTIONS -DNoProject=1)
run_cmake(BeforeProject)
unset(RunCMake_TEST_OPTIONS)
+
+run_cmake(NotOn)