Apply patch by rielb to make our use of custom build flags for release builds more CMake-standard

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@10935 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2012-03-06 16:42:00 +00:00
parent f75a7221f0
commit c1a43b42aa
2 changed files with 30 additions and 3 deletions

View File

@ -5,9 +5,10 @@ set(PROJECT_VERSION "0.7.3")
cmake_minimum_required(VERSION 2.8.1)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake)
include(BuildTypeSTKRelease)
if (NOT CMAKE_BUILD_TYPE)
message(STATUS "No build type selected, default to Release")
set(CMAKE_BUILD_TYPE "Release")
message(STATUS "No build type selected, default to STKRelease")
set(CMAKE_BUILD_TYPE "STKRelease")
endif()
@ -19,7 +20,6 @@ set(STK_SOURCE_DIR "src")
set(STK_DATA_DIR "${PROJECT_SOURCE_DIR}/data")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin")
set(CMAKE_CXX_FLAGS_RELEASE -O2)
# Tweakable values
if(CMAKE_BUILD_TYPE MATCHES "Debug")

View File

@ -0,0 +1,27 @@
# Build type STKRelease is similar to Release provided by CMake,
# but it uses a lower optimization level
set(CMAKE_CXX_FLAGS_STKRELEASE "-O2 -DNDEBUG" CACHE STRING
"Flags used by the C++ compiler during STK release builds."
FORCE)
set(CMAKE_C_FLAGS_STKRELEASE "-O2 -DNDEBUG" CACHE STRING
"Flags used by the C compiler during STK release builds."
FORCE)
set(CMAKE_EXE_LINKER_FLAGS_STKRELEASE
"" CACHE STRING
"Flags used for linking binaries during STK release builds."
FORCE)
set(CMAKE_SHARED_LINKER_FLAGS_STKRELEASE
"" CACHE STRING
"Flags used by the shared libraries linker during STK release builds."
FORCE)
mark_as_advanced(
CMAKE_CXX_FLAGS_STKRELEASE
CMAKE_C_FLAGS_STKRELEASE
CMAKE_EXE_LINKER_FLAGS_STKRELEASE
CMAKE_SHARED_LINKER_FLAGS_STKRELEASE)
set(CMAKE_BUILD_TYPE "${CMAKE_BUILD_TYPE}" CACHE STRING
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel STKRelease."
FORCE)