aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Szakmeister <john@szakmeister.net>2014-11-09 06:58:17 -0500
committerJohn Szakmeister <john@szakmeister.net>2014-11-09 06:58:17 -0500
commitd51c0a94719381e51c8ffd11b759fd9e7f44c92d (patch)
tree4fa4aaa0bb51034ad64e3b8b23685f7d4a29e30f
parent1ea90f697113cc5a98e63df3f89552f0837561b1 (diff)
downloadrneovim-d51c0a94719381e51c8ffd11b759fd9e7f44c92d.tar.gz
rneovim-d51c0a94719381e51c8ffd11b759fd9e7f44c92d.tar.bz2
rneovim-d51c0a94719381e51c8ffd11b759fd9e7f44c92d.zip
build: only attempt to use -Og if it's supported
Commit a1d411f9c991c03488c74c6266eb37cc2bab970e just assumes that gcc will support the `-Og` option, but gcc that comes with Ubuntu 12.04 does not. Let's check to see if the flag is supported, and then decide whether to enable it or not.
-rw-r--r--CMakeLists.txt9
1 files changed, 8 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d67aebee64..f413599adb 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -67,9 +67,16 @@ if(TRAVIS_CI_BUILD)
add_definitions(-Werror)
endif()
+if(CMAKE_COMPILER_IS_GNUCC)
+ include(CheckCCompilerFlag)
+ check_c_compiler_flag(-Og HAS_OG_FLAG)
+else()
+ set(HAS_OG_FLAG 0)
+endif()
+
# Set custom build flags for RelWithDebInfo.
# -DNDEBUG purposely omitted because we want assertions.
-if(CMAKE_COMPILER_IS_GNUCC)
+if(HAS_OG_FLAG)
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-Og -g"
CACHE STRING "Flags used by the compiler during release builds with debug info." FORCE)
else()