Skip to content

Commit 26cddec

Browse files
committed
cmake: improve check of APNG feature availability
1 parent bb7d72f commit 26cddec

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

gui/qt/CMakeLists.txt

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,8 +285,16 @@ endif()
285285

286286
find_package(PNG QUIET)
287287
if(PNG_FOUND)
288-
target_compile_definitions(CEmu PRIVATE "PNG_SUPPORT")
289-
target_link_libraries(CEmu PRIVATE PNG::PNG)
288+
include(CheckSymbolExists)
289+
set(CMAKE_REQUIRED_INCLUDES ${PNG_INCLUDE_DIRS})
290+
check_symbol_exists(PNG_WRITE_APNG_SUPPORTED "png.h" HAVE_PROPER_APNG_LIB)
291+
if(HAVE_PROPER_APNG_LIB)
292+
set_property(TARGET CEmu PROPERTY AUTOMOC_MOC_OPTIONS "-DPNG_WRITE_APNG_SUPPORTED")
293+
target_compile_definitions(CEmu PRIVATE "PNG_SUPPORT")
294+
target_link_libraries(CEmu PRIVATE PNG::PNG)
295+
else()
296+
message(WARNING "The LibPNG found does not seem to support APNG. APNG capture will not be available")
297+
endif()
290298
else()
291299
message(WARNING "No LibPNG found! APNG capture will not be available")
292300
endif()

0 commit comments

Comments
 (0)