Skip to content

Commit db93234

Browse files
committed
cmake: support building static SDL2_net on top of shared SDL3
1 parent 68d2915 commit db93234

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

CMakeLists.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,13 @@ set(SDL2NET_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS})
7474
if(SDL2NET_BUILD_SHARED_LIBS)
7575
set(sdl2_net_export_name SDL2_net)
7676
set(sdl2_net_install_name_infix shared)
77-
set(sdl3_target_name SDL3::SDL3)
77+
set(sdl3_target_name SDL3::SDL3-shared)
7878
set(sdl3_component SDL3)
7979
else()
8080
set(sdl2_net_export_name SDL2_net-static)
8181
set(sdl2_net_install_name_infix static)
82-
set(sdl3_target_name SDL3::SDL3-static)
83-
set(sdl3_component SDL3-shared)
82+
set(sdl3_target_name SDL3::Headers)
83+
set(sdl3_component Headers SDL3)
8484
endif()
8585

8686
if(NOT TARGET ${sdl3_target_name})
@@ -300,14 +300,14 @@ if(SDL2NET_SAMPLES)
300300

301301
add_executable(showinterfaces examples/showinterfaces.c)
302302
target_compile_definitions(showinterfaces PRIVATE SDL_MAIN_HANDLED)
303-
target_link_libraries(showinterfaces PRIVATE SDL2_net::${sdl2_net_export_name} ${sdl3_target_name})
303+
target_link_libraries(showinterfaces PRIVATE SDL2_net::${sdl2_net_export_name} SDL3::SDL3)
304304

305305
add_executable(chat examples/chat.c examples/chat.h)
306-
target_link_libraries(chat PRIVATE SDL2_net::${sdl2_net_export_name} SDL3::SDL3_test ${sdl3_target_name})
306+
target_link_libraries(chat PRIVATE SDL2_net::${sdl2_net_export_name} SDL3::SDL3_test SDL3::SDL3)
307307

308308
add_executable(chatd examples/chatd.c examples/chat.h)
309309
target_compile_definitions(chatd PRIVATE SDL_MAIN_HANDLED)
310-
target_link_libraries(chatd PRIVATE SDL2_net::${sdl2_net_export_name} ${sdl3_target_name})
310+
target_link_libraries(chatd PRIVATE SDL2_net::${sdl2_net_export_name} SDL3::SDL3)
311311
endif()
312312

313313
add_library(SDL2_net_on_SDL3 INTERFACE)

cmake/test/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ endif()
2626

2727
if(TEST_STATIC)
2828
# FIXME: in the distant future, must become REQUIRED
29-
find_package(SDL3 CONFIG REQUIRED COMPONENTS SDL3-static)
29+
find_package(SDL3 CONFIG REQUIRED COMPONENTS SDL3)
3030
find_package(SDL2_net REQUIRED CONFIG)
3131
add_executable(main_static main.c)
32-
target_link_libraries(main_static PRIVATE SDL3::SDL3-static SDL2_net::SDL2_net-static)
32+
target_link_libraries(main_static PRIVATE SDL3::SDL3 SDL2_net::SDL2_net-static)
3333
endif()
3434

3535
feature_summary(WHAT ALL)

0 commit comments

Comments
 (0)