-
Notifications
You must be signed in to change notification settings - Fork 160
fix #143 by setting LIB_INSTALL_DIR CMake var #144
base: develop
Are you sure you want to change the base?
Conversation
This is more or less correct. Currently in OpenWrt, libdir= comes up as blank and includedir=/evhtp , which is totally wrong. This is currently used to fix: https://github.com/openwrt/packages/blob/master/libs/libevhtp/Makefile#L49 In most other pkgconfig files that I've seen, this is the format:
which works well in OpenWrt. |
Please do not hardcode prefixes like |
ping @cotequeiroz |
I get what @neheb wants. He does not want to hardcode anything, but to use the So the following patch should do it that way: --- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -14,6 +14,7 @@ include(CheckIncludeFiles)
include(CheckTypeSize)
include(CheckCCompilerFlag)
include(TestBigEndian)
+include(GNUInstallDirs)
check_function_exists(strndup HAVE_STRNDUP)
check_function_exists(strnlen HAVE_STRNLEN)
diff --git a/evhtp.pc.in b/evhtp.pc.in
index a7b351f..fbddc51 100644
--- a/evhtp.pc.in
+++ b/evhtp.pc.in
@@ -1,6 +1,7 @@
prefix=@CMAKE_INSTALL_PREFIX@
-libdir=@LIB_INSTALL_DIR@
-includedir=@INCLUDE_INSTALL_DIR@/evhtp
+exec_prefix=${prefix}
+libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@
+includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@/evhtp
Name: libevhtp
Description: A more flexible replacement for libevent's httpd API Note that this changes behavior. Currently, on gentoo-x86_64, libevht will install libs to Edit:
|
Not quite:
|
Keep in mind that unlike autotools, cmake does not do prefix/exec_prefix distinction. It will still work the same way. You could also just use @CMAKE_INSTALL_PREFIX@ again. |
Does CMake even use pkgconfig? I see files under /usr/lib/cmake which I'm guessing do what pkgconfig does for autotools. I see
As far as pkgconfig files go, autotools should probably be the focus. |
Yes, they have their own package management tool. Keep in mind that you may want to build non-cmake-aware apps with the library. |
@cotequeiroz Your suggestion works fine for me as well, I just tested it under NixOS. So how to proceed? Will you open a new PR with your proposed patch or shall I adapt it into this one? |
You choose. It’s such a small set of changes, that I would prefer not to do it on its own. Besides, we lose the discussion. If you want to give me credit, just write it in the commit message. |
setting pkgconfig libdir and includedir during build according to GNUInstallDirs. Patch proposed by @[email protected]
dd76512
to
4de722b
Compare
incorporated the proposal of @cotequeiroz |
So is there any interest in merging this tiny fix? |
This is a simple fix for #143 by reverting parts of 327bf14.
I don't know though whether this fits the intended modernized CMake workflow.