]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
cmake: do not issue CMAKE_BUILD_TYPE warning if set
authorPatrick Donnelly <pdonnell@redhat.com>
Tue, 31 Oct 2023 14:54:37 +0000 (10:54 -0400)
committerPatrick Donnelly <pdonnell@redhat.com>
Tue, 31 Oct 2023 14:55:44 +0000 (10:55 -0400)
Fixes: b8c6ba01b262d33084b9c607d829503ac8ae25c5
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
CMakeLists.txt

index f5ea2c49b9a6e6ace43b28e15ad1a4f2fbc16048..4feb22c135e1811903eb6f1165e517a5187a7fa0 100644 (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")