Skip to content

Commit

Permalink
style: pre-commit.ci fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci[bot] committed Jun 30, 2023
1 parent ce6518a commit de9fd87
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 28 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,8 @@ this library:

## Install

To use, the most common methods are described here additional methods and details are
available at
[installation][]:
To use, the most common methods are described here additional methods and
details are available at [installation][]:

- All-in-one local header: Copy `CLI11.hpp` from the [most recent
release][github releases] into your include directory, and you are set. This
Expand All @@ -185,7 +184,8 @@ available at
- All-in-one global header: Like above, but copying the file to a shared folder
location like `/opt/CLI11`. Then, the C++ include path has to be extended to
point at this folder. With CMake 3.5+, use `include_directories(/opt/CLI11)`
- For other methods including using CMake or vcpkg and some specific instructions for GCC 8 or WASI see [installation][].
- For other methods including using CMake or vcpkg and some specific
instructions for GCC 8 or WASI see [installation][].

## Usage

Expand Down
52 changes: 28 additions & 24 deletions book/chapters/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
This example uses the single file edition of CLI11. You can download `CLI11.hpp`
from the latest release and put it into the same folder as your source code,
then compile this with C++ enabled. For a larger project, you can just put this
in an include folder and you are set. This is the simplest and most straightforward means of including CLI11 with a project.
in an include folder and you are set. This is the simplest and most
straightforward means of including CLI11 with a project.

## Full edition

Expand Down Expand Up @@ -44,15 +45,17 @@ necessary `lib/cmake/CLI11/CLI11Config.cmake` files, so
`find_package(CLI11 CONFIG REQUIRED)` also works.

If you use conan.io, CLI11 supports that too. CLI11 also supports Meson and
pkg-config if you are not using CMake.
pkg-config if you are not using CMake.

If the CMake option `CLI11_PRECOMPILED` is set then the library is compiled into a static library. This can be used to improve compile times if CLI11 is included in many different parts of a project.
If the CMake option `CLI11_PRECOMPILED` is set then the library is compiled into
a static library. This can be used to improve compile times if CLI11 is included
in many different parts of a project.

### Global Headers

Use `CLI/*.hpp` files stored in a shared folder. You could
check out the git repository to a system-wide folder, for example `/opt/`.
With CMake, you could add to the include path via:
Use `CLI/*.hpp` files stored in a shared folder. You could check out the git
repository to a system-wide folder, for example `/opt/`. With CMake, you could
add to the include path via:

```bash
if(NOT DEFINED CLI11_DIR)
Expand All @@ -72,21 +75,23 @@ linker errors):

#### Global Headers with Target

configuring and installing the project is required
for linking CLI11 to your project in the same way as you would do with any
other external library. With CMake, this step allows using
`find_package(CLI11 CONFIG REQUIRED)` and then using the `CLI11::CLI11` target
when linking. If `CMAKE_INSTALL_PREFIX` was changed during install to a
specific folder like `/opt/CLI11`, then you have to pass
`-DCLI11_DIR=/opt/CLI11` when building your current project. You can also use
[Conan.io](https://conan.io/center/cli11) or [Hunter](https://docs.hunter.sh/en/latest/packages/pkg/CLI11.html). (These are just conveniences to allow
you to use your favorite method of managing packages; it's just header only so
including the correct path and using C++11 is all you really need.)
configuring and installing the project is required for linking CLI11 to your
project in the same way as you would do with any other external library. With
CMake, this step allows using `find_package(CLI11 CONFIG REQUIRED)` and then
using the `CLI11::CLI11` target when linking. If `CMAKE_INSTALL_PREFIX` was
changed during install to a specific folder like `/opt/CLI11`, then you have to
pass `-DCLI11_DIR=/opt/CLI11` when building your current project. You can also
use [Conan.io](https://conan.io/center/cli11) or
[Hunter](https://docs.hunter.sh/en/latest/packages/pkg/CLI11.html). (These are
just conveniences to allow you to use your favorite method of managing packages;
it's just header only so including the correct path and using C++11 is all you
really need.)

#### Using Fetchcontent

If you do not want to add cmake as a submodule or include it with your code the
project can be added using `FetchContent`. This capability requires CMake 3.14+ (or 3.11+ with more work).
project can be added using `FetchContent`. This capability requires CMake 3.14+
(or 3.11+ with more work).

An example CMake file would include:

Expand All @@ -113,11 +118,11 @@ And use
#include <CLI/CLI.hpp>
```

in your project. It is highly recommended that you use the git hash for `GIT_TAG` instead of a
tag or branch, as that will both be more secure, as well as faster to
reconfigure - CMake will not have to reach out to the internet to see if the tag
moved. You can also download just the single header file from the releases using
`file(DOWNLOAD)`.
in your project. It is highly recommended that you use the git hash for
`GIT_TAG` instead of a tag or branch, as that will both be more secure, as well
as faster to reconfigure - CMake will not have to reach out to the internet to
see if the tag moved. You can also download just the single header file from the
releases using `file(DOWNLOAD)`.

### Running tests on the full edition

Expand Down Expand Up @@ -209,7 +214,6 @@ community contributors. If the version is out of date, please
[create an issue or pull request](https://github.com/Microsoft/vcpkg) on the
vcpkg repository.


## Special instructions for GCC 8, Some clang, and WASI

If you are using GCC 8 and using it in C++17 mode with CLI11. CLI11 makes use of
Expand All @@ -233,4 +237,4 @@ them are unknown yet.

If building with WASI it is necessary to add the flag
`-lc-printscan-long-double` to the build to allow long double support. See #841
for more details.
for more details.

0 comments on commit de9fd87

Please sign in to comment.