Skip to content

Commit

Permalink
cmake: make RelWithDebInfo the default configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
madebr committed Dec 28, 2024
1 parent ae0b7c4 commit f72cc99
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
cmake_minimum_required(VERSION 3.16...3.28)

if(NOT DEFINED CMAKE_BUILD_TYPE)
set(cmake_build_type_undefined 1)
endif()

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")

# See docs/release_checklist.md
Expand Down Expand Up @@ -28,6 +32,24 @@ else()
set(SDLIMAGE_ROOTPROJECT OFF)
endif()


# By default, configure in RelWithDebInfo configuration
if(NOT SDL3_SUBPROJECT)
get_property(is_multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if(is_multi_config)
# The first item in CMAKE_CONFIGURATION_TYPES is the default configuration
if(DEFINED CMAKE_CONFIGURATION_TYPES AND "RelWithDebInfo" IN_LIST CMAKE_CONFIGURATION_TYPES)
list(REMOVE_ITEM CMAKE_CONFIGURATION_TYPES "RelWithDebInfo")
list(INSERT CMAKE_CONFIGURATION_TYPES 0 "RelWithDebInfo")
set(CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES}" CACHE STRING "CMake configuration types" FORCE)
endif()
else()
if(cmake_build_type_undefined)
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "CMake build type" FORCE)
endif()
endif()
endif()

set(SDLIMAGE_SAMPLES_DEFAULT ${SDLIMAGE_ROOTPROJECT})
if(ANDROID)
set(SDLIMAGE_SAMPLES_DEFAULT OFF)
Expand Down

0 comments on commit f72cc99

Please sign in to comment.