Skip to content
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

Macro conan_package_library_targets reverted to single config #11859

Merged

Conversation

lasote
Copy link
Contributor

@lasote lasote commented Aug 12, 2022

Changelog: Bugfix: The CMakeDeps generator was not managing correctly the IMPORTED LOCATION of the libraries for different build_type.
Docs: omit

Close #11852

After investigating (thanks @jcar87) looks like the IMPORTED_LOCATION_<build_type> doesn't make the targets of the library files multi-config, CMake only uses it as a priority based on other things like the config mappings. More (cryptic) info can be found here: https://gitlab.kitware.com/cmake/cmake/-/issues/16280
So I decided to revert that part of the macro keeping the improvements introduced in the last release, that so far have worked ok.

@lasote lasote added this to the 1.51.3 milestone Aug 12, 2022
@lasote lasote requested review from memsharded and jcar87 August 12, 2022 13:04
set(_out_libraries_target "")
set(_CONAN_ACTUAL_TARGETS "")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it was not needed, not related with the bug

foreach(_CONAN_ACTUAL_TARGET ${_CONAN_ACTUAL_TARGETS})
get_target_property(linked_libs ${_CONAN_ACTUAL_TARGET} INTERFACE_LINK_LIBRARIES)
message(VERBOSE "Target Properties: ${_CONAN_ACTUAL_TARGET} INTERFACE_LINK_LIBRARIES ='${linked_libs}'")
foreach(_T ${_out_libraries_target})
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pure refactor to not use _CONAN_ACTUAL_TARGETS but _out_libraries_target

@@ -96,7 +96,7 @@ def template(self):
set_property(TARGET {{root_target_name}}
PROPERTY INTERFACE_LINK_LIBRARIES
$<$<CONFIG:{{configuration}}>:{{ '${'+pkg_name+'_OBJECTS'+config_suffix+'}' }}>
${{'{'}}{{pkg_name}}_LIBRARIES_TARGETS}
$<$<CONFIG:{{configuration}}>:${{'{'}}{{pkg_name}}_LIBRARIES_TARGETS}>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So now we have to "protect" these library targets with the configuration

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, this is exactly what I meant! Doing this by locally modifying generated cmake files is exactly how I worked around the issue ^^

@lasote lasote marked this pull request as ready for review August 12, 2022 13:57
Copy link
Contributor

@jcar87 jcar87 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!!!

@lasote lasote merged commit 9d5ceae into conan-io:release/1.51 Aug 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants