-
Notifications
You must be signed in to change notification settings - Fork 994
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
[workspaces] Support for the cmake_paths generator #3302
Comments
Hi @AlessandroA, this is very interesting, thanks. We will have a look. |
I believe this would break my project. My solution to this problem is to always link against the interface target generated by a FindXXX.cmake script whether my executable is in a workspace or not. lmeditor consumes lmlib as a package requirement. Making find_package a no-op would break my project I think. |
I have a different idea for supporting cmake_paths workspace generator. When specifying cmake_paths as the workspace generator, the generated
The only difference is the addition of the setting of CMAKE_PROJECT_foo_INCLUDE variables. |
Sounds very good. Did you try? |
Success! I tried it by manually hacking There are some things that are really important to note, however.
|
Mhh, after taking a look at this: #4808 |
To consider: If you edit a file in a subproject, how well the root project is able to "detect" it and recompile if needed etc. It exceeds my knowledge. I would need to try, so I'm tagging it to take a look to get more knowledge to decide what/when to implement. |
What about ExternalProject_Add() to create the superbuild project? ... as I suggested here: #3034 (comment) |
Really interesting thread 👍 Some of the alternatives proposed here are very related to some POC I did in #4879. In this POC the standard conan_basic_setup(TARGETS)
add_library(mylib ...)
target_link_libraries(mylib PUBLIC CONAN_PKG::mydep) Here CMake/Conan machinery is creating an imported target called But when I'm working in a workspace these To bypass it and keep my project files the same we need to do something different, like some of you are proposing in this issue. In my POC I don't need the imported target anymore, set(PACKAGE_mydep_SRC "path/to/mydep/src")
set(PACKAGE_mylib_SRC "path/to/mylib/src")
macro(conan_workspace_subdirectories)
set(CONAN_IS_WS TRUE)
add_subdirectory(${PACKAGE_mydep_SRC} "mydep/build/folder")
add_library(CONAN_PKG::mydep ALIAS mydep) # for cmake generator
add_subdirectory(${PACKAGE_mylib_SRC} "mylib/build/folder")
add_library(CONAN_PKG::mylib ALIAS mylib) # for cmake generator
endmacro()
And also, it could make sense to no-op all the The PR and this comment is just a draft, I haven't tried it with |
We have still some things to discuss about this so no time enough for 1.15. I will reconsider it for 1.16 |
As I mentioned in #5762, I think we should use Although I like that
|
Using
but also some benefits:
Something like this: (didn't work in my case)
But I'm not sure To be honest, I would prefer conan workspace to stick to |
Hi, in my company, we are coming from superbuild and we try to "conanify" our componants and so use conan workspace feature for the development task. we are "believing" transparent usage of conan in cmake, so we are using cmake_paths and cmake_find_packages generators. In the link below , I modified the workspace example to demonstrate our usage. I also added a dependancy to a "third part" (zlib). For us, third part are "read only" componant. so they will never be modified in conan workspace. i will be glad to have some feedback... its seems working.... |
@davidtazy
Why is this a challenge. The outer super build happens to be cmake, but otherwise isn't related to the build systems of the packages. In fact, this is the key to enable workspaces with heterogeneous build systems. The cmake-based super build is executed with a
Why is this a challenge? This is why cmake + ExternalProject is a good candidate for the super build: it already has the
If so, then all projects must be cmake-based. That doesn't seem acceptable in the mission of conan. It also allows cmake scope to bleed together - no proper separation of the package builds. |
This is outdated, |
Conan version: 1.6.1
Hi, it would be nice if workspaces had a specialized behaviour for the
cmake_paths
generator.The issue with
find_package
cmake_paths
is useful to keep build and packaging systems separate because itallows us to use
find_package
commands as we would do without conan.The issue is that
find_package
does not work well withadd_subdirectory
. Therecommended solution is to re-map
find_package
from the top-level CMakeListsfile so that it becomes a no-op when the package has been added as a sub-project
(see Daniel Pfeifer's talk at 50m30s).
Feature request
The top-level CMakeLists file could look something like this:
One could maintain their own top-level CMakeLists file, but conan helps a lot
because the order of the
add_subdirectory
commands is important.Not sure if this would be consistent with your idea of workspaces and the use of
cmake_paths
!The text was updated successfully, but these errors were encountered: