Make CMAKE_C_FLAGS{,_DEBUG} configurable.

Now you can add any options for compilers with e.g. `cmake
-DCMAKE_C_FLAGS="-Werror -Wformat=2"`. Note that these options are added
at first, so `cmake -DCMAKE_C_FLAGS=-O3` would not work as expected
since `-O2` is specified after your `-O3`.

Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
This commit is contained in:
OGINO Masanori 2015-05-11 12:54:16 +09:00
parent e7946902c1
commit c4174d3d5c
1 changed files with 2 additions and 2 deletions

View File

@ -11,8 +11,8 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY bin) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY lib) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY lib)
set(CMAKE_C_FLAGS "-O2 -Wall -Wextra") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2 -Wall -Wextra")
set(CMAKE_C_FLAGS_DEBUG "-O0 -g -DDEBUG=1") set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0 -g -DDEBUG=1")
option(STRICT_C89_MODE "Strict c89 mode" OFF) option(STRICT_C89_MODE "Strict c89 mode" OFF)
if(STRICT_C89_MODE) if(STRICT_C89_MODE)