[CMake] Conditional install

Tyler Roscoe tyler at cryptio.net
Mon Jul 27 11:05:24 EDT 2009


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