Module: kamailio
Branch: master
Commit: b6f25031590e472f0f63b3e2a4fa61dad946a582
URL:
https://github.com/kamailio/kamailio/commit/b6f25031590e472f0f63b3e2a4fa61d…
Author: Xenofon Karamanos <xk(a)gilawa.com>
Committer: Xenofon Karamanos <xk(a)gilawa.com>
Date: 2024-12-10T12:37:00Z
cmake: Build type set to Debug
---
Added: cmake/BuildType.cmake
Modified: CMakeLists.txt
---
Diff:
https://github.com/kamailio/kamailio/commit/b6f25031590e472f0f63b3e2a4fa61d…
Patch:
https://github.com/kamailio/kamailio/commit/b6f25031590e472f0f63b3e2a4fa61d…
---
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f7270f0abc3..47e7c0b2a55 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -23,6 +23,9 @@ message(STATUS "VERSIONVAL: ${VERSIONVAL}")
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED True)
+list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules")
+
+include(${CMAKE_SOURCE_DIR}/cmake/BuildType.cmake)
# -----------------------
# Main project name
# -----------------------
@@ -37,8 +40,6 @@ set(CFG_NAME
CACHE STRING "Config name"
)
-list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules")
-
# Add the source directory
add_subdirectory(src)
diff --git a/cmake/BuildType.cmake b/cmake/BuildType.cmake
new file mode 100644
index 00000000000..7b15e3e052f
--- /dev/null
+++ b/cmake/BuildType.cmake
@@ -0,0 +1,21 @@
+# Set a default build type if none was specified
+set(default_build_type "Release")
+if(EXISTS "${CMAKE_SOURCE_DIR}/.git")
+ set(default_build_type "Debug")
+endif()
+
+if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
+ message(
+ STATUS
+ "Setting build type to '${default_build_type}' as none was
specified."
+ )
+ set(CMAKE_BUILD_TYPE
+ "${default_build_type}"
+ CACHE STRING "Choose the type of build." FORCE
+ )
+ # Set the possible values of build type for cmake-gui
+ set_property(
+ CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release"
"MinSizeRel"
+ "RelWithDebInfo"
+ )
+endif()