-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
[package] cereal/1.3.0: cereal cannot be found when using the cmake_paths
generator
#2151
Comments
Hey @uilianries, thanks for the quick answer! For the project I'm having this issue with, we want to recommend users to get the dependencies via Conan but design the I only have one additional problem with this approach: For some dependencies, e.g. Eigen3, the target provided with the conan-generated CMake find file is named differently then the original target. In the Eigen case: Is there some solution for that? I guess it's related to this issue. Thanks again for the help! |
Indeed it's related to components. Now we can create target for find cmake, so if you find a wrong target, according the upstream, please, open an issue describing the case, including this one for Eigen. Regards |
I would say fixing CMake imported targets created by conan recipes is a work in progress in conan-center-index, since components mechanism in conan has been added recently. It should be more reliable in few weeks. Anyway for Eigen3, #2155 should fix both cmake and pkgconfig. |
Ha, just wanted to open an issue. Thanks @SpaceIm, that should fix our problems! Closing this issue. |
Actually, I'm not sure if it is properly solved yet. After #2155, Eigen3 works like a charm now. When linking to cereal, however, it's not behaving like with the original So basically, it is necessary to write @uilianries What do you think? This shouldn't be the case, right? |
Yes, several libraries don't define namespace, I've pointed some issues with current behaviour in conan: #2144 (comment) |
While yes, upstream packages should ideally adhere to cmake conventions, IMHO Conan should first of all follow the upstream cmake config, such that usage with different package managers or manual installation of the dependencies is transparent for the consuming
It may of course also provide the "proper" targets with namespace in addition. Do the generated find modules support specifying such alias targets? Then I think we need another PR for the cereal recipe. |
Since version 3.3 Eigen provides Eigen3Config.cmake with the imported target Eigen3::Eigen. [1] Use this imported target as descibed in Eigen-Wiki [2] In the CeresConfig file improve relocatability by removing absolute paths to the compiled dependencies. Instead find the used Eigen3::Eigen. Furthermore use the find_dependency() [4] CMake function instead of the find_package() call in CeresConfig. This commit relies on all targets to be explicitly linked private or public as done in the the change [3] [1] https://bitbucket.org/eigen/eigen/pull-requests/257/cmake-imported-target-take-2/diff [2] https://eigen.tuxfamily.org/dox/TopicCMakeGuide.html [3] https://ceres-solver-review.googlesource.com/c/ceres-solver/+/16220 [4] https://cmake.org/cmake/help/latest/module/CMakeFindDependencyMacro.html Change-Id: I44f44a089083f7169bcf430b59775242e4eb72d1
|
I understand. I'm just not sure what is the "official" opinion on how it should be addressed. Providing alias targets? Is that supported by the generator? Would a PR that fixes cereal be welcome, or is there a systematic effort ongoing? |
It can't be fixed in recipes right now, because AFAIK currently conan always creates namespaced targets with EDIT: I misunderstood, you suggested to submit a PR to cereal? Yes it would be welcome. |
Ok. Is there any place where we should voice our support for getting this changed? I'm new to Conan, but it seems a bit strange to discourage installing the working cmake config files (together with
No, I meant a PR to the recipe. Fixing upstream cereal would of course be good and should be done as well, but I don't think that will result in a very quick solution, since the project is not terribly active, and we'd probably have to then wait for the next release...
Actually, coming back to your original reply. I understand that conan(-center?) prefers the and I understand that sometimes the upstream cmake config files are not working great. However, nowhere else does it say that using the packages' own cmake config files or find modules (where they are properly set up) is discouraged. E.g. if you check the conan documentation, it is described as a valid approach (and actually before https://docs.conan.io/en/latest/integrations/build_system/cmake.html So can't we just have both? Install the project's own cmake config, as well as making the IMHO one thing that the FAQ at https://github.com/conan-io/conan-center-index/wiki/FAQ#why-are-cmake-findconfig-files-and-pkg-config-files-not-packaged doesn't really discuss is that Conan should not force the consuming CMakeLists.txt to be written in a conan specific way. If I write a library that depends on say Cereal, it should be up to the users of my library how they wanna fulfill that dependency. They might use conan, they might use vcpkg, or a system package manager like apt or homebrew. My libraries CMakeLists.txt should just call Am I wrong in my assessment of the situation at Conan (Center)? Where would be the right place to voice my opinion about this? |
@NikolausDemmel Interesting case about Cereal. I used it in the past, but I didn't remember about the namespace absence. Anyway, we know the recommend way is using namespace, but unfortunately only Cereal doesn't follow it, but also other projects. So, I suggest filing a new issue to Conan, asking to support such case. As Conan forces to use its generators, they should provide something close to the upstream behavior, but at same time valid. |
I've open a feature request to Conan: conan-io/conan#7352 I think these are details that cannot be added to |
Sounds like a good solution.
What about this one? Is there objection to still installing the packages own cmake config files? Even if the recommended way is using the cmake_find_package generator (which can be fixed once it's enabled by conan upstream)? |
Do CCI hooks allow files (or parent folder of those files) included in |
Yes, if not listed in build_modules it won't be allowed by hooks. You can use
|
This comment has been minimized.
This comment has been minimized.
This issue can be closed. cereal imported target has been fixed in #4257 |
Package and Environment Details (include every applicable attribute)
Conan profile (output of
conan profile show default
orconan profile show <profile>
if custom profile is in use)Description
When installing the cereal package, the project gets installed but
cereal-config.cmake
subsequently removed, see here:However, without this file, CMake cannot find the
cereal
package when using theconan_paths.cmake
toolchain file. Everything works as expected if the line above is removed.@stilgarpl actually already noted the issue in this comment in PR #881 but it seems like they did not yet open an issue to discuss about it.
Steps to reproduce (Include if Applicable)
conanfile.txt
requirescereal/1.3.0
and setscmake_paths
as generatorCMakeLists.txt
callsfind_package(cereal REQUIRED)
cd build/
conan install ..
cmake .. -DCMAKE_TOOLCHAIN_FILE=conan_paths.cmake
Logs (Include/Attach if Applicable)
Click to expand log
CMake error at
find_package(cereal REQUIRED)
:The text was updated successfully, but these errors were encountered: