According to
http://www.cmake.org/cmake/help/v2.8.12/cmake.html#module:GNUInstallDirs
I should be able to use -DCMAKE_INSTALL_LIBDIR=/some/arbitrary/place to override the default location (PREFIX/lib) where the library gets installed. From googling, looks like Debian and other multiarch distros really need this sort of feature. Easy enough to implement, just use that variable instead of the hardcoded "lib" in the CMakeLists.txt INSTALL(...LIBRARY DESTINATION) commands.
This was only added to cmake GNUInstallDirs.cmake in 2.8.8 (a module that only existed at all as of 2.8.7) I think, so you either need to specify that as CMAKE_MININUM_REQUIRED or have a fallback.
Presumably INSTALL(...ARCHIVE DESTINATION) should match (so both static and shared libs are side-by-side). And the .pc should be patched to have its libdir= path matched.
Dear Daniel,
Would you be able to provide a patch for this? It seems you know a lot more about CMake than we do.
Thanks!
Dee
See attached. Works for me on OS X 10.8 without -DCMAKE_INSTALL_LIBDIR ("same behavior as unpatched"), and with it as either absolute or relative path (the latter treated as relative to PREFIX). I'm using cmake-3.1.0 and can't easily try older...I set the minimum based on other projects and online documentation. I don't have any other sandbox machines to verify its behavior on other platforms.
Hello, I tried the patch. Seems fine, but I have a question before commiting it. Shouldn't we also install the pkg-config file to wherever CMAKE_INSTALL_LIBDIR says? Because right now it looks like it's still installed under /whatever/lib.
To answer my own question, yes, pkg-config files should also go there. I applied your patch, modified to put the pkg-config files there as well.
(svn rev: 1743)
Last edit: John Tsiombikas 2015-02-18