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>
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(DEFINED CMAKE_BUILD_TYPE OR 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()