Overwrite CMake default C[XX]FLAGS

CMake sets default flags for the standard build types.
We want to replace them, not merge them.

Reported by azalyn.
This commit is contained in:
dhewg 2011-12-15 17:48:59 +01:00 committed by Daniel Gibson
parent e3f2666f32
commit a7b3b9fb0b

View file

@ -116,33 +116,16 @@ if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
add_definitions(-march=pentium3) add_definitions(-march=pentium3)
endif() endif()
if (CMAKE_BUILD_TYPE STREQUAL "Debug") set(CMAKE_C_FLAGS_DEBUG "-g -D_DEBUG -O1")
add_definitions(-g) set(CMAKE_CXX_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG})
add_definitions(-D_DEBUG) set(CMAKE_C_FLAGS_DEBUGALL "-g -ggdb -D_DEBUG")
add_definitions(-O1) set(CMAKE_CXX_FLAGS_DEBUGALL ${CMAKE_C_FLAGS_DEBUGALL})
elseif (CMAKE_BUILD_TYPE STREQUAL "DebugAll") set(CMAKE_C_FLAGS_RELEASE "-O3 -ffast-math -fno-unsafe-math-optimizations -fomit-frame-pointer")
add_definitions(-g) set(CMAKE_CXX_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE})
add_definitions(-ggdb) set(CMAKE_C_FLAGS_RELWITHDEBINFO "-g -O3 -ffast-math -fno-unsafe-math-optimizations -fomit-frame-pointer")
add_definitions(-D_DEBUG) set(CMAKE_CXX_FLAGS_RELWITHDEBINFO ${CMAKE_C_FLAGS_RELWITHDEBINFO})
elseif (CMAKE_BUILD_TYPE STREQUAL "Release") set(CMAKE_C_FLAGS_MINSIZEREL "-Os -ffast-math -fno-unsafe-math-optimizations -fomit-frame-pointer")
add_definitions(-O3) set(CMAKE_CXX_FLAGS_MINSIZEREL ${CMAKE_C_FLAGS_MINSIZEREL})
add_definitions(-ffast-math)
add_definitions(-fno-unsafe-math-optimizations)
add_definitions(-fomit-frame-pointer)
elseif (CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
add_definitions(-g)
add_definitions(-O3)
add_definitions(-ffast-math)
add_definitions(-fno-unsafe-math-optimizations)
add_definitions(-fomit-frame-pointer)
elseif (CMAKE_BUILD_TYPE STREQUAL "MinSizeRel")
add_definitions(-Os)
add_definitions(-ffast-math)
add_definitions(-fno-unsafe-math-optimizations)
add_definitions(-fomit-frame-pointer)
else()
message(FATAL_ERROR "Unknown build type")
endif()
add_definitions(-fno-strict-aliasing) add_definitions(-fno-strict-aliasing)