[CMake] CPack: howto change directory layout depending on the generator
Timenkov Yuri
ytimenkov at gmail.com
Sun Sep 21 04:29:39 EDT 2008
I've hurried a bit when I was writing previous message.
On Sat, Sep 20, 2008 at 8:12 PM, Tanguy Krotoff <tkrotoff at gmail.com> wrote:
> > FIrst of all, there are a couple of discussions about using
> > CPACK_SET_DESTDIR, install prefixes and co in this list which are about
> same
> > problems: directory layout depends on generator used.
>
> From what I've read, CPACK_SET_DESTDIR and
> CPACK_PACKAGING_INSTALL_PREFIX only deal with the install prefix.
> I've read this: http://www.mail-archive.com/cmake@cmake.org/msg11163.html
> I think changing the install prefix is not enough for allowing this:
Some part of discussion at the issue
http://public.kitware.com/Bug/view.php?id=7000 (see Brad's comments).
Now you can still play with prefixes and set them or not during cpack run,
for example for ZIP/TAR generator set this prefix to empty, while when using
rpm/deb, set it to /usr.
>
> ** NSIS:
> /myapp.exe
> /internal_lib1.dll
> /plugins/plugin1.dll
> ---> No install prefix
>
> ** DEB / RPM:
> /usr/Bin/myapp
> /usr/Lib/app/internal_lib1.so
> /usr/Lib/app/plugins/plugin1.so
> ---> install prefix is /usr/bin and also /usr/lib/app for internal stuffs
>
> > Next, cmake_install files (which contain install rules) are generated at
> > cmake time and it may be possible to code some variables there, which
> then
> > can be passed through cpack.
>
> I've checked the cmake_install.cmake files and I'm a bit lost, is
> there some examples/doc about how to modify them?
I suppose it is possible to write install rules in the way they will contain
placeholders for variables, somehow like this:
install(TARGETS myapp DESTINATION "\${MYPACKPREFIX}/bin")
(note dollar sign escaping) which should result in
file(INSTALL <somethings> DESTINATION "${MYPACKPREFIX}/bin")
in cmake_install.cmake file.
When running cpack, define this variable (with -D, for example). CPack
simply reads cmake_install.cmake files, so every variables expansions should
take place. The main obstracle can be, if cmake will escape dollar signs
when processing install statements of your CMakeLists.txt file.
>
>
> Also is it possible to know the list of files to be installed by CPack
> and modify this list?
> In this case it would be simple to a something like this:
>
> foreach (filepath, CPACK_LIST_OF_FILES_TO_BE_INSTALLED)
> if (CPACK_GENERATOR == "DEB" OR "RPM")
> if (filepath CONTAINS "plugins")
> file(REPLACE filepath "plugins" "/usr/lib/app/plugins")
> list(APPEND new_list_of_files_to_be_installed filepath)
> endif()
> elseif()
> #do nothing, keep the list of files as it is
> endif()
> endforeach()
>
> set(CPACK_LIST_OF_FILES_TO_BE_INSTALLED new_list_of_files_to_be_installed)
>
> --
> Tanguy Krotoff <tkrotoff at gmail.com>
> +33 6 68 42 70 24
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20080921/9eaa1f5f/attachment.htm>
More information about the CMake
mailing list