set compiler and linker flags only for msvc
This commit is contained in:
parent
f7ba9ec0a6
commit
36f9925357
1 changed files with 17 additions and 18 deletions
|
@ -46,26 +46,25 @@ elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
|
|||
message(FATAL_ERROR "Visual Studio 2015 or higher required")
|
||||
endif()
|
||||
|
||||
|
||||
# DEBUG compiler flags:
|
||||
# /Zi create debugging information PDB file
|
||||
# /Od disable optimizations
|
||||
# /Oy- do not suppress frame pointers (recommended for debugging)
|
||||
# /MTd use statically linked, thread-safe, debug CRT libs (Magic Builder set this flag when build)
|
||||
#
|
||||
# RELEASE compiler flags:
|
||||
# /MT use statically linked, thread-safe CRT libs (Magic Builder set this flag when build)
|
||||
# /GS- no Buffer Security Check
|
||||
#
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /Zi /Od /Oy-")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zi")
|
||||
|
||||
# Explaining of linker flags and why enable pdb with debug info for Release build is on:
|
||||
# https://www.wintellect.com/correctly-creating-native-c-release-build-pdbs
|
||||
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /DEBUG /OPT:REF /OPT:ICF")
|
||||
endif()
|
||||
|
||||
# DEBUG compiler flags:
|
||||
# /Zi create debugging information PDB file
|
||||
# /Od disable optimizations
|
||||
# /Oy- do not suppress frame pointers (recommended for debugging)
|
||||
# /MTd use statically linked, thread-safe, debug CRT libs (Magic Builder set this flag when build)
|
||||
#
|
||||
# RELEASE compiler flags:
|
||||
# /MT use statically linked, thread-safe CRT libs (Magic Builder set this flag when build)
|
||||
# /GS- no Buffer Security Check
|
||||
#
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /Zi /Od /Oy-")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zi")
|
||||
|
||||
# Explaining of linker flags and why enable pdb with debug info for Release build is on:
|
||||
# https://www.wintellect.com/correctly-creating-native-c-release-build-pdbs
|
||||
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_STATIC_LINKER_FLAGS_RELEASEz} /DEBUG /OPT:REF /OPT:ICF")
|
||||
|
||||
|
||||
subdirs(src conf man files)
|
||||
if(WITH_LUA)
|
||||
add_subdirectory(lua)
|
||||
|
|
Loading…
Add table
Reference in a new issue