Skip to content

Commit 7fa2d80

Browse files
committed
udpated docs on find_package usage
1 parent 2db6ba8 commit 7fa2d80

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,35 @@ target_link_libraries(MY_TARGET ut::target_name)
7070

7171
A special target `ut::ut` is also available, combining all of the above.
7272

73+
### Using with `find_package`
74+
75+
If you prefer, you can install the library and import it into a project via
76+
`find_package` like so:
77+
78+
79+
```sh
80+
git clone github.com/dk949/libut
81+
cd libut
82+
# use cmake --list-presets for a list of available presets
83+
cmake --preset local -DCMAKE_INSTALL_PREFIX=./libut-install
84+
cmake --install build
85+
```
86+
87+
Then in your cmake file:
88+
89+
```cmake
90+
set(ENV{ut_DIR} /path/to/libut/libut-install)
91+
find_package(ut REQUIRED)
92+
target_link_libraries(MY_TARGET ut::ut_target_name)
93+
```
94+
95+
> [!NOTE]
96+
> When using find_package, all target names above (except ut::ut) are prefixed
97+
> with`ut_`.
98+
>
99+
> The prefixed targets are also available when using `FetchContent`, so for
100+
> a config that could use either, use the prefixed targets.
101+
73102
## Testing
74103

75104
Test can be ran using Catch2

0 commit comments

Comments
 (0)