cmake: namespace functions and macros

Prefix (or suffix) curl-defined macro and function names with `curl`.
To avoid collisions with non-curl CMake and to make them recognizable
as curl-specific calls.

Closes #15498
This commit is contained in:
Viktor Szakats 2024-11-06 14:00:04 +01:00
parent fa676a6985
commit b9895b9d3f
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
16 changed files with 155 additions and 154 deletions

View file

@ -27,7 +27,7 @@
# This macro is intended to be called multiple times with a sequence of
# possibly dependent header files. Some headers depend on others to be
# compiled correctly.
macro(check_include_file_concat _file _variable)
macro(check_include_file_concat_curl _file _variable)
check_include_files("${CURL_INCLUDES};${_file}" ${_variable})
if(${_variable})
list(APPEND CURL_INCLUDES ${_file})

View file

@ -25,7 +25,7 @@ include(CheckCSourceCompiles)
include(CheckCSourceRuns)
include(CheckTypeSize)
macro(add_header_include _check _header)
macro(curl_add_header_include _check _header)
if(${_check})
set(_source_epilogue "${_source_epilogue}
#include <${_header}>")
@ -51,8 +51,8 @@ endif()
if(NOT WIN32)
set(_source_epilogue "#undef inline")
add_header_include(HAVE_SYS_TYPES_H "sys/types.h")
add_header_include(HAVE_SYS_SOCKET_H "sys/socket.h")
curl_add_header_include(HAVE_SYS_TYPES_H "sys/types.h")
curl_add_header_include(HAVE_SYS_SOCKET_H "sys/socket.h")
check_c_source_compiles("${_source_epilogue}
int main(void)
{
@ -63,7 +63,7 @@ if(NOT WIN32)
endif()
set(_source_epilogue "#undef inline")
add_header_include(HAVE_SYS_TIME_H "sys/time.h")
curl_add_header_include(HAVE_SYS_TIME_H "sys/time.h")
check_c_source_compiles("${_source_epilogue}
#include <time.h>
int main(void)
@ -98,9 +98,9 @@ endif()
if(NOT DEFINED HAVE_GETADDRINFO_THREADSAFE)
set(_source_epilogue "#undef inline")
add_header_include(HAVE_SYS_SOCKET_H "sys/socket.h")
add_header_include(HAVE_SYS_TIME_H "sys/time.h")
add_header_include(HAVE_NETDB_H "netdb.h")
curl_add_header_include(HAVE_SYS_SOCKET_H "sys/socket.h")
curl_add_header_include(HAVE_SYS_TIME_H "sys/time.h")
curl_add_header_include(HAVE_NETDB_H "netdb.h")
check_c_source_compiles("${_source_epilogue}
int main(void)
{
@ -141,8 +141,8 @@ endif()
if(NOT WIN32 AND NOT DEFINED HAVE_CLOCK_GETTIME_MONOTONIC_RAW)
set(_source_epilogue "#undef inline")
add_header_include(HAVE_SYS_TYPES_H "sys/types.h")
add_header_include(HAVE_SYS_TIME_H "sys/time.h")
curl_add_header_include(HAVE_SYS_TYPES_H "sys/types.h")
curl_add_header_include(HAVE_SYS_TIME_H "sys/time.h")
check_c_source_compiles("${_source_epilogue}
#include <time.h>
int main(void)

View file

@ -24,7 +24,7 @@
# File containing various utilities
# Returns number of arguments that evaluate to true
function(count_true _output_count_var)
function(curl_count_true _output_count_var)
set(lst_len 0)
foreach(option_var IN LISTS ARGN)
if(${option_var})