Skip to content

Commit 75eb5d1

Browse files
committed
cmake: Haiku always has getifaddrs(), but the current check fails.
(since it needs to link with -lnetwork.) Reference Issue #166.
1 parent 841e11a commit 75eb5d1

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

CMakeLists.txt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,9 @@ else()
117117
add_library(${sdl3_net_target_name} src/SDL_net.c)
118118
endif()
119119

120-
if(NOT (WIN32 OR SDLNET_STUB_ONLY))
120+
if(HAIKU)
121+
set(HAVE_GETIFADDRS True) # Haiku always has it (but you have to -lnetwork, so check_c_source_compiles won't work as-is).
122+
elseif(NOT (WIN32 OR SDLNET_STUB_ONLY))
121123
check_c_source_compiles("
122124
#include <ifaddrs.h>
123125
int main(void) {
@@ -126,9 +128,10 @@ if(NOT (WIN32 OR SDLNET_STUB_ONLY))
126128
return 0;
127129
}
128130
" HAVE_GETIFADDRS)
129-
if(HAVE_GETIFADDRS)
130-
target_compile_definitions(${sdl3_net_target_name} PRIVATE HAVE_GETIFADDRS)
131-
endif()
131+
endif()
132+
133+
if(HAVE_GETIFADDRS)
134+
target_compile_definitions(${sdl3_net_target_name} PRIVATE HAVE_GETIFADDRS)
132135
endif()
133136

134137
add_library(SDL3_net::${sdl3_net_target_name} ALIAS ${sdl3_net_target_name})

0 commit comments

Comments
 (0)