cJSON

mirror of Dave's cJSON
git clone git://git.thc420.xyz/cJSON
Log | Files | Refs | README | LICENSE

commit 1f5538f79dd452defaaf125f18911e3769d919ec
parent 9ed906758e052bdd791702bd7a43c48f8d438849
Author: Max Bruckner <max@maxbruckner.de>
Date:   Tue,  7 Feb 2017 20:20:56 +0100

CMake: Fix several problems with automatic flag detection

Diffstat:
MCMakeLists.txt | 16++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt @@ -36,22 +36,18 @@ if (ENABLE_CUSTOM_COMPILER_FLAGS) -Wundef -Wswitch-default -Wconversion + -Wc++-compat -fstack-protector-strong ) endif() -# "I am starting to hate CMake" - FSMaxB -# In older versions of CMake, testing for -Wc++-compat -# fails because it cannot compile a regular expression -# This seems to be a bug in the CheckCSourceCompiles module -if (NOT (CMAKE_MAJOR_VERSION EQUAL 2)) - list(APPEND custom_compiler_flags "-Wc++-compat") -endif() - # apply custom compiler flags foreach(compiler_flag ${custom_compiler_flags}) - CHECK_C_COMPILER_FLAG(${compiler_flag} "FLAG_SUPPORTED-${compiler_flag}") - if (FLAG_SUPPORTED${compiler_flag}) + #remove problematic characters + string(REGEX REPLACE "[^a-zA-Z0-9]" "" current_variable ${compiler_flag}) + + CHECK_C_COMPILER_FLAG(${compiler_flag} "FLAG_SUPPORTED_${current_variable}") + if (FLAG_SUPPORTED_${current_variable}) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${compiler_flag}") endif() endforeach()