Giter VIP home page Giter VIP logo

vcpkg-docs's Introduction

vcpkg-docs's People

Contributors

augp avatar autoantwort avatar billyoneal avatar cmcclister avatar cmello avatar colin-home avatar dan-shaw avatar data-queue avatar dg0yt avatar javiermatosd avatar lilywangll avatar michaelbprice avatar monicaliu0311 avatar neumann-a avatar permalmberg avatar quyykk avatar randallpittman avatar raprice avatar ras0219-msft avatar roysc avatar sharadhr avatar shea-c4 avatar suisse00 avatar thomas1664 avatar tsondergaard avatar tylermsft avatar unixy2k avatar vicroms avatar walbourn avatar wimleflere avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vcpkg-docs's Issues

Typo

Under "Can I get vcpkg integration for custom configurations?":
"before the Vcpk integration is loaded"

should be "vcpkg", not "Vcpk".


Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

Wrong type for default-features

I believe that in the table for top level items, the type given for default-features is wrong.
vcpkg seems to want an array of features instead of a bool.


Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

A couple of problems

cmake presets=default

should be
cmake preset=default

On my (windows) system $ENV in CMakePresets.json must be lower case, as stated in the CMake docs

"CMAKE_TOOLCHAIN_FILE": "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"

should be
"CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"


Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

There is no description on how to change the mode vcpkg runs in.

I am a vcpkg noob, so I followed the install instructions VS 2022 linked to here: https://vcpkg.io/en/getting-started.html
I installed a package in classic mode, and then when I restarted the console, vcpkg switched to manifest mode, and it would be nice to have docs that tell you how to switch modes.


Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

Inconsistency definition of "version" field in vcpkg.json

  • In vcpkg/reference/vcpkg-json.md, you can read:

"version" - Relaxed Semantic Version 2.0.0, allowing more or less than 3 primary numbers. Example: 1.2.3.4.10-alpha1

  • In vcpkg/users/versioning.md, you can read:
  1. version: For dot-separated numeric versions

and

  1. version

Accepts version strings that follow a relaxed, dot-separated-, semver-like scheme.

The version is logically composed of dot-separated (.) numeric sections. Each section must contain an integer positive number with no leading zeroes.

The regex pattern for this versioning scheme is: (0|[1-9]\d*)(.(0|[1-9]\d*))*

  • Inconsistency

I think the documentation in vcpkg-json.md is good.

The regex in versioning.md looks to be wrong. This sentence should be removed to avoid confusion.

The sentence "For dot-separated numeric versions" also looks to be wrong.

The version comparison in versioning.md should also be updated to avoid thinking that "version" allow only number. For example (see the two last version updated) :

1.0.0-1 < 1.0.0-alpha < 1.0.0-beta < 1.0.0 < 1.0.1+20240101 < 1.1.0.0-alpha

Tutorial: Create and publish packages is outdated

https://learn.microsoft.com/en-us/vcpkg/get_started/get-started-packaging

vcpkg install vcpkg-sample-library --overlay-ports=C:\path\to\custom-overlay

The command above does not work for the example in Install and use packages with vcpkg, which now uses manifest mode to build a project.

The correct solution should be adding the "overlay-ports" section to vcpkg-configuration.json:

{
  "default-registry": {
    "kind": "git",
    "baseline": "45f6e57d3e10ad96b7db206cf7888f736ba5aa61",
    "repository": "https://github.com/microsoft/vcpkg"
  },
  "registries": [
    {
      "kind": "artifact",
      "location": "https://github.com/microsoft/vcpkg-ce-catalog/archive/refs/heads/main.zip",
      "name": "microsoft"
    }
  ],
  "overlay-ports": [
    "../custom-overlay/vcpkg-sample-library"
  ]
}

BTW, all these two documents mentioned main.cpp but the source file is helloworld.cpp. See https://learn.microsoft.com/en-us/vcpkg/get_started/get-started?pivots=shell-bash#3---add-dependencies-and-project-files


Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

Missing documentation for the scenario where vcpkg is installed via Visual Studio installer.

Nowadays vcpkg is also available via Visual Studio installer, and the documentation isn't clear in what steps are missing, or additional changes are required when installing via this mechanism.


Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

libogg tutorial - needs more work

If this is a tutorial, it's really missing a lot. Where do you start? Do you clone a copy of libogg? Do you start in the vcpkg root directory? What about the libogg port that already exists, are we supposed to modify it? or create a new directory?


Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

Rename VCPKG_MAKE_CONFIGURE_OPTIONS -> VCPKG_CONFIGURE_MAKE_OPTIONS not documented

I just spend 2 hours two build vcpkg cppunit package with llvm libc++. It is build is make/automake based.

Documentation says i should modify VCPKG_MAKE_CONFIGURE_OPTIONS in my custom triplet but this had no affect. So I went digging into the vcpkg code and learned that this was renamed in PR#20165. Missing documentation was already posted there but no one took action.

Therefore I open this issue in hope this will be changed and future users do not need to do the same digging as I did.


Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

  • ID: 81b81fec-b84b-3943-0b8b-4d3c6c8a17cd
  • Version Independent ID: 81b81fec-b84b-3943-0b8b-4d3c6c8a17cd
  • Content: Triplet files
  • Content Source: vcpkg/users/triplets.md
  • Product: vcpkg
  • GitHub Login: @vicroms
  • Microsoft Alias: viromer

Further problems with CMakePresets.json and Cmake

Following up on the previous comment.
The VS 2019 included CMake doesn't work with the CMakePresets.json file specified.
I then tried a new install of the latest Cmake (3.28.0-rc3) but the command

cmake --preset=default

gives the different error:
Preset "default" missing field "generator"
Invalid preset: "default"

If I knew the details of how to fix things like this I would not be following a basic tutorial on using vcpkg - so I have no idea what to do now, and it seems that this page if of no value to VS 2019 Enterprise users.


Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

part of path missing for running HelloWorld

Type of issue

Missing information

Description

In the "Build and run the project" section, step 3 "run the application" should say

.\build\Debug\HelloWorld

The "Debug" part of the path is missing. By default vcpkg builds Debug mode.

image

Page URL

https://learn.microsoft.com/en-us/vcpkg/get_started/get-started?pivots=shell-cmd&source=docs

Content source URL

https://github.com/Microsoft/vcpkg-docs/blob/main/vcpkg/get_started/get-started.md

Document Version Independent Id

5099d71b-6e6f-f2d6-ab3f-3e8327541245

Article author

@JavierMatosD

Metadata

  • ID: 5099d71b-6e6f-f2d6-ab3f-3e8327541245
  • Service: vcpkg

The prerequisites are not documented well

From https://vcpkg.io/en/getting-started.html, we can see the prerequisites are:

  • Git
  • g++ >= 6

However, ./vcpkg/bootstrap-vcpkg.sh has more prerequisites from the vcpkg-bootstrap.log:

Could not find curl. Please install it (and other dependencies) with:
On Debian and Ubuntu derivatives:
  sudo apt-get install curl zip unzip tar
On recent Red Hat and Fedora derivatives:
  sudo dnf install curl zip unzip tar
On older Red Hat and Fedora derivatives:
  sudo yum install curl zip unzip tar
On SUSE Linux and derivatives:
  sudo zypper install curl zip unzip tar
On Arch Linux and derivatives:
  sudo pacman -S curl zip unzip tar cmake ninja
On Alpine:
  apk add build-base cmake ninja zip unzip curl git
  (and export VCPKG_FORCE_SYSTEM_BINARIES=1)
Unable to determine a binary release of vcpkg; attempting to build from source.
Building vcpkg-tool...
CMake Error at CMakeLists.txt:1 (cmake_minimum_required):
  CMake 3.15 or higher is required.  You are running version 3.13.4

i.e. to use vcpkg we also need:

  • curl
  • zip
  • unzip
  • tar
  • ninja
  • cmake >= 3.15

Two manifest articles under Concepts

There are two manifest articles under Concepts currently. These should be reconciled or one should be moved to a different section of the docs.

error: this vcpkg instance requires a manifest with a specified baseline in order to interact with ports.

Hi
I did the instructions , but I got an error:
error: this vcpkg instance requires a manifest with a specified baseline in order to interact with ports. Please add 'builtin-baseline' to the manifest or add a 'vcpkg-configuration.json' that redefines the default registry.


Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

mpg123 is not a MSBuild-based example

mpg123 is noted as an MSBuild-based port example, but it looks like it is a CMAKE based port
https://github.com/microsoft/vcpkg/tree/master/ports/mpg123


Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

Manifest docs: First example is not very clear

Hi,

In the manifest docs https://learn.microsoft.com/en-us/vcpkg/users/manifests, the first example contains:

  "dependencies": [
    "boost-system",
    {
      "name": "cpprestsdk",
      "default-features": false
    },
    "libxml2",
    "yajl"
  ]

It's not clear to me, and not described in the text (as far as I can see), what this part does:

    {
      "name": "cpprestsdk",
      "default-features": false
    }

Is it a dependency on cpprestsdk, but one that's not part of the default features? So is this a short-hand notation for adding a feature called "cpprestsdk", so if one then does vcpkg install my-application[cpprestsdk] the cpprestsdk gets installed, otherwise it won't?

Also, unrelated, but on the same page, the final heading "Default Features", it explains what default features are in plain text, but not what the syntax is to specify that something is (or is not) a default feature in the vcpkg.json file?

Thanks.


Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

Platform expression documentation appears to be inaccurate

Type of issue

Outdated article

Description

The platform expression documentation https://github.com/Microsoft/vcpkg-docs/blob/main/vcpkg/reference/vcpkg-json.md#-platform-expression indicates that expr && expr and expr || expr should be valid, however locally I found that this wasn't the case and it'd only allow single & or |:

~/Projects/vcpkg !19549 › ./vcpkg x-add-version cpptrace --overwrite-version
error: can't load port cpptrace
error: while loading /home/rifkin/Projects/vcpkg/ports/cpptrace/vcpkg.json:
$.supports (a platform expression): CONTROL:1:6: error: missing or invalid identifier
  on expression: !uwp&&!android
                      ^
~/Projects/vcpkg !19550 › ./vcpkg x-add-version cpptrace --overwrite-version
error: can't load port cpptrace
error: while loading /home/rifkin/Projects/vcpkg/ports/cpptrace/vcpkg.json:
$.supports (a platform expression): CONTROL:1:9: error: missing or invalid identifier
  on expression: (!uwp) && (!android)
                         ^
~/Projects/vcpkg !19550 › ./vcpkg x-add-version cpptrace --overwrite-version
error: can't load port cpptrace
error: while loading /home/rifkin/Projects/vcpkg/ports/cpptrace/vcpkg.json:
$.supports (a platform expression): CONTROL:1:8: error: missing or invalid identifier
  on expression: !(uwp || android)
                        ^

Page URL

https://learn.microsoft.com/en-us/vcpkg/reference/vcpkg-json#platform-expression

Content source URL

https://github.com/Microsoft/vcpkg-docs/blob/main/vcpkg/reference/vcpkg-json.md

Document Version Independent Id

c9908f8f-fc4a-6ba6-65a0-c4f16fc1621d

Article author

@vicroms

Metadata

  • ID: c9908f8f-fc4a-6ba6-65a0-c4f16fc1621d
  • Service: vcpkg

Missing a new temp file location

For the temporary files FAQ, I think there's a new directiory that should also be mentioned here (%LocalAppData%\vcpkg).


Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

What is Ninja?

Type of issue

Code doesn't work

Description

I'm running VSCode under Win10. I followed https://learn.microsoft.com/en-us/vcpkg/get_started/get-started-vscode?pivots=shell-cmd and when I try to run the Helloworld project I get

[cmake] CMake Error: CMake was unable to find a build program corresponding to "Ninja". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.

Full output: ```

[proc] Executing command: cmake --version
[proc] The command: cmake --version failed with error: Error: spawn cmake ENOENT
[proc] Executing command: cmake -E capabilities
[proc] The command: cmake -E capabilities failed with error: Error: spawn cmake ENOENT
[variant] Loaded new set of variants
[kit] Successfully loaded 4 kits from C:\Users\David\AppData\Local\CMakeTools\cmake-tools-kits.json
[presetController] Reading and validating the presets "file D:\Code\Ctest\CMakePresets.json"
[presetController] Successfully validated presets in D:\Code\Ctest\CMakePresets.json
[presetController] Reading and validating the presets "file D:\Code\Ctest\CMakeUserPresets.json"
[presetController] Successfully validated presets in D:\Code\Ctest\CMakeUserPresets.json
[proc] Executing command: "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" --version
[proc] Executing command: "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" -E capabilities
[cms-client] Configuring using the "Ninja" CMake generator
[cms-client] Configuring using the "Ninja" CMake generator
[driver] Switching to package preset: defaultPackagePreset
[driver] Switching to workflow preset: defaultWorkflowPreset
[main] Configuring project: Ctest
[cmake] CMake Error at C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.10/Modules/CMakeDetermineSystem.cmake:100 (message):
[cmake] Could not find toolchain file: /scripts/buildsystems/vcpkg.cmake
[cmake] Call Stack (most recent call first):
[cmake] CMakeLists.txt:3 (project)
[cmake]
[cmake]
[cmake] CMake Error: CMake was unable to find a build program corresponding to "Ninja". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.
[cmake] CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
[cmake] CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
[cmake] Configuring incomplete, errors occurred!
[cms-driver] Error during CMake configure:
Error: Configuration failed.
at CMakeServerClient.onMessage (c:\Users\David.vscode\extensions\ms-vscode.cmake-tools-1.17.17\dist\main.js:55555:33)
at CMakeServerClient.onMoreData (c:\Users\David.vscode\extensions\ms-vscode.cmake-tools-1.17.17\dist\main.js:55528:18)
at Socket.emit (node:events:517:28)
at addChunk (node:internal/streams/readable:335:12)
at readableAddChunk (node:internal/streams/readable:308:9)
at Readable.push (node:internal/streams/readable:245:10)
at Pipe.onStreamRead (node:internal/stream_base_commons:190:23)

</details>

### Page URL

https://learn.microsoft.com/en-us/vcpkg/get_started/get-started-vscode

### Content source URL

https://github.com/Microsoft/vcpkg-docs/blob/main/vcpkg/get_started/get-started-vscode.md

### Document Version Independent Id

6402b87a-b33e-ebf5-01d2-a2d1115d6f2b

### Article author

@data-queue

### Metadata

* ID: 6402b87a-b33e-ebf5-01d2-a2d1115d6f2b 
* Service: **vcpkg**

Private library link doesn't contain stated content

The page says:

Can I build a private library with this tool?
Yes. Follow our packaging zlib Example for creating a portfile using a fake URL.

But the "packaging zlib Example" link doesn't have any content mentioning using a fake URL. Maybe that was an earlier version of that page's content?

Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

Document `X_VCPKG_NUGET_PREFIX`

The X_VCPKG_NUGET_PREFIX environment variable allows you to set a prefix for all binary packages in a binary cache. But currently is undocumented.

This page requests the creation of main.cpp but all build files refer to HelloWorld.cpp

Type of issue

Typo

Description

This page's instruction requests the creation of main.cpp.
All build files refer to HelloWorld.cpp.
This results in the following error.

CMake Error at C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/vcpkg/scripts/buildsystems/vcpkg.cmake:598 (_add_executable):
Cannot find source file:

helloworld.cpp

Page URL

https://learn.microsoft.com/en-us/vcpkg/get_started/get-started

Content source URL

https://github.com/Microsoft/vcpkg-docs/blob/main/vcpkg/get_started/get-started.md

Document Version Independent Id

5099d71b-6e6f-f2d6-ab3f-3e8327541245

Article author

@JavierMatosD

Metadata

  • ID: 5099d71b-6e6f-f2d6-ab3f-3e8327541245
  • Service: vcpkg

Ubuntu 16.04 FAQ reference may be outdated

The vcpkg FAQ states that continuous testing targets Ubuntu 16.04. It is possible that this statement is out of date considering that standard support for Ubuntu 16.04 (and 18.04 for that matter) has expired.

It would be good to know what the current support target is.


Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

[doc] readwrite is not the default permission

This issue is a duplicate of microsoft/vcpkg#36949, originally initiated by @0x0ACB.

Describe the bug
The doc for binary caching states in multiple places that the default permission for the binary cache is readwrite

This is in fact not the case (atleast when a vcpkg.json is used). And the linked example will not work! Neither on linux nor on windows. I tested this both manually and via the run-vcpk action

Environment

  • OS: Windows/Linux
  • Compiler: msvc/gcc

To Reproduce
a) ./vcpkg/vcpkg.exe install --binarysource="clear;files,C:/vcpkg-cache"
b) or set the VCPKG_BINARY_SOURCES="clear;files,C:/vcpkg-cache" before running vcpkg install

Expected behavior
Stored binaries in 1 destinations in 30.8 ms.

The term '%PATH%' is not recognized as the name of a cmdlet, function, script file, or operable program.

Type of issue

Code doesn't work

Description

There seems to be an issue with set PATH=%VCPKG_ROOT%;%PATH% or there is a lack of information here.

Full error message:

%PATH% : The term '%PATH%' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path    
is correct and try again.
At line:1 char:23
+ set PATH=%VCPKG_ROOT%;%PATH%
+                       ~~~~~~
    + CategoryInfo          : ObjectNotFound: (%PATH%:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Page URL

https://learn.microsoft.com/en-us/vcpkg/get_started/get-started-vscode

Content source URL

https://github.com/Microsoft/vcpkg-docs/blob/main/vcpkg/get_started/get-started-vscode.md

Document Version Independent Id

6402b87a-b33e-ebf5-01d2-a2d1115d6f2b

Article author

@data-queue

Metadata

  • ID: 6402b87a-b33e-ebf5-01d2-a2d1115d6f2b
  • Service: vcpkg

Download opencv error.

Type of issue

Typo

Description

By the tips, it means that the links error. Like opencv, the success is "https://github.com/opencv/opencv/releases/tag/4.8.0/...", but it shows "https://github.com/opencv/opencv/archive/4.8.0.tar.gz" when I run the code ".\vcpkg.exe install opencv:x64-windows --triplet x64-windows-custom".

It's error like '7z | powershell | ...'.

What I downloaded is version-2024.02.14.

图片
a

Page URL

https://learn.microsoft.com/zh-cn/vcpkg/get_started/overview

Content source URL

https://github.com/Microsoft/vcpkg-docs/blob/main/vcpkg/get_started/overview.md

Document Version Independent Id

c038c76a-550b-9b30-215f-a2747465590b

Article author

@AugP

Metadata

  • ID: c038c76a-550b-9b30-215f-a2747465590b
  • Service: vcpkg

CMake tutorial gives an error

Thank you for the tutorial on vcpkg and CMake.

I tried followed the tutorial, but I get this error when running

$ cmake --preset=default

Preset CMake variables:

  CMAKE_TOOLCHAIN_FILE="$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"

CMake Error at /opt/homebrew/Cellar/cmake/3.27.8/share/cmake/Modules/CMakeDetermineSystem.cmake:154 (message):
  Could not find toolchain file:
  $ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake
Call Stack (most recent call first):
  CMakeLists.txt:3 (project)


CMake Error: CMake was unable to find a build program corresponding to "Unix Makefiles".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!

And the vcpkg.cmake is there

$ ll $VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake
.rw-r--r-- 44k kevinsimper 16 Nov 09:42 /Users/kevinsimper/projects/vcpkg/scripts/buildsystems/vcpkg.cmake

I installed CMake from brew

$ cmake --version
cmake version 3.27.8

Edit:
I found out, that it seemed to work when I ran it like this

$ cmake -DCMAKE_TOOLCHAIN_FILE=/Users/kevinsimper/projects/vcpkg/scripts/buildsystems/vcpkg.cmake
-- Running vcpkg install
Fetching registry information from https://github.com/microsoft/vcpkg (HEAD)...

Dokumentoplysninger

Undlad at redigere denne sektion. Det er påkrævet til learn.microsoft.com ➟ GitHub-problemlinkning.

Specific Boost version for transitive dependencies

Type of issue

Missing information

Description

I'm reading how to install a specific version for Boost libraries and, it works fine.

What is not described is how to consume a port, in a private registry, that depends on a specific version of Boost. Say that you have a port foo that depends on some old Boost 1.76.0.

So far I have tried using vcpkg-configuration property in ports/foo/portfile.cmake and, setting a baseline there:

{
  "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json",
  "name": "foo",
  "version": "1.0.0",
  "port-version": 0,
  "supports": "!(windows) & (arm32 | arm64 | x64 | x86)",
  "dependencies": [
      {"name": "boost-filesystem", "platform": "native"}
  ],
  "vcpkg-configuration": {
    "registries": [
      {
        "kind": "git",
        "repository": "https://github.com/Microsoft/vcpkg",
        "baseline": "761c81d43335a5d5ccc2ec8ad90bd7e2cbba734e",
        "packages": [ "boost*", "boost-*"]
      }
    ]
  }
}

In the consuming project (let's call it bar):

> vcpkg install --overlay-ports=/path/to/ports/foo
Fetching registry information from https://github.com/microsoft/vcpkg (HEAD)...

The "Fetching registry information from" is only printed once and, uses the baseline configured for the registry in bar , which brings newer Boost versions.

I also tried a combination of vcpkg-configuration and overrides, without success.

Page URL

https://learn.microsoft.com/en-us/vcpkg/consume/boost-versions

Content source URL

https://github.com/Microsoft/vcpkg-docs/blob/main/vcpkg/consume/boost-versions.md

Document Version Independent Id

efdb8438-0860-24e8-c015-44fda7053a6a

Article author

@vicroms

Metadata

  • ID: efdb8438-0860-24e8-c015-44fda7053a6a
  • Service: vcpkg

Totally puzzled by this page - please help me understand

Hi there,

Thank you for this page. I am trying to understand how CMake in VS works, and it is a big help.

It also gives me a lot of headache. I managed to follow it in the end, but it took me two whole evenings, which is much more than I am used to. I am still puzzled about some parts of it, and I found some minor mistakes in documentation.

1. Quotation marks issue

The documentation says: set VCPKG_ROOT="C:\path\to\vcpkg" If you do this, then you will get the following warning when running
vcpkg new --application:

warning: The vcpkg C:\Bin\Dev\vcpkg\vcpkg.exe is using detected vcpkg root C:\Bin\Dev\vcpkg and ignoring mismatched VCPKG_ROOT environment value "C:\Bin\Dev\vcpkg". To suppress this message, unset the environment variable or use the --vcpkg-root command line switch.

First I did not realize what the problem was, so I tracked down that I had vcpkg also installed as a part of VS. I uninstalled it, even restarted the Windows, just to be sure, still the warning stayed. It was just then that I realized vcpkg expects the path without quotation marks.

2. Puzzled about env vars

This sentence: "Setting VCPKG_ROOT helps Visual Studio locate your vcpkg instance." puzzles me. As far as my knowledge goes, environment variables are local to the command prompt. If I open another developer prompt, there is no VCPKG_ROOT defined. I suppose it is not defined for the Visual Studio itself. I googled it if I am wrong, but didn't find any proof. So I think that this sentence is not true. I am not sure, though. Please let me know if I am wrong.

3. Puzzled about the jsons

In the old times, without vcpkg I would create a CMakeLists.txt file, added a fetch_content for fmt, and I was done, with just a few lines of code. Now we need to run extra tools, and create three extra jsons. One of these jsons cannot even be put in VCS. OK, I can add it to .gitignore, but then on the other computers the other users must recreate it. I could not memorize it. I would need to google it. This sounds bad. You said that explaining the third json is outside of the scope of this document. So my question: why is it worth doing things this way if it is so much more complicated? I am asking this honestly. No malice or passive-aggressive things here. I really would like to understand, as I see the world is going this direction. I'd really appreciate if you answer this question.

4. Advice for documenting hotkeys

The documentation says: Press Ctrl+Shift+B to build the project in Visual Studio. - I would advise you to first always define where can a feature be found on the user interface, and add the hotkeys just after that. I have never used Ctrl+Shift+B before, so I did not know what it is (I used F7 instead). When starting VS this way, the buttons and menus are different on the UI, and even the wording you use is different. Normally these hotkeys build the solution, not the project. So it was not clear for me that you changed the meaning of the words.

I hope these minor notes help improving the documentation, and I am looking forward for your answers.

Cheers,
Khardan


Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

List of included things for ABI Hashing is incomplete

The documentation doesn't mention that files named .DS_Store are not considered for ABI Hashing. Furthermore, it misses the fact that the GRDK toolkit is also considered for ABI Hashing on Xbox triplets.


Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

vcpkg is listed as a system package manager

Type of issue

Typo

Description

C++ libraries are available in system package managers such as apt and vcpkg.

Should this be brew instead of vcpkg?

Page URL

https://learn.microsoft.com/en-us/vcpkg/concepts/system-package-managers

Content source URL

https://github.com/Microsoft/vcpkg-docs/blob/main/vcpkg/concepts/system-package-managers.md

Document Version Independent Id

ac54c45f-19d4-038a-c34b-184a9ba79e48

Article author

@data-queue

Metadata

  • ID: ac54c45f-19d4-038a-c34b-184a9ba79e48
  • Service: vcpkg

issue about doc of "vcpkg env"

This issue is a duplicate of microsoft/vcpkg#34970, originally initiated by @QiuYilin.

In doc https://learn.microsoft.com/en-us/vcpkg/commands/env,the method of saving environment variables is described as follows:

PS C:\Users\vcpkg\vcpkg> $env:CLEARED_ENV_VAR="hello"
PS C:\Users\vcpkg\vcpkg> vcpkg env "set CLEARED_ENV_VAR"
Environment variable CLEARED_ENV_VAR not defined
PS C:\Users\vcpkg\vcpkg> $env:KEEP_ENV_VARS="CLEARED_ENV_VAR"
PS C:\Users\vcpkg\vcpkg> vcpkg env "set CLEARED_ENV_VAR"
CLEARED_ENV_VAR=hello

It does not work. Maybe it should be :

PS C:\Users\vcpkg\vcpkg> $env:VCPKG_KEEP_ENV_VARS="CLEARED_ENV_VAR"

Tutorial: Create and publish packages does not work

I'm working through the tutorial set.

I started with Install and use packages with CMake and transitioned to this tutorial Create and publish packages. This package creation tutorial is not working.

The first observation I had was that the sha returned by the first vcpkg install vcpkg-sample-library --overlay-ports=... step doesn't match the sha in the documentation.

Next, after updating the sha the second vcpkg install vcpkg-sample-library --overlay-ports=... doesn't compile anything on my system, but the example shows that something is compiled.

Then verifying with the helloworld project fails during the cmake --preset=default stage.

System information and details follow. It's long winded with all the steps to illusrate I did what the example says to do.

System Information

  • Windows 11 Pro N (23H2 / 22631.3007)
  • VS2017 (15.9.59), VS2019 (16.11.33) and VS2022 (17.8.4) are all installed
  • cmake 3.23.1
  • git 2.42.0.windows.2

Details

Install and Use Packages

c:\Users\rocha\Desktop\VCPKG-TEST>git clone https://github.com/microsoft/vcpkg.git
git clone https://github.com/microsoft/vcpkg.git
Cloning into 'vcpkg'...
Updating files: 100% (11074/11074), done.
c:\Users\rocha\Desktop\VCPKG-TEST>cd vcpkg
cd vcpkg

c:\Users\rocha\Desktop\VCPKG-TEST\vcpkg>bootstrap-vcpkg.bat 
bootstrap-vcpkg.bat 
Downloading https://github.com/microsoft/vcpkg-tool/releases/download/2024-01-11/vcpkg.exe -> C:\Users\rocha\Desktop\VCPKG-TEST\vcpkg\vcpkg.exe... done.
Validating signature... done.

vcpkg package management program version 2024-01-11-710a3116bbd615864eef5f9010af178034cb9b44

See LICENSE.txt for license information.
Telemetry
---------
vcpkg collects usage data in order to help us improve your experience.
The data collected by Microsoft is anonymous.
You can opt-out of telemetry by re-running the bootstrap-vcpkg script with -disableMetrics,
passing --disable-metrics to vcpkg on the command line,
or by setting the VCPKG_DISABLE_METRICS environment variable.

Read more about vcpkg telemetry at docs/about/privacy.md

c:\Users\rocha\Desktop\VCPKG-TEST\vcpkg>set "VCPKG_ROOT=%CD%"
set "VCPKG_ROOT=%CD%"

c:\Users\rocha\Desktop\VCPKG-TEST\vcpkg>set VCPKG_ROOT
set VCPKG_ROOT
VCPKG_ROOT=c:\Users\rocha\Desktop\VCPKG-TEST\vcpkg

c:\Users\rocha\Desktop\VCPKG-TEST\vcpkg>set "PATH=%PATH%;%VCPKG_ROOT%"
set "PATH=%PATH%;%VCPKG_ROOT%"

c:\Users\rocha\Desktop\VCPKG-TEST\vcpkg>set PATH
set PATH
PATH=C:\Program Files\Eclipse Adoptium\jdk-11.0.21.9-hotspot\bin;C:\Program Files\Python310\Scripts\;C:\Program Files\Python310\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Perforce\;C:\Program Files\IcedTeaWeb\WebStart\bin;C:\Program Files\CMake\bin;C:\Program Files (x86)\Graphviz2.38\bin;C:\Program Files\doxygen\bin;C:\Program Files\gs\gs9.52\bin;C:\Program Files\Git\cmd;C:\Users\rocha\AppData\Local\Microsoft\WindowsApps;C:\Users\rocha\AppData\Local\Programs\MiKTeX\miktex\bin\x64\;c:\Users\rocha\Desktop\VCPKG-TEST\vcpkg
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.PY;.PYW
c:\Users\rocha\Desktop\VCPKG-TEST\vcpkg>mkdir helloworld
mkdir helloworld

c:\Users\rocha\Desktop\VCPKG-TEST\vcpkg>cd helloworld
cd helloworld

c:\Users\rocha\Desktop\VCPKG-TEST\vcpkg\helloworld>vcpkg new --application
vcpkg new --application
c:\Users\rocha\Desktop\VCPKG-TEST\vcpkg\helloworld>vcpkg add port fmt
vcpkg add port fmt
Succeeded in adding ports to vcpkg.json file.

c:\Users\rocha\Desktop\VCPKG-TEST\vcpkg\helloworld>type vcpkg.json 
type vcpkg.json 
{
  "dependencies": [
    "fmt"
  ]
}

c:\Users\rocha\Desktop\VCPKG-TEST\vcpkg\helloworld>type CMakeLists.txt 
type CMakeLists.txt 
cmake_minimum_required(VERSION 3.10)

project(HelloWorld)

find_package(fmt CONFIG REQUIRED)

add_executable(HelloWorld helloworld.cpp)

target_link_libraries(HelloWorld PRIVATE fmt::fmt)

c:\Users\rocha\Desktop\VCPKG-TEST\vcpkg\helloworld>type helloworld.cpp 
type helloworld.cpp 
#include <fmt/core.h>

int main()
{
    fmt::print("Hello World!\n");
    return 0;
}

c:\Users\rocha\Desktop\VCPKG-TEST\vcpkg\helloworld>type CMakePresets.json 
type CMakePresets.json 
{
    "version": 3,
    "configurePresets": [
        {
            "name": "default",
            "binaryDir": "${sourceDir}/build",
            "cacheVariables": {
                "CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"
            }
        }
    ]
}
c:\Users\rocha\Desktop\VCPKG-TEST\vcpkg\helloworld>cmake --preset=default
cmake --preset=default
Preset CMake variables:

  CMAKE_TOOLCHAIN_FILE="c:\Users\rocha\Desktop\VCPKG-TEST\vcpkg/scripts/buildsystems/vcpkg.cmake"

-- Building for: Visual Studio 17 2022
-- Running vcpkg install
Fetching registry information from https://github.com/microsoft/vcpkg (HEAD)...
A suitable version of cmake was not found (required v3.27.1) Downloading portable cmake 3.27.1...
Downloading cmake...
https://github.com/Kitware/CMake/releases/download/v3.27.1/cmake-3.27.1-windows-i386.zip->C:\Users\rocha\Desktop\VCPKG-TEST\vcpkg\downloads\cmake-3.27.1-windows-i386.zip
Downloading https://github.com/Kitware/CMake/releases/download/v3.27.1/cmake-3.27.1-windows-i386.zip
Extracting cmake...
Detecting compiler hash for triplet x64-windows...
A suitable version of powershell-core was not found (required v7.2.11) Downloading portable powershell-core 7.2.11...
Downloading powershell-core...
https://github.com/PowerShell/PowerShell/releases/download/v7.2.11/PowerShell-7.2.11-win-x86.zip->C:\Users\rocha\Desktop\VCPKG-TEST\vcpkg\downloads\PowerShell-7.2.11-win-x86.zip
Downloading https://github.com/PowerShell/PowerShell/releases/download/v7.2.11/PowerShell-7.2.11-win-x86.zip
Extracting powershell-core...
The following packages will be built and installed:
    fmt:[email protected] -- C:\Users\rocha\AppData\Local\vcpkg\registries\git-trees\405156a2b01c91258bf66768ceb3ae75c1caba7f
  * vcpkg-cmake:x64-windows@2023-05-04 -- C:\Users\rocha\AppData\Local\vcpkg\registries\git-trees\88a7058fc7fa73a9c4c99cfcae9d79e2abf87a5a
  * vcpkg-cmake-config:x64-windows@2022-02-06#1 -- C:\Users\rocha\AppData\Local\vcpkg\registries\git-trees\8d54cc4f487d51b655abec5f9c9c3f86ca83311f
Additional packages (*) will be modified to complete this operation.
A suitable version of 7zip was not found (required v23.1.0) Downloading portable 7zip 23.1.0...
Downloading 7zip...
https://www.7-zip.org/a/7z2301-extra.7z->C:\Users\rocha\Desktop\VCPKG-TEST\vcpkg\downloads\7z2301-extra.7z
Downloading https://www.7-zip.org/a/7z2301-extra.7z
Extracting 7zip...
Restored 3 package(s) from C:\Users\rocha\AppData\Local\vcpkg\archives in 64.6 ms. Use --debug to see more details.
Installing 1/3 vcpkg-cmake-config:x64-windows@2022-02-06#1...
Elapsed time to handle vcpkg-cmake-config:x64-windows: 4.79 ms
vcpkg-cmake-config:x64-windows package ABI: 20b02959c1badd0b0b2b18e80846b45687839ecb3ca822a7d65fb1b8142ed722
Installing 2/3 vcpkg-cmake:x64-windows@2023-05-04...
Elapsed time to handle vcpkg-cmake:x64-windows: 4.7 ms
vcpkg-cmake:x64-windows package ABI: c62da996a7b71d8c0f633c18ce2938d82903a191cc178cbee3722793543520d5
Installing 3/3 fmt:[email protected]...
Elapsed time to handle fmt:x64-windows: 13.5 ms
fmt:x64-windows package ABI: c87d6137cd1d670d2a0b4bae5d358af57d6c3f0973f0f38fe4e2780a971d4746
Total install time: 23.1 ms
The package fmt provides CMake targets:

    find_package(fmt CONFIG REQUIRED)
    target_link_libraries(main PRIVATE fmt::fmt)

    # Or use the header-only version
    find_package(fmt CONFIG REQUIRED)
    target_link_libraries(main PRIVATE fmt::fmt-header-only)

-- Running vcpkg install - done
-- Selecting Windows SDK version 10.0.22000.0 to target Windows 10.0.22631.
-- The C compiler identification is MSVC 19.38.33134.0
-- The CXX compiler identification is MSVC 19.38.33134.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.38.33130/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.38.33130/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/rocha/Desktop/VCPKG-TEST/vcpkg/helloworld/build
c:\Users\rocha\Desktop\VCPKG-TEST\vcpkg\helloworld>cmake --build build
cmake --build build
MSBuild version 17.8.3+195e7f5a3 for .NET Framework

  Checking Build System
  Building Custom Rule C:/Users/rocha/Desktop/VCPKG-TEST/vcpkg/helloworld/CMakeLists.txt
  helloworld.cpp
  HelloWorld.vcxproj -> C:\Users\rocha\Desktop\VCPKG-TEST\vcpkg\helloworld\build\Debug\HelloWorld.exe
  Building Custom Rule C:/Users/rocha/Desktop/VCPKG-TEST/vcpkg/helloworld/CMakeLists.txt

c:\Users\rocha\Desktop\VCPKG-TEST\vcpkg\helloworld>build\Debug\HelloWorld.exe
build\Debug\HelloWorld.exe
Hello World!

Create and publish packages

c:\Users\rocha\Desktop\VCPKG-TEST\vcpkg\helloworld>cd ..
cd ..

c:\Users\rocha\Desktop\VCPKG-TEST\vcpkg>mkdir custom-overlay
mkdir custom-overlay

c:\Users\rocha\Desktop\VCPKG-TEST\vcpkg>cd custom-overlay
cd custom-overlay

c:\Users\rocha\Desktop\VCPKG-TEST\vcpkg\custom-overlay>mkdir vcpkg-sample-library
mkdir vcpkg-sample-library
c:\Users\rocha\Desktop\VCPKG-TEST\vcpkg\custom-overlay>type vcpkg-sample-library\vcpkg.json
type vcpkg-sample-library\vcpkg.json
{
  "name": "vcpkg-sample-library",
  "version": "1.0.0",
  "homepage": "https://github.com/microsoft/vcpkg-docs/tree/cmake-sample-lib",
  "description": "A sample C++ library designed to serve as a foundational example for a tutorial on packaging libraries with vcpkg.",
  "license": "MIT",
  "dependencies": [
    {
      "name" : "vcpkg-cmake",
      "host" : true
    },
    {
      "name" : "vcpkg-cmake-config",
      "host" : true
    },
    "fmt"
  ]
}

c:\Users\rocha\Desktop\VCPKG-TEST\vcpkg\custom-overlay>type vcpkg-sample-library\usage
type vcpkg-sample-library\usage
vcpkg-sample-library provides CMake targets:

find_package(my_sample_lib CONFIG REQUIRED)
target_link_libraries(main PRIVATE my_sample_lib::my_sample_lib)
c:\Users\rocha\Desktop\VCPKG-TEST\vcpkg\custom-overlay>type vcpkg-sample-library\portfile.cmake
type vcpkg-sample-library\portfile.cmake
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)

vcpkg_from_github(
    OUT_SOURCE_PATH SOURCE_PATH
    REPO Microsoft/vcpkg-docs
    REF "${VERSION}"
    SHA512 0  # This is a temporary value. We will modify this value in the next section.
    HEAD_REF cmake-sample-lib
)


vcpkg_cmake_configure(
    SOURCE_PATH "${SOURCE_PATH}"
)

vcpkg_cmake_install()

vcpkg_cmake_config_fixup(PACKAGE_NAME "my_sample_lib")

file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")

file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
configure_file("${CMAKE_CURRENT_LIST_DIR}/usage" "${CURRENT_PACKAGES_DIR}/share/${PORT}/usage" COPYONLY)

Deviation #1: Run the command so it fails and gives the Actual hash. The hash value does not match the example documentation

c:\Users\rocha\Desktop\VCPKG-TEST\vcpkg\custom-overlay>vcpkg install vcpkg-sample-library --overlay-ports="%CD%"
vcpkg install vcpkg-sample-library --overlay-ports="%CD%"
warning: In the September 2023 release, the default triplet for vcpkg libraries changed from x86-windows to the detected host triplet (x64-windows). For the old behavior, add --triplet x86-windows . To suppress this message, add --triplet x64-windows .
Computing installation plan...
The following packages will be built and installed:
  * fmt:[email protected]
  * vcpkg-cmake:x64-windows@2023-05-04
  * vcpkg-cmake-config:x64-windows@2022-02-06#1
    vcpkg-sample-library:[email protected] -- c:\Users\rocha\Desktop\VCPKG-TEST\vcpkg\custom-overlay\vcpkg-sample-library
Additional packages (*) will be modified to complete this operation.
Detecting compiler hash for triplet x64-windows...
Restored 3 package(s) from C:\Users\rocha\AppData\Local\vcpkg\archives in 60.9 ms. Use --debug to see more details.
Installing 1/4 vcpkg-cmake:x64-windows@2023-05-04...
Elapsed time to handle vcpkg-cmake:x64-windows: 4.9 ms
vcpkg-cmake:x64-windows package ABI: c62da996a7b71d8c0f633c18ce2938d82903a191cc178cbee3722793543520d5
Installing 2/4 vcpkg-cmake-config:x64-windows@2022-02-06#1...
Elapsed time to handle vcpkg-cmake-config:x64-windows: 4.24 ms
vcpkg-cmake-config:x64-windows package ABI: 20b02959c1badd0b0b2b18e80846b45687839ecb3ca822a7d65fb1b8142ed722
Installing 3/4 fmt:[email protected]...
Elapsed time to handle fmt:x64-windows: 13.3 ms
fmt:x64-windows package ABI: c87d6137cd1d670d2a0b4bae5d358af57d6c3f0973f0f38fe4e2780a971d4746
Installing 4/4 vcpkg-sample-library:[email protected]...
Building vcpkg-sample-library:[email protected]...
-- Installing port from location: c:\Users\rocha\Desktop\VCPKG-TEST\vcpkg\custom-overlay\vcpkg-sample-library
-- Note: vcpkg-sample-library only supports static library linkage. Building static library.
-- Downloading https://github.com/Microsoft/vcpkg-docs/archive/1.0.0.tar.gz -> Microsoft-vcpkg-docs-1.0.0.tar.gz...
[DEBUG] To include the environment variables in debug output, pass --debug-env
[DEBUG] Trying to load bundleconfig from c:\Users\rocha\Desktop\VCPKG-TEST\vcpkg\vcpkg-bundle.json
[DEBUG] Failed to open: c:\Users\rocha\Desktop\VCPKG-TEST\vcpkg\vcpkg-bundle.json
[DEBUG] Bundle config: readonly=false, usegitregistry=false, embeddedsha=nullopt, deployment=Git, vsversion=nullopt
[DEBUG] Metrics enabled.
[DEBUG] Feature flag 'binarycaching' unset
[DEBUG] Feature flag 'compilertracking' unset
[DEBUG] Feature flag 'registries' unset
[DEBUG] Feature flag 'versions' unset
[DEBUG] Feature flag 'dependencygraph' unset
Downloading https://github.com/Microsoft/vcpkg-docs/archive/1.0.0.tar.gz
[DEBUG] Trying to hash C:\Users\rocha\Desktop\VCPKG-TEST\vcpkg\downloads\Microsoft-vcpkg-docs-1.0.0.tar.gz.8732.part
[DEBUG] C:\Users\rocha\Desktop\VCPKG-TEST\vcpkg\downloads\Microsoft-vcpkg-docs-1.0.0.tar.gz.8732.part has hash 3f206cc2fe61d9c97c82b30852e1e4e6df299d93f6159edd1e56c644fa03ccc4670f7681e356d0e3db898a74e099a1ec531821df5430a7b14d61c743c5aa8c30
error: Failed to download from mirror set
error: File does not have the expected hash:
url: https://github.com/Microsoft/vcpkg-docs/archive/1.0.0.tar.gz
File: C:\Users\rocha\Desktop\VCPKG-TEST\vcpkg\downloads\Microsoft-vcpkg-docs-1.0.0.tar.gz.8732.part
Expected hash: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
Actual hash: 3f206cc2fe61d9c97c82b30852e1e4e6df299d93f6159edd1e56c644fa03ccc4670f7681e356d0e3db898a74e099a1ec531821df5430a7b14d61c743c5aa8c30
[DEBUG] D:\a\_work\1\s\src\vcpkg\base\downloads.cpp(1029): 
[DEBUG] Time in subprocesses: 0us
[DEBUG] Time in parsing JSON: 5us
[DEBUG] Time in JSON reader: 0us
[DEBUG] Time in filesystem: 1027us
[DEBUG] Time in loading ports: 0us
[DEBUG] Exiting after 588 ms (578117us)

CMake Error at scripts/cmake/vcpkg_download_distfile.cmake:32 (message):
      
      Failed to download file with error: 1
      If you are using a proxy, please check your proxy setting. Possible causes are:
      
      1. You are actually using an HTTP proxy, but setting HTTPS_PROXY variable
         to `https://address:port`. This is not correct, because `https://` prefix
         claims the proxy is an HTTPS proxy, while your proxy (v2ray, shadowsocksr
         , etc..) is an HTTP proxy. Try setting `http://address:port` to both
         HTTP_PROXY and HTTPS_PROXY instead.
      
      2. If you are using Windows, vcpkg will automatically use your Windows IE Proxy Settings
         set by your proxy software. See https://github.com/microsoft/vcpkg-tool/pull/77
         The value set by your proxy might be wrong, or have same `https://` prefix issue.
      
      3. Your proxy's remote server is out of service.
      
      If you've tried directly download the link, and believe this is not a temporary
      download server failure, please submit an issue at https://github.com/Microsoft/vcpkg/issues
      to report this upstream download server failure.
      

Call Stack (most recent call first):
  scripts/cmake/vcpkg_download_distfile.cmake:270 (z_vcpkg_download_distfile_show_proxy_and_fail)
  scripts/cmake/vcpkg_from_github.cmake:106 (vcpkg_download_distfile)
  custom-overlay/vcpkg-sample-library/portfile.cmake:3 (vcpkg_from_github)
  scripts/ports.cmake:170 (include)


error: building vcpkg-sample-library:x64-windows failed with: BUILD_FAILED
Elapsed time to handle vcpkg-sample-library:x64-windows: 651 ms
Please ensure you're using the latest port files with `git pull` and `vcpkg update`.
Then check for known issues at:
  https://github.com/microsoft/vcpkg/issues?q=is%3Aissue+is%3Aopen+in%3Atitle+vcpkg-sample-library
You can submit a new issue at:
  https://github.com/microsoft/vcpkg/issues/new?title=[vcpkg-sample-library]+Build+error+on+x64-windows&body=Copy+issue+body+from+C%3A%2FUsers%2Frocha%2FDesktop%2FVCPKG-TEST%2Fvcpkg%2Finstalled%2Fvcpkg%2Fissue_body.md

Update the SHA (Hash)

c:\Users\rocha\Desktop\VCPKG-TEST\vcpkg\custom-overlay>type vcpkg-sample-library\portfile.cmake
type vcpkg-sample-library\portfile.cmake
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)

vcpkg_from_github(
    OUT_SOURCE_PATH SOURCE_PATH
    REPO Microsoft/vcpkg-docs
    REF "${VERSION}"
    SHA512 3f206cc2fe61d9c97c82b30852e1e4e6df299d93f6159edd1e56c644fa03ccc4670f7681e356d0e3db898a74e099a1ec531821df5430a7b14d61c743c5aa8c30
    HEAD_REF cmake-sample-lib
)


vcpkg_cmake_configure(
    SOURCE_PATH "${SOURCE_PATH}"
)

vcpkg_cmake_install()

vcpkg_cmake_config_fixup(PACKAGE_NAME "my_sample_lib")

file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")

file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
configure_file("${CMAKE_CURRENT_LIST_DIR}/usage" "${CURRENT_PACKAGES_DIR}/share/${PORT}/usage" COPYONLY)

Deviation #2: running the install command again doesn't cause the code to compile. The example output shows that the code compiles, but my execution does not.

c:\Users\rocha\Desktop\VCPKG-TEST\vcpkg\custom-overlay>vcpkg install vcpkg-sample-library --overlay-ports="%CD%"
vcpkg install vcpkg-sample-library --overlay-ports="%CD%"
warning: In the September 2023 release, the default triplet for vcpkg libraries changed from x86-windows to the detected host triplet (x64-windows). For the old behavior, add --triplet x86-windows . To suppress this message, add --triplet x64-windows .
Computing installation plan...
The following packages will be built and installed:
    vcpkg-sample-library:[email protected] -- c:\Users\rocha\Desktop\VCPKG-TEST\vcpkg\custom-overlay\vcpkg-sample-library
Detecting compiler hash for triplet x64-windows...
Restored 1 package(s) from C:\Users\rocha\AppData\Local\vcpkg\archives in 22.3 ms. Use --debug to see more details.
Installing 1/1 vcpkg-sample-library:[email protected]...
Elapsed time to handle vcpkg-sample-library:x64-windows: 7.49 ms
vcpkg-sample-library:x64-windows package ABI: 9a45655de051c185fd1e6c3b77b815ae7fb674354c421ef83d72c1d1f04adee3
Total install time: 7.51 ms
vcpkg-sample-library provides CMake targets:

find_package(my_sample_lib CONFIG REQUIRED)
target_link_libraries(main PRIVATE my_sample_lib::my_sample_lib)
c:\Users\rocha\Desktop\VCPKG-TEST\vcpkg\custom-overlay>cd ..\helloworld
cd ..\helloworld

c:\Users\rocha\Desktop\VCPKG-TEST\vcpkg\helloworld>type CMakeLists.txt
type CMakeLists.txt
cmake_minimum_required(VERSION 3.10)

project(HelloWorld)

find_package(fmt CONFIG REQUIRED)
find_package(my_sample_lib CONFIG REQUIRED)  # Add this line

add_executable(HelloWorld helloworld.cpp)

target_link_libraries(HelloWorld PRIVATE fmt::fmt)
target_link_libraries(HelloWorld PRIVATE my_sample_lib::my_sample_lib)  # Add this line

c:\Users\rocha\Desktop\VCPKG-TEST\vcpkg\helloworld>type helloworld.cpp
type helloworld.cpp
#include "my_sample_lib.h"  // Replace #include <fmt/core.h> with "my_sample_lib.h"

int main()
{
    greet("World!");  // Replace fmt::print("Hello World!\n) with this line
    return 0;
}

Deviation #3: Usage with the Hello World program fails

c:\Users\rocha\Desktop\VCPKG-TEST\vcpkg\helloworld>cmake --preset=default
cmake --preset=default
Preset CMake variables:

  CMAKE_TOOLCHAIN_FILE="c:\Users\rocha\Desktop\VCPKG-TEST\vcpkg/scripts/buildsystems/vcpkg.cmake"

-- Running vcpkg install
Detecting compiler hash for triplet x64-windows...
All requested packages are currently installed.
Total install time: 1.1 us
The package fmt provides CMake targets:

    find_package(fmt CONFIG REQUIRED)
    target_link_libraries(main PRIVATE fmt::fmt)

    # Or use the header-only version
    find_package(fmt CONFIG REQUIRED)
    target_link_libraries(main PRIVATE fmt::fmt-header-only)

-- Running vcpkg install - done
-- Selecting Windows SDK version 10.0.22000.0 to target Windows 10.0.22631.
CMake Error at C:/Users/rocha/Desktop/VCPKG-TEST/vcpkg/scripts/buildsystems/vcpkg.cmake:859 (_find_package):
  Could not find a package configuration file provided by "my_sample_lib"
  with any of the following names:

    my_sample_libConfig.cmake
    my_sample_lib-config.cmake

  Add the installation prefix of "my_sample_lib" to CMAKE_PREFIX_PATH or set
  "my_sample_lib_DIR" to a directory containing one of the above files.  If
  "my_sample_lib" provides a separate development package or SDK, be sure it
  has been installed.
Call Stack (most recent call first):
  CMakeLists.txt:6 (find_package)


-- Configuring incomplete, errors occurred!
See also "C:/Users/rocha/Desktop/VCPKG-TEST/vcpkg/helloworld/build/CMakeFiles/CMakeOutput.log".

$schema URL is a 404

Hi,

The $schema URL given in https://learn.microsoft.com/en-us/vcpkg/users/manifests is a 404: https://raw.githubusercontent.com/microsoft/vcpkg/master/scripts/vcpkg.schema.json.

"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg/master/scripts/vcpkg.schema.json"

Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

Why to setup vcpkg if its included in VS 2022?

Hey there,

This is confusing for person who do not have a lot of experience with cpp + vs.

Page:
https://learn.microsoft.com/en-us/vcpkg/get_started/get-started-vs?pivots=shell-cmd#1---set-up-vcpkg

It took my a while to understand that:

  • There no need to pull vcpkg since now its comes with VS (yay package manager for cpp in 2023, sorta).
  • And if you do you will get warnings and errors - because VS using UI config path which is not mentioned here at all and
  • For some reason we trying set custom vcpkg path in CMD which will be ignored when you try to build the project from VS ui.

This need to updated to by in sync with current dev of vcpkg integration


Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

How to Create Overlay Port

The docs on vcpkg's git docs folder used to explain how to create an overlay port. Now, all docs point to the Overlay Ports section here, but there is no statement on what is needed in order to create an overlay port.


Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

vcpkg如何添加本地包

Type of issue

Missing information

Description

我要利用cmake混合编译opencv和libtorch,我的电脑上已经安装了opencv和libtorch库,但是我使用vcpkg管理包时,仍然需要重新下载。在使用文档中提供的指令时却报错需要使用经典模式才能使用这个命令,但是文档中建议使用清单模式,并未对经典模式进行深入讲解。而且在visual studio 2022中,我无法对cmake编译附加参数,在解决方案右键属性并未找到附加参数项。请问我应该如何使用vcpkg来管理我本地opencv和libtorch库,在项目中编译并运行?

Page URL

https://learn.microsoft.com/zh-cn/vcpkg/get_started/get-started

Content source URL

https://github.com/Microsoft/vcpkg-docs/blob/main/vcpkg/get_started/get-started.md

Document Version Independent Id

5099d71b-6e6f-f2d6-ab3f-3e8327541245

Article author

@JavierMatosD

Metadata

  • ID: 5099d71b-6e6f-f2d6-ab3f-3e8327541245
  • Service: vcpkg

The CMakePresets.json file presented in the text is incompatible with the CMake shipped with VS 2019 (latest)

In the documentation on how to use vcpkg the CMakePresets.json file uses a version 3 schema.
This schema type is available only with Cmake version 3.21, while the version shipped with VC 2019 is 3.20, and therefore the
subsequent

cmake --preset=default

fails with the error "Invalid preset".

Please either:

  1. Add a pre-requisites section indicating the need for a newer CMake (and link to instructions on how to install a more modern cmake)
  2. Correct the CMakePresets.json file to be compatible with version 2 schema
  3. Arrange for an update to the Cmake in 2019 (and others) so that the json file successfully processes

Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

translate of `https://learn.microsoft.com/zh-cn/vcpkg/get_started/get-started-packaging?pivots=shell-cmd` has some thing wrong

Type of issue

Other (describe below)

Description

The chinse transation at https://learn.microsoft.com/zh-cn/vcpkg/get_started/get-started-packaging?pivots=shell-cmd#4---set-up-the-port-files

首先,在 vcpkg.json 文件夹中创建 custom-overlay\vcpkg-sample-library 的文件,其中包含以下内容:

Should be:

首先,在  custom-overlay\vcpkg-sample-library 文件夹中创建  vcpkg.json 文件,其中包含以下内容

And at https://learn.microsoft.com/zh-cn/vcpkg/get_started/get-started-packaging?pivots=shell-cmd#4---set-up-the-port-files

现在,使用以下内容在 usage 目录中创建 custom-overlay\vcpkg-sample-library 文件:

Shoud be

现在,使用以下内容在 custom-overlay\vcpkg-sample-library 目录中创建 usage 文件:

Look's like there other simular issue on this page. 在xxx文件夹中创建yyy文件,should be 在yyy文件夹中创建xxx文件

Page URL

https://learn.microsoft.com/zh-cn/vcpkg/get_started/get-started-packaging?pivots=shell-cmd

Content source URL

https://github.com/Microsoft/vcpkg-docs/blob/main/vcpkg/get_started/get-started-packaging.md

Document Version Independent Id

f8d2112b-8112-9f5a-7d19-c472e07e739f

Article author

@JavierMatosD

Metadata

  • ID: f8d2112b-8112-9f5a-7d19-c472e07e739f
  • Service: vcpkg

Markdown broken on CMakePresets.json page & confusing explanation

Hi,

On this page here, the Markdown looks broken:

image

If I interpret the broken Markdown correctly, you'd have two entries in CMakePresets.json, one default and one named vcpkg - and both would set "CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"? That somehow doesn't make sense to me. And then you have a CMakeUserPresets.json that sets the environment variable VCPKG_ROOT, but inherits the vcpkg preset from CMakePresets.json (which in turn depends on the environment variable)? It all doesn't really make sense to me, and I think that section would benefit from a better explanation.


Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

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.