question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[package] boost/*: CMakeDeps generator broken for Conan 1.51.0

See original GitHub issue

Package and Environment Details

  • Package Name/Version: conan/1.79.0
  • Operating System+version: Fedora Linux 36
  • Compiler+version: GCC 12
  • Conan version: conan 1.51.0
  • Python version: Python 3.10.5

Conan profile

conan profile show linux/gcc/debug Configuration for profile linux/gcc/debug:

[settings] os=Linux arch=x86_64 compiler=gcc compiler.version=12 compiler.libcxx=libstdc++11 compiler.cppstd=17 build_type=Debug [options] [conf] [build_requires] [env]

Steps to reproduce

  1. Use CMakeDeps generator with the Boost package from Conan Center as a requires.
  2. Run conan install.
  3. Run conan build, where the configure stage of CMake will fail.

Logs

Click to expand log
CMake Error at build/Boost-Target-debug.cmake:1274 (target_link_libraries):
  Cannot specify link libraries for target "boost::boost" which is not built
  by this project.
Call Stack (most recent call first):
  build/BoostTargets.cmake:26 (include)
  build/BoostConfig.cmake:10 (include)
  CMakeLists.txt:1 (find_package)


-- Configuring incomplete, errors occurred!

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:20 (15 by maintainers)

github_iconTop GitHub Comments

2reactions
jwillikerscommented, Aug 1, 2022

I re-created a minimal example project demonstrating the problem. Due to the fact the release notes mentioned GLOBAL target behavior, I deduced the problem only occurred when using multiple CMakeLists.txt files through add_subdirectory.

CMakeLists.txt:

cmake_minimum_required(VERSION 3.16)
project(hello CXX)

set(CMAKE_FIND_PACKAGE_PREFER_CONFIG yes CACHE BOOL "")
find_package(Boost REQUIRED COMPONENTS exception headers)

add_subdirectory(src)

src/CMakeLists.txt:

find_package(Boost REQUIRED COMPONENTS exception headers)

add_library(hello hello.cpp)
target_include_directories(hello PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../include)

target_link_libraries(hello PUBLIC Boost::exception Boost::headers)

set_target_properties(hello PROPERTIES PUBLIC_HEADER "${CMAKE_CURRENT_SOURCE_DIR}/../include/hello.h")
install(TARGETS hello)
1reaction
lasotecommented, Aug 2, 2022

I finally manage to reproduce it. Now I can hunt the bug, million thanks for your help.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Changelog — conan 1.56.0 documentation
Fix: Clang compiler check in cmake generator. Fix: Detection of Zypper package tool on latest versions of openSUSE. Fix: Improved help output of...
Read more >
Why do some Conan packages delete CMake ...
I can make and consume packages with that generator no problem. I'm now trying to comsume a number of third party libraries, namely...
Read more >
conan Changelog - pyup.io
Bugfix: The `CMakeDeps` generator was not working properly when the consumer ... 1.51.0. - Feature: Update system package manager db right before install, ......
Read more >
conanio/conan
liberforce yeah, I first tried with adding boost/1.66.0@conan/stable to my ... on Freenode Can you add an argument to a generator in a...
Read more >
Why is it that package managers are unnecessarily hard?
-GNinja. And here is my conanfile.txt [requires] boost/1.80.0 fmt/9.1.0 pcapplusplus/22.05 [generators] CMakeDeps CMakeToolchain.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found