summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2022-08-19 20:12:40 +0300
committerIvan Maidanski <ivmai@mail.ru>2022-08-19 20:12:40 +0300
commit4c25246cfb4cf5a6a610b2f63a6f18e06b1dbdcf (patch)
treec59ac052d51fb12cd6b819b4ed36c58b5d8cc107 /CMakeLists.txt
parent3aacaba9b775750b089ad8c7030cb20a1ebc3185 (diff)
downloadbdwgc-4c25246cfb4cf5a6a610b2f63a6f18e06b1dbdcf.tar.gz
Set default build type to RelWithDebInfo (CMake)
Issue #468 (bdwgc). This enforces -O2 -g options passed to the compiler (in case of the gcc or clang compiler), matching that of the configure-based build. * CMakeLists.txt [!CMAKE_BUILD_TYPE && !CMAKE_CONFIGURATION_TYPES] (CMAKE_BUILD_TYPE): Set to RelWithDebInfo; set property (listing all possible values).
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt9
1 files changed, 9 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 18dda3d2..c9b8b2d5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -83,6 +83,15 @@ option(install_headers "Install header and pkg-config metadata files" ON)
option(with_libatomic_ops "Use an external libatomic_ops" OFF)
option(without_libatomic_ops "Use atomic_ops.h in libatomic_ops/src" OFF)
+# Override the default build type to RelWithDebInfo (this instructs cmake to
+# pass -O2 -g -DNDEBUG options to the compiler by default).
+if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
+ set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE
+ STRING "Choose the type of build." FORCE)
+ set_property(CACHE CMAKE_BUILD_TYPE PROPERTY
+ STRINGS "Debug" "Release" "RelWithDebInfo" "MinSizeRel")
+endif()
+
# Convert VER_INFO values to [SO]VERSION ones.
if (BUILD_SHARED_LIBS)
# cord: