Skip to content

Commit

Permalink
Fix build on *BSD (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
rafe-s authored Aug 4, 2023
1 parent 8bdf5e8 commit 09ef1be
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@ if(WIN32)
libutp_inet_ntop.h)
endif()

if(CMAKE_VERSION VERSION_LESS 3.25)
set(BSD OFF)
if(CMAKE_SYSTEM_NAME MATCHES "BSD")
set(BSD ON)
endif()
endif()

add_library(libutp ${LIBUTP_LIBRARY_TYPE}
include/libutp/utp.h
include/libutp/utp_types.h
Expand Down Expand Up @@ -118,7 +125,7 @@ if(LIBUTP_BUILD_PROGRAMS AND NOT MSVC)

target_compile_definitions(ucat
PRIVATE
$<$<NOT:$<BOOL:${WIN32}>>:_POSIX_C_SOURCE=200112L>
$<$<NOT:$<OR:$<BOOL:${WIN32}>,$<BOOL:${BSD}>>>:_POSIX_C_SOURCE=200112L>
$<$<BOOL:${APPLE}>:_DARWIN_C_SOURCE>)

target_link_libraries(ucat
Expand Down

0 comments on commit 09ef1be

Please sign in to comment.