From: Michihiro NAKAJIMA Date: Wed, 22 Feb 2012 07:19:16 +0000 (+0900) Subject: Avoid a miss detection of iconv prototype after we started using X-Git-Tag: v3.0.4~36 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3ff440d28cc70d1718e75d75b6f652df245d884f;p=thirdparty%2Flibarchive.git Avoid a miss detection of iconv prototype after we started using CMAKE_C_FLAGS_DEBUG. --- diff --git a/CMakeLists.txt b/CMakeLists.txt index b2c363b4d..2c081634f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -545,6 +545,16 @@ ENDMACRO(CHECK_CRYPTO_WIN CRYPTO_LIST) # MACRO(CHECK_ICONV LIB TRY_ICONV_CONST) IF(NOT HAVE_ICONV) + IF ("CMAKE_C_COMPILER_ID" MATCHES "^GNU$") + # + # 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(SAVE_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) + SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Werror") + ENDIF ("CMAKE_C_COMPILER_ID" MATCHES "^GNU$") + # CHECK_C_SOURCE_COMPILES( "#include #include @@ -560,6 +570,12 @@ MACRO(CHECK_ICONV LIB TRY_ICONV_CONST) SET(HAVE_ICONV true) SET(ICONV_CONST ${TRY_ICONV_CONST}) ENDIF(HAVE_ICONV_${LIB}_${TRY_ICONV_CONST}) + # + # Restore CMAKE_REQUIRED_FLAGS + # + IF ("CMAKE_C_COMPILER_ID" MATCHES "^GNU$") + SET(CMAKE_REQUIRED_FLAGS ${SAVE_CMAKE_REQUIRED_FLAGS}) + ENDIF ("CMAKE_C_COMPILER_ID" MATCHES "^GNU$") ENDIF(NOT HAVE_ICONV) ENDMACRO(CHECK_ICONV TRY_ICONV_CONST)