aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2014-11-08 18:39:12 -0500
committerJustin M. Keyes <justinkz@gmail.com>2014-11-08 18:39:12 -0500
commitc9df7ba308434be02365a35458d67840fcba4c7e (patch)
tree28e4d52a8505571342433e5cc1294cc2bda03f52
parent2aeda4ba6f033707dd96daabd2084d239ac82b3d (diff)
parenta1d411f9c991c03488c74c6266eb37cc2bab970e (diff)
downloadrneovim-c9df7ba308434be02365a35458d67840fcba4c7e.tar.gz
rneovim-c9df7ba308434be02365a35458d67840fcba4c7e.tar.bz2
rneovim-c9df7ba308434be02365a35458d67840fcba4c7e.zip
Merge pull request #1383 from fwalch/nvim-buildtype
CMake: Set custom RelWithDebInfo compile flags.
-rw-r--r--CMakeLists.txt15
1 files changed, 12 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 951a0c14f3..d67aebee64 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -67,16 +67,25 @@ if(TRAVIS_CI_BUILD)
add_definitions(-Werror)
endif()
-add_definitions(-DINCLUDE_GENERATED_DECLARATIONS)
+# Set custom build flags for RelWithDebInfo.
+# -DNDEBUG purposely omitted because we want assertions.
+if(CMAKE_COMPILER_IS_GNUCC)
+ set(CMAKE_C_FLAGS_RELWITHDEBINFO "-Og -g"
+ CACHE STRING "Flags used by the compiler during release builds with debug info." FORCE)
+else()
+ set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g"
+ CACHE STRING "Flags used by the compiler during release builds with debug info." FORCE)
+endif()
-add_definitions(-DHAVE_CONFIG_H)
if(CMAKE_BUILD_TYPE MATCHES Debug)
- # cmake automatically appends -g to the compiler flags
set(DEBUG 1)
else()
set(DEBUG 0)
endif()
+add_definitions(-DINCLUDE_GENERATED_DECLARATIONS)
+add_definitions(-DHAVE_CONFIG_H)
+
if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--no-undefined")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined")