Skip to content

Commit 319f657

Browse files
committed
cmake: make RelWithDebInfo the default configuration
1 parent d842d52 commit 319f657

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

CMakeLists.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
cmake_minimum_required(VERSION 3.16)
22

3+
if(NOT DEFINED CMAKE_BUILD_TYPE)
4+
set(cmake_build_type_undefined 1)
5+
endif()
6+
37
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
48

59
# See docs/release_checklist.md
@@ -26,6 +30,23 @@ else()
2630
set(SDLNET_ROOTPROJECT OFF)
2731
endif()
2832

33+
# By default, configure in RelWithDebInfo configuration
34+
if(SDLNET_ROOTPROJECT)
35+
get_property(is_multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
36+
if(is_multi_config)
37+
# The first item in CMAKE_CONFIGURATION_TYPES is the default configuration
38+
if(DEFINED CMAKE_CONFIGURATION_TYPES AND "RelWithDebInfo" IN_LIST CMAKE_CONFIGURATION_TYPES)
39+
list(REMOVE_ITEM CMAKE_CONFIGURATION_TYPES "RelWithDebInfo")
40+
list(INSERT CMAKE_CONFIGURATION_TYPES 0 "RelWithDebInfo")
41+
set(CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES}" CACHE STRING "CMake configuration types" FORCE)
42+
endif()
43+
else()
44+
if(cmake_build_type_undefined)
45+
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "CMake build type" FORCE)
46+
endif()
47+
endif()
48+
endif()
49+
2950
set(SDLNET_SAMPLES_DEFAULT ${SDLNET_ROOTPROJECT})
3051
if(ANDROID)
3152
set(SDLNET_SAMPLES_DEFAULT OFF)

0 commit comments

Comments
 (0)