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 but I don't know what to do for the libpng part. How do I provide `libpng-config --ldflags` with CMake?
I finally solved it using
find_package
. Thanks to this blog post.I think the recommended and portable way it should be done using pkg-config, something like this: