From: Michihiro NAKAJIMA Date: Wed, 11 May 2011 04:39:24 +0000 (-0400) Subject: Specify -fno-builtin to gcc during detecting functions because use of X-Git-Tag: v3.0.0a~391 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a1d8db291f9372a2f72e677e4fbe82e0157b87a3;p=thirdparty%2Flibarchive.git Specify -fno-builtin to gcc during detecting functions because use of -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 --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 32da7259c..cd5192d0e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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(