From 01427fedc91efcb0bf887506bf4293043cf9010b Mon Sep 17 00:00:00 2001 From: Lennart Braun Date: Sun, 14 Jun 2020 18:41:48 +0200 Subject: [PATCH] Fix typo `add_directory` -> `add_subdirectory` There is no add_directory command in CMake. --- chapters/install.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chapters/install.md b/chapters/install.md index 7b3574a..9e67c49 100644 --- a/chapters/install.md +++ b/chapters/install.md @@ -8,7 +8,7 @@ If you are the library author, don't make a `Find.cmake` script! Thes ## Add Subproject -A package can include your project in a subdirectory, and then use `add_directory` on the subdirectory. This useful for header-only and quick-to-compile libraries. Note that the install commands may interfere with the parent project, so you can add `EXCLUDE_FROM_ALL` to the `add_subdirectory` command; the targets you explicitly use will still be built. +A package can include your project in a subdirectory, and then use `add_subdirectory` on the subdirectory. This useful for header-only and quick-to-compile libraries. Note that the install commands may interfere with the parent project, so you can add `EXCLUDE_FROM_ALL` to the `add_subdirectory` command; the targets you explicitly use will still be built. In order to support this as a library author, make sure you use `CMAKE_CURRENT_SOURCE_DIR` instead of `PROJECT_SOURCE_DIR` (and likewise for other variables, like binary dirs). You can check `CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME` to only add options or defaults that make sense if this is a project.