summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2018-03-26 11:29:48 (GMT)
committerBrad King <brad.king@kitware.com>2018-03-26 11:44:22 (GMT)
commit70c50aa23cc993a502cd3c87be8afb79d973b50e (patch)
tree446bffd5b90c76145e30af3a841360273b9820c0 /Source/cmLocalGenerator.cxx
parent6b9172d759b5f00069e7d2c65f1c649d4a3b0a70 (diff)
downloadCMake-70c50aa23cc993a502cd3c87be8afb79d973b50e.zip
CMake-70c50aa23cc993a502cd3c87be8afb79d973b50e.tar.gz
CMake-70c50aa23cc993a502cd3c87be8afb79d973b50e.tar.bz2
Revert "Remove CTestTestfile.cmake when BUILD_TESTING is OFF"
Revert commit v3.8.0-rc1~305^2 (Remove CTestTestfile.cmake when BUILD_TESTING is OFF, 2016-11-14) again. We reverted it once in commit v3.8.0-rc3~22^2 (Revert "Remove CTestTestfile.cmake when BUILD_TESTING is OFF", 2017-03-06) but it was accidentally restored by commit v3.11.0-rc1~387^2 (server: add "ctestInfo" request to get test info, 2017-10-25), perhaps due to conflict resolution during rebase. We cannot remove `CTestTestfile.cmake` when testing is off because it breaks projects that never enable testing but create their own `CTestTestfile.cmake` manually instead. Revert the change again and add a test case.
Diffstat (limited to 'Source/cmLocalGenerator.cxx')
-rw-r--r--Source/cmLocalGenerator.cxx11
1 files changed, 4 insertions, 7 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index cee540b..e942ff4 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);