]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Avoid a miss detection of iconv prototype after we started using
authorMichihiro NAKAJIMA <ggcueroad@gmail.com>
Wed, 22 Feb 2012 07:19:16 +0000 (16:19 +0900)
committerMichihiro NAKAJIMA <ggcueroad@gmail.com>
Sun, 11 Mar 2012 05:26:19 +0000 (14:26 +0900)
CMAKE_C_FLAGS_DEBUG.

CMakeLists.txt

index b2c363b4def2acae7982710f225230815a4976f3..2c081634fe5dbd9ec238a5b63bfa2810ca124666 100644 (file)
@@ -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 <stdlib.h>
        #include <iconv.h>
@@ -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)