Boost includes headers not found using cmake

This question is very similar to Why this boost header file is not included , however the hints there (appear to be) do not solve my problem.

I have CMakeLists.txt

CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
PROJECT(jetorigin)

SET(Boost_ADDITIONAL_VERSIONS "1.43" "1.43.0" "1.44" "1.44.0" "1.45" "1.45.0")
SET(BOOST_ROOT "$ENV{HOME}/usr")
MESSAGE(STATUS "** Search Boost root: ${BOOST_ROOT}")
FIND_PACKAGE(Boost 1.43 COMPONENTS filesystem regex REQUIRED)
 MESSAGE(STATUS "** Boost Include: ${Boost_INCLUDE_DIR}")
 MESSAGE(STATUS "** Boost Libraries: ${Boost_LIBRARY_DIRS}")
 MESSAGE(STATUS "** Boost Libraries: ${Boost_LIBRARIES}")

INCLUDE_DIRECTORIES(${BOOST_INCLUDE_DIR})
LINK_DIRECTORIES(${Boost_LIBRARY_DIRS})

ADD_SUBDIRECTORY(src)

And include the following formatting headers in your code:

#include <boost/regex.hpp>
#include <boost/filesystem.hpp>
#include <boost/filesystem/fstream.hpp>

Now cmake result looks ok

-- ** Search Boost root: /home/oli/usr
-- Boost version: 1.43.0
-- Found the following Boost libraries:
--   filesystem
--   regex
-- ** Boost Include: /home/oli/usr/include
-- ** Boost Libraries: /home/oli/usr/lib
-- ** Boost Libraries: /home/oli/usr/lib/libboost_filesystem.so;/home/oli/usr/lib/libboost_regex.so

But I get this error:

error: boost/regex.hpp: No such file or directory

(and similar for another). The full conclusion from make VERBOSE = 1 can be found here http://pastebin.ca/2039425 . It doesn't seem that the -I flag has been added, although Boost_INCLUDE_DIR seems to be configured correctly.

I am using CMake 2.8.1. I would really appreciate any hints of what's going wrong here.


EDIT: . , - CMakeLists.txt. :

INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIR})

( - "Boost" )... , CMake , CMakeLists.txt .

+3

Source: https://habr.com/ru/post/1783838/


All Articles