Comments (7)
Could you be more specific about what list of variables we're providing?
from vcpkg.
find_library(CPPREST_LIBRARY cpprest_2_8)
find_path(CPPREST_INCLUDE_DIR cpprest/version.h)include_directories(${CPPREST_INCLUDE_DIR})
link_libraries(${CPPREST_LIBRARY})
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".
You can generate files for find_package directly that create the imported targets for you.
The pkg-config CMake support upstream has been doing that.
from vcpkg.
I've filed an issue against cpprestsdk. Thanks for bringing this up!
from vcpkg.
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.
from vcpkg.
We do support all the normal CMake integration (find_package
and so forth) for packages that provide it. For example, find_package(ZLIB)
should work correctly.
Is there a package that externally supports cmake but is not being packaged correctly?
from vcpkg.
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:
find_package(ZLIB REQUIRED)
target_link_libraries(MyExecutable PRIVATE ZLIB::ZLIB)
Don't forget the PUBLIC / PRIVATE after target_link_libraries either in examples.
Don't use link_libraries, usage is not recommended as per CMake's documentation. You don't want everything to link against it, just your executable or library, and that should be explicit.
from vcpkg.
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:
If you're using a library that does not provide CMake integration, you will need to explicitly search for the files and add them yourself using find_path() and find_library().
but I only understand it now when I found this issue... others may have a hard time to find it too.
from vcpkg.
Related Issues (20)
- [boost] boost:x64-windows build failed HOT 3
- [opencv4] build failure HOT 3
- [devil] build failure on mac os arm64 HOT 4
- [gtest] Build error on x64-windows HOT 1
- [New Port Request] <libiio>
- libpq build failure HOT 1
- [sfml] Build error on arm64-android HOT 1
- [sfml] Build error on arm64-android HOT 3
- [daw-header-libraries] update to v2.106.0
- [daw-json-link] update to v3.24.0
- [libpq] Build error on x64-mingw-static HOT 2
- [New Port Request] MIT Kerberos/krb5 HOT 1
- [libxkbcommon] build failure on windows and macosx HOT 1
- vcpkg upgrade error HOT 2
- [avcpp] Can't use avcpp with CMake on x64-windows because CMake can't find Threads::Threads HOT 2
- [pcl][eigen]error:function '_mm_blendv_pd' requires target feature 'sse4.1' HOT 3
- [log4cpp-log4cpp] build failure on Windows HOT 3
- [gl3w] Support extension loading. HOT 2
- [libcap] Failed to download from https://git.kernel.org/pub/scm/libs/libcap HOT 3
- [shader-slang] Build failure on arm64-osx HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vcpkg.