-
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] fmt/6.1.2 find_package(fmt REQUIRED) in cmake fails #786
Comments
Hi @TobiSchluter, Yes, this probably because you are using the generator by default in conan.cmake, which is Here is the CMakeLists.txt that would make it work with the actual test_package example:
Note that you have to set the On another note, if you are asking for the CMake find files that were previously packaged, here is an explanation about the topic https://github.com/conan-io/conan-center-index/wiki/FAQ#why-are-cmake-findconfig-files-and-pkg-config-files-not-packaged |
Thank you. So that would generate the package files locally, so to say? I actually came back to close this bug report, because I wanted to check one thing locally before being confident that this is really reproducible, but I can only do this tomorrow morning. Since you're really responsive and I've therefore already hijacked your time there's no additional cost in keeping this question open until I've checked 😉 Thanks again, let's see if I can confidently exclude local issues tomorrow |
No problem! I really tried the CMakelists.txt pasted above with latest conan.cmake and it worked. I used Visual Studio 15 2017 Win64 as generator. The only thing you have to care about is the build type to match the one installed by default (It was Debug un my case). I will close this issue but please comment here or reopen if you find any trouble later when you are able to try it 😄 |
Thank you. Adding GENERATORS cmake_find_package seems to indeed do the right thing.What is still confusing me is that it worked the first time I included fmt in my build it simply worked™ and that it still works without the added paths for, say, Catch2. Anyway, thanks for your help. I'm gonna do things the right way™ from now on! |
Yes, that could be because you are using However, as per the explanations in https://github.com/conan-io/conan-center-index/wiki/FAQ#why-are-cmake-findconfig-files-and-pkg-config-files-not-packaged Instead, Conan is able to abstract the information from Thanks a lot for the feedback and hope it helps to understand this decision better. |
soapbox time, this has nothing to do specifically with this "bug report": working with this way of doing things a bit more, I find it inconvenient that this approach changes the library names, e.g.
I guess I can live with that, but maybe there's a mean to teach the conan recipes how to generate the normal targets instead of autogenerated names? In the case of Boost it is impossible to do the kind of translation I'm doing above. I understand that Boost is ... unwieldy, actually the original reason for me to try out conan. Why is this kind of translation impossible? Because there is only one big target Boost::Boost left. This is not identical to the usual Boost::boost one gets from findBoost.cmake because the latter only covers header-only libs whereas others have to be referenced as Boost::date_time etc I guess one could alias all of them to Boost::Boost, but that's deifnitely not pretty. Anyway, thanks for the good work. I still believe that conan makes my life easier. |
Indeed, that is a current limitation of the model that has been discussed previously and it is known as components conan-io/conan#5090. The feature is not developed yet but is a strong topic on the community especially regarding the CMake targets where the implications are evident. You can read more about it on that thread and comment on anything you want. As it is commonly said: We are working on it! 😄 |
Hi @TobiSchluter |
find_package(fmt) doesn't work with the fmtlib from conan-center. This seems to be a deliberate choice in the recipe (no cmake_find_package generator) but is fairly inconvenient.
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)Steps to reproduce (Include if Applicable)
CMakeLists.txt:
Logs (Include/Attach if Applicable)
I prefer using find_package() and then using the usual fmt::fmt target over simply using
${CONAN_LIBS}
because it is more explicit and because it allows me to use the same CMakeLists.txt whether I'm using conan or not.I'd appreciate if this functionality could be reinstated.
Edit: I removed a part about removing cmake etc. Instead, going by the FAQ, it seems that the generator cmake_find_package should be added to the recipe
https://github.com/conan-io/conan-center-index/blob/25f0751b56e7c95bd0e8b23326c88adaf825f945/recipes/fmt/all/conanfile.py
The text was updated successfully, but these errors were encountered: