I have my own code which depends on third-party libraries, such as yaml-cpp for example. I want to download these third-party libraries before compiling my own sources. However, I don't manage to do it with CMake.
I managed to download yaml-cpp like this:
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 before. Actually, yaml-cpp is downloaded at the very last step.
Do you know how to tell CMake to download third-party libraries at the very first building step?
Thanks!
ExternalProject
creates a target. You can make your first target, e.g. your library, dependent from that target. Then it gets downloaded before you start building your library.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With