Search code examples
cmakeconan

Bincrafters modular Conan packages and the cmake_find_package generator


I have run into an issue using the 1.69.0 version of Boost conan packages built by bincrafters. I do not have problems using other conan packages like libcurl and zlib.

I have written a conanfile.txt like so:

[requires]
boost_context/1.69.0@bincrafters/stable
boost_coroutine/1.69.0@bincrafters/stable
boost_date_time/1.69.0@bincrafters/stable
boost_filesystem/1.69.0@bincrafters/stable
boost_iostreams/1.69.0@bincrafters/stable
boost_program_options/1.69.0@bincrafters/stable
expat/2.2.5@bincrafters/stable
libcurl/7.56.1@bincrafters/stable

[generators]
cmake_find_package

and in CMakeLists.txt, I am trying to link like so:

target_link_libraries(
  llcommon PUBLIC
  expat::expat
  zlib::zlib
  boost_coroutine::boost_coroutine
  boost_context::boost_context
  )

Expat and Zlib are found and link without a hitch. For the boost* libraries though, I receive the following error from CMake:

CMake Error at llcommon/CMakeLists.txt:243 (add_library):
  Target "llcommon" links to target "boost_context::boost_context" but the
  target was not found.  Perhaps a find_package() call is missing for an
  IMPORTED target, or an ALIAS target is missing?

Is there something about the bincrafters modular Boost packages that I am missing? or can I not use the conan_find_package generator with them?


Solution

  • Resolved. I did not update the find_package call.

    find_package(boost_coroutine)
    find_package(boost_context)
    

    was missing

    Apparently, I need to pay attention to what the CMake error is telling me next time.