diff options
author | Jean-Christophe Fillion-Robin <jchris.fillionr@kitware.com> | 2015-01-21 02:09:53 -0500 |
---|---|---|
committer | Jean-Christophe Fillion-Robin <jchris.fillionr@kitware.com> | 2015-01-21 02:09:53 -0500 |
commit | e636e75ced44763c4d76604a66e8bfc877edea09 (patch) | |
tree | d33d7a4f053b58491d832a8d89b7db53531fbd67 /CMakeLists.txt | |
parent | f93e32f4a2e4b67b05d9042346439c169c03a39d (diff) | |
download | libarchive-e636e75ced44763c4d76604a66e8bfc877edea09.tar.gz |
Fix warnings for CMake Policy CMP0054
This commit ensures the variables CMAKE_C_COMPILER_ID and
CMAKE_C_COMPILER_ID will always be interpreted by removing
the double quotes.
It fixes warnings like this one:
CMake Warning (dev) at CMakeLists.txt:91 (IF):
Policy CMP0054 is not set: Only interpret if() arguments as variables or
keywords when unquoted. Run "cmake --help-policy CMP0054" for policy
details. Use the cmake_policy command to set the policy and suppress this
warning.
Quoted variables like "CMAKE_C_COMPILER_ID" will no longer be dereferenced
when the policy is set to NEW. Since the policy is not set the OLD
behavior will be used.
This warning is for project developers. Use -Wno-dev to suppress it.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 9f18c8bc..a9d2531e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -88,7 +88,7 @@ SET(CMAKE_REQUIRED_FLAGS) # Especially for early development, we want to be a little # aggressive about diagnosing build problems; this can get # relaxed somewhat in final shipping versions. -IF ("CMAKE_C_COMPILER_ID" MATCHES "^GNU$") +IF (CMAKE_C_COMPILER_ID MATCHES "^GNU$") SET(CMAKE_REQUIRED_FLAGS "-Wall -Wformat -Wformat-security") ################################################################# # Set compile flags for all build types. @@ -100,8 +100,8 @@ IF ("CMAKE_C_COMPILER_ID" MATCHES "^GNU$") SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wshadow") SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wmissing-prototypes") SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wcast-qual") -ENDIF ("CMAKE_C_COMPILER_ID" MATCHES "^GNU$") -IF ("CMAKE_C_COMPILER_ID" MATCHES "^Clang$") +ENDIF (CMAKE_C_COMPILER_ID MATCHES "^GNU$") +IF (CMAKE_C_COMPILER_ID MATCHES "^Clang$") SET(CMAKE_REQUIRED_FLAGS "-Wall -Wformat -Wformat-security") ################################################################# # Set compile flags for all build types. @@ -114,7 +114,7 @@ IF ("CMAKE_C_COMPILER_ID" MATCHES "^Clang$") SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wshadow") SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wmissing-prototypes") SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wcast-qual") -ENDIF ("CMAKE_C_COMPILER_ID" MATCHES "^Clang$") +ENDIF (CMAKE_C_COMPILER_ID MATCHES "^Clang$") IF (MSVC) ################################################################# # Set compile flags for debug build. @@ -834,16 +834,16 @@ ENDMACRO(CHECK_CRYPTO_WIN CRYPTO_LIST) MACRO(CHECK_ICONV LIB TRY_ICONV_CONST) IF(NOT HAVE_ICONV) CMAKE_PUSH_CHECK_STATE() # Save the state of the variables - IF ("CMAKE_C_COMPILER_ID" MATCHES "^GNU$" OR - "CMAKE_C_COMPILER_ID" MATCHES "^Clang$") + IF (CMAKE_C_COMPILER_ID MATCHES "^GNU$" OR + CMAKE_C_COMPILER_ID MATCHES "^Clang$") # # During checking iconv proto type, we should use -Werror to avoid the # success of iconv detection with a warnig which success is a miss # detection. So this needs for all build mode(even it's a release mode). # SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Werror") - ENDIF ("CMAKE_C_COMPILER_ID" MATCHES "^GNU$" OR - "CMAKE_C_COMPILER_ID" MATCHES "^Clang$") + ENDIF (CMAKE_C_COMPILER_ID MATCHES "^GNU$" OR + CMAKE_C_COMPILER_ID MATCHES "^Clang$") IF (MSVC) # NOTE: /WX option is the same as gcc's -Werror option. SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} /WX") @@ -1121,16 +1121,16 @@ ENDIF(NOT FOUND_POSIX_REGEX_LIB AND POSIX_REGEX_LIB MATCHES "^(AUTO|LIBPCREPOSIX # Check functions # CMAKE_PUSH_CHECK_STATE() # Save the state of the variables -IF ("CMAKE_C_COMPILER_ID" MATCHES "^GNU$" OR - "CMAKE_C_COMPILER_ID" MATCHES "^Clang$") +IF (CMAKE_C_COMPILER_ID MATCHES "^GNU$" OR + CMAKE_C_COMPILER_ID MATCHES "^Clang$") # # During checking functions, we should use -fno-builtin to avoid the # failure of function detection which failure is an error "conflicting # types for built-in function" caused by using -Werror option. # SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -fno-builtin") -ENDIF ("CMAKE_C_COMPILER_ID" MATCHES "^GNU$" OR - "CMAKE_C_COMPILER_ID" MATCHES "^Clang$") +ENDIF (CMAKE_C_COMPILER_ID MATCHES "^GNU$" OR + CMAKE_C_COMPILER_ID MATCHES "^Clang$") CHECK_SYMBOL_EXISTS(_CrtSetReportMode "crtdbg.h" HAVE__CrtSetReportMode) CHECK_FUNCTION_EXISTS_GLIBC(arc4random_buf HAVE_ARC4RANDOM_BUF) CHECK_FUNCTION_EXISTS_GLIBC(chflags HAVE_CHFLAGS) |