microsoft / microsoft/vscode-cmake-tools

Unable to use vcpkg

Open
#443 15 comments 13 reactions 0 assignees View on GitHub
blocked-by-external bug Feature: configure
Dominant language
TypeScript
Stars
1.7k
Forks
546
Avg merge
2d 16h
Merged PRs (30d)
32

Description

Hello,

I am trying to use vcpkg on Ubuntu with vscode.
After I install the vcpkg, did the bootstrap and run `sudo ./vcpkg integrate install`. The console output:
```
Applied user-wide integration for this vcpkg root.

CMake projects should use: "-DCMAKE_TOOLCHAIN_FILE=/path_of_vcpkg/vcpkg/scripts/buildsystems/vcpkg.cmake"

```
Then, I install a library `vckpg install cppzmq`. The console output is:
```
...
The package cppzmq:x64-linux provides CMake targets:

find_package(cppzmq CONFIG REQUIRED)
target_link_libraries(main PRIVATE cppzmq libzmq cppzmq-static libzmq-static)
```
Based on the first output, i edited the vscode user settings file `settings.json` by adding following entry:
```
"cmake.configureArgs": [
"-DCMAKE_TOOLCHAIN_FILE=/path_of_vcpkg/vcpkg/scripts/buildsystems/vcpkg.cmake"
]
```
After build, I got error:
```
[cmake] CMake Error at CMakeLists.txt:169 (find_package):
[cmake] Could not find a package configuration file provided by "cppzmq" with any
[cmake] of the following names:
[cmake]
[cmake] cppzmqConfig.cmake
[cmake] cppzmq-config.cmake
[cmake]
[cmake] Add the installation prefix of "cppzmq" to CMAKE_PREFIX_PATH or set
[cmake] "cppzmq_DIR" to a directory containing one of the above files. If "cppzmq"
[cmake] provides a separate development package or SDK, be sure it has been
[cmake] installed.
[cmake]
[cmake]
[cmake] Configuring incomplete, errors occurred!
[cmake] See also "/home/rong/projects/SGX/code/MajordomoServer/build/CMakeFiles/CMakeOutput.log".
[cms-driver] Error during CMake configure: [cmake-server] Configuration failed.
```
After a bit search, I can see a file 'cppzmqConfig.cmake' is in `path_of_vcpkg/vcpkg/buildtrees/cppzmq/x64-linux-dbg/cppzmqConfig.cmake`, So I tried to edit settings.json
```
"cmake.configureArgs": [
"-DCMAKE_TOOLCHAIN_FILE=/path_of_vcpkg/vcpkg/scripts/buildsystems/vcpkg.cmake",
"-DCMAKE_PREFIX_PATH=path_of_vcpkg/vcpkg/buildtrees/cppzmq/x64-linux-dbg/cppzmqConfig.cmake"
]
```

But the same error still pops up.

Based on https://docs.microsoft.com/en-us/cpp/vcpkg, The only thing I need is adding "-DCMAKE_TOOLCHAIN_FILE" when configuring 'cmake'.
Any suggestions about how to configure CMAKE_TOOLCHAIN_FILE correctly by using CMake Tools plugin?

Environment:
Ubuntu 16.04 LTS
VSCode 1.23.1
VSCode plugin CMake Tools 0.11.1
VSCode plugin CMake 0.0.17
CMake version: 3.11.1
Clang 7.0
vcpkg 0.0.113

Contributor guide

Open the contributing guide

Research direction

Start with the reported cmake.configureArgs in settings.json and the find_package call at CMakeLists.txt:169, then review how the CMake Tools plugin passes the vcpkg CMAKE_TOOLCHAIN_FILE during configuration. Reproduce the cppzmq lookup failure on the stated Ubuntu and plugin versions; done means CMake configures successfully and finds cppzmq through the supported toolchain setting.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, cpp, vscode
Domain
build-system, developer-experience
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.