onepaigu
onepaigu

Reputation: 1

How to control the timing of shell execution in cmake

I am having the following directory structure:

/CMakeLists.txt
/component-a/CMakeLists.txt
           /...
/component-b/CMakeLists.txt
           /...
/doc/CMakeLists.txt  

In the top CMakeLists.txt:

ADD_SUBDIRECTORY(component-a)
ADD_SUBDIRECTORY(component-b)

In the sub dir(component-a/component-b) CMakeLists.txt:

ADD_LIBRARY(xxx SHARED ${xxx})

this commond will link some c and h files which will generate by other tools

now I want to exec shell in the top CMakeLists.txt after the build of this two sub dir.

how can I write execute_process/add_custom_command/add_custom_target

Upvotes: 0

Views: 31

Answers (1)

arrowd
arrowd

Reputation: 34401

First, you don't need execute_process, as it runs things at the configuration stage.

Second, you can define the execution order by properly setting dependencies between targets using add_dependencies().

Upvotes: 0

Related Questions