diff options
author | Daniel Stenberg <daniel@haxx.se> | 2017-08-18 23:37:52 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2017-08-18 23:37:52 +0200 |
commit | 6e12ee90e5b7e778b2ddb86b02fc03be1d5adce7 (patch) | |
tree | 53897d39eaecdf6ca2310222a0033de0fafe514c | |
parent | 0870d6bef63d902ebc6c50015d2a0b2acc9c643f (diff) | |
download | curl-bagder/cmake-picky-options.tar.gz |
cmake: search for picky options only for gcc and clangbagder/cmake-picky-options
-rw-r--r-- | CMakeLists.txt | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 5282f8ab6..50ff5adbf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -90,16 +90,18 @@ CMAKE_DEPENDENT_OPTION(ENABLE_THREADED_RESOLVER "Set to ON to enable threaded DN option(ENABLE_DEBUG "Set to ON to enable curl debug features" OFF) option(ENABLE_CURLDEBUG "Set to ON to build with TrackMemory feature enabled" OFF) -if (PICKY_COMPILER) - foreach (_CCOPT -pedantic -Wall -W -Wpointer-arith -Wwrite-strings -Wunused -Wshadow -Winline -Wnested-externs -Wmissing-declarations -Wmissing-prototypes -Wno-long-long -Wfloat-equal -Wno-multichar -Wsign-compare -Wundef -Wno-format-nonliteral -Wendif-labels -Wstrict-prototypes -Wdeclaration-after-statement -Wstrict-aliasing=3 -Wcast-align -Wtype-limits -Wold-style-declaration -Wmissing-parameter-type -Wempty-body -Wclobbered -Wignored-qualifiers -Wconversion -Wno-sign-conversion -Wvla -Wdouble-promotion -Wno-system-headers) - # surprisingly, CHECK_C_COMPILER_FLAG needs a new variable to store each new - # test result in. - CHECK_C_COMPILER_FLAG(${_CCOPT} OPT${_CCOPT}) - if(OPT${_CCOPT}) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${_CCOPT}") - endif() - endforeach() -endif(PICKY_COMPILER) +if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG) + if (PICKY_COMPILER) + foreach (_CCOPT -pedantic -Wall -W -Wpointer-arith -Wwrite-strings -Wunused -Wshadow -Winline -Wnested-externs -Wmissing-declarations -Wmissing-prototypes -Wno-long-long -Wfloat-equal -Wno-multichar -Wsign-compare -Wundef -Wno-format-nonliteral -Wendif-labels -Wstrict-prototypes -Wdeclaration-after-statement -Wstrict-aliasing=3 -Wcast-align -Wtype-limits -Wold-style-declaration -Wmissing-parameter-type -Wempty-body -Wclobbered -Wignored-qualifiers -Wconversion -Wno-sign-conversion -Wvla -Wdouble-promotion -Wno-system-headers) + # surprisingly, CHECK_C_COMPILER_FLAG needs a new variable to store each new + # test result in. + CHECK_C_COMPILER_FLAG(${_CCOPT} OPT${_CCOPT}) + if(OPT${_CCOPT}) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${_CCOPT}") + endif() + endforeach() + endif(PICKY_COMPILER) +endif(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG) if (ENABLE_DEBUG) # DEBUGBUILD will be defined only for Debug builds |