Skip to content

Commit

Permalink
refs #1 Дополнительная справка по использованию проекта
Browse files Browse the repository at this point in the history
  • Loading branch information
izvolov committed Aug 10, 2019
1 parent 6740d13 commit 3f929a8
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 4 deletions.
35 changes: 33 additions & 2 deletions README.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,11 @@ Contents
6. [doc](#doc)
7. [wandbox](#wandbox)
4. [Examples](#examples)
5. [Tools](#tools)
6. [Bonus](#bonus)
5. [Usage](#usage)
1. [Through the installation](#through-the-installation)
2. [As a submodule](#as-a-submodule)
6. [Tools](#tools)
7. [Bonus](#bonus)

Build
-----
Expand Down Expand Up @@ -176,6 +179,34 @@ cmake -S path/to/sources -B path/to/build/directory -DCMAKE_BUILD_TYPE=Release -
cmake --build path/to/build/directory --target doc
```

Usage
-----

### Through the installation

One of the ways to use the module is to install it into the system.

```shell
cmake --build path/to/build/directory --target install
```

After that, all the libraries from the `Mylib::` namespace can be used from any other project using the [`find_package`](https://cmake.org/cmake/help/v3.14/command/find_package.html) command:

```cmake
find_package(Mylib 1.0 REQUIRED)
add_executable(some_executable some.cpp sources.cpp)
target_link_libraries(some_executable PRIVATE Mylib::myfeature)
```

`Mylib::mylib` library is used for the headers only, and `Mylib::myfeature` library is used when it is also needed to link with the `libmyfeature` library.

### As a submodule

The project can also be used by another project as a submodule using the [`add_subdirectory`](https://cmake.org/cmake/help/v3.14/command/add_subdirectory.html) command:

In this case, libraries `Mylib::myfeature` and `Mylib::mylib` will be available in the same manner.

Tools
-----

Expand Down
35 changes: 33 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,11 @@
6. [doc](#doc)
7. [wandbox](#wandbox)
4. [Примеры](#примеры)
5. [Инструменты](#инструменты)
6. [Бонус](#бонус)
5. [Использование](#использование)
1. [Через установку](#через-установку)
2. [В качестве подмодуля](#в-качестве-подмодуля)
6. [Инструменты](#инструменты)
7. [Бонус](#бонус)

Сборка
------
Expand Down Expand Up @@ -179,6 +182,34 @@ cmake -S путь/к/исходникам -B путь/к/сборочной/ди
cmake --build путь/к/сборочной/директории --target doc
```

Использование
-------------

### Через установку

Один из вариантов использования модуля — установить его в систему.

```shell
cmake --build путь/к/сборочной/директории --target install
```

После этого любой другой проект, вызвав команду [`find_package`](https://cmake.org/cmake/help/v3.14/command/find_package.html), получает возможность использовать все библиотеки из пространства имён `Mylib::`:

```cmake
find_package(Mylib 1.0 REQUIRED)
add_executable(some_executable some.cpp sources.cpp)
target_link_libraries(some_executable PRIVATE Mylib::myfeature)
```

Библиотеку `Mylib::myfeature` нужно подключать тогда, когда необходимо слинковаться с библиотекой `libmyfeature`. Если достаточно заголовков, то тогда стоит использовать библиотеку `Mylib::mylib`.

### В качестве подмодуля

Также проект может быть подключён к другому проекту в качестве подмодуля с помощью команды [`add_subdirectory`](https://cmake.org/cmake/help/v3.14/command/add_subdirectory.html):

В этом случае аналогичным образом будут доступны библиотеки `Mylib::myfeature` и `Mylib::mylib`.

Инструменты
-----------

Expand Down

0 comments on commit 3f929a8

Please sign in to comment.