I would like to have a failsafe setup in my project. I don't really want to mess around with installing boost and the other libs every time we are setting stuff up.
So it would be awesome, that if a required Boost version is not found, cmake downloads and compiles boost and uses that version for the project.
Is there an easy possibility?
I found this in the maid-safe project. But I am not that experienced with cmake and have no clue how to use it.
You could use this find module I created.
cmake
. CMAKE_MODULE_PATH
. Here's one way of accomplishing this: list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
. BOOST_REQUESTED_VERSION
. For example, set(BOOST_REQUESTED_VERSION 1.61)
. find_package(Boost COMPONENTS system program_options)
If Boost is not installed in your system it will be downloaded and compiled on-the-fly , at build time (ie, when you run make
). If it is installed in your system, nothing will be downloaded.
( Optional ) You can change BOOST_ROOT_DIR
to the root directory of the location where boost is installed in your system. This is useful if it is installed in a non-standard location.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.