[CMake] CPack source package install location

Domen Vrankar domen.vrankar at gmail.com
Mon Jul 4 02:44:31 EDT 2016


Hi,

> I have a very standard CPack configuration for deb package. I have two
> questions:
>
> 1. I generate the deb with: cpack --config CPackConfig.cmake -G "DEB"
>
> This is supposedly a binary package but when I install it on the machine I
> see header files being installed in /usr/include.
>
> Is this normal?

I'm guessing that CPackConfig.cmake is generated by cmake and not hand written.

CMake generates CPackConfig.cmake that can be used to create a package
with content listed with 'install()' commands (see:
https://cmake.org/cmake/help/v3.5/command/install.html). If those
commands contain header files then those files will be part of the
package. You could also split packages between bin and dev packages by
using COMPONENT attribute in install commands and then generating
component packages - one per component.

> 2. Header files are installed into /usr/include but there is one problem:
> other projects using the library are including header files with #include
> <libname/SomeHeader.h> as a standard practice.
>
> So I actually want them installed in /usr/include/libname instead. After
> scouring the CPack variables in documentation I didn't really find anything
> suitable to do this. Is it possible to achieve?

This would have to be changed in CMakeLists.txt (install commands) or
is possibly already written with prefix variable in mind in which case
you have to look into CMakeLists.txt install commands and set the
variable that is used there for this purpose.

Regards,
Domen


More information about the CMake mailing list