Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding boost to existing cmake project fails #841

Closed
MasterBe opened this issue Dec 30, 2023 · 1 comment
Closed

Adding boost to existing cmake project fails #841

MasterBe opened this issue Dec 30, 2023 · 1 comment

Comments

@MasterBe
Copy link

MasterBe commented Dec 30, 2023

Hello,

I am having an issue using boost, I get the error: "fatal error C1083: Cannot open include file: 'boost/algorithm/string.hpp': No such file or directory". I got here following the steps:

  1. git clone --recursive https://github.com/boostorg/boost.git
  2. bootstrap and then .\b2
  3. added boost includes and linked the libs in cmake lists as below:
    target_include_directories(${PROJECT_NAME} INTERFACE external/boost/libs/algorithm/include)
    target_link_directories(${PROJECT_NAME} INTERFACE external/boost/libs)
  4. Then trying to use the boost string algos: #include <boost/algorithm/string.hpp>

Could you please help?

Thanks for reading!

@MasterBe
Copy link
Author

I tried using vcpkg and did the below in Cmakelists:

Find and include Boost

find_package(Boost REQUIRED)
message(STATUS "Boost_INCLUDE_DIRS: ${Boost_INCLUDE_DIRS}")
message(STATUS "Boost_LIBRARIES: ${Boost_LIBRARIES}")

Include Boost headers

target_include_directories(${PROJECT_NAME} INTERFACE ${Boost_INCLUDE_DIRS})

Link against Boost

target_link_libraries(${PROJECT_NAME} INTERFACE Boost::headers)
still I get the same issue: fatal error C1083: Cannot open include file: 'boost/algorithm/string.hpp': No such file or directory
I am pretty sure I checked the include path and looked correct. Could please someone help?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant