[feature-request] Add missing CMake config or pkg-config file
This would make it more convenient to find the library/headers using common means, and also make it possible to query whether a minimal version is satisfied.
How about two pc files: one for the c++ header library, the other for the C static and shared libraries and their header?
It sounds like a good idea! Maybe watcher-c.pc for the C static/shared library? Or is it better practice to keep these separated these days, like watcher-c-private.pc and watcher-c.pc ?
Think https://github.com/e-dant/watcher/commit/bd02b11ae7a15e4bb10c3e3e8cea5011310dbaf4 solves this. How does it look?
Maybe watcher-c.pc for the C static/shared library?
That sounded good to me, went with that.
Will try it now for my use case (unbundling watcher in dolphin-emu).
I tried the latest commit of the next branch, but the test suite appears to fail there, with errors like:
Access events are not reported ... sed: read error on /tmp/guix-build-watcher-0.13.6-0.5638162.drv-0/tst-uYB7BS: Is a directory
oops :(
I'll try just applying the pkg-config patches.
Managed to build with test suite passing on commit 0aff9ee.
Works well, thank you!
Ah, I think there's a small issue, where prefix= is not set to a value, so the include dir is relative, which trips CMake for example:
CMake Error in Source/Core/Common/CMakeLists.txt:
Target "_alias_PkgConfigWATCHER" contains relative path in its
INTERFACE_INCLUDE_DIRECTORIES:
"include/wtr"
At least when building watcher with CMake.
I think the .pc files are often expressed as something like:
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=${prefix}
includedir=${prefix}/include
libdir=${exec_prefix}/lib
Got it, will fix that up, thank you!
fixed in 0.13.7
@e-dant hi! I just tried 0.13.8 to build dolphin-emu, and got:
CMake Error in Source/Core/Common/CMakeLists.txt:
Target "_alias_PkgConfigWATCHER" contains relative path in its
INTERFACE_INCLUDE_DIRECTORIES:
"include/wtr"
Indeed, there are relative paths in the watcher.pc file still:
$ cat /gnu/store/1hs79cagf7kbli886gjdmwb64kv9aq54-watcher-0.13.8/lib/pkgconfig/watcher.pc
prefix=
exec_prefix=${prefix}
libdir=lib
includedir=include/wtr
Name: watcher
Description: watcher: a filesystem watcher
URL: github.com/e-dant/watcher
Version: 0.13.8
Requires:
Conflicts:
Libs:
Libs.private: ;Threads::Threads
Cflags: -I${includedir}
So I've brough back my Guix-package phase to fix it up in Guix:
(add-after 'unpack 'fix-.pc-files-prefix
;; There are some issues with the new .pc files (see:
;; <https://github.com/e-dant/watcher/issues/82>).
(lambda _
(substitute* "CMakeLists.txt"
(("\"\\$\\{CMAKE_INSTALL_LIBDIR}\"")
"\"${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}\"")
(("\\$\\{CMAKE_INSTALL_INCLUDEDIR}/wtr")
"${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}/wtr"))
(substitute* "watcher.pc.in"
(("@PC_WATCHER_PREFIX@")
#$output))
(substitute* "watcher-c/watcher-c.pc.in"
(("@PC_LIBWATCHER_C_PREFIX@")
#$output))))
And I can now build dolphin-emu again. Could you please reopen this issue? Thanks!
Oof, my bad! I'll fix this up, thank you
No worries :-) Thanks for your reactivity!