aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Walch <florian@fwalch.com>2014-11-05 11:54:15 +0100
committerFlorian Walch <florian@fwalch.com>2014-11-05 11:54:15 +0100
commit5714afc11edec6a08f2566104fc98946994353a0 (patch)
tree83dfcb64c96808db60e7205229338a075e0be452
parent58b87579cf8db6233052685ac280e8baf909ce93 (diff)
downloadrneovim-5714afc11edec6a08f2566104fc98946994353a0.tar.gz
rneovim-5714afc11edec6a08f2566104fc98946994353a0.tar.bz2
rneovim-5714afc11edec6a08f2566104fc98946994353a0.zip
CMake: Modify _FORTIFY_SOURCE only for release builds.
Remove build warning for Debug builds: # warning _FORTIFY_SOURCE requires compiling with optimization (-O)
-rw-r--r--CMakeLists.txt7
1 files changed, 4 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 00095fae53..ef0889589f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -15,7 +15,7 @@ list(APPEND CMAKE_PREFIX_PATH ${DEPS_INSTALL_DIR})
# Version tokens
include(GetGitRevisionDescription)
get_git_head_revision(GIT_REFSPEC NVIM_VERSION_COMMIT)
-if (NOT NVIM_VERSION_COMMIT)
+if(NOT NVIM_VERSION_COMMIT)
set(NVIM_VERSION_COMMIT "?")
endif()
set(NVIM_VERSION_MAJOR 0)
@@ -25,7 +25,7 @@ set(NVIM_VERSION_PRERELEASE "-alpha")
# TODO(justinmk): UTC time would be nice here #1071
git_timestamp(GIT_TIMESTAMP)
# TODO(justinmk): do not set this for "release" builds #1071
-if (GIT_TIMESTAMP)
+if(GIT_TIMESTAMP)
set(NVIM_VERSION_BUILD "+${GIT_TIMESTAMP}")
endif()
@@ -45,7 +45,8 @@ endif()
# 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.
-if(CMAKE_COMPILER_IS_GNUCC AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS "4")
+if(CMAKE_COMPILER_IS_GNUCC AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS "4"
+ AND CMAKE_BUILD_TYPE MATCHES "^Rel")
# -U in add_definitions doesn't end up in the correct spot, so we add it to
# the flags variable instead.
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1")