Fix option --libs output library path#2402
Fix option --libs output library path#2402JackBoosY wants to merge 2 commits intowxWidgets:masterfrom
Conversation
|
@MaartenBent could you please review this? TIA! |
MaartenBent
left a comment
There was a problem hiding this comment.
This breaks determining the external libraries, see my inline comments.
| string(REGEX REPLACE "^.+>:(.+)>$" "\\1" dep_name ${dep}) | ||
| if (NOT dep_name) | ||
| set(dep_name ${dep}) | ||
| endif() |
There was a problem hiding this comment.
Why did you remove get_filename_component(dep_name ${dep} NAME)? We need this to get the library name.
With this change it will be /Applications/Xcode.app/Contents/..../MacOSX11.3.sdk/usr/lib/libz.tbd instead of -lz, or /usr/lib/x86_64-linux-gnu/libX11.so instead of -lX11.
There was a problem hiding this comment.
For some port use *Config.cmake or *-config.cmake, the INTERFACE_LINK_LIBRARIES may contains cmake generator expression like $<$<NOT:$<CONFIG:DEBUG>>:LIB_PATH>.
If we use get_filename_component(dep_name ${dep} NAME), the value of dep_name is NAME>.
There was a problem hiding this comment.
But can you use the regex to extract the library from the generator expression, and then use get_filename_component on this?
There was a problem hiding this comment.
I don't know why you use the file name directly here.
If the dependency library is not in system like /usr/lib, the compiler will fail to search this library.
There was a problem hiding this comment.
I try to generate the same output as configure does when generating wx-config. and it only has the library names.
If it is in a different path, maybe we have to specify -Lpath/to/lib before the library. Or require the user to have it in PATH.
There was a problem hiding this comment.
Yes, we must choose one way to solve this issue.
Co-authored-by: Maarten <MaartenBent@users.noreply.github.com>
|
@JackBoosY @MaartenBent Any news? |
|
I can't really work on this, since on the build systems I can test this on (Windows MSVC & MinGW, Ubuntu, macOS) I do not get paths with generator expressions. What about the following solution? And before adding the library name, we add the library path: This should hopefully fix your problem. Some other additions, but probably not needed immediately, is keeping track of the added |
|
Thanks for working on this. I hope this gets resolved soon so we can use vcpkg for Tenacity. |
|
Also for our side can get resolve: |
MaartenBent
left a comment
There was a problem hiding this comment.
After rethinking this, I suppose it could be merged as it is now.
It will still have some libraries with full path and extension even when it is not required (like I mentioned earlier #2402 (comment)), but I suppose it is more important to keep the path in case it is not in a default location.
And if needed, we could add something in the future that strips default locations like /usr/lib or the macOS sdk location.
|
Thanks for the changes and for the review, merging it now with just a minor fix for a typo in a comment. |
Don't prepend "-l" if a dependency is not a library name. Closes wxWidgets#2402
Don't prepend "-l" if a dependency is not a library name. Closes wxWidgets#2402
The
depdoes not consider the cmake generator expression and the absolute path.We may meet some different situation:
depwas already handled like-pthread:dep_nameshould be${dep}.depis system library likedl/m:dep_nameshould be-l${dep}depis$<$<CONFIG:DEBUG>:LIB_PATH>or$<$<NOT:$<CONFIG:DEBUG>>:LIB_PATH>that fromLIB-config.cmake:dep_nameshould be${LIB_PATH}.depis an absolute path like/usr/home/lib.aor/usr/home/lib.soetc:dep_nameshould be${dep}.Related: microsoft/vcpkg#18580