]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Specify -fno-builtin to gcc during detecting functions because use of
authorMichihiro NAKAJIMA <ggcueroad@gmail.com>
Wed, 11 May 2011 04:39:24 +0000 (00:39 -0400)
committerMichihiro NAKAJIMA <ggcueroad@gmail.com>
Wed, 11 May 2011 04:39:24 +0000 (00:39 -0400)
-Werror on CMake prevent the detection of built-in functions of gcc by
compiling failure which is conflicting types for built-in function.

SVN-Revision: 3295

CMakeLists.txt

index 32da7259cec113b46da2ad85dd1fb11d11b5579a..cd5192d0ef1cff498cf9b303a4ff28b8dd30dd6f 100644 (file)
@@ -605,6 +605,15 @@ ENDIF(LIBXML2_FOUND)
 #
 # Check functions
 #
+IF ("CMAKE_C_COMPILER_ID" MATCHES "^GNU$")
+  #
+  # 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(SAVE_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
+  SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -fno-builtin")
+ENDIF ("CMAKE_C_COMPILER_ID" MATCHES "^GNU$")
 CHECK_SYMBOL_EXISTS(_CrtSetReportMode "crtdbg.h" HAVE__CrtSetReportMode)
 CHECK_FUNCTION_EXISTS_GLIBC(chflags HAVE_CHFLAGS)
 CHECK_FUNCTION_EXISTS_GLIBC(chown HAVE_CHOWN)
@@ -692,6 +701,11 @@ CHECK_FUNCTION_EXISTS(vprintf HAVE_VPRINTF)
 CHECK_FUNCTION_EXISTS(wmemcmp HAVE_WMEMCMP)
 CHECK_FUNCTION_EXISTS(wmemcpy HAVE_WMEMCPY)
 
+# 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$")
+
 # Make sure we have the POSIX version of readdir_r, not the
 # older 2-argument version.
 CHECK_C_SOURCE_COMPILES(