-
Notifications
You must be signed in to change notification settings - Fork 4.5k
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
CMake can't locate spdlogExports.cmake #2514
Comments
https://github.com/gabime/spdlog/blob/v1.x/CMakeLists.txt#L332 And if you are using Are you trying to call |
Agreed, but I also believe that it also needs to be
Indeed. I am using EDIT:
It is not installed on my system, and I do not want to force the user to install it manually beforehand; I want to install it for them alongside my library at install-time, as mentioned above. |
I don't know how your Cmake project is configured, but I have a feeling that simply removing If you configure your CMake project as per the sample in FetchContent, you will import an external project with And you can then configure CMake target Line 85 in d011332
|
If you believe that the previous behavior is correct, you may create PR. https://cmake.org/cmake/help/v3.25/command/export.html:
|
Unfortunately that does not address the issue, I still encounter the following issue: CMake Error in CMakeLists.txt:
export called with target "myLibrary" which requires target "spdlog" that is
not in any export set. and I also do want to install the However, simply remembering to also export the targets using fixes the issue.
Yep, that makes complete sense, e.g. after libraries have been installed, the I'll open a PR. |
@puneetmatharu Could you please find out from the commit log what was the reason for the change? There was probably a good reason. |
I noticed one workaround. If you have imported the CMake target spdlog into your project with |
Yeah, I've just stumbled across this commit too. It looks like there was a bunch of refactoring going on and they simply forgot to export the targets at build time, which is completely reasonable if you only expect your project to be used after it has been installed... EDIT: See e.g. the info at the bottom of this page. |
Got it. So PR #2515 would solve it I guess. Will merge. |
Excellent, thanks all for helping resolve this so quickly Out of curiosity, would it be okay to create a tag for the merged commit too? E.g. |
I try to tag only releases. So I prefer not to if not critical to release officialy. |
I completely understand. Thanks for letting me know :) |
I'm attempting to consume
spdlog
as a third-party library via FetchContent but I encounter the following error:I believe this is down to a missing exported targets file in your build directory at configure-time. At configure-time, I would typically expect an exported targets file to be placed in the build directory. At the moment this is not the case, as can be seen from the snippet below:
spdlog/CMakeLists.txt
Lines 284 to 288 in d011332
However, this was not the case up until v1.3.1 of the library. See e.g.
spdlog/CMakeLists.txt
Lines 147 to 151 in a7148b7
Keeping in line with the currently-used variables, you would simply need to add the following code:
I am happy to create a PR to this effect if you would like. Please let me know how you'd like to proceed.
The text was updated successfully, but these errors were encountered: