Added: VC++ flags to fix some warnings and errors
This commit is contained in:
parent
230039a5c3
commit
b2585e21f6
1 changed files with 34 additions and 26 deletions
|
@ -288,6 +288,26 @@ MACRO(NL_SETUP_BUILD)
|
|||
ENDIF(CMAKE_BUILD_TYPE MATCHES "Release")
|
||||
ENDIF(CMAKE_BUILD_TYPE MATCHES "Debug")
|
||||
|
||||
# Determine target CPU
|
||||
# IF(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86")
|
||||
IF(NOT CMAKE_SIZEOF_VOID_P)
|
||||
INCLUDE (CheckTypeSize)
|
||||
CHECK_TYPE_SIZE("void*" CMAKE_SIZEOF_VOID_P)
|
||||
ENDIF(NOT CMAKE_SIZEOF_VOID_P)
|
||||
|
||||
# Using 32 or 64 bits libraries
|
||||
SET(TARGET_X86 1)
|
||||
IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
SET(ARCH "x86_64")
|
||||
SET(TARGET_X64 1)
|
||||
ADD_DEFINITIONS(-DHAVE_X86_64)
|
||||
ELSE(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
SET(ARCH "x86")
|
||||
ADD_DEFINITIONS(-DHAVE_X86)
|
||||
ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
# ADD_DEFINITIONS(-DHAVE_IA64)
|
||||
# ENDIF(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86")
|
||||
|
||||
IF(WIN32)
|
||||
IF(MSVC10)
|
||||
# /Ox is working with VC++ 2010, but custom optimizations don't exist
|
||||
|
@ -301,14 +321,24 @@ MACRO(NL_SETUP_BUILD)
|
|||
SET(MIN_OPTIMIZATIONS "/Ob1")
|
||||
ENDIF(MSVC10)
|
||||
|
||||
SET(PLATFORM_CFLAGS "/D_CRT_SECURE_NO_WARNINGS /DWIN32 /D_WINDOWS /W3 /Zi /Zm1000 /MP")
|
||||
|
||||
# Exceptions are only set for C++
|
||||
SET(PLATFORM_CXXFLAGS "${PLATFORM_CFLAGS} /EHa")
|
||||
SET(PLATFORM_CFLAGS "/D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_WARNINGS /DWIN32 /D_WINDOWS /W3 /Zi /Zm1000 /MP /Gy-")
|
||||
|
||||
# Common link flags
|
||||
SET(PLATFORM_LINKFLAGS "-DEBUG")
|
||||
|
||||
IF(TARGET_X64)
|
||||
# Fix a bug with Intellisense
|
||||
SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} /D_WIN64")
|
||||
# Fix a compilation error for some big C++ files
|
||||
SET(MIN_OPTIMIZATIONS "${MIN_OPTIMIZATIONS} /bigobj")
|
||||
ELSE(TARGET_X64)
|
||||
# Allows 32 bits applications to use 3 GB of RAM
|
||||
SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} /LARGEADDRESSAWARE")
|
||||
ENDIF(TARGET_X64)
|
||||
|
||||
# Exceptions are only set for C++
|
||||
SET(PLATFORM_CXXFLAGS "${PLATFORM_CFLAGS} /EHa")
|
||||
|
||||
SET(NL_DEBUG_CFLAGS "/MDd /RTC1 /D_DEBUG ${MIN_OPTIMIZATIONS}")
|
||||
SET(NL_RELEASE_CFLAGS "/MD /D NDEBUG ${SPEED_OPTIMIZATIONS}")
|
||||
SET(NL_DEBUG_LINKFLAGS "/NODEFAULTLIB:msvcrt /INCREMENTAL:YES")
|
||||
|
@ -331,29 +361,7 @@ MACRO(NL_SETUP_BUILD)
|
|||
|
||||
SET(NL_DEBUG_CFLAGS "-DNL_DEBUG -D_DEBUG")
|
||||
SET(NL_RELEASE_CFLAGS "-DNL_RELEASE -DNDEBUG -O6")
|
||||
|
||||
ENDIF(WIN32)
|
||||
|
||||
# Determine target CPU
|
||||
# IF(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86")
|
||||
IF(NOT CMAKE_SIZEOF_VOID_P)
|
||||
INCLUDE (CheckTypeSize)
|
||||
CHECK_TYPE_SIZE("void*" CMAKE_SIZEOF_VOID_P)
|
||||
ENDIF(NOT CMAKE_SIZEOF_VOID_P)
|
||||
|
||||
# Using 32 or 64 bits libraries
|
||||
SET(TARGET_X86 1)
|
||||
IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
SET(ARCH "x86_64")
|
||||
SET(TARGET_X64 1)
|
||||
ADD_DEFINITIONS(-DHAVE_X86_64)
|
||||
ELSE(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
SET(ARCH "x86")
|
||||
ADD_DEFINITIONS(-DHAVE_X86)
|
||||
ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
# ADD_DEFINITIONS(-DHAVE_IA64)
|
||||
# ENDIF(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86")
|
||||
|
||||
ENDMACRO(NL_SETUP_BUILD)
|
||||
|
||||
MACRO(NL_SETUP_BUILD_FLAGS)
|
||||
|
|
Loading…
Reference in a new issue