From cf92cf9c0766b03a8096b499e465a6a8cc28b6f1 Mon Sep 17 00:00:00 2001 From: Robert Date: Wed, 23 Sep 2020 11:00:31 +0200 Subject: BUILD(cmake): Suppress warning on following runs The way the deprecation check for BUILD_TESTING worked, it would issue a warning in any case from the second run onwards (as CTest will set this variable to the cache) --- CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index e3fe096c7..cb4780571 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -115,7 +115,7 @@ message(STATUS "Build type: ${BUILD_STR}") message(STATUS "##################################################") # We have to check for BUILD_TESTING before including CTest as CTest defines this variable -if(DEFINED BUILD_TESTING) +if(DEFINED BUILD_TESTING AND NOT BUILD_TESTING_CHECKED) message(WARNING "Use of option \"BUILD_TESTING\" is deprecated. Use \"tests\" instead.") if(NOT tests) @@ -124,6 +124,8 @@ if(DEFINED BUILD_TESTING) endif() endif() +set(BUILD_TESTING_CHECKED ON INTERNAL CACHE BOOL "Persistent helper variable" FORCE) + if(tests) include(CTest) endif() -- cgit v1.2.3