Git Product home page Git Product logo

Comments (7)

ras0219-msft avatar ras0219-msft commented on May 21, 2024

Could you be more specific about what list of variables we're providing?

from vcpkg.

Orphis avatar Orphis commented on May 21, 2024

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.

ras0219-msft avatar ras0219-msft commented on May 21, 2024

I've filed an issue against cpprestsdk. Thanks for bringing this up!

from vcpkg.

Orphis avatar Orphis commented on May 21, 2024

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.

ras0219-msft avatar ras0219-msft commented on May 21, 2024

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.

Orphis avatar Orphis commented on May 21, 2024

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.

stoperro avatar stoperro commented on May 21, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.