libspng provides CMake targets: find_package(SPNG CONFIG REQUIRED) target_link_libraries(main PRIVATE $,spng::spng,spng::spng_static>)