mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-22 06:31:29 -06:00
Merge topic 'revert-CTestTestfile-removal-again'
70c50aa23c Revert "Remove CTestTestfile.cmake when BUILD_TESTING is OFF"
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1887
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
1
Tests/RunCMake/CTest/CTestTestfile.cmake.in
Normal file
1
Tests/RunCMake/CTest/CTestTestfile.cmake.in
Normal file
@@ -0,0 +1 @@
|
||||
# Created manually
|
||||
8
Tests/RunCMake/CTest/NotOn-check.cmake
Normal file
8
Tests/RunCMake/CTest/NotOn-check.cmake
Normal file
@@ -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()
|
||||
3
Tests/RunCMake/CTest/NotOn.cmake
Normal file
3
Tests/RunCMake/CTest/NotOn.cmake
Normal file
@@ -0,0 +1,3 @@
|
||||
set(BUILD_TESTING OFF CACHE BOOL "Build the testing tree.")
|
||||
include(CTest)
|
||||
configure_file(CTestTestfile.cmake.in CTestTestfile.cmake)
|
||||
@@ -3,3 +3,5 @@ include(RunCMake)
|
||||
set(RunCMake_TEST_OPTIONS -DNoProject=1)
|
||||
run_cmake(BeforeProject)
|
||||
unset(RunCMake_TEST_OPTIONS)
|
||||
|
||||
run_cmake(NotOn)
|
||||
|
||||
Reference in New Issue
Block a user