diff options
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 3808c3c..c5c5620 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,21 +14,20 @@ project(ck C) set(ck_MAJOR_VERSION 0) set(ck_MINOR_VERSION 7) -# c flags -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall") +# Feature test macros +set(FEATURE_TEST_MACROS "-D_DEFAULT_SOURCE") +# Default C flags +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${FEATURE_TEST_MACROS} -std=c99 -pedantic") +# Warnings for debug builds +set(C_WARNINGS "-Wall -Wextra -Wwrite-strings -Wconversion -Wfloat-equal -Wpointer-arith") # options -option(CK_ASAN "Build with asan") -option(CK_DEBUG "Build with debug symbols") +option(CK_DEBUG "Build with debug symbols, asan and warnings") option(CK_TESTS "Make the tests") option(CK_SHARED "Build with shared lib") -if(CK_ASAN) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address") -endif() - if (CK_DEBUG) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g3") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${C_WARNINGS} -g3 -fsanitize=address") else(CK_DEBUG) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3") endif() |