Vcpkg: reprint the cmake usage when `vcpkg install` an existing lib

Created on 16 Apr 2020  路  9Comments  路  Source: microsoft/vcpkg


I always find it valuble at the end of installing a library something like this shows up

The package mongo-c-driver is compatible with built-in CMake targets:

        find_package(mongo-c-driver CONFIG REQUIRED)
        target_include_directories(${project} PRIVATE ${MONGOC_INCLUDE_DIRS})

For use dynamic library:
        target_link_libraries(${project} PRIVATE ${MONGOC_LIBRARIES})
For use static library:
        target_link_libraries(${project} PRIVATE ${MONGOC_STATIC_LIBRARY})


However, there's no way to bring it up again afterwards that I know of.

Is your feature request related to a problem? Please describe.
No.

Proposed solution

I am hoping there is a way, either by a new command or at every vcpkg install <lib> even when <lib> was installed already

Describe alternatives you've considered

text search in the /vcpkg folder

Additional context
Add any other context or screenshots about the feature request here.

question

All 9 comments

I have always used "_vcpkg install < port >_" to get the information again.

Hi @rockonedege
Thanks for posting this issue.
It seems that we need to add the usages to vcpkg folder, which can make them easy to be found.
Currently, some ports has implemented to add the usages to ports/libName/usage.

For example:
https://github.com/microsoft/vcpkg/tree/master/ports/ignition-cmake2/usage
https://github.com/microsoft/vcpkg/blob/master/ports/xeus/usage
https://github.com/microsoft/vcpkg/blob/master/ports/libhdfs3/usage

Could you help confirm if the way to add the usages are suitable for you?

I always find it valuble at the end of installing a library something like this shows up
[...]
I am hoping there is a way, either by a new command or at every vcpkg install <lib> even when <lib> was installed already

Actually, like @timautry said, just running vcpkg install <port> again for an installed package does show this message again.

````PowerShell
$ vcpkg install ms-gsl:x64-windows
Computing installation plan...
The following packages are already installed:
ms-gsl[core]:x64-windows
Package ms-gsl:x64-windows is already installed

Total elapsed time: 7.939 ms

The package ms-gsl:x64-windows provides CMake targets:

find_package(Microsoft.GSL CONFIG REQUIRED)
target_link_libraries(main PRIVATE Microsoft.GSL::GSL)

````

@NancyLi1013 It is what I was looking for.

Thanks. It looks I was confused, as some packages do others don't.

It definitely helps if it's a mandatory requirement for publish a port, otherwise it is really hard to find such info for a given port.

Hi all,

Thanks for joining the discussion about this issue.

Currently, there are two ways to get the usage info:

One way is the usage file in the package, another way is by reading the cmake config files.

Actually, only in this case, we need to add the info.
Please refer to this comments https://github.com/microsoft/vcpkg/pull/10766#discussion_r414108470

Since when we want to improve or change the message, it isn't possible to update them into the files immediately.

But based on the above situation you encountered, we will consider to add the usages to the ports that users ask for requirement.

Could you please help list the ports you require us to add ?

@rockonedege and @Farwaykorse
Could you please help list the ports that you want to add the usage info?

I'd like it to be a standard feature for all packages. in the mean time, the most notable missing for me
are

  • boost
  • mongo-cxx-driver
  • mongo-c-driver(this one works after I submitted issue ticket, but it generates warnings saying vcpkg is use a deprecated way of importing)

@rockonedege
Thanks for your above info.
Currently, there is no plan for all packages. we can only add the usage info for these ports that you require.

This is especially needed when in manifest mode #12290

Was this page helpful?
0 / 5 - 0 ratings