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

Failing to use leaf with Conan and CMake #52

Closed
up2datecyborg opened this issue Dec 19, 2022 · 4 comments
Closed

Failing to use leaf with Conan and CMake #52

up2datecyborg opened this issue Dec 19, 2022 · 4 comments

Comments

@up2datecyborg
Copy link

Hi,

I used for a year stx library, and wanted to give boost::leaf a try.
As of writing the latest version of boost in Conan is 1.80.0.
As the conan package boost-leaf (1.81.0) was marked as deprecated recently, I cannot use leaf with Conan and CMake.
It seems CMake component leaf is inexistent.

In my conanfile.txt I have:
[requires] boost/1.80.0

In my CMakeLists.txt:
find_package(Boost REQUIRED COMPONENTS leaf)

It's failing with:
Conan: Component 'leaf' NOT found in package 'Boost'

Looking at the files in ~/.conan/, the library is there, but there is no reference to it in the conan/cmake files.

Am I doing something wrong?

@kammce
Copy link
Contributor

kammce commented Dec 20, 2022

I tested this out and you should do the following:

conanfile.txt

[requires]
boost/1.80.0
// other dependencies

[generators]
CMakeToolchain
CMakeDeps
VirtualRunEnv

CMakeLists.txt

Find package using config

find_package(Boost REQUIRED CONFIG)

Link project

target_link_libraries(${PROJECT_NAME} PRIVATE Boost::boost)

@up2datecyborg
Copy link
Author

Thanks, I'll try it, I guess there is no component because it's a header-only lib.

@kammce
Copy link
Contributor

kammce commented Dec 20, 2022

Yeah I'm not sure why they didn't make it into its own component. From the looks of it, only a few items within the boost library are pulled out to their own component.

@up2datecyborg
Copy link
Author

Sorry for the delay, what you explained is working fine.
Thanks!

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

2 participants