From c4174d3d5cde82a6d0ede7e3d1cab7127d22718f Mon Sep 17 00:00:00 2001 From: OGINO Masanori Date: Mon, 11 May 2015 12:54:16 +0900 Subject: [PATCH] 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 --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cb3743fd..45a3a2b6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,8 +11,8 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/") set(CMAKE_RUNTIME_OUTPUT_DIRECTORY bin) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY lib) -set(CMAKE_C_FLAGS "-O2 -Wall -Wextra") -set(CMAKE_C_FLAGS_DEBUG "-O0 -g -DDEBUG=1") +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2 -Wall -Wextra") +set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0 -g -DDEBUG=1") option(STRICT_C89_MODE "Strict c89 mode" OFF) if(STRICT_C89_MODE)