added cmake linking instructions in readme

This commit is contained in:
Donghoon Park 2024-12-14 12:45:24 +09:00
parent 18a90a0a3e
commit 42ba10717a

View File

@ -96,8 +96,30 @@ int main(int argc, char* argv[]) {
## Installation
### Integrate source code to your project
Just copy `nanomodbus.c` and `nanomodbus.h` inside your application codebase.
### CMake project
nanomodbus supports library linking by using cmake.
```cmake
FetchContent_Declare(
nanomodbus
GIT_REPOSITORY https://github.com/debevv/nanoMODBUS
GIT_TAG master # or the version you want
GIT_SHALLOW TRUE
)
FetchContent_MakeAvailable(nanomodbus)
...
add_executable(your_program source_codes)
target_link_libraries(your_program nanomodbus)
```
## API reference
API reference is available in the repository's [GitHub Pages](https://debevv.github.io/nanoMODBUS/nanomodbus_8h.html).