readme: add building into project with cmake section

Modifications to original commit:

* Minor reword of instructions

Signed-off-by: Vanya A. Sergeev <v@sergeev.io>
This commit is contained in:
HopeCollector
2024-01-19 14:28:36 +00:00
committed by Vanya A. Sergeev
parent aca6815e68
commit b5e53e6b3a

View File

@@ -471,6 +471,21 @@ $ gcc myprog.c -lperiphery -o myprog
Otherwise, additional include (`-I`) and library (`-L`) paths may be required.
## Building c-periphery into another project with CMake
Add to project's `CMakeLists.txt`:
```cmake
find_package(periphery REQUIRED)
# If package is installed locally, specify search path explicitly:
# find_package(periphery REQUIRED PATHS <path to install/dir/lib/cmake>)
...
add_executable(YOUR_TARGET src/myprog.c)
target_link_libraries(YOUR_TARGET PRIVATE periphery::periphery)
```
## Documentation
`man` page style documentation for each interface wrapper is available in [docs](docs/) folder.