Skip to content

Commit d01bfcb

Browse files
committed
Support linking with SDL2 2.0.10 (Ubuntu Focal).
1 parent a160484 commit d01bfcb

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

examples/CMakeLists.txt

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

6868

6969
if (WITH_EXAMPLE_HEIF_VIEW)
70-
find_package(SDL2 NO_MODULE)
70+
find_package(SDL2 COMPONENTS SDL2 SDL2main NO_MODULE)
7171

7272
if (SDL2_FOUND)
7373
add_executable(heif-view ${getopt_sources}
@@ -76,7 +76,15 @@ if (WITH_EXAMPLE_HEIF_VIEW)
7676
sdl.hh
7777
common.cc
7878
common.h)
79-
target_link_libraries(heif-view PRIVATE heif SDL2::SDL2main SDL2::SDL2)
79+
target_link_libraries(heif-view PRIVATE heif)
80+
if (TARGET SDL2::SDL2main)
81+
target_link_libraries(heif-view PRIVATE SDL2::SDL2main)
82+
endif()
83+
if (TARGET SDL2::SDL2)
84+
target_link_libraries(heif-view PRIVATE SDL2::SDL2)
85+
else()
86+
target_link_libraries(heif-view PRIVATE ${SDL2_LIBRARIES})
87+
endif()
8088
install(TARGETS heif-view RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
8189
endif ()
8290
endif ()

0 commit comments

Comments
 (0)