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
This commit is contained in:
Viktor Szakats 2024-10-22 17:32:28 +02:00
parent 9126eb5a8a
commit 825a800e0e
No known key found for this signature in database
GPG Key ID: B5ABD165E2AEF201
3 changed files with 8 additions and 1 deletions

View File

@ -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()

View File

@ -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()

View File

@ -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"