Skip to content

Commit

Permalink
Properly set optimization level for GCC on Windows.
Browse files Browse the repository at this point in the history
  • Loading branch information
gablank committed Jun 19, 2015
1 parent 5e3ebd1 commit 49e2a76
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@ endif()

# GCC on Windows generates wrong code with -O3
if(WINDOWS AND GCC)
set(CMAKE_CXX_FLAGS_RELEASE "-O2")
# Remove -O3
string (REPLACE "-O3" "" CMAKE_CXX_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE})
# Add -O2
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2")
# -ftree-vectorize is turned on by -O3 but not -O2.
# Investigate if the issue of generating wrong code still exists before uncommenting the following line.
# set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -ftree-vectorize")
Expand Down

0 comments on commit 49e2a76

Please sign in to comment.