[CMake] How to run the install step of an ExternalProject when installing the whole project?

Patrick Boettcher patrick.boettcher at posteo.de
Fri Mar 8 10:01:46 EST 2019


On Fri, 8 Mar 2019 15:45:50 +0100
Patrick Boettcher <patrick.boettcher at posteo.de> wrote:

> Hi list,
> 
> I have several externalprojects in my build. Some of them have a quite
> complete install-step which I would like to have running when the
> parent-build is installed (and not during the compile build of the
> parent).
> 
> How can I achieve that?

I found a way, but is it the best one?

The external-project gets its INSTALL_COMMAND set to "".

And then I add:

  ExternalProject_Get_Property(project-ext BINARY_DIR)
  install(CODE "execute_process(COMMAND ${CMAKE_COMMAND} --build ${BINARY_DIR} --target install)")

--
Patrick.


More information about the CMake mailing list