Skip to content
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

[question] Limitations of CMakeToolchain wrt legacy generators #16304

Open
1 task done
rconde01 opened this issue May 18, 2024 · 4 comments
Open
1 task done

[question] Limitations of CMakeToolchain wrt legacy generators #16304

rconde01 opened this issue May 18, 2024 · 4 comments

Comments

@rconde01
Copy link

What is your question?

I am migrating from a v1 based configuration where I was using the cmake generator. Using this configuration I had multiple consumer conanfiles using different profiles which different parts of the build tree used. In migrating to conan v2 and CMakeToolchain I've just realized this is not possible anymore since the toolchain is passed to the root. It appears that ExternalProject_Add is a partial workaround in that it allows multiple toolchains, but in the IDE (Visual Studio) it only shows the ExternalProject as a target - not the subtargets.

I'm not saying there's anything wrong with Conan here, but just providing a scenario where as a package consumer I don't see a path to accomplish what I want. If it's a reasonably common case maybe you want to brainstorm solutions - or perhaps just list it as a limitation in the docs.

Have you read the CONTRIBUTING guide?

  • I've read the CONTRIBUTING guide
@rconde01
Copy link
Author

Hmm...I wonder the disadvantage of include(conan_toolchain.cmake) rather than specifying on the command line?

@rconde01
Copy link
Author

it doesn't work - it seems like the targets don't get updated after the first definition

@memsharded
Copy link
Member

The include(conan_toolchain.cmake) definitely doesn't work if it is added after project() call. In some scenarios it might work if passed before project() call, but I think even in those cases the net effect is still not identical to passing it explicitly as a CMAKE_TOOLCHAIN_FILE argument, as toolchains have some special meaning to CMake.

I'm not saying there's anything wrong with Conan here, but just providing a scenario where as a package consumer I don't see a path to accomplish what I want. If it's a reasonably common case maybe you want to brainstorm solutions - or perhaps just list it as a limitation in the docs.

Yes, this is a result of the majority of users complaining about Conan being intrusive and demanding a transparent integration, that basically needs to use a CMake toolchain.

I agree this is something that we want to at least think about it. It is also quite close to the "workspace" feature (check #15992), it shares the same challenges.

@rconde01
Copy link
Author

Yes, this is a result of the majority of users complaining about Conan being intrusive and demanding a transparent integration, that basically needs to use a CMake toolchain.

At a high level I get the sentiment, but if you consider custom packages I think changing some references in your CMakeLists.txt is a pretty small part of migration to some other package manager (which I assume is the motivation for transparent integration)? But maybe I'm missing something, and if "the crowd demands it" I guess it doesn't matter anyhow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants