cmake third party step dependency

255 views Asked by At

We are using a vendor code as third party project in our source code. This party project is hosted on different server.

Our application needs to include header file from third party project. So far, application cmake has dependecy on external project, untill external project install is done, application will not start building up.

Logically Application can start building once third party project is downloaded and header files are available. To Achieve the same, I can have a step which depends on configure/download

ExternalProject_Add_Step(CopyHeaderFileStep DEPENDS configure)

However since it is just a step, not target, I am not able to specify dependecy of CopyHeaderFileStep in my application CMake.

I looked upon cmake third party documentation throughtly but no help. Is there any way out here ?

1

There are 1 answers

1
Tsyvarev On BEST ANSWER

However since it is just a step, not target, I am not able to specify dependecy of CopyHeaderFileStep in my application CMake.

Exactly for that purpose there is a function ExternalProject_Add_StepTargets, which creates normal CMake targets for the steps of the ExternalProject. From documentation:

ExternalProject_Add_StepTargets() function generates targets for the steps listed. The name of each created target will be of the form <name>-<step>.

Example:

# Create targets for steps
ExternalProject_Add_StepTargets(extProject # External project name
    CopyHeaderFileStep # List of steps, for which targets will be created
)

# Depend on these targets in outer code
add_dependencies(myApp extProject-CopyHeaderFileStep)