microsoft / vcpkg

C++ Library Manager for Windows, Linux, and MacOS
MIT License
23.22k stars 6.4k forks source link

How does `vcpkg` know which libs to link in Visual Studio? #24040

Closed playgithub closed 2 years ago

playgithub commented 2 years ago

When vcpkg is integrated with Visual Studio by vcpkg integrate install, how does it know which libs to link?

autoantwort commented 2 years ago

It simply links everything

heheda123123 commented 1 year ago

It simply links everything

How can I know which libs to link if I use cmake? I only have two lines below

The package poco is compatible with built-in CMake targets:

    find_package(Poco REQUIRED [COMPONENTS <libs>...])
    target_link_libraries(main PRIVATE Poco::<libs>)

my code below

#include <Poco/Any.h>
#include <Poco/Exception.h>
#include <iostream>

using Poco::Any;
using Poco::AnyCast;
using Poco::RefAnyCast;

int main() {
    Any any(123);
    int i = AnyCast<int>(any);
    std::cout << i << std::endl;

}
autoantwort commented 1 year ago

You have to take a look at the poco documentation