[CMake] Re: Install target and Component (once more)

Nicolas Burrus nespub at free.fr
Fri Sep 14 04:02:42 EDT 2007


All right, was I propose is the following patch (which seems to work
fine and not pertubate CPack). Then to set the component to install at
configure time, one just need to add:

SET(CMAKE_INSTALL_COMPONENT "Runtime")

Any objection against this patch? Is it possible to apply it?
Thanks,

Index: Source/cmLocalGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalGenerator.cxx,v
retrieving revision 1.236
diff -r1.236 cmLocalGenerator.cxx
411a412,413
-   const char* install_component =
this->Makefile->GetDefinition("CMAKE_INSTALL_COMPONENT");
+   if (!install_component) install_component = "";
419c421
+     "    SET(CMAKE_INSTALL_COMPONENT)\n"
---
+     "    SET(CMAKE_INSTALL_COMPONENT \"" << install_component << "\")\n"

On 9/13/07, Nicolas Burrus <nespub at free.fr> wrote:
> Hi,
>
> After some mailing list browsing, I could not find any complete answer
> to a recurrent request: how can we specify at configure time the
> component which should be installed by the install rule?
>
> Right now, I'm using the following custom rule:
> ADD_CUSTOM_TARGET(install-runtime COMMAND ${CMAKE_COMMAND}
> -DCOMPONENT=Runtime -P cmake_install.cmake)
>
> But it implies running "make install-runtime" instead of the standard
> "make install" (it seems like a custom target cannot replace a
> predefined rule like "install").
>
> Is there already a trick to avoid this? If the answer is no, let me
> transform it into a feature request :-)
>
> CPack handles this properly, and I can't see any good reason (but I'm
> not a cmake expert !) for Cmake not to automatically propagate the
> CMAKE_INSTALL_COMPONENT variable into the cmake_install.cmake script,
> like it already does for CMAKE_INSTALL_PREFIX.
>
> This way, something like
> SET(CMAKE_INSTALL_COMPONENT "Runtime") would do the job.
>
> In particular, this feature would be really useful when a project
> embbeds some library subprojects, whose header files should not be
> installed when they are just used to build the main program.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: install_component.patch
Type: text/x-patch
Size: 512 bytes
Desc: not available
Url : http://public.kitware.com/pipermail/cmake/attachments/20070914/24a8b986/install_component-0001.bin


More information about the CMake mailing list