ENH: Avoid cmcurl CMake macro name conflicts
Utilities/cmcurl/CMake provides macros with the same file names and macro names as others in Modules, but with different interfaces. We rename the curl ones to avoid conflict.
This commit is contained in:
parent
315fed9d49
commit
eb85676928
|
@ -1,5 +1,5 @@
|
|||
# - Check if the source code provided in the SOURCE argument compiles.
|
||||
# CHECK_C_SOURCE_COMPILES(SOURCE VAR)
|
||||
# CURL_CHECK_C_SOURCE_COMPILES(SOURCE VAR)
|
||||
# - macro which checks if the source code compiles
|
||||
# SOURCE - source code to try to compile
|
||||
# VAR - variable to store whether the source code compiled
|
||||
|
@ -12,7 +12,7 @@
|
|||
# CMAKE_REQUIRED_INCLUDES = list of include directories
|
||||
# CMAKE_REQUIRED_LIBRARIES = list of libraries to link
|
||||
|
||||
MACRO(CHECK_C_SOURCE_COMPILES SOURCE VAR)
|
||||
MACRO(CURL_CHECK_C_SOURCE_COMPILES SOURCE VAR)
|
||||
IF("${VAR}" MATCHES "^${VAR}$" OR "${VAR}" MATCHES "UNKNOWN")
|
||||
SET(message "${VAR}")
|
||||
# If the number of arguments is greater than 2 (SOURCE VAR)
|
||||
|
@ -23,16 +23,16 @@ MACRO(CHECK_C_SOURCE_COMPILES SOURCE VAR)
|
|||
SET(MACRO_CHECK_FUNCTION_DEFINITIONS
|
||||
"-D${VAR} ${CMAKE_REQUIRED_FLAGS}")
|
||||
IF(CMAKE_REQUIRED_LIBRARIES)
|
||||
SET(CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES
|
||||
SET(CURL_CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES
|
||||
"-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}")
|
||||
ELSE(CMAKE_REQUIRED_LIBRARIES)
|
||||
SET(CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES)
|
||||
SET(CURL_CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES)
|
||||
ENDIF(CMAKE_REQUIRED_LIBRARIES)
|
||||
IF(CMAKE_REQUIRED_INCLUDES)
|
||||
SET(CHECK_C_SOURCE_COMPILES_ADD_INCLUDES
|
||||
SET(CURL_CHECK_C_SOURCE_COMPILES_ADD_INCLUDES
|
||||
"-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}")
|
||||
ELSE(CMAKE_REQUIRED_INCLUDES)
|
||||
SET(CHECK_C_SOURCE_COMPILES_ADD_INCLUDES)
|
||||
SET(CURL_CHECK_C_SOURCE_COMPILES_ADD_INCLUDES)
|
||||
ENDIF(CMAKE_REQUIRED_INCLUDES)
|
||||
SET(src "")
|
||||
FOREACH(def ${EXTRA_DEFINES})
|
||||
|
@ -53,8 +53,8 @@ MACRO(CHECK_C_SOURCE_COMPILES SOURCE VAR)
|
|||
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c
|
||||
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
|
||||
CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS}
|
||||
"${CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES}"
|
||||
"${CHECK_C_SOURCE_COMPILES_ADD_INCLUDES}"
|
||||
"${CURL_CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES}"
|
||||
"${CURL_CHECK_C_SOURCE_COMPILES_ADD_INCLUDES}"
|
||||
OUTPUT_VARIABLE OUTPUT)
|
||||
IF(${VAR})
|
||||
SET(${VAR} 1 CACHE INTERNAL "Test ${message}")
|
||||
|
@ -72,4 +72,4 @@ MACRO(CHECK_C_SOURCE_COMPILES SOURCE VAR)
|
|||
"Source file was:\n${src}\n")
|
||||
ENDIF(${VAR})
|
||||
ENDIF("${VAR}" MATCHES "^${VAR}$" OR "${VAR}" MATCHES "UNKNOWN")
|
||||
ENDMACRO(CHECK_C_SOURCE_COMPILES)
|
||||
ENDMACRO(CURL_CHECK_C_SOURCE_COMPILES)
|
|
@ -1,5 +1,5 @@
|
|||
# - Check if the source code provided in the SOURCE argument compiles and runs.
|
||||
# CHECK_C_SOURCE_RUNS(SOURCE VAR)
|
||||
# CURL_CHECK_C_SOURCE_RUNS(SOURCE VAR)
|
||||
# - macro which checks if the source code runs
|
||||
# SOURCE - source code to try to compile
|
||||
# VAR - variable to store size if the type exists.
|
||||
|
@ -12,7 +12,7 @@
|
|||
# CMAKE_REQUIRED_INCLUDES = list of include directories
|
||||
# CMAKE_REQUIRED_LIBRARIES = list of libraries to link
|
||||
|
||||
MACRO(CHECK_C_SOURCE_RUNS SOURCE VAR)
|
||||
MACRO(CURL_CHECK_C_SOURCE_RUNS SOURCE VAR)
|
||||
IF("${VAR}" MATCHES "^${VAR}$" OR "${VAR}" MATCHES "UNKNOWN")
|
||||
SET(message "${VAR}")
|
||||
# If the number of arguments is greater than 2 (SOURCE VAR)
|
||||
|
@ -23,16 +23,16 @@ MACRO(CHECK_C_SOURCE_RUNS SOURCE VAR)
|
|||
SET(MACRO_CHECK_FUNCTION_DEFINITIONS
|
||||
"-D${VAR} ${CMAKE_REQUIRED_FLAGS}")
|
||||
IF(CMAKE_REQUIRED_LIBRARIES)
|
||||
SET(CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES
|
||||
SET(CURL_CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES
|
||||
"-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}")
|
||||
ELSE(CMAKE_REQUIRED_LIBRARIES)
|
||||
SET(CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES)
|
||||
SET(CURL_CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES)
|
||||
ENDIF(CMAKE_REQUIRED_LIBRARIES)
|
||||
IF(CMAKE_REQUIRED_INCLUDES)
|
||||
SET(CHECK_C_SOURCE_COMPILES_ADD_INCLUDES
|
||||
SET(CURL_CHECK_C_SOURCE_COMPILES_ADD_INCLUDES
|
||||
"-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}")
|
||||
ELSE(CMAKE_REQUIRED_INCLUDES)
|
||||
SET(CHECK_C_SOURCE_COMPILES_ADD_INCLUDES)
|
||||
SET(CURL_CHECK_C_SOURCE_COMPILES_ADD_INCLUDES)
|
||||
ENDIF(CMAKE_REQUIRED_INCLUDES)
|
||||
SET(src "")
|
||||
FOREACH(def ${EXTRA_DEFINES})
|
||||
|
@ -53,8 +53,8 @@ MACRO(CHECK_C_SOURCE_RUNS SOURCE VAR)
|
|||
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c
|
||||
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
|
||||
CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS}
|
||||
"${CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES}"
|
||||
"${CHECK_C_SOURCE_COMPILES_ADD_INCLUDES}"
|
||||
"${CURL_CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES}"
|
||||
"${CURL_CHECK_C_SOURCE_COMPILES_ADD_INCLUDES}"
|
||||
OUTPUT_VARIABLE OUTPUT)
|
||||
# if it did not compile make the return value fail code of 1
|
||||
IF(NOT ${VAR}_COMPILED)
|
||||
|
@ -80,4 +80,4 @@ MACRO(CHECK_C_SOURCE_RUNS SOURCE VAR)
|
|||
"Source file was:\n${src}\n")
|
||||
ENDIF("${result_var}" EQUAL 0)
|
||||
ENDIF("${VAR}" MATCHES "^${VAR}$" OR "${VAR}" MATCHES "UNKNOWN")
|
||||
ENDMACRO(CHECK_C_SOURCE_RUNS)
|
||||
ENDMACRO(CURL_CHECK_C_SOURCE_RUNS)
|
|
@ -1,4 +1,4 @@
|
|||
INCLUDE(CheckCSourceCompiles)
|
||||
INCLUDE(CurlCheckCSourceCompiles)
|
||||
SET(EXTRA_DEFINES "__unused1\n#undef inline\n#define __unused2")
|
||||
SET(HEADER_INCLUDES)
|
||||
SET(headers_hack)
|
||||
|
@ -28,7 +28,7 @@ ENDIF(HAVE_WINDOWS_H)
|
|||
|
||||
SET(EXTRA_DEFINES_BACKUP "${EXTRA_DEFINES}")
|
||||
SET(EXTRA_DEFINES "${EXTRA_DEFINES_BACKUP}\n${headers_hack}\n${extern_line}\n#define __unused5")
|
||||
CHECK_C_SOURCE_COMPILES("recv(0, 0, 0, 0)" curl_cv_recv)
|
||||
CURL_CHECK_C_SOURCE_COMPILES("recv(0, 0, 0, 0)" curl_cv_recv)
|
||||
IF(curl_cv_recv)
|
||||
# AC_CACHE_CHECK([types of arguments and return type for recv],
|
||||
#[curl_cv_func_recv_args], [
|
||||
|
@ -44,7 +44,7 @@ IF(curl_cv_recv)
|
|||
SET(curl_cv_func_recv_test "UNKNOWN")
|
||||
SET(extern_line "extern ${recv_retv} ${signature_call_conv} recv(${recv_arg1}, ${recv_arg2}, ${recv_arg3}, ${recv_arg4})\;")
|
||||
SET(EXTRA_DEFINES "${EXTRA_DEFINES_BACKUP}\n${headers_hack}\n${extern_line}\n#define __unused5")
|
||||
CHECK_C_SOURCE_COMPILES("
|
||||
CURL_CHECK_C_SOURCE_COMPILES("
|
||||
${recv_arg1} s=0;
|
||||
${recv_arg2} buf=0;
|
||||
${recv_arg3} len=0;
|
||||
|
@ -91,7 +91,7 @@ ENDIF(curl_cv_recv)
|
|||
SET(curl_cv_func_recv_args "${curl_cv_func_recv_args}" CACHE INTERNAL "Arguments for recv")
|
||||
SET(HAVE_RECV 1)
|
||||
|
||||
CHECK_C_SOURCE_COMPILES("send(0, 0, 0, 0)" curl_cv_send)
|
||||
CURL_CHECK_C_SOURCE_COMPILES("send(0, 0, 0, 0)" curl_cv_send)
|
||||
IF(curl_cv_send)
|
||||
# AC_CACHE_CHECK([types of arguments and return type for send],
|
||||
#[curl_cv_func_send_args], [
|
||||
|
@ -107,7 +107,7 @@ IF(curl_cv_send)
|
|||
SET(curl_cv_func_send_test "UNKNOWN")
|
||||
SET(extern_line "extern ${send_retv} ${signature_call_conv} send(${send_arg1}, ${send_arg2}, ${send_arg3}, ${send_arg4})\;")
|
||||
SET(EXTRA_DEFINES "${EXTRA_DEFINES_BACKUP}\n${headers_hack}\n${extern_line}\n#define __unused5")
|
||||
CHECK_C_SOURCE_COMPILES("
|
||||
CURL_CHECK_C_SOURCE_COMPILES("
|
||||
${send_arg1} s=0;
|
||||
${send_arg2} buf=0;
|
||||
${send_arg3} len=0;
|
||||
|
@ -161,7 +161,7 @@ SET(curl_cv_func_send_args "${curl_cv_func_send_args}" CACHE INTERNAL "Arguments
|
|||
SET(HAVE_SEND 1)
|
||||
|
||||
SET(EXTRA_DEFINES "${EXTRA_DEFINES}\n${headers_hack}\n#define __unused5")
|
||||
CHECK_C_SOURCE_COMPILES("int flag = MSG_NOSIGNAL" HAVE_MSG_NOSIGNAL)
|
||||
CURL_CHECK_C_SOURCE_COMPILES("int flag = MSG_NOSIGNAL" HAVE_MSG_NOSIGNAL)
|
||||
|
||||
SET(EXTRA_DEFINES "__unused1\n#undef inline\n#define __unused2")
|
||||
SET(HEADER_INCLUDES)
|
||||
|
@ -190,16 +190,16 @@ ELSE(HAVE_WINDOWS_H)
|
|||
add_header_include(HAVE_TIME_H "time.h")
|
||||
ENDIF(HAVE_WINDOWS_H)
|
||||
SET(EXTRA_DEFINES "${EXTRA_DEFINES}\n${headers_hack}\n#define __unused5")
|
||||
CHECK_C_SOURCE_COMPILES("struct timeval ts;\nts.tv_sec = 0;\nts.tv_usec = 0" HAVE_STRUCT_TIMEVAL)
|
||||
CURL_CHECK_C_SOURCE_COMPILES("struct timeval ts;\nts.tv_sec = 0;\nts.tv_usec = 0" HAVE_STRUCT_TIMEVAL)
|
||||
|
||||
|
||||
INCLUDE(CheckCSourceRuns)
|
||||
INCLUDE(CurlCheckCSourceRuns)
|
||||
SET(EXTRA_DEFINES)
|
||||
SET(HEADER_INCLUDES)
|
||||
IF(HAVE_SYS_POLL_H)
|
||||
SET(HEADER_INCLUDES "sys/poll.h")
|
||||
ENDIF(HAVE_SYS_POLL_H)
|
||||
CHECK_C_SOURCE_RUNS("return poll((void *)0, 0, 10 /*ms*/)" HAVE_POLL_FINE)
|
||||
CURL_CHECK_C_SOURCE_RUNS("return poll((void *)0, 0, 10 /*ms*/)" HAVE_POLL_FINE)
|
||||
|
||||
SET(HAVE_SIG_ATOMIC_T 1)
|
||||
SET(EXTRA_DEFINES)
|
||||
|
@ -210,7 +210,7 @@ IF(HAVE_SIGNAL_H)
|
|||
ENDIF(HAVE_SIGNAL_H)
|
||||
CHECK_TYPE_SIZE("sig_atomic_t" SIZEOF_SIG_ATOMIC_T)
|
||||
IF(HAVE_SIZEOF_SIG_ATOMIC_T)
|
||||
CHECK_C_SOURCE_COMPILES("static volatile sig_atomic_t dummy = 0" HAVE_SIG_ATOMIC_T_NOT_VOLATILE)
|
||||
CURL_CHECK_C_SOURCE_COMPILES("static volatile sig_atomic_t dummy = 0" HAVE_SIG_ATOMIC_T_NOT_VOLATILE)
|
||||
IF(NOT HAVE_SIG_ATOMIC_T_NOT_VOLATILE)
|
||||
SET(HAVE_SIG_ATOMIC_T_VOLATILE 1)
|
||||
ENDIF(NOT HAVE_SIG_ATOMIC_T_NOT_VOLATILE)
|
||||
|
|
Loading…
Reference in New Issue