aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Szakmeister <john@szakmeister.net>2014-11-07 06:21:54 -0500
committerJohn Szakmeister <john@szakmeister.net>2014-11-07 06:21:54 -0500
commit5d97f3fc2c259613db7065f249e073a7994fab29 (patch)
tree0c58b91e12dadc7aa484cd1a0c12967378db9d7a
parentf7a468c1e76a1b2fb4ccf436fc9d50174b88b412 (diff)
downloadrneovim-5d97f3fc2c259613db7065f249e073a7994fab29.tar.gz
rneovim-5d97f3fc2c259613db7065f249e073a7994fab29.tar.bz2
rneovim-5d97f3fc2c259613db7065f249e073a7994fab29.zip
build: default to using -O2 for release builds
The -O3 optimization level can often lead to dangerous (and sometimes incorrect) optimizations being performed. So let's use a level that's more stable.
-rw-r--r--CMakeLists.txt3
1 files changed, 3 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index eb79a18747..951a0c14f3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -42,6 +42,9 @@ if(APPLE)
endif()
endif()
+# Default to -O2 on release builds.
+string(REPLACE "-O3" "-O2" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
+
# gcc 4.0 and better turn on _FORTIFY_SOURCE=2 automatically. This currently
# does not work with Neovim due to some uses of dynamically-sized structures.
# See https://github.com/neovim/neovim/issues/223 for details.