Changed: Tweaked CMake default flags to use identical settings as VC++ projects

This commit is contained in:
kervala 2010-08-28 14:56:29 +02:00
parent c95e70ca6e
commit f745142447

View file

@ -226,12 +226,25 @@ MACRO(NL_SETUP_BUILD)
ENDIF(CMAKE_BUILD_TYPE MATCHES "Debug") ENDIF(CMAKE_BUILD_TYPE MATCHES "Debug")
IF(WIN32) IF(WIN32)
SET(NL_DEBUG_CFLAGS "/EHa /Ob1 /Zi") # don't use a /O[012x] flag if you want custom optimizations
SET(NL_RELEASE_CFLAGS "/EHa /Zi /Ox /Ob2 /Oi /Ot /Oy /GT /GF /GS-") SET(SPEED_OPTIMIZATIONS "/Ob2 /Oi /Ot /Oy /GT /GF /GS-")
SET(NL_RELEASEDEBUG_CFLAGS "/EHa /DNL_RELEASE_DEBUG /Zi /Ob2 /GF") SET(SIZE_OPTIMIZATIONS "/O1")
# without inlining it's unusable, use custom optimizations again
SET(MIN_OPTIMIZATIONS "/Ob1")
SET(CMAKE_C_FLAGS_DEBUG "/MDd /Zi /RTC1 /D_DEBUG ${MIN_OPTIMIZATIONS}")
SET(CMAKE_C_FLAGS_RELEASE "/MD /Zi /D NDEBUG ${SPEED_OPTIMIZATIONS}")
SET(CMAKE_C_FLAGS_RELWITHDEBINFO "/MD /Zi /D NDEBUG ${SPEED_OPTIMIZATIONS}")
SET(CMAKE_C_FLAGS_MINSIZEREL "/MD /D NDEBUG ${SIZE_OPTIMIZATIONS}")
SET(CMAKE_CXX_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG})
SET(CMAKE_CXX_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE})
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO ${CMAKE_C_FLAGS_RELWITHDEBINFO})
SET(CMAKE_CXX_FLAGS_MINSIZEREL ${CMAKE_C_FLAGS_MINSIZEREL})
SET(NL_DEBUG_CFLAGS "/EHa /Zi")
SET(NL_RELEASE_CFLAGS "/EHa /Zi")
SET(NL_DEBUG_LINK_FLAGS "/NODEFAULTLIB:msvcrt") SET(NL_DEBUG_LINK_FLAGS "/NODEFAULTLIB:msvcrt")
SET(NL_RELEASE_LINK_FLAGS "/OPT:REF /OPT:ICF") SET(NL_RELEASE_LINK_FLAGS "/OPT:REF /OPT:ICF")
SET(NL_RELEASEDEBUG_LINK_FLAGS "/OPT:REF /OPT:ICF")
ELSE(WIN32) ELSE(WIN32)
SET(PLATFORM_CFLAGS "-ftemplate-depth-24 -D_REENTRANT -Wall -ansi -W -Wpointer-arith -Wsign-compare -Wno-deprecated-declarations -Wno-multichar -Wno-long-long -Wno-unused") SET(PLATFORM_CFLAGS "-ftemplate-depth-24 -D_REENTRANT -Wall -ansi -W -Wpointer-arith -Wsign-compare -Wno-deprecated-declarations -Wno-multichar -Wno-long-long -Wno-unused")
IF(WITH_COVERAGE) IF(WITH_COVERAGE)
@ -243,7 +256,6 @@ MACRO(NL_SETUP_BUILD)
ENDIF(NOT APPLE) ENDIF(NOT APPLE)
SET(NL_DEBUG_CFLAGS "-DNL_DEBUG -g") SET(NL_DEBUG_CFLAGS "-DNL_DEBUG -g")
SET(NL_RELEASE_CFLAGS "-DNL_RELEASE -O6 -g") SET(NL_RELEASE_CFLAGS "-DNL_RELEASE -O6 -g")
SET(NL_RELEASEDEBUG_CFLAGS "-DNL_RELEASE_DEBUG -g -finline-functions -O3 ")
SET(NL_NONE_CFLAGS "-DNL_RELEASE -g -finline-functions -O2 ") SET(NL_NONE_CFLAGS "-DNL_RELEASE -g -finline-functions -O2 ")
ENDIF(WIN32) ENDIF(WIN32)
@ -286,14 +298,14 @@ MACRO(NL_SETUP_BUILD_FLAGS)
SET(CMAKE_LINK_FLAGS_RELEASE "${CMAKE_LINK_FLAGS_RELEASE} ${NL_RELEASE_LINK_FLAGS} ${PLATFORM_LINKFLAGS} ") SET(CMAKE_LINK_FLAGS_RELEASE "${CMAKE_LINK_FLAGS_RELEASE} ${NL_RELEASE_LINK_FLAGS} ${PLATFORM_LINKFLAGS} ")
## RelWithDebInfo ## RelWithDebInfo
SET(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} ${NL_RELEASEDEBUG_CFLAGS} ${PLATFORM_CFLAGS} ") SET(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} ${NL_RELEASE_CFLAGS} ${PLATFORM_CFLAGS} ")
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${NL_RELEASEDEBUG_CFLAGS} ${PLATFORM_CFLAGS} ") SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${NL_RELEASE_CFLAGS} ${PLATFORM_CFLAGS} ")
SET(CMAKE_LINK_FLAGS_RELWITHDEBINFO "${CMAKE_LINK_FLAGS_RELWITHDEBINFO} ${NL_RELEASEDEBUG_LINK_FLAGS} ${PLATFORM_LINKFLAGS} ") SET(CMAKE_LINK_FLAGS_RELWITHDEBINFO "${CMAKE_LINK_FLAGS_RELWITHDEBINFO} ${NL_RELEASE_LINK_FLAGS} ${PLATFORM_LINKFLAGS} ")
## MinSizeRel ## MinSizeRel
SET(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL} ${NL_RELEASEDEBUG_CFLAGS} ${PLATFORM_CFLAGS} ") SET(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL} ${NL_RELEASE_CFLAGS} ${PLATFORM_CFLAGS} ")
SET(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} ${NL_RELEASEDEBUG_CFLAGS} ${PLATFORM_CFLAGS} ") SET(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} ${NL_RELEASE_CFLAGS} ${PLATFORM_CFLAGS} ")
SET(CMAKE_LINK_FLAGS_MINSIZEREL "${CMAKE_LINK_FLAGS_MINSIZEREL} ${NL_RELEASEDEBUG_LINK_CFLAGS} ${PLATFORM_LINKFLAGS} ") SET(CMAKE_LINK_FLAGS_MINSIZEREL "${CMAKE_LINK_FLAGS_MINSIZEREL} ${NL_RELEASE_LINK_CFLAGS} ${PLATFORM_LINKFLAGS} ")
ENDMACRO(NL_SETUP_BUILD_FLAGS) ENDMACRO(NL_SETUP_BUILD_FLAGS)
MACRO(NL_SETUP_PREFIX_PATHS) MACRO(NL_SETUP_PREFIX_PATHS)