From 0e650ee702f458379d1aef591b434017f1021a1c Mon Sep 17 00:00:00 2001 From: Michihiro NAKAJIMA Date: Wed, 22 Feb 2012 16:19:16 +0900 Subject: [PATCH] Avoid a miss detection of iconv prototype after we started using CMAKE_C_FLAGS_DEBUG. --- CMakeLists.txt | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index d15064d6d..ff07d17cf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -556,6 +556,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 @@ -571,6 +581,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) -- 2.47.3