Skip to content

Commit

Permalink
README updates
Browse files Browse the repository at this point in the history
  • Loading branch information
opokatech committed May 5, 2024
1 parent 7fb2c88 commit 26d60e2
Showing 1 changed file with 37 additions and 3 deletions.
40 changes: 37 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,38 @@ A similar example, but with validation of data can be found [here](src/example/e

This library can be used in a few ways:

A simplest and not recommended way is to copy `src/options` directory to your project and add the files in there to the compilation process either by hand OR by including only this directory via `add_subdirectory`. After all the whole library is just 7 files.
Using cmake the easiest way seems to be using
[FetchContent](https://cmake.org/cmake/help/latest/module/FetchContent.html) mechanism:

Another option is to clone the whole repository and add it via `add_subdirectory`:
```cmake
include(FetchContent)
FetchContent_Declare(
options
GIT_REPOSITORY https://github.com/opokatech/options
GIT_TAG v3.0.0
GIT_SHALLOW TRUE
GIT_PROGRESS TRUE)
FetchContent_MakeAvailable(options)
# ....
add_executable(example my_main.cpp)
target_link_libraries(example PRIVATE options)
```

Another option is to clone the whole repository as a [git submodule](https://git-scm.com/book/en/v2/Git-Tools-Submodules)
and add it via `add_subdirectory`:

```bash
git submodule add https://github.com/opokatech/options externals/options

# optionally checkout some particular version:
cd externals/options
git checkout v3.0.0
```

And then in your CMakeLists.txt:

```cmake
add_subdirectory(external/options) # location of the cloned repository
Expand All @@ -104,7 +133,12 @@ add_executable(example my_main.cpp)
target_link_libraries(example PRIVATE options)
```

## Some notes:
And there is of course the most simple and **not recommended** way:
copying `src/options` directory to your project and adding the files from it to
the compilation process. Either by hand OR by including only the `options` directory
via `add_subdirectory`. After all the whole library consists of just 7 files.

## Some notes

* an option may have an argument or not. An option without an argument is a flag,
* an option is always identified by a long name. A long name is used with 2 dashes in front of it,
Expand Down

0 comments on commit 26d60e2

Please sign in to comment.