[CMake] Conditional install

rozelak at volny.cz rozelak at volny.cz
Tue Aug 11 17:37:54 EDT 2009


Hallo,

thank you for your reply. I have tried to set the COMPONENT in the INSTALL()
command, but it did not lead to the expected result. The install command
I changed to (ONLY for the target I want to install, inspired by http://www.cmake.org/pipermail/cmake/2006-October/011362.html):

INSTALL(TARGETS ${LIB_NAME}  DESTINATION lib  COMPONENT dist )

and called as 

>$ cmake COMPONENT=dist -P cmake_install.cmake ../
>$ make
>$ make package # CPack is configured ...

still adds also the targets NOT having COMPONENT filled (the libraries
joined by svn:externals and statically linked) into the package built.
And I cannot change CMakeLists.txt except the one in my target ...


Do you think that my original requirement is meaningful enough for feature
request to be filled?

Thank you very much,
DanT.



----- PŮVODNÍ ZPRÁVA -----
Od: "Tyler Roscoe" <tyler at cryptio.net>
Komu: rozelak at volny.cz
Předmět: Re: [CMake] Conditional install
Datum: 27.7.2009 - 17:05:24

> On Mon, Jul 27, 2009 at 04:19:48PM +0200, rozelak at volny.cz
> wrote:
> > When 'make' is called, both libraries are built and
> > then STATICALLY linked
> > > to the application - works perfectly.
> > 
> > However, when 'make install' is called, the libraries
> > are installed as
> > > well (right, they contain INSTALL() definition ...)
> > > 
> > What I need is to tell to CMake NOT to install the
> > libraries (they are
> > > 
> > separate projects and it is not necessary to publish
> > them together with
> > > the binary). I mean something like EXCLUDE_FROM_ALL
> > but in form of
> > > EXCLUDE_FROM_INSTALL :-)
> 
> Maybe the COMPONENT argument to install() can help
> you?
> 
> Otherwise, maybe only define install() rules for your
> components if
> there is no top-level target that will end up doing
> the work?
> 
> if (NOT TARGET myExe)
> install(myLib1 ...)
> install(myLib2 ...)
> endif ()
> 
> 
> tyler





More information about the CMake mailing list