From 825a800e0e44c6339c66b21a6f686d32c9d28dac Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Tue, 22 Oct 2024 17:32:28 +0200 Subject: [PATCH] cmake: use the `BSD` variable - use `BSD` in addition to backwards-compatible method. - add `BSD` to the configuration log and `buildinfo.txt` if detected. - add `BSD` tag to `buildinfo.txt` also via `./configure`. The `BSD` variable is supported by CMake 3.25.0 and upper. Ref: https://cmake.org/cmake/help/latest/variable/BSD.html Closes #15367 --- CMake/OtherTests.cmake | 2 +- CMakeLists.txt | 3 +++ acinclude.m4 | 4 ++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CMake/OtherTests.cmake b/CMake/OtherTests.cmake index 736d539c87..2e5b62f6e3 100644 --- a/CMake/OtherTests.cmake +++ b/CMake/OtherTests.cmake @@ -90,7 +90,7 @@ elseif(APPLE OR CMAKE_SYSTEM_NAME STREQUAL "NetBSD" OR CMAKE_SYSTEM_NAME STREQUAL "SunOS") set(HAVE_GETADDRINFO_THREADSAFE TRUE) -elseif(CMAKE_SYSTEM_NAME MATCHES "BSD") +elseif(BSD OR CMAKE_SYSTEM_NAME MATCHES "BSD") set(HAVE_GETADDRINFO_THREADSAFE FALSE) endif() diff --git a/CMakeLists.txt b/CMakeLists.txt index 795fbb2a98..f78ee84679 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -99,6 +99,9 @@ endif() if(UNIX) set(_target_flags "${_target_flags} UNIX") endif() +if(BSD) + set(_target_flags "${_target_flags} BSD") +endif() if(WIN32) set(_target_flags "${_target_flags} WIN32") endif() diff --git a/acinclude.m4 b/acinclude.m4 index 9afc1774da..0c17ba5ec5 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -1552,6 +1552,10 @@ AC_DEFUN([CURL_PREPARE_BUILDINFO], [ *-*-*bsd*|*-*-aix*|*-*-hpux*|*-*-interix*|*-*-irix*|*-*-linux*|*-*-solaris*|*-*-sunos*|*-apple-*|*-*-cygwin*|*-*-msys*) curl_pflags="${curl_pflags} UNIX";; esac + case $host in + *-*-*bsd*) + curl_pflags="${curl_pflags} BSD";; + esac fi if test "$curl_cv_cygwin" = 'yes'; then curl_pflags="${curl_pflags} CYGWIN"