-
Notifications
You must be signed in to change notification settings - Fork 247
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
[develop2] Can conan_provider.cmake work with add_subdirectory #621
Comments
Ah, maybe Editable Packages help me here? |
Hi @garethsb Thanks for your question.
Probably not, those are intended to solve a different problem: working simultaneously on different packages. Something to do occasionally, because mainly using packages means that every package should and will be develop in isolation most of the time (otherwise it is not really a package). But if the project is not really componentized into packages, then the Regarding the approach of having a meta project with several subprojects and each one containing a different If you need consistency of dependencies across all subprojects, it would be much better to have a single central |
Thanks for the thoughtful response. The use case for me is exactly the one you mentioned of the integrated development experience in a single IDE project, by using I do understand the concerns about carefully managing dependencies of dependencies, so a central conanfile when using |
Definitely, being able to modify the |
I use this idiom frequently: # Find and use FooBar from its installed location or as a subdirectory
set(USE_ADD_SUBDIRECTORY OFF CACHE BOOL "Use add_subdirectory() rather than find_package()")
if(NOT USE_ADD_SUBDIRECTORY)
message(STATUS "Using find_package(FooBar)")
# Using find_package() will require FooBar and its dependencies (Baz, Qux, etc.)
# to be installed and discoverable via a config-file package or find-module
# Conan is one way of achieving this...
find_package(FooBar REQUIRED)
else()
set(FOO_BAR_DIRECTORY "../FooBar" CACHE STRING "Path to FooBar directory")
message(STATUS "Using add_subdirectory(${FOO_BAR_DIRECTORY})")
add_subdirectory(${FOO_BAR_DIRECTORY} build-FooBar EXCLUDE_FROM_ALL)
endif() |
I am adding a test here: #623 that shows that the described |
I have a top-level CMakeLists.txt which has no
find_package
of its own, it just doesadd_subdirectory
with a second directory (might be a git submodule for example). That second directory contains its own CMakeLists.txt and a conanfile.txt.If I call CMake at the top-level with
-DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=.../conan_provider.cmake
I have two, related, problems. First, cmake fails because the Conan provider reports there is no conanfile.{py,txt}, and second, if I were to put an empty one at the top-level, I think the Conan provider still won't consider the conanfile.txt in the subdirectory.I may subsequently have a third and fourth directory each with their own CMakeLists.txt and a conanfile.txt, also added to the top-level project. Or the subdirectory projects may have subdirectories of their own with their own list of dependencies.
Do I have to manually merge the conanfiles at the top level, before calling CMake?
Thanks for help
The text was updated successfully, but these errors were encountered: