diff options
| author | Robert Schumacher <roschuma@microsoft.com> | 2017-03-30 22:36:05 -0700 |
|---|---|---|
| committer | Robert Schumacher <roschuma@microsoft.com> | 2017-03-30 22:36:05 -0700 |
| commit | a6957ebf389648e2b2253e9b18f83d6a1508ab10 (patch) | |
| tree | b7e71b0a3dd989012482176ab65cc6e8afdfe877 /docs | |
| parent | e8441676e3c2ef8e65087306457a7e6ec36dc89f (diff) | |
| download | vcpkg-a6957ebf389648e2b2253e9b18f83d6a1508ab10.tar.gz vcpkg-a6957ebf389648e2b2253e9b18f83d6a1508ab10.zip | |
[examples.md] Add information about how to use header-only libraries from cmake. Improvement suggested by #798.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/EXAMPLES.md | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/docs/EXAMPLES.md b/docs/EXAMPLES.md index 1a2bacc99..73b0d3048 100644 --- a/docs/EXAMPLES.md +++ b/docs/EXAMPLES.md @@ -145,6 +145,27 @@ PS D:\src\cmake-test\build> .\Debug\main.exe *Note: The correct sqlite3.dll is automatically copied to the output folder when building for x86-windows. You will need to distribute this along with your application.* +Unlike other platforms, we do not automatically add the `include\` directory to your compilation line by default. If you're using a library that does not provide CMake integration, you will need to explicitly search for the files and add them yourself using [`find_path()`][1] and [`find_library()`][2]. + +```cmake +# To find and use catch +find_path(CATCH_INCLUDE_DIR catch.hpp) +include_directories(${CATCH_INCLUDE_DIR}) + +# To find and use azure-storage-cpp +find_path(WASTORAGE_INCLUDE_DIR was/blob.h) +find_library(WASTORAGE_LIBRARY wastorage) +include_directories(${WASTORAGE_INCLUDE_DIR}) +link_libraries(${WASTORAGE_LIBRARY}) + +# Note that we recommend using the target-specific directives for a cleaner cmake: +# target_include_directories(main ${LIBRARY}) +# target_link_libraries(main PRIVATE ${LIBRARY}) +``` + +[1]: https://cmake.org/cmake/help/latest/command/find_path.html +[2]: https://cmake.org/cmake/help/latest/command/find_library.html + <a name="example-1-2-c"></a> #### Option C: Other buildsystems |
