aboutsummaryrefslogtreecommitdiffstats
path: root/community/ceph/44-cmake-buildtype.patch
diff options
context:
space:
mode:
Diffstat (limited to 'community/ceph/44-cmake-buildtype.patch')
-rw-r--r--community/ceph/44-cmake-buildtype.patch38
1 files changed, 38 insertions, 0 deletions
diff --git a/community/ceph/44-cmake-buildtype.patch b/community/ceph/44-cmake-buildtype.patch
new file mode 100644
index 0000000000..7112ce1a38
--- /dev/null
+++ b/community/ceph/44-cmake-buildtype.patch
@@ -0,0 +1,38 @@
+updated: https://github.com/ceph/ceph/commit/6e4481316884f08daad624c1d997378daedf410e
+
+commit a7e3ece459111d157a20d05de3a92cf4dab6bde6
+Author: Kefu Chai <kchai@redhat.com>
+Date: Thu Jul 1 15:24:50 2021 +0800
+
+ cmake: set CMAKE_BUILD_TYPE only if .git exists
+
+ distros intend to fine tune the CFLAGS and CXXFLAGS by themselves, see
+
+ - https://git.alpinelinux.org/abuild/tree/abuild.conf
+ - https://wiki.archlinux.org/title/CMake_package_guidelines#CMake_undesired_behaviors
+ - https://github.com/Debian/debhelper/blob/5d1bb29841043d8e47ebbdd043e6cd086cad508e/lib/Debian/Debhelper/Buildsystem/cmake.pm#L16
+
+ so instead of setting a CMAKE_BUILD_TYPE when building from a
+ dist tarball, let's just leave it empty.
+
+ Signed-off-by: Kefu Chai <kchai@redhat.com>
+
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index 760a2ceb0c..6f35e87f90 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -156,12 +156,8 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL Clang)
+ endif()
+ endif(CMAKE_CXX_COMPILER_ID STREQUAL GNU)
+
+-if(NOT CMAKE_BUILD_TYPE)
+- if(EXISTS "${CMAKE_SOURCE_DIR}/.git")
+- set(default_build_type "Debug")
+- else()
+- set(default_build_type "RelWithDebInfo")
+- endif()
++if(NOT DEFINED CMAKE_BUILD_TYPE AND EXISTS "${CMAKE_SOURCE_DIR}/.git")
++ 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)
+ endif()