Enable CMake Release build type and LTO by default

This commit is contained in:
Diomendius
2024-07-06 14:31:27 +12:00
parent b8f8180638
commit 1505dda2b9

View File

@@ -5,6 +5,22 @@ SET(EXECNAME "AerofoilX" CACHE STRING "Defines the exec name")
message(${CMAKE_BINARY_DIR})
# Use Release build type by default
if("${CMAKE_BUILD_TYPE}" STREQUAL "")
set(CMAKE_BUILD_TYPE Release)
message("Build type unspecified, using Release")
endif()
# Enable LTO by default if supported
if("${CMAKE_INTERPROCEDURAL_OPTIMIZATION}" STREQUAL "")
include(CheckIPOSupported)
check_ipo_supported(RESULT IPO_SUPPORTED)
if(IPO_SUPPORTED)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION On)
message("Compiler supports LTO, enabling automatically")
endif()
endif()
find_package(SDL2 REQUIRED)
if(PLATFORM STREQUAL "MAC")