cpp-ipfs-http-client
cpp-ipfs-http-client copied to clipboard
Could be nice to generate/install pkg-config file
I'm testing your project right now.
Could be nice to create a pkg-config file like in: https://github.com/sebastiandev/zipper/blob/master/zipper.pc.cmakein
Or for Makefile: https://github.com/Lecrapouille/MyMakefile/blob/master/Makefile.macros#L165 sudo make install will install it: https://github.com/Lecrapouille/MyMakefile/blob/master/Makefile.macros#L181 https://github.com/Lecrapouille/MyMakefile/blob/master/Makefile.macros#L63 (not sure this is working well for Mac)
So in your readme instead of:
g++ -std=c++11 -I/path/to/header -L/path/to/lib -lipfs-http-client myprog.cc -o myprog
Could be replaced by:
g++ -std=c++11 myprog.cc -o myprog `pkg-config --cflags --libs ipfs-http-client`
In addition in your command -lipfs-http-client
is misplaced and -lcurl
is missing. The pkg-config will contain the -lcurl
code
I see, thank you for you remarks. Ideally you should use CMake, which interact very well with an existing CMake project.
But I will test if pkg-config
config you provided also work, instead of the manual -I ..
and -L ..
, which is indeed old school.
The additional pkg-config file is also a great idea! Thx.
Please, be welcome to add a PR if you wish.
pkg-config generation is managed by CMakefile. I'll check if I can make a PR from this project I helped, I'm noob with CMake:
https://github.com/sebastiandev/zipper/blob/master/zipper.pc.cmakein
https://github.com/sebastiandev/zipper/blob/87b14a4b31771ed94ebb3204dc6ed69ad9c78436/CMakeLists.txt#L465
https://github.com/sebastiandev/zipper/blob/87b14a4b31771ed94ebb3204dc6ed69ad9c78436/CMakeLists.txt#L479
Yes so zipper.pc.cmakein
is an input file for the configure_file
of CMake, generating the final file. Which is exported to: ${PROJECT_BINARY_DIR}/zipper.pc
, so under the CMAKE project binary directory with final name 'zipper.pc'. Configure_file
will fill all the @CMAKE_INSTALL_PREFIX@
statement etc. during the build.