CMake compile options for libpng

后端 未结 2 750
无人及你
无人及你 2020-12-03 20:12

I am using libpng in my project. Right now, I can compile my project with: g++ *.cpp `libpng-config --ldflags`

I want to switch to using CMake for easy recompiling

2条回答
  •  离开以前
    2020-12-03 20:46

    I finally solved it using find_package. Thanks to this blog post.

    find_package(PNG REQUIRED)
    include_directories(${PNG_INCLUDE_DIR})
    target_link_libraries(${MY_EXEC} ${PNG_LIBRARY})
    

提交回复
热议问题