diff options
author | Rich Wareham <rjw57@cam.ac.uk> | 2014-02-27 12:27:20 +0000 |
---|---|---|
committer | Rich Wareham <rjw57@cam.ac.uk> | 2014-02-27 12:29:44 +0000 |
commit | 1f827beff0ddc3aa10189aac5e756a70c3eec270 (patch) | |
tree | 45634f1959f46e9d6993525873eb7275f9f993ff | |
parent | 29f4e8ebc4f45ba65589bb1a3748f3560a1f6a6d (diff) | |
download | rneovim-1f827beff0ddc3aa10189aac5e756a70c3eec270.tar.gz rneovim-1f827beff0ddc3aa10189aac5e756a70c3eec270.tar.bz2 rneovim-1f827beff0ddc3aa10189aac5e756a70c3eec270.zip |
Use CMAKE_C_FLAGS variable to set compiler flags.
If the compiler is some GNU-alike variant, set the compiler flags to use
the gnu99 dialect of C and enable all warnings.
Non-GNU compilers may have to have their own magic added to set dialect
and enable warnings.
Closes #179.
-rw-r--r-- | CMakeLists.txt | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 04b59acd28..8859ab8488 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,7 +10,12 @@ set(NEOVIM_VERSION_PATCH 0) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) -add_definitions(-DHAVE_CONFIG_H -Wall -std=gnu99) +# If the C compiler is some GNU-alike, use the gnu99 standard and enable all warnings. +if(CMAKE_COMPILER_IS_GNUCC) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -std=gnu99") +endif(CMAKE_COMPILER_IS_GNUCC) + +add_definitions(-DHAVE_CONFIG_H) if(CMAKE_BUILD_TYPE MATCHES Debug) # cmake automatically appends -g to the compiler flags set(DEBUG 1) |