From f2cb5e4dd496f688c96efca83f5f848914cacc6d Mon Sep 17 00:00:00 2001 From: Max Bruckner Date: Tue, 15 Nov 2016 20:21:57 +0700 Subject: [PATCH] CMake: ENABLE_CUSTOM_COMPILER_FLAGS option --- CMakeLists.txt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dc6eb3c..3689dee 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,8 +12,11 @@ set(CJSON_VERSION_SO 1) set(CJSON_UTILS_VERSION_SO 1) set(PROJECT_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}") -if(("${CMAKE_C_COMPILER_ID}" MATCHES "GNU") OR ("${CMAKE_C_COMPILER_ID}" MATCHES "Clang")) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c89 -pedantic -Wall -Wextra -Werror -Wstrict-prototypes -Wwrite-strings") +option(ENABLE_CUSTOM_COMPILER_FLAGS ON) +if (ENABLE_CUSTOM_COMPILER_FLAGS) + if(("${CMAKE_C_COMPILER_ID}" MATCHES "GNU") OR ("${CMAKE_C_COMPILER_ID}" MATCHES "Clang")) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c89 -pedantic -Wall -Wextra -Werror -Wstrict-prototypes -Wwrite-strings") + endif() endif() #variables for pkg-config