Crazy писал(а): ↑07.10.2012 12:28
Лично я отталкиваюсь от CMAKE_INSTALL_PREFIX
DESTINATION arguments specify the directory on disk to which a file will be installed. If a full path (with a leading slash or drive letter) is given it is used directly. If a relative path is given it is interpreted relative to the value of CMAKE_INSTALL_PREFIX.
и тогда будет выглядеть
Код: Выделить всё
install(TARGETS rtnl_static rtnl
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib)
И мне обычно этого хватает.
Как показал опыт в данном случае установка будет осуществляться в /usr/local/lib.
А как тогда описывать установку заголовочных файлов, документации и тому подобного? Вернее сказать так, как указывать директории для их установки? По аналогии с библиотекой это должно быть что-то типа bin/doc/include/..., где можно ознакомиться с полным списком?
Вариант с ${DEST_LIB_DIR} выглядит предпочтительнее, но почему Cmake не устанавливает значение по-умолчанию если эта переменная не установлена пользователем, я надеюсь это встроенная в CMake переменная?
Возьмём для примера тот же autotools:
Код: Выделить всё
Installation directories:
--prefix=PREFIX install architecture-independent files in PREFIX
[/usr/local]
--exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
[PREFIX]
................
For better control, use the options below.
Fine tuning of the installation directories:
--bindir=DIR user executables [EPREFIX/bin]
--sbindir=DIR system admin executables [EPREFIX/sbin]
--libexecdir=DIR program executables [EPREFIX/libexec]
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
--libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include]
--datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
--datadir=DIR read-only architecture-independent data [DATAROOTDIR]
--infodir=DIR info documentation [DATAROOTDIR/info]
--localedir=DIR locale-dependent data [DATAROOTDIR/locale]
--mandir=DIR man documentation [DATAROOTDIR/man]
--docdir=DIR documentation root [DATAROOTDIR/doc/librtnl]
--htmldir=DIR html documentation [DOCDIR]
--dvidir=DIR dvi documentation [DOCDIR]
--pdfdir=DIR pdf documentation [DOCDIR]
--psdir=DIR ps documentation [DOCDIR]
Т.е. даже если я не укажу куда установить собранное, то есть предопределённые места.