[CMake] Installing a list of components

tom.edwards at thefoundry.co.uk tom.edwards at thefoundry.co.uk
Thu Aug 18 11:26:01 EDT 2016


I’m working on an application which consists of many different components surrounding a common core. We ship multiple products from the same source tree by adding and/or removing components from the output application directory.

Using CMake’s install system in this environment is proving difficult. I’ve managed to set things up so that all components are installed to the same place, which is fine for development but not suitable for testing or shipping. A proper solution would install only the components needed for an individual application.

The new EXCLUDE_FROM_ALL option for the install command overcomes one of the biggest hurdles to reaching that goal. I can now add that option to every install command, generate a list of component names, and add a custom target for each application which invokes CMake and has it install only the relevant components.

The problem now is that I can only install one component at a time, and that invoking CMake 200+ times to install them all individually is unacceptably slow.

Looking at the install scripts CMake generates I see lines like this:

> if("${CMAKE_INSTALL_COMPONENT}" STREQUAL "foobar" OR NOT CMAKE_INSTALL_COMPONENT)

The install process would become much more flexible if STREQUAL were changed to IN_LIST. As far as I can see this change: a) has no performance penalty when the component value isn’t a list and b) would be backwards compatible unless an individual component name contained a semicolon (which seems an unlikely scenario).

What do the developers think? 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20160818/a0d34315/attachment.html>


More information about the CMake mailing list