-
Notifications
You must be signed in to change notification settings - Fork 988
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
CMakeDeps: Fix imported library config suffix #13841
CMakeDeps: Fix imported library config suffix #13841
Conversation
Currently the imported libraries are set without config suffix first. At the end there is one additional set using the config suffix, which overwrites the already set libraries. Fixes conan-io#13504
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution!
A couple of suggestions:
- If we want this to be part of the 2.0.X patches, it needs to be targeted to the
release/2.0
branch. Thedevelop2
branch is intended for 2.1 - Some tests in the test suite that proves that this is solving an issue would be necessary, also to guarantee that this doesn't break in the future. Doing tests might be a bit more difficult, we can try to help contributing them or guiding.
- Signing the CLA is necessary for accepting contributions, please have a look to it when possible.
Ok,
Before the fix, this did not work. After the fix it does. In general, the issue is only observed in Windows, when the if-clause at the top of the function sets IMPORTED_IMPLIB and IMPORTED_LOCATION. How to write a test for this? |
It will be available in 2.1 too yes :)
The functional tests look like the place to do this, with an decorator guard to only execute on Windows (There are some examples already there), but let us know if you need extra help with that! |
Thanks @Untzelmann - indeed this fixes a bug that existed with two different properties conflicting when on Windows with shared libraries, and the I'll add the pertinent tests ahead of the merge, thanks so much for your contribution! |
@jcar87 Thanks for adding the tests for me. I actually intended to have a look at implementing the a test for this, but I will probably not find time for this in the next days. So I am very thankful, if you add the test, and I will still have a look how to implement tests, for my next contributions. |
Hi @Untzelmann - thanks! Just pushed the test which replicates the problem, and tests that the DLL from a dependency is copied next to the executable (also tests that the executable actually runs: if the DLLs isn't there, on the command line it will produce no visible output). This was indeed a bug, where the Once again, thanks for contributing and for fixing this! And this is a very good example of using the |
conans/test/functional/toolchains/cmake/cmakedeps/test_cmakedeps.py
Outdated
Show resolved
Hide resolved
I think it should not have any side effects. We usually only set the _RELEASE / _DEBUG versions in our CMake files and works fine. I think the only reason why the setting of the IMPORTED_LOCATION${config_suffix} was made is, to make sure that the other values are not overwritten, if release and debug is generated for a project. However the IMPORTED_IMPLIB was not considered. It would probably also have been fine to just set the IMPORTED_IMPLIB${config_suffix} at the end. However, then the value of the variables without config suffix would have the values of debug or release at random. So I preferred the solution were we do not set these variables at all. Thank you for your assistance. By looking at your change for the tests, I think I already understood how that works. My next contributions will contain a unit test directly, then. |
Currently the imported libraries are set without config suffix first. At the end there is one additional set using the config suffix, which overwrites the already set libraries.
Fixes #13504
Changelog: Fix: Fix imported library config suffix.
Docs: Omit
develop
branch, documenting this one.Note: I think no documentation changes are required. Should I still make a change in the documentation?