-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
Provide CMake imported targets instead of variables #6
Comments
Could you be more specific about what list of variables we're providing? |
You should be providing instead something like "find_package(vcpkg::cpprest_2_8 REQUIRED)" and then have people link against the target "vcpkg::cpprest_2_8". |
I've filed an issue against cpprestsdk. Thanks for bringing this up! |
Well, that's not specific to cpprestsdk, it's first your example that isn't great, and then you don't provide a good mechanism to link the libs provided by vcpkg to the targets in our projects. |
We do support all the normal CMake integration ( Is there a package that externally supports cmake but is not being packaged correctly? |
Well, you should then really use find_package() instead in your example and have the cpprestsdk either provide the imported targets or patch it in your ports file to add support for them. For Zlib that would be:
Don't forget the PUBLIC / PRIVATE after target_link_libraries either in examples. |
It took me a while to learn why find_package(cpprestsdk REQUIRED) doesn't work. Could somehow vcpkg provide warning if someone does it like that that this less standard way of using libraries is needed? I thought my installation was broken. I see now in Readme.md there is:
but I only understand it now when I found this issue... others may have a hard time to find it too. |
GH Actions: use Azure Artifacts binary cache
…cheme dependencies (microsoft#6) * [vcpkg] Fix failure to install features for non-string, non-relaxed scheme dependencies * [vcpkg] Fix warnings
* [wxwidgets] Fix linux build * clean up baseline * version * Fix --libs output * version * Use system pkg-config on linux (#6) * Use system pkg-config for linux * Update versions * Revert baseline changes * Add double quotes to paths * version * Fix incorrect double quotes place * version Co-authored-by: Kai Pastor <[email protected]>
Updating README.md (installation instructions)
In modern CMake, you are not supposed to give the user a list of variables but an imported target you use directly with "target_link_libraries".
It's a bit sad to see the example requiring CMake 3.0 but using patterns from CMake 2.6 dating from the CMake stone age.
https://cmake.org/cmake/help/v3.6/command/add_library.html#imported-libraries
The text was updated successfully, but these errors were encountered: