From c966ff4b197c4661a9d5835bb13ab6932af1f44f Mon Sep 17 00:00:00 2001 From: Michihiro NAKAJIMA Date: Sat, 4 Oct 2014 23:27:37 +0900 Subject: [PATCH] Correct detecting iconv liberary with Clang. --- CMakeLists.txt | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 427be37cf..cdd1f0f20 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -821,14 +821,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$") + 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$") + 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") @@ -1106,14 +1108,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$") +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$") +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) -- 2.47.2