'How to properly use CMake subprojects together with Conan?
Let's say we have:
AppCMake project which uses Conan to manage dependencies (viaconanfile.txt)LibCMake library standalone project which also uses Conan for same purpose, lives in a separate repositoryLibis a subproject ofApp- Some of
AppandLibdependencies in their ownconanfile.txtfiles are same (let's say they both useboost/1.78.0)
In this case, App project fails to build with error:
[cmake] CMake Error at build/conanbuildinfo.cmake:1507 (add_library):
[cmake] add_library cannot create imported target "CONAN_LIB::boost_boost_contract"
[cmake] because another target with the same name already exists.
What's the proper way to handle such cases? When we have nested CMake subproject and both parent and nested project use Conan inside.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
