Skip to content

Commit 43a9268

Browse files
committed
improve readme; add option to disable test execution on build
1 parent 3b9c42b commit 43a9268

3 files changed

Lines changed: 17 additions & 6 deletions

File tree

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ endif(DOXYGEN_FOUND)
2525
add_subdirectory(src)
2626

2727
include(CTest)
28-
set(CMAKE_CTEST_ARGUMENTS "--verbose")
2928
if(BUILD_TESTING)
29+
set(CMAKE_CTEST_ARGUMENTS "--verbose")
3030
add_subdirectory(test)
3131
endif()

README.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,17 @@ To use this library in you project, you can install it in the following ways:
2222
# Add artifactory repository as remote:
2323
conan remote add jothepro-conan-public https://jothepro.jfrog.io/artifactory/api/conan/conan-public
2424
# Install a release of `mylibrary`
25-
conan install --remote jothepro-conan-public mylibrary/0.1.7@jothepro/stable --update
26-
# Pre-Releases are available in the `beta` channel
27-
conan install --remote jothepro-conan-public mylibrary/0.1.8@jothepro/beta --update
25+
conan install --remote jothepro-conan-public mylibrary/0.1.7@jothepro/stable
26+
```
27+
28+
If you don't want to build & run tests when building from source, set the [CONAN_RUN_TESTS](https://docs.conan.io/en/latest/reference/env_vars.html#conan-run-tests) variable:
29+
```sh
30+
install --remote jothepro-conan-public mylibrary/0.1.7@jothepro/stable -e CONAN_RUN_TESTS=0
31+
```
32+
33+
Pre-Releases are available in the `beta` channel:
34+
```sh
35+
conan install --remote jothepro-conan-public mylibrary/0.1.8@jothepro/beta
2836
```
2937

3038

@@ -102,7 +110,7 @@ This template uses [Github Actions](https://github.com/features/actions) for aut
102110
103111
```
104112

105-
1. Root CMakeLists.txt. Includes Library Sources (11) and unit tests (18).
113+
1. Root `CMakeLists.txt`. Includes Library Sources (11) and unit tests (18).
106114
2. Doxyfile for documentation generation. `CMakeLists.txt` (1) defines a target `doxygen` to build the documentation.
107115
3. License file.
108116
4. The Readme you currently read.

conanfile.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,12 @@ class MyLibraryConan(ConanFile):
3737

3838
def build(self):
3939
cmake = CMake(self)
40+
if not tools.get_env("CONAN_RUN_TESTS", True):
41+
cmake.definitions["BUILD_TESTING"] = "OFF"
4042
cmake.configure()
4143
cmake.build()
42-
cmake.test()
44+
if tools.get_env("CONAN_RUN_TESTS", True):
45+
cmake.test()
4346
cmake.install()
4447

4548
def package_info(self):

0 commit comments

Comments
 (0)