diff --git a/CMakeLists.txt b/CMakeLists.txt index 881a025..a6e1ae4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -239,6 +239,13 @@ if(NOT TARGET SDL2::SDL2) find_package(SDL2 MODULE REQUIRED) endif() target_link_libraries(infinisim PRIVATE SDL2::SDL2) + +option(WITH_PNG "Compile with libpng support to dump current screen as png" ON) +if(WITH_PNG) + target_compile_definitions(infinisim PRIVATE WITH_PNG) + add_subdirectory(libpng EXCLUDE_FROM_ALL) + target_link_libraries(infinisim PRIVATE png_static) +endif() endif() # Get the latest abbreviated commit hash of the working branch @@ -251,11 +258,4 @@ execute_process( set(VERSION_EDIT_WARNING "// Do not edit this file, it is automatically generated by CMAKE!") configure_file("${InfiniTime_DIR}/src/Version.h.in" "${CMAKE_CURRENT_BINARY_DIR}/Version.h") -option(WITH_PNG "Compile with libpng support to dump current screen as png" ON) -if(WITH_PNG) - target_compile_definitions(infinisim PRIVATE WITH_PNG) - add_subdirectory(libpng EXCLUDE_FROM_ALL) - target_link_libraries(infinisim PRIVATE png_static) -endif() - install(TARGETS infinisim DESTINATION bin)