Skip to content

Commit f578aac

Browse files
authored
follow-up for #13050 - fixed CMake warning when BUILD_TESTS is not actually provided (danmar#8277)
1 parent 33bd6fb commit f578aac

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

cmake/options.cmake

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ option(BUILD_CORE_DLL "Build lib as cppcheck-core.dll with Visual Studio"
5656
if(BUILD_CORE_DLL AND NOT MSVC)
5757
message(FATAL_ERROR "Building of lib as DLL is only supported with Visual Studio")
5858
endif()
59-
option(BUILD_TESTS "Build tests" OFF)
59+
# need to check before the option() specifying it or it will be defined
6060
if(DEFINED BUILD_TESTS)
6161
message(WARNING "BUILD_TESTS has been deprecated and will be removed in Cppcheck 2.22 - please use BUILD_TESTING instead")
6262
if(DEFINED BUILD_TESTING)
@@ -68,6 +68,7 @@ elseif(NOT DEFINED BUILD_TESTING)
6868
# disable tests by default - TODO: remove this
6969
set(BUILD_TESTING OFF)
7070
endif()
71+
option(BUILD_TESTS "Build tests" OFF)
7172
option(REGISTER_TESTS "Register tests in CTest" ON)
7273
option(ENABLE_CHECK_INTERNAL "Enable internal checks" OFF)
7374
option(DISABLE_DMAKE "Disable run-dmake dependencies" OFF)

0 commit comments

Comments
 (0)