aboutsummaryrefslogtreecommitdiff
path: root/docs/users/integration.md
diff options
context:
space:
mode:
authorPhil Christensen <philc@microsoft.com>2018-12-06 15:06:28 -0800
committerPhil Christensen <philc@microsoft.com>2018-12-06 15:06:28 -0800
commit7347305e8459fcc78553a9f88196e0d93eb0a8fe (patch)
treeac9eee9ff267c6a71a83249bed7a94f02b00d9a5 /docs/users/integration.md
parented9357a5aafea7192932b5874264bd103fc61255 (diff)
parent63c1b2628e958f8e02356411f032941c0c2f3bbb (diff)
downloadvcpkg-7347305e8459fcc78553a9f88196e0d93eb0a8fe.tar.gz
vcpkg-7347305e8459fcc78553a9f88196e0d93eb0a8fe.zip
Merge branch 'master' of https://github.com/microsoft/vcpkg into dev/philc/3425
Diffstat (limited to 'docs/users/integration.md')
-rw-r--r--docs/users/integration.md26
1 files changed, 24 insertions, 2 deletions
diff --git a/docs/users/integration.md b/docs/users/integration.md
index f1b5014bf..fbaea41d9 100644
--- a/docs/users/integration.md
+++ b/docs/users/integration.md
@@ -35,15 +35,37 @@ cmake ../my/project -DCMAKE_TOOLCHAIN_FILE=C:\vcpkg\scripts\buildsystems\vcpkg.c
```
Projects configured with the Vcpkg toolchain file will have the appropriate Vcpkg folders added to the cmake search paths. This makes all libraries available to be found through `find_package()`, `find_path()`, and `find_library()`.
-See [Example: Using Sqlite](../examples/using-sqlite.md) for a fully worked example using our CMake toolchain.
+See [Installing and Using Packages Example: sqlite](../examples/installing-and-using-packages.md) for a fully worked example using our CMake toolchain.
Note that we do not automatically add ourselves to your compiler include paths. To use a header-only library, simply use `find_path()`, which will correctly work on all platforms:
```cmake
# To find and use catch
-find_path(CATCH_INCLUDE_DIR catch.hpp)
+find_path(CATCH_INCLUDE_DIR NAMES catch.hpp PATH_SUFFIXES catch2)
include_directories(${CATCH_INCLUDE_DIR})
```
+##### Using an environment variable instead of a command line option
+
+The `CMAKE_TOOLCHAIN_FILE` setting simply must be set before the `project()` directive is first called. This means that you can easily read from an environment variable to avoid passing it on the configure line:
+
+```cmake
+if(DEFINED ENV{VCPKG_ROOT} AND NOT DEFINED CMAKE_TOOLCHAIN_FILE)
+ set(CMAKE_TOOLCHAIN_FILE "${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"
+ CACHE STRING "")
+endif()
+
+project(myproject CXX)
+```
+
+##### Using multiple toolchain files
+
+To use an external toolchain file with a project using vcpkg, you can set the cmake variable `VCPKG_CHAINLOAD_TOOLCHAIN_FILE` on the configure line:
+```no-highlight
+cmake ../my/project \
+ -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake \
+ -DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=../my/project/compiler-settings-toolchain.cmake
+```
+
#### Linking NuGet file
We also provide individual VS project integration through a NuGet package. This will modify the project file, so we do not recommend this approach for open source projects.