microsoft / vcpkg

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

`VCPKG_CHAINLOAD_TOOLCHAIN_FILE` has two different meanings #36244

Open sharadhr opened 7 months ago

sharadhr commented 7 months ago

I believe VCPKG_CHAINLOAD_TOOLCHAIN_FILE may be set in two different places, affecting different parts of a project using CMake and vcpkg:

This is documented for the above two use-cases respectively:

This dual behaviour is clearly noted in the first link above:

[!NOTE] vcpkg does not automatically apply your toolchain's settings, such as your compiler or compilation flags, while building libraries. To change vcpkg's library settings, you must make a custom triplet file (which can share your toolchain)**

Furthermore, note that the URL further up in the same page is also misleading (it goes to the triplets page, rather than linking to the section further down). I am guessing even the documentation writer had mixed the two variables up.

I suggest renaming both to clarify the scope of these variables. For instance:

This is, in my opinion, so much clearer.

Furthermore, it would be good to implement some sort of boolean option in vcpkg that would automatically compile all ports with the project's toolchain, rather than requiring users to set up a custom triplet and then re-include a toolchain. Perhaps, VCPKG_USE_PROJECT_TOOLCHAIN_FOR_PORTS?

github-actions[bot] commented 1 month 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.

sharadhr commented 1 month ago

Do not close!

FrankXie05 commented 1 month ago

@data-queue Could you help take a look at this issue?