Ask Your Question

Revision history [back]

To make the configuration of directory "B" rely on the build of directory "A" in CMake, we need to use the add_dependencies command in CMake.

In the CMakeLists.txt file of directory "B", we need to add the following line:

add_dependencies(B A)

This tells CMake that the target "B" depends on the target "A" and that "A" must be built before "B".

It's important to note that "A" must be a target defined in the CMakeLists.txt file of directory "A" and that the name "A" should be replaced with the actual name of the target.