Skip to content

Commit

Permalink
fix analogdevicesinc#336, remove warnings on FreeBSD
Browse files Browse the repository at this point in the history
Previously, building libiio on FreeBSD would warn with:
network.c:240:8: warning: implicit declaration of function 'pipe2' is invalid in C99

This fixes that for all BSDs, since pipe2 (inside <unistd.h>) is protected by __BSD_VISIBLE.
On Linux, it's protected by _GNU_SOURCE (which is already defined in the cmake).

Signed-off-by: Robin Getz <[email protected]>
  • Loading branch information
rgetz committed Jan 17, 2020
1 parent a904cd2 commit 100f910
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,12 @@ IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
add_definitions(-D_GNU_SOURCE=1)
endif()

# For BSD variants
if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD|DragonFly|OpenBSD|NetBSD")
set(CMAKE_REQUIRED_DEFINITIONS "-D__BSD_VISIBLE")
add_definitions(-D__BSD_VISIBLE=1)
endif()

option(ENABLE_IPV6 "Define if you want to enable IPv6 support" ON)
if (ENABLE_IPV6)
check_symbol_exists(in6addr_any "netinet/in.h" HAVE_IPV6)
Expand Down

0 comments on commit 100f910

Please sign in to comment.