From: Simon McVittie Date: Tue, 6 Jun 2023 12:33:00 +0000 (+0100) Subject: cmake: Define _GNU_SOURCE before checking for any symbols X-Git-Tag: dbus-1.15.8~39^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=80392649da57bd15e59bbe561c3c5239be134db6;p=thirdparty%2Fdbus.git cmake: Define _GNU_SOURCE before checking for any symbols Some of the symbols we check for, such as close_range(), are only declared in their corresponding header files if _GNU_SOURCE was defined. Resolves: dbus/dbus#453 Signed-off-by: Simon McVittie --- diff --git a/cmake/ConfigureChecks.cmake b/cmake/ConfigureChecks.cmake index dfa21a557..33eb61ee4 100644 --- a/cmake/ConfigureChecks.cmake +++ b/cmake/ConfigureChecks.cmake @@ -6,6 +6,8 @@ include(CheckTypeSize) include(CheckCSourceCompiles) include(CheckCSourceRuns) +set(CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE) + check_include_files("winsock2.h;afunix.h" HAVE_AFUNIX_H) check_include_file(alloca.h HAVE_ALLOCA_H) check_include_file(byteswap.h HAVE_BYTESWAP_H) @@ -50,7 +52,6 @@ check_symbol_exists(socketpair "sys/socket.h" HAVE_SOCKETPAIR) # check_symbol_exists(setlocale "locale.h" HAVE_SETLOCALE) # dbus-test-main.c check_symbol_exists(localeconv "locale.h" HAVE_LOCALECONV) # dbus-sysdeps.c check_symbol_exists(poll "poll.h" HAVE_POLL) # dbus-sysdeps-unix.c -set(CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE) check_symbol_exists(pipe2 "fcntl.h;unistd.h" HAVE_PIPE2) check_symbol_exists(accept4 "sys/socket.h" HAVE_ACCEPT4) check_symbol_exists(inotify_init1 "sys/inotify.h" HAVE_INOTIFY_INIT1)