extract install from external projects

There is a software package consisting of CMake based products in subdirectories of the package root
One needs to go into the subdirectories manually in the proper order and call cmake within these subdirectories. There is no original CMakeLists.txt in the package root.

My attempt was to cover these products all in package root CMakeLists.txt.

This works quite ok via ExternalProject_Add for the dependencies and some common variables.

An issue is, that the external projects implicitly do make; make install but I would like to have the make install separate from the root.

So basically I want ExternalProject_Add not to perform the install step (which could be done via INSTALL_COMMAND "" but how can I collect all install steps for the root make install?

How could this be realized? Is there a better way to integrate individual CMake projects?

In case of interest: Here is my fork GitHub - Fabian188/SuiteSparse-root-cmake: This fork adds a root CMakeLists.txt to the official SuiteSparse library authored or co-authored by Tim Davis

Thanks!

I suppose you could use install(SCRIPT) to do these install commands, but I don’t think that will work well in the face of having to edit rpaths or the like (but maybe it could be set up to work).

Thanks, that made the job. I collect the modules build directory in a list and create an easy install script via configure_file().

rpath seems to be no issue. I set CMAKE_INSTALL_DIR in ExternalProject_Add() but prevent immediate install vial INSTALL_COMMAND “”.