Skip to content

Commit a494f0c

Browse files
committed
CMake: Don't compile with -D_GNU_SOURCE
We do not want to compile with GNU-specific extensions, as we want the code to be as portable as possible. Thanksfully we don't actually need _GNU_SOURCE to be defined, removing it only triggers an error in network-unix.c about an undefined structure, which we can fix by including the right header. Signed-off-by: Paul Cercueil <[email protected]>
1 parent bc4385e commit a494f0c

File tree

2 files changed

+1
-3
lines changed

2 files changed

+1
-3
lines changed

CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,6 @@ endif()
120120
if(APPLE)
121121
#full Single Unix Standard v3 (SUSv3) conformance (the Unix API)
122122
add_definitions(-D_DARWIN_C_SOURCE)
123-
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
124-
set(CMAKE_REQUIRED_DEFINITIONS "-D_GNU_SOURCE=1")
125-
add_definitions(-D_GNU_SOURCE=1)
126123
elseif (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD|DragonFly|OpenBSD|NetBSD")
127124
set(CMAKE_REQUIRED_DEFINITIONS "-D__BSD_VISIBLE")
128125
add_definitions(-D__BSD_VISIBLE=1)

network-unix.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include <poll.h>
1818
#include <string.h>
1919
#include <sys/socket.h>
20+
#include <sys/time.h>
2021
#include <unistd.h>
2122

2223
int set_blocking_mode(int fd, bool blocking)

0 commit comments

Comments
 (0)