Skip to content

Commit beb44d1

Browse files
committed
Merge PR ceph#54272 into main
* refs/pull/54272/head: cmake: do not issue CMAKE_BUILD_TYPE warning if set Reviewed-by: Ilya Dryomov <[email protected]> Reviewed-by: Casey Bodley <[email protected]>
2 parents dc36aa7 + 536b054 commit beb44d1

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

CMakeLists.txt

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,15 @@ endforeach()
2323

2424
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules/")
2525

26-
if(NOT CMAKE_BUILD_TYPE AND EXISTS "${CMAKE_SOURCE_DIR}/.git")
27-
message(WARNING "CMAKE_BUILD_TYPE not specified, assuming CMAKE_BUILD_TYPE=Debug because .git exists.")
28-
set(default_build_type "Debug")
29-
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE
30-
STRING "Default BUILD_TYPE is Debug, other options are: RelWithDebInfo, Release, and MinSizeRel." FORCE)
31-
else()
32-
message(WARNING "CMAKE_BUILD_TYPE not specified, leaving unset because .git does NOT exist.")
26+
if(NOT CMAKE_BUILD_TYPE)
27+
if (EXISTS "${CMAKE_SOURCE_DIR}/.git")
28+
message(WARNING "CMAKE_BUILD_TYPE not specified, assuming CMAKE_BUILD_TYPE=Debug because .git exists.")
29+
set(default_build_type "Debug")
30+
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE
31+
STRING "Default BUILD_TYPE is Debug, other options are: RelWithDebInfo, Release, and MinSizeRel." FORCE)
32+
else()
33+
message(WARNING "CMAKE_BUILD_TYPE not specified, leaving unset because .git does NOT exist.")
34+
endif()
3335
endif()
3436

3537
if(CMAKE_SYSTEM_NAME MATCHES "Linux")

0 commit comments

Comments
 (0)