curl: Simplify if() conditions on check result variables
Remove use of an old hack that takes advantage of the auto-dereference behavior of the if() command to detect if a variable is defined. The hack has the form: if("${VAR} MATCHES "^${VAR}$") where "${VAR}" is a macro argument reference. Use if(DEFINED) instead. This also avoids warnings for CMake Policy CMP0054.
This commit is contained in:
parent
8d311a813c
commit
5924270273
|
@ -13,7 +13,7 @@
|
||||||
# CMAKE_REQUIRED_LIBRARIES = list of libraries to link
|
# CMAKE_REQUIRED_LIBRARIES = list of libraries to link
|
||||||
|
|
||||||
macro(CURL_CHECK_C_SOURCE_COMPILES SOURCE VAR)
|
macro(CURL_CHECK_C_SOURCE_COMPILES SOURCE VAR)
|
||||||
if("${VAR}" MATCHES "^${VAR}$" OR "${VAR}" MATCHES "UNKNOWN")
|
if(NOT DEFINED "${VAR}")
|
||||||
set(message "${VAR}")
|
set(message "${VAR}")
|
||||||
# If the number of arguments is greater than 2 (SOURCE VAR)
|
# If the number of arguments is greater than 2 (SOURCE VAR)
|
||||||
if(${ARGC} GREATER 2)
|
if(${ARGC} GREATER 2)
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
# CMAKE_REQUIRED_LIBRARIES = list of libraries to link
|
# CMAKE_REQUIRED_LIBRARIES = list of libraries to link
|
||||||
|
|
||||||
macro(CURL_CHECK_C_SOURCE_RUNS SOURCE VAR)
|
macro(CURL_CHECK_C_SOURCE_RUNS SOURCE VAR)
|
||||||
if("${VAR}" MATCHES "^${VAR}$" OR "${VAR}" MATCHES "UNKNOWN")
|
if(NOT DEFINED "${VAR}")
|
||||||
set(message "${VAR}")
|
set(message "${VAR}")
|
||||||
# If the number of arguments is greater than 2 (SOURCE VAR)
|
# If the number of arguments is greater than 2 (SOURCE VAR)
|
||||||
if(${ARGC} GREATER 2)
|
if(${ARGC} GREATER 2)
|
||||||
|
@ -79,5 +79,5 @@ macro(CURL_CHECK_C_SOURCE_RUNS SOURCE VAR)
|
||||||
"Return value: ${result_var}\n"
|
"Return value: ${result_var}\n"
|
||||||
"Source file was:\n${src}\n")
|
"Source file was:\n${src}\n")
|
||||||
endif("${result_var}" EQUAL 0)
|
endif("${result_var}" EQUAL 0)
|
||||||
endif("${VAR}" MATCHES "^${VAR}$" OR "${VAR}" MATCHES "UNKNOWN")
|
endif()
|
||||||
endmacro(CURL_CHECK_C_SOURCE_RUNS)
|
endmacro(CURL_CHECK_C_SOURCE_RUNS)
|
||||||
|
|
|
@ -21,7 +21,7 @@ endmacro(CHECK_INCLUDE_FILE_CONCAT)
|
||||||
|
|
||||||
# For other curl specific tests, use this macro.
|
# For other curl specific tests, use this macro.
|
||||||
macro(CURL_INTERNAL_TEST CURL_TEST)
|
macro(CURL_INTERNAL_TEST CURL_TEST)
|
||||||
if("${CURL_TEST}" MATCHES "^${CURL_TEST}$")
|
if(NOT DEFINED "${CURL_TEST}")
|
||||||
set(MACRO_CHECK_FUNCTION_DEFINITIONS
|
set(MACRO_CHECK_FUNCTION_DEFINITIONS
|
||||||
"-D${CURL_TEST} ${CURL_TEST_DEFINES} ${CMAKE_REQUIRED_FLAGS}")
|
"-D${CURL_TEST} ${CURL_TEST_DEFINES} ${CMAKE_REQUIRED_FLAGS}")
|
||||||
if(CMAKE_REQUIRED_LIBRARIES)
|
if(CMAKE_REQUIRED_LIBRARIES)
|
||||||
|
@ -49,11 +49,11 @@ macro(CURL_INTERNAL_TEST CURL_TEST)
|
||||||
"Performing Curl Test ${CURL_TEST} failed with the following output:\n"
|
"Performing Curl Test ${CURL_TEST} failed with the following output:\n"
|
||||||
"${OUTPUT}\n")
|
"${OUTPUT}\n")
|
||||||
endif(${CURL_TEST})
|
endif(${CURL_TEST})
|
||||||
endif("${CURL_TEST}" MATCHES "^${CURL_TEST}$")
|
endif()
|
||||||
endmacro(CURL_INTERNAL_TEST)
|
endmacro(CURL_INTERNAL_TEST)
|
||||||
|
|
||||||
macro(CURL_INTERNAL_TEST_RUN CURL_TEST)
|
macro(CURL_INTERNAL_TEST_RUN CURL_TEST)
|
||||||
if("${CURL_TEST}_COMPILE" MATCHES "^${CURL_TEST}_COMPILE$")
|
if(NOT DEFINED "${CURL_TEST}_COMPILE")
|
||||||
set(MACRO_CHECK_FUNCTION_DEFINITIONS
|
set(MACRO_CHECK_FUNCTION_DEFINITIONS
|
||||||
"-D${CURL_TEST} ${CMAKE_REQUIRED_FLAGS}")
|
"-D${CURL_TEST} ${CMAKE_REQUIRED_FLAGS}")
|
||||||
if(CMAKE_REQUIRED_LIBRARIES)
|
if(CMAKE_REQUIRED_LIBRARIES)
|
||||||
|
@ -85,5 +85,5 @@ macro(CURL_INTERNAL_TEST_RUN CURL_TEST)
|
||||||
file(APPEND "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log"
|
file(APPEND "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log"
|
||||||
"\n\n")
|
"\n\n")
|
||||||
endif(${CURL_TEST}_COMPILE AND NOT ${CURL_TEST})
|
endif(${CURL_TEST}_COMPILE AND NOT ${CURL_TEST})
|
||||||
endif("${CURL_TEST}_COMPILE" MATCHES "^${CURL_TEST}_COMPILE$")
|
endif()
|
||||||
endmacro(CURL_INTERNAL_TEST_RUN)
|
endmacro(CURL_INTERNAL_TEST_RUN)
|
||||||
|
|
|
@ -44,7 +44,7 @@ if(curl_cv_recv)
|
||||||
foreach(recv_arg3 "size_t" "int" "socklen_t" "unsigned int")
|
foreach(recv_arg3 "size_t" "int" "socklen_t" "unsigned int")
|
||||||
foreach(recv_arg4 "int" "unsigned int")
|
foreach(recv_arg4 "int" "unsigned int")
|
||||||
if(NOT curl_cv_func_recv_done)
|
if(NOT curl_cv_func_recv_done)
|
||||||
set(curl_cv_func_recv_test "UNKNOWN")
|
unset(curl_cv_func_recv_test CACHE)
|
||||||
set(extern_line "extern ${recv_retv} ${signature_call_conv} recv(${recv_arg1}, ${recv_arg2}, ${recv_arg3}, ${recv_arg4})\;")
|
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")
|
set(EXTRA_DEFINES "${EXTRA_DEFINES_BACKUP}\n${headers_hack}\n${extern_line}\n#define __unused5")
|
||||||
curl_check_c_source_compiles("
|
curl_check_c_source_compiles("
|
||||||
|
@ -107,7 +107,7 @@ if(curl_cv_send)
|
||||||
foreach(send_arg3 "size_t" "int" "socklen_t" "unsigned int")
|
foreach(send_arg3 "size_t" "int" "socklen_t" "unsigned int")
|
||||||
foreach(send_arg4 "int" "unsigned int")
|
foreach(send_arg4 "int" "unsigned int")
|
||||||
if(NOT curl_cv_func_send_done)
|
if(NOT curl_cv_func_send_done)
|
||||||
set(curl_cv_func_send_test "UNKNOWN")
|
unset(curl_cv_func_send_test CACHE)
|
||||||
set(extern_line "extern ${send_retv} ${signature_call_conv} send(${send_arg1}, ${send_arg2}, ${send_arg3}, ${send_arg4})\;")
|
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")
|
set(EXTRA_DEFINES "${EXTRA_DEFINES_BACKUP}\n${headers_hack}\n${extern_line}\n#define __unused5")
|
||||||
curl_check_c_source_compiles("
|
curl_check_c_source_compiles("
|
||||||
|
|
Loading…
Reference in New Issue