So I could not compile the c++ code with this in its CMakeList.txt
find_package(Boost REQUIRED COMPONENTS program_options)
due to error output
Imported target "Boost::program_options" includes non-existent path
"/include"
in its INTERFACE_INCLUDE_DIRECTORIES.
I print out the variables BOOST_ROOT and Boost_INCLUDE_DIRS in boost_program_options-config.cmake (it is the file which the compiler error points to )
It turns out that BOOST_ROOT is "" and Boost_INCLUDE_DIRS points to "/include"
I believe this is the reason, the directory of the boost include file is under path /usr/include
What could I to set the BOOST_ROOT parameter permanently for all future build or better ways to fix this problem?
Following fellow coder's advises, I reinstalled the boost but the build error still persists.
What I did to reinstall boost was
- remove the boost( I only have boost 1.71 install), commands on Ubuntu20.04 Terminal are:
:~$ sudo apt-get autoremove libboost1.71-dev
- reinstall boost, commands are:
:~$ sudo apt-get install libboost-all-dev
I also checked the cmake version and it is cmake 3.16.3
The code is the ROS2's Nav2 package. With ROS2 already installed and running prefectly, the build commands I use to build the Nav2 package is
:~$ colcon build --symlink-install
This is the command that throws out the error
Imported ... Boost::program_options ... non-existent path ... INTERFACE_INCLUDE_DIRECTORIES
thanks ahead!