Revert "Remove CTestTestfile.cmake when BUILD_TESTING is OFF"
Revert !258 (merged) again. We reverted it once in !553 (merged) but it was accidentally restored by !1414 (merged), 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.