forked from catchorg/Catch2
Add documentation for installing Catch from the repository
This might prove helpful when the package managers either doesn't have Catch at all, or provides it in obsolete version (Ubuntu 16.04, I am looking at you). Closes #1383
This commit is contained in:
@@ -1,6 +1,12 @@
|
||||
<a id="top"></a>
|
||||
# CMake integration
|
||||
|
||||
**Contents**<br>
|
||||
[CMake target](#cmake-target)<br>
|
||||
[Automatic test registration](#automatic-test-registration)<br>
|
||||
[CMake project options](#cmake-project-options)<br>
|
||||
[Installing Catch2 from git repository](#installing-catch2-from-git-repository)<br>
|
||||
|
||||
Because we use CMake to build Catch2, we also provide a couple of
|
||||
integration points for our users.
|
||||
|
||||
@@ -47,7 +53,7 @@ to your CMake module path.
|
||||
`Catch.cmake` provides function `catch_discover_tests` to get tests from
|
||||
a target. This function works by running the resulting executable with
|
||||
`--list-test-names-only` flag, and then parsing the output to find all
|
||||
existing tests.
|
||||
existing tests.
|
||||
|
||||
#### Usage
|
||||
```cmake
|
||||
@@ -184,6 +190,27 @@ included in the installation. Defaults to `ON`.
|
||||
* `BUILD_TESTING` -- When `ON` and the project is not used as a subproject,
|
||||
Catch2's test binary will be built. Defaults to `ON`.
|
||||
|
||||
|
||||
## Installing Catch2 from git repository
|
||||
|
||||
If you cannot install Catch2 from a package manager (e.g. Ubuntu 16.04
|
||||
provides catch only in version 1.2.0) you might want to install it from
|
||||
the repository instead. Assuming you have enough rights, you can just
|
||||
install it to the default location, like so:
|
||||
```
|
||||
$ git clone https://github.com/catchorg/Catch2.git
|
||||
$ cd Catch2
|
||||
$ cmake -Bbuild -H. -DBUILD_TESTING=OFF
|
||||
$ sudo cmake --build build/ --target install
|
||||
```
|
||||
|
||||
If you do not have superuser rights, you will also need to specify
|
||||
[CMAKE_INSTALL_PREFIX](https://cmake.org/cmake/help/latest/variable/CMAKE_INSTALL_PREFIX.html)
|
||||
when configuring the build, and then modify your calls to
|
||||
[find_package](https://cmake.org/cmake/help/latest/command/find_package.html)
|
||||
accordingly.
|
||||
|
||||
|
||||
---
|
||||
|
||||
[Home](Readme.md#top)
|
||||
|
@@ -15,7 +15,7 @@
|
||||
The simplest way to get Catch2 is to download the latest [single header version](https://raw.githubusercontent.com/catchorg/Catch2/master/single_include/catch2/catch.hpp). The single header is generated by merging a set of individual headers but it is still just normal source code in a header file.
|
||||
|
||||
Alternative ways of getting Catch2 include using your system package
|
||||
manager, or installing it using its CMake package.
|
||||
manager, or installing it using [its CMake package](cmake-integration.md#installing-catch2-from-git-repository).
|
||||
|
||||
The full source for Catch2, including test projects, documentation, and other things, is hosted on GitHub. [http://catch-lib.net](http://catch-lib.net) will redirect you there.
|
||||
|
||||
|
Reference in New Issue
Block a user