diff options
| author | Robert Schumacher <roschuma@microsoft.com> | 2017-04-27 15:24:39 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-04-27 15:24:39 -0700 |
| commit | 13d6e660a30d59a598d43d97d9d905e3cc2fdb6d (patch) | |
| tree | fda9b49d1172c2aa8946f6c270bd0a2411adb320 | |
| parent | 68726d313f59d2343edf8809b32533567428e3a0 (diff) | |
| parent | 369c60c0f95c351b3be61c16fe9ff6c6fbc807af (diff) | |
| download | vcpkg-13d6e660a30d59a598d43d97d9d905e3cc2fdb6d.tar.gz vcpkg-13d6e660a30d59a598d43d97d9d905e3cc2fdb6d.zip | |
Merge pull request #997 from eco/open-folder-doc
Document how to specify CMAKE_TOOLCHAIN_FILE when using VS2017 Open Folder
| -rw-r--r-- | docs/EXAMPLES.md | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/docs/EXAMPLES.md b/docs/EXAMPLES.md index 7331bd81c..2463d321f 100644 --- a/docs/EXAMPLES.md +++ b/docs/EXAMPLES.md @@ -101,7 +101,31 @@ To remove the integration for your user, you can use `.\vcpkg integrate remove`. The best way to use installed libraries with cmake is via the toolchain file `scripts\buildsystems\vcpkg.cmake`. To use this file, you simply need to add it onto your CMake command line as `-DCMAKE_TOOLCHAIN_FILE=D:\src\vcpkg\scripts\buildsystems\vcpkg.cmake`. -Let's first make a simple CMake project with a main file. +Alternatively, if you are using CMake through Open Folder with Visual Studio 2017 you can define `CMAKE_TOOLCHAIN_FILE` by adding a `variables` section to your `CMakeSettings.json` configurations: + +```json +{ + "configurations": [ + { + "name": "x86-Debug", + "generator": "Visual Studio 15 2017", + "configurationType" : "Debug", + "buildRoot": "${env.LOCALAPPDATA}\\CMakeBuild\\${workspaceHash}\\build\\${name}", + "cmakeCommandArgs": "", + "buildCommandArgs": "-m -v:minimal" + "variables": [ + { + "name": "CMAKE_TOOLCHAIN_FILE", + "value": "D:\\src\\vcpkg\\scripts\\buildsystems\\vcpkg.cmake" + } + ] + }, + // also add it to the other configurations... + ] +} +``` + +Now let's make a simple CMake project with a main file. ```cmake # CMakeLists.txt cmake_minimum_required(VERSION 3.0) |
