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

Mojca Miklavec mojca.miklavec.lists at gmail.com
Sat Jul 6 19:32:12 EDT 2013


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