diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2009-10-30 13:10:56 -0400 |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2009-10-30 13:10:56 -0400 |
commit | fb51d98562a26b6dcde7d3597938a0b707b6b881 (patch) | |
tree | b42fbfb6b27b7a9e2d5068601f61d80e7033dc79 /Utilities/cmlibarchive/build/cmake/CheckFuncs.cmake | |
parent | 0615218bdf3e240e44e539f9eed6c1cf9fbff2d4 (diff) | |
download | cmake-fb51d98562a26b6dcde7d3597938a0b707b6b881.tar.gz |
Switch to using libarchive from libtar for cpack and cmake -E tar
This allows for a built in bzip and zip capability, so external tools
will not be needed for these packagers. The cmake -E tar xf should be
able to handle all compression types now as well.
Diffstat (limited to 'Utilities/cmlibarchive/build/cmake/CheckFuncs.cmake')
-rw-r--r-- | Utilities/cmlibarchive/build/cmake/CheckFuncs.cmake | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/Utilities/cmlibarchive/build/cmake/CheckFuncs.cmake b/Utilities/cmlibarchive/build/cmake/CheckFuncs.cmake new file mode 100644 index 0000000000..923c693a95 --- /dev/null +++ b/Utilities/cmlibarchive/build/cmake/CheckFuncs.cmake @@ -0,0 +1,47 @@ +# Check if the system has the specified function; treat glibc "stub" +# functions as nonexistent: +# CHECK_FUNCTION_EXISTS_GLIBC (FUNCTION FUNCVAR) +# +# FUNCTION - the function(s) where the prototype should be declared +# FUNCVAR - variable to define if the function does exist +# +# In particular, this understands the glibc convention of +# defining macros __stub_XXXX or __stub___XXXX if the function +# does appear in the library but is merely a stub that does nothing. +# By detecting this case, we can select alternate behavior on +# platforms that don't support this functionality. +# +# The following variables may be set before calling this macro to +# modify the way the check is run: +# +# CMAKE_REQUIRED_FLAGS = string of compile command line flags +# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) +# CMAKE_REQUIRED_INCLUDES = list of include directories +# Copyright (c) 2009, Michihiro NAKAJIMA +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + +INCLUDE(CheckFunctionExists) + +MACRO (CHECK_FUNCTION_EXISTS_GLIBC _FUNC _FUNCVAR) + IF(NOT DEFINED ${_FUNCVAR}) + SET(CHECK_STUB_FUNC_1 "__stub_${_FUNC}") + SET(CHECK_STUB_FUNC_2 "__stub___${_FUNC}") + CONFIGURE_FILE( ${libarchive_SOURCE_DIR}/build/cmake/CheckFuncs_stub.c.in + ${CMAKE_BINARY_DIR}/cmake.tmp/CheckFuncs_stub.c IMMEDIATE) + TRY_COMPILE(__stub + ${CMAKE_BINARY_DIR} + ${CMAKE_BINARY_DIR}/cmake.tmp/CheckFuncs_stub.c + COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} + CMAKE_FLAGS + -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_INCLUDE_FILE_FLAGS} + "${CHECK_INCLUDE_FILE_C_INCLUDE_DIRS}") + IF (__stub) + SET("${_FUNCVAR}" "" CACHE INTERNAL "Have function ${_FUNC}") + ELSE (__stub) + CHECK_FUNCTION_EXISTS("${_FUNC}" "${_FUNCVAR}") + ENDIF (__stub) + ENDIF(NOT DEFINED ${_FUNCVAR}) +ENDMACRO (CHECK_FUNCTION_EXISTS_GLIBC) + |