- CMake Cookbook
- Radovan Bast Roberto Di Remigio
- 111字
- 2025-04-04 16:17:18
How it works
The FindBoost.cmake module, which is used in this recipe, will try to locate the Boost libraries in standard system installation directories. Since we link to the imported Boost::filesystem target, CMake will automatically set the include directories and adjust the compile and link flags. In case the Boost libraries are installed in a non-standard location, one can pass the root of the Boost installation at configuration time using the BOOST_ROOT variable in order to point CMake to also search the non-standard path:
$ cmake -D BOOST_ROOT=/custom/boost/
Alternatively, one can pass both the BOOST_INCLUDEDIR and BOOST_LIBRARYDIR variables for the directories containing headers and libraries:
$ cmake -D BOOST_INCLUDEDIR=/custom/boost/include -D BOOST_LIBRARYDIR=/custom/boost/lib