1
0
mirror of synced 2024-11-05 12:38:54 +01:00

Merge branch 'lenerd/fix-typos' into 'master'

Fix typo `add_directory` -> `add_subdirectory`

See merge request CLIUtils/modern-cmake!35
This commit is contained in:
Henry Schreiner 2020-06-15 13:22:40 +00:00
commit 7f255e6648

View File

@ -8,7 +8,7 @@ If you are the library author, don't make a `Find<mypackage>.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.