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
fix linker flags in cmake (find_package based) generators #8740
fix linker flags in cmake (find_package based) generators #8740
Conversation
conan/tools/cmake/cmakedeps.py
Outdated
self.sharedlinkflags_list = join_flags(";", ["-{}".format(f) | ||
for f in cpp_info.sharedlinkflags]) | ||
self.exelinkflags_list = join_flags(";", ["-{}".format(f) for f in cpp_info.exelinkflags]) |
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.
Could this break flags that already start with a -
or --
, for non-MSVC linkers?
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.
Yes, good catch, I will verify that too.
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.
Keeping flags that already start with "-" in 4ebe404
files = gen.content | ||
d = files["mypkgTarget-release.cmake"] | ||
assert "$<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,EXECUTABLE>:-/OPT:NOICF>" in d | ||
assert "$<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,MODULE_LIBRARY>:-/NODEFAULTLIB;-/OTHERFLAG>" in d |
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.
so, is it really expected to pass -/OPT
with both dash and slash?
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.
Apparently it worked, but you are right, better double check, I'll check it.
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.
yeah, that syntax looks a bit weird to me
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.
Ok, it was working, it didn't raise an error, but just a warning. Dropped the extra /, please check.
files = gen.content | ||
d = files["mypkgTarget-release.cmake"] | ||
assert "$<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,EXECUTABLE>:-/OPT:NOICF>" in d | ||
assert "$<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,MODULE_LIBRARY>:-/NODEFAULTLIB;-/OTHERFLAG>" in d |
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.
yeah, that syntax looks a bit weird to me
Changelog: Bugfix: Fix linker flags in cmake (find_package based) generators.
Docs: Omit
Fix: #8703
#tags: slow