Skip to content

Commit b69d45f

Browse files
committed
Update README.md
1 parent 3ab13f2 commit b69d45f

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,28 @@ cpp_library_setup(
197197
- Version is automatically detected from git tags (see [Version Tagging](#version-tagging)).
198198
- Examples using doctest should include `test` in the filename to be visible in the [C++ TestMate](https://marketplace.visualstudio.com/items?itemName=matepek.vscode-catch2-test-adapter) extension for VS Code test explorer.
199199

200+
### Target Naming
201+
202+
For `project(your-library)`, `cpp_library_setup` will create a target called `your-library`.
203+
204+
The utility will additionally create an alias target based on the `NAMESPACE` option: `your_namespace::your-library`.
205+
206+
If your project name starts with the namespace followed by a dash, the namespace in the project name is stripped from the alias target:
207+
208+
```cmake
209+
cmake_minimum_required(VERSION 3.20)
210+
project(namespace-library)
211+
212+
# ... CPM setup ...
213+
214+
cpp_library_setup(
215+
NAMESPACE namespace
216+
# ...
217+
)
218+
```
219+
220+
Results in `namespace-library` and `namespace::library` targets.
221+
200222
### Path Conventions
201223

202224
The template uses consistent path conventions for all file specifications:

0 commit comments

Comments
 (0)