Commit c1bcd226 authored by Simon McVittie's avatar Simon McVittie

cmake: always enable GNU and recent-POSIX extensions, like autoconf does

If the C library is (e)glibc, this allows use of POSIX, BSD, SVID, GNU,
etc., extensions to ISO C, regardless of using -ansi or not.

Not doing this broke the cmake build on Linux since commit 18b08180,
which added AC_USE_SYSTEM_EXTENSIONS to (and removed
_GNU_SOURCE from files that use it) without also updating the cmake
build system. SO_PEERCRED is defined unconditionally, but struct ucred
is considered to be a GNU extension, so can't be used under _GNU_SOURCE.

Bug: Will Thompson's avatarWill Thompson <>
parent 2dfee731
......@@ -100,6 +100,9 @@ OPTION(DBUS_DISABLE_ASSERTS "Disable assertion checking" OFF)
option (DBUS_ENABLE_STATS "enable bus daemon usage statistics" OFF)
# analogous to AC_USE_SYSTEM_EXTENSIONS in
add_definitions(-D_POSIX_C_SOURCE=199309L -D_GNU_SOURCE)
# do config checks
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment