How to tell CMake to load external projects before compiling my sources

I have my own code, which depends on third-party libraries, for example, yaml-cpp. I want to download these third-party libraries before compiling my own sources. However, I am unable to do this with CMake.

I managed to load yaml-cpp as follows:

ExternalProject_Add(yaml-cpp
                URL https://yaml-cpp.googlecode.com/files/yaml-cpp-0.5.1.tar.gz
                PREFIX ${CMAKE_CURRENT_BINARY_DIR}/yaml-cpp
                CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>

But when I type

cmake ..
make

my sources are compiled earlier. In fact, yaml-cpp loads in the last step.

Do you know how to tell CMake to load third-party libraries in the first stage of construction?

Thank!

+4
source share
2 answers

ExternalProject . , . , . , .

+6

, !

add_dependencies(my_project yaml-cpp)

yaml-cpp my_project.

!

+4

All Articles