Skip to content

Commit

Permalink
Simplify optimization flags, add MSVC flags
Browse files Browse the repository at this point in the history
  • Loading branch information
nemequ committed Aug 13, 2016
1 parent b2500ca commit 884cfae
Showing 1 changed file with 6 additions and 19 deletions.
25 changes: 6 additions & 19 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -150,25 +150,12 @@ if (ENABLE_COVERAGE)
message(FATAL_ERROR "Coverage analysis requires a debug build.")
endif()
else()
if (NOT MSVC)
set(CMAKE_C_FLAGS_DEBUG "-g -O2")
set(CMAKE_CXX_FLAGS_DEBUG "-g -O2")

check_c_compiler_flag("-Os" "CFLAG__Os")
check_cxx_compiler_flag("-Os" "CXXFLAG__Os")

if(CFLAG__Os)
set(CMAKE_C_FLAGS_RELEASE "-Os -DNDEBUG")
else()
set(CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG")
endif()

if(CFLAG__Os)
set(CMAKE_CXX_FLAGS_RELEASE "-Os -DNDEBUG")
else()
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
endif()
endif()
set_compiler_specific_flags(
VARIABLE optimization_flags
GCCISH -O3 -DNDEBUG
MSVC /O2 /DNDEBUG)
global_add_compiler_flags(${optimization_flags})
unset(optimization_flags)
endif()

set_directory_properties(PROPERTIES INTERPROCEDURAL_OPTIMIZATION TRUE)
Expand Down

0 comments on commit 884cfae

Please sign in to comment.