Boost Cmake Example

  1. Boost Cmake Example Questions

Nehme Bilal wrote: Hello allI am a not very familiar with Cmake but I am starting a new project based on cmake and trying to add boost libraries to my project. Fortunately boost now provide a cmake configuration FYI, the CMake configuration for Boost is unofficial.

  1. CMake( twxs.cmake )Plug in 0.0.17; CMake Tools(ms- vscode.cmake -Tools) plug in 1.3.1; Visual Studio IntelliCode( visualstudioexptteam.vscodeintellicode )Plug in 1.2.7; Visual studio community 2019 (need to call the MSVC compiler provided by vs, as well as the corresponding header file and library file) CMake 3.17.2; Ninja 1.10.0.
  2. Jun 22, 2016 Download and extract boost archieve from ( Make sure to download the source package! Extract the archive, enter the directory from CMD.exe (example below) cd 'D: Program Files boost '. Run the following commands. Bootstrap.bat gcc.
  3. Questions: I am trying to get a simple boost.log example running on Linux using GCC 4.4.5, CMake 2.8.2 and Boost 1.53.0. Compiling boost and boost log succeeded, but I keep getting issues when linking my test program to boost.log.
  4. In a cmake project, the build steps can all be done using cmake itself instead of the build system cmake generates for (like make/ninja), if your cmake version is 3.15 or higher): cd to/project/folder cmake -build build/ sudo cmake -install build/ No seperate make, the last cmake command wraps around that. You can also just do it the old.

I'm trying to cross-compile ROS Base from source.

I've cross-compiled the Boost 1.58.0 and installed it at /usr/local/boost, which contains include/boost and lib.


Also, I wrote

into the CMakeLists.txt of cpp_common, so it becomes as below:

Boost Cmake Example

And I created a file named test.cmake as below:

Boost cmake example pdf

However, when I executed the command ./src/catkin/bin/catkin_make_isolated -DCMAKE_TOOLCHAIN_FILE=/home/zyh/ros_base/test2.cmake --install -DCMAKE_BUILD_TYPE=Release to compile the ROS, I still get the error:

editretagflag offensiveclosemergedelete


Try writing the Boost-related variables like so:

Cmake boost example

set(Boost_INCLUDE_DIR /usr/local/boost/include)set(Boost_LIBRARY_DIR /usr/local/boost/lib)

Also, I have them in the toolchain file rather than cpp_common's CMake file, I suggest you change that if you are building the whole bare-bones variant.

@jotator thanks a lot, it works perfectly.

Boost Cmake Example Questions

No problem :) Did you have to put it inside the toolchain file or was cpp_common's CMakeLists.txt enough?