[CMake] Component group specific installation with Makefile

Doug Gregor doug.gregor at gmail.com
Wed Aug 6 16:43:24 EDT 2008


On Wed, Aug 6, 2008 at 1:55 PM, Yuri V. Timenkov
<ytimenkov at parallels.com> wrote:
> On Wednesday 06 August 2008 17:43:18 Yann Cointepas wrote:
>> Hi,
>>
>> Is there a way to define component group (or installation type)
>> specific installation targets in a Makefile ?
>>
>> I work on Linux. I have defined three CPack component groups (and/or
>> installation types) for my project: runtime, devel and doc and I would
>> like to be able to install all components of each group separately
>> (for example with make install_doc). I only found a way to install a
>> single component (not a component group) by defining
>> CPACK_INSTALL_CMAKE_PROJECTS variable in CMakeLists.txt.
> If you need to install single component (not group), then you can write simple
> custom target, which invokes CMake in command mode (look how "install" target
> implemented in Makefile).
>
> I came to conclusion that only CPack can install multiple components. See my
> last comments in http://public.kitware.com/Bug/view.php?id=6835 about
> installing arbitrary set of components in CPack. (this is kind of hack in
> CPack to include in "ALL" target only necessary components).
>
> You can write custom make targets which make simple tgz or zip package with
> CPack and then unpack it.

It seems entirely reasonable to me that cpack_add_component and
cpack_add_component_group would add install targets
install-<componentname> and install-<componentgroupname> to makefile
targets, which just perform the appropriate

  cmake -DCOMPONENT=<componentname> -P cmake_install.cmake

actions. It means that cpack_add_* is somewhat of a misnomer (CPack
doesn't even come into play with the install targets in the makefile),
but I think it's useful behavior. Bonus points if you make targets
like "install-help" and "install-help-<componentname>" provide useful
documentation.

  - Doug


More information about the CMake mailing list