-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
FMT_LIB_NAME not properly substituted in pkg-config file fmt.pc #1597
Comments
cc @ambitslix, the author of #1534 that introduced |
Hmmm somehow this line is missing now from CMakeLists.txt. set_target_properties(fmt PROPERTIES Do you want to merge this? I've created a pull request for the fix. |
I thought the |
It's probably easier to just set |
You would think but it's not the case.
Not in this case. You're welcome to try alternate ways. A few other libraries have this issue with pkg-config, and there aren't seem to be good solutions. See here: I think it's best to drop pkg-config support altogether or use the fix provided. I don't use pkg-config with cmake projects anymore. |
Please don't do that. You may not be using In our case, for example, we're using Conan (the C++ source-package manager) to manage package dependencies for 3 platforms and a number of difficult-to-manage packages. As far as our own packages go, we're sometimes using However, we do want to be able to also support compiling of our library outside of the Conan framework (sometimes you're working on your laptop and just don't want to set up all the Conan infrastructure just to make a quick change while you're riding the train). Now if libfmt ditches BTW, in the link you're providing, it's not TL;DR: +1 for setting that |
Merged @ambitslix's PR (#1598) which should fix the issue. Thanks! |
Thanks a lot! |
@ambitslix, could you elaborate why it is not the case, i.e. why won't setting |
This issue is a bit deeper then what it seems at first. The way I see it after working on this here and for other libs as well is that pkg-config and cmake don't really work together well. You are using a library in this case fmt that uses primarily cmake, and cmake provides for the same functionality that pkg-config does (configuring build dependencies). So you're expecting a tool such cmake to maintain functionality that it already has buit for an independent tool (pkg-config). Unfortunately currently cmake support is kind of broken for pkg-config. So to make all this work you have to do ugly tricks in cmake. So I recommend that for cmake project use cmake for pkg-config project use pkg-config. When the cmake developers fix these cmake issues perhaps we can go back to using cmake to configure with pkg-config as well and have that convenience. But remember cmake already has the functionality that pkg-config provides. As for providing answers to why all that works the way it does, I don't remember sorry, I've looked at too many thousands of other lines of code in the last 3 months that made me forget why pkg-config exactly doesn't work with cmake. It has to do with variables (library names) needed by pkg-config (pc) file configuration not being available, and configure time to cmake. So you might as well call an external script to get it right. |
Thanks for checking! |
No problem, thanks for the rapid fix! :-) |
Hello,
I'm compiling libfmt with the following command line:
After compiling, the installed
fmt.pc
file looks like this:In particular, the library name (expected
-lfmt
or-lfmtd
) is not properly set.I'm using today's HEAD, i.e. 3cf619d
Any ideas?
Thanks,
fb.
The text was updated successfully, but these errors were encountered: