From 41ae1a0f0d86d2fc19f333ee23889c11beb0a4dd Mon Sep 17 00:00:00 2001 From: gramanas Date: Fri, 26 Oct 2018 16:00:29 +0300 Subject: Confort to pedantic std-c99 and update readme --- CMakeLists.txt | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'CMakeLists.txt') 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() -- cgit v1.2.3