microsoft / vcpkg

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

Feature request: vcpkg integrate project that imports vcpkg.targets directly #31611

Open davidmatson opened 1 year ago

davidmatson commented 1 year ago

The current implementation of vcpkg integrate project is not recommended, because it makes projects hard to share with different users: https://learn.microsoft.com/en-us/vcpkg/users/buildsystems/msbuild-integration#linked-nuget-package

Currently, this command generates a NuGet package. However, it could instead take the path to a vcxproj file and edit that file to add

<Import Project="..\vcpkg\scripts\buildsystems\msbuild\vcpkg.props" />

right after Microsoft.Cpp.Default.props and

<Import Project="..\vcpkg\scripts\buildsystems\msbuild\vcpkg.targets" />

right after Microsoft.Cpp.targets.

That implementation of vcpkg integrate project would be useful and could be recommended.

FrankXie05 commented 1 year ago

Please see the note.

davidmatson commented 1 year ago

@FrankXie05 - yes, I saw this note:

This approach is not recommended for new projects, since it makes them difficult to share with others. For a portable, self-contained NuGet package, see the [export command](https://learn.microsoft.com/en-us/vcpkg/commands/export).

Since the current implementation of vcpkg integrate project isn't recommended, I'm suggesting an implementation that would be useful and could be recommended, and fits with per-project integration mentioned elsewhere in docs.

FrankXie05 commented 1 year ago

Do you mean ./vcpkg integrate install?

davidmatson commented 1 year ago

No, I'm suggesting a new implementation of vcpkg integrate project that does something more useful and that can be recommended.

github-actions[bot] commented 1 year ago

This is an automated message. Per our repo policy, stale issues get closed if there has been no activity in the past 28 days. The issue will be automatically closed in 14 days. If you wish to keep this issue open, please add a new comment.

davidmatson commented 1 year ago

/remove-stale

github-actions[bot] commented 10 months ago

This is an automated message. Per our repo policy, stale issues get closed if there has been no activity in the past 180 days. The issue will be automatically closed in 14 days. If you wish to keep this issue open, please add a new comment.

davidmatson commented 10 months ago

/remove-stale

FrankXie05 commented 10 months ago

Sorry for the late reply. :) Although adding Nuget package integration to aa is a good idea. But there are a few things we are considering:

  1. Nuget is a package manually generated by users using commands. It is difficult for us to identify them, whether it is from the location, information, name of the file, etc.
  2. The way to add to vs integration should also take into account the nuget support supported by vs itself.
davidmatson commented 10 months ago

@FrankXie05 - I'm not quite understanding the reply.

This issue is a suggestion to provide a non-NuGet mechanism to add vcpkg.props & vcpkg.targets to a vcxproj file.

FrankXie05 commented 10 months ago

Do you mean to achieve the same integrated function of ./vcpkg integrate project as /vcpkg integrate install?

davidmatson commented 10 months ago

No, this would be different from vcpkg integrate install. Per the docs, vcpkg integrate install does:

vcpkg integrate install Integrates with [Visual Studio](https://learn.microsoft.com/en-us/vcpkg/users/buildsystems/msbuild-integration#user-wide-integration) (Windows-only), sets the user-wide vcpkg instance, and displays CMake integration help.

I believe adding

<Import Project="..\vcpkg\scripts\buildsystems\msbuild\vcpkg.props" />

and

<Import Project="..\vcpkg\scripts\buildsystems\msbuild\vcpkg.targets" />

to the project file is different from per-user installation/integration.

github-actions[bot] commented 4 months ago

This is an automated message. Per our repo policy, stale issues get closed if there has been no activity in the past 180 days. The issue will be automatically closed in 14 days. If you wish to keep this issue open, please add a new comment.