[CMake] Specifying different locations for libraries (lib/*.dylib) and cmake files (lib/Pkg-Ver/*.cmake)

Mojca Miklavec mojca.miklavec.lists at gmail.com
Tue Jul 16 13:56:56 EDT 2013


Dear CMake developers,

I'm reposting the question, hoping to get some feedback. If my
question was unclear, please ask for clarifications.

Short version of the question:

Which variables should be used to install library files to
    $prefix/lib/Package/Package-Version/lib*.dylib
and cmake modules to
    $prefix/lib/Package-Version/*.cmake
?

If I set -DCMAKE_INSTALL_LIBDIR=lib/Package/Package-Version then the
latter end up in
    $prefix/lib/Package/Package-Version/Package-Version/*.cmake
and other packages don't find it there.

Thank you,
    Mojca

On Sun, Jul 7, 2013 at 1:32 AM, Mojca Miklavec wrote:
> Hello,
>
> I'm a novice in CMake, but I'm trying to create a package (for
> MacPorts) to install some CMake-based software.
>
> I would like to support installing multiple versions side-by-side.
> This already works fine if I configure the software with something
> like the following:
>     -DCMAKE_INSTALL_LIBDIR=lib/Package/Package-Version
>     -DCMAKE_INSTALL_INCLUDEDIR=include/Package/Package-Version
>     -DCMAKE_INSTALL_BINDIR=libexec/Package/Package-Version
> but the main problem with this approach is that changing
> CMAKE_INSTALL_LIBDIR also results in *.cmake modules ending up in
>     lib/Package/Package-Version/Package-Version/*.cmake
> which is not the desired location. It should rather be
>     lib/Package-Version/*.cmake
> where CMake would find the package automatically.
>
> Of course I could use ugly patches to force the files to end up at the
> desired place, but I'm curious if there is any variable that I
> could/should use or some suggested way to achieve this.
>
> I can probably ask the developers of the package to provide an
> additional option to configure location of libraries (lib/*.dylib) and
> cmake modules (lib/package-version/*.cmake) separately, or I could try
> to write a patch myself, but I first need to know the suggested way to
> achieve this.
>
> Thank you,
>     Mojca


More information about the CMake mailing list