cmake: do not issue CMAKE_BUILD_TYPE warning if set

Fixes: b8c6ba01b2
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
This commit is contained in:
Patrick Donnelly 2023-10-31 10:54:37 -04:00
parent d5792f0512
commit 536b054167
No known key found for this signature in database
GPG Key ID: FA47FD0B0367D313

View File

@ -23,13 +23,15 @@ endforeach()
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules/")
if(NOT CMAKE_BUILD_TYPE AND EXISTS "${CMAKE_SOURCE_DIR}/.git")
message(WARNING "CMAKE_BUILD_TYPE not specified, assuming CMAKE_BUILD_TYPE=Debug because .git exists.")
set(default_build_type "Debug")
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE
STRING "Default BUILD_TYPE is Debug, other options are: RelWithDebInfo, Release, and MinSizeRel." FORCE)
else()
message(WARNING "CMAKE_BUILD_TYPE not specified, leaving unset because .git does NOT exist.")
if(NOT CMAKE_BUILD_TYPE)
if (EXISTS "${CMAKE_SOURCE_DIR}/.git")
message(WARNING "CMAKE_BUILD_TYPE not specified, assuming CMAKE_BUILD_TYPE=Debug because .git exists.")
set(default_build_type "Debug")
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE
STRING "Default BUILD_TYPE is Debug, other options are: RelWithDebInfo, Release, and MinSizeRel." FORCE)
else()
message(WARNING "CMAKE_BUILD_TYPE not specified, leaving unset because .git does NOT exist.")
endif()
endif()
if(CMAKE_SYSTEM_NAME MATCHES "Linux")