[CMake] Proper behaviour and use of CMAKE_INSTALL_* variables
Mojca Miklavec
mojca.miklavec.lists at gmail.com
Mon Dec 9 09:50:08 EST 2013
Dear list members,
I often like or need to install two versions of the same software.
Ideally the software should put its files by default to
$prefix/include/$NAME/*.h
$prefix/lib/$NAME/*.dylib
...
($prefix => $CMAKE_INSTALL_PREFIX)
and in order to be able to install multiple versions side-by-side I
would like to be able to specify something like
-DCMAKE_INSTALL_INCLUDEDIR=include/$NAME/$VERSION
-DCMAKE_INSTALL_LIBDIR=lib/$NAME/$VERSION
to end up with
$prefix/include/$NAME/$VERSION/*.h
$prefix/lib/$NAME/$VERSION/*.dylib
instead of default paths.
The problem is that in this case either of the two options must be true:
a) Software sets CMAKE_INSTALL_INCLUDEDIR to "include/$NAME" rather
than to "include" by default which "violates" the convention from
http://www.cmake.org/cmake/help/v2.8.12/cmake.html#module:GNUInstallDirs,
but leads to the desired behaviour.
b) Software sets CMAKE_INSTALL_INCLUDEDIR to "include" by default and
automatically adds "$NAME" to an internal variable when installing the
files. The drawback of this approach is that
-DCMAKE_INSTALL_INCLUDEDIR=include/$NAME/$VERSION
results in files being installed to
$prefix/include/$NAME/$VERSION/$NAME/*.h
and there is absolutely no way to change that.
What approach would you suggest to achieve the desired behaviour
without violating the conventions?
Thank you very much,
Mojca
More information about the CMake
mailing list