aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Walch <florian@fwalch.com>2014-11-08 12:49:04 +0100
committerFlorian Walch <florian@fwalch.com>2014-11-08 21:54:30 +0100
commita1d411f9c991c03488c74c6266eb37cc2bab970e (patch)
tree2ed86affacff11a7be7bf003ff19d9a5e8a472f4
parent5d0f8b63e344c13ae32d43389e22537aa8e3da4d (diff)
downloadrneovim-a1d411f9c991c03488c74c6266eb37cc2bab970e.tar.gz
rneovim-a1d411f9c991c03488c74c6266eb37cc2bab970e.tar.bz2
rneovim-a1d411f9c991c03488c74c6266eb37cc2bab970e.zip
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 eb79a18747..844c02f7e5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -64,16 +64,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")