meson: install cmake dependency files#185
Conversation
My understanding is that with cmake you need a "basic package version" file, which this function you added does, that effectively serves as the "Version: xxx" and "Name: yyy" from a pkg-config file. You also need a |
|
I made some modifications. I doubt these are correct. I have absolutely no idea how this is supposed to work. conan's version of this package says that is what works but I don't see any modifications to add inih::inih anywhere. Let's ping some hopefully experts: ping @aengusjiang @otavio @Ryanf55 |
|
If you did this: pkg_check_modules(INIH IMPORTED_TARGET GLOBAL inih)
pkg_check_modules(INIREADER IMPORTED_TARGET GLOBAL INIReader)Then pkg_check_modules will execute pkg-config, find those two dependencies, and creates an "interface" library named PkgConfig::INIH or PkgConfig::INIREADER. It has the usual INCLUDE_DIRECTORIES and LINK_LIBRARIES and COMPILE_OPTIONS etc properties. You probably want to model that somehow, instead of just setting a freestanding CFLAGS variable. People still have to know the name of the produced interface library but at least all the info is in one place. This is roughly speaking the same experience as a meson |
|
right. but the cmake interface seems to be inih as used by consumers. |
|
This package is so simple, is there a reason not to add a CMakeLists? It wouldn't take that much code at all. |
|
I don't see how that would be remotely helpful. Then there would be multiple ways to build inih and neither one would provide everything that downstream users have come to depend on. |
There was a problem hiding this comment.
Syntax doesn't work as is. Try my PR, which seems to get us 95% of the way there.
neheb#1
There's instructions in the CMakeLists. I added targets for both libraries, and a version file for each.
It currently has an issue in the installed shared library, which you can reproduce on master.
inih library can be linked well, but inih_reader has runtime shared library loading issues.
$ ldd build/ini_reader
linux-vdso.so.1 (0x00007ffe7ddd5000)
libINIReader.so.0 => /home/ryan/Dev/benhoyt/inih/install/lib/x86_64-linux-gnu/libINIReader.so.0 (0x00007f516aad8000)
libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f516a889000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f516a869000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f516a640000)
libinih.so.0 => not found
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f516a557000)
/lib64/ld-linux-x86-64.so.2 (0x00007f516aaf3000)
| @@ -0,0 +1,4 @@ | |||
| @PACKAGE_INIT@ | |||
|
|
|||
| set(inih_CFLAGS "${inih_CFLAGS}" | |||
There was a problem hiding this comment.
| set(inih_CFLAGS "${inih_CFLAGS}" | |
| set(inih_CFLAGS "${inih_CFLAGS}") |
Missing close paran.
There was a problem hiding this comment.
Fixed. Does this even work?
There was a problem hiding this comment.
No, you were missing finding the library and creating the target. See my PR.
CMake users seem to prefer these to pkgconfig files. Signed-off-by: Rosen Penev <rosenp@gmail.com>
CMake users seem to prefer these to pkgconfig files.
@eli-schwartz how would extra_args be passed as in pkgconfig?