Skip to content

Commit 08cdf57

Browse files
committed
Control tests building via AV_BUILD_TESTS CMake arg
1 parent ed68418 commit 08cdf57

2 files changed

Lines changed: 12 additions & 9 deletions

File tree

CMakeLists.txt

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ set(FFMPEG_PKG_CONFIG_SUFFIX "" CACHE STRING "This suffix uses for FFmpeg compon
1515
set(AV_ENABLE_STATIC On CACHE BOOL "Enable static library build (On)")
1616
set(AV_ENABLE_SHARED On CACHE BOOL "Enable shared library build (On)")
1717
set(AV_BUILD_EXAMPLES On CACHE BOOL "Build example applications (On)")
18+
set(AV_BUILD_TESTS On CACHE BOOL "Build tests (On)")
1819

1920
# Compiler-specific C++ standard activation
2021
#set(CMAKE_CXX_STANDARD 17)
@@ -43,13 +44,15 @@ if (${AV_BUILD_EXAMPLES})
4344
add_subdirectory(example/api2-samples)
4445
endif()
4546

46-
set(CATCH_DIR ${CMAKE_CURRENT_LIST_DIR}/catch2)
47-
if (EXISTS ${CATCH_DIR}/CMakeLists.txt)
48-
enable_testing()
49-
set(CATCH_BUILD_TESTING Off CACHE STRING "")
50-
add_subdirectory(${CATCH_DIR})
51-
add_subdirectory(tests)
52-
else()
53-
message(STATUS "Catch2 not found, testing skipped")
47+
if (AV_BUILD_TESTS)
48+
set(CATCH_DIR ${CMAKE_CURRENT_LIST_DIR}/catch2)
49+
if (EXISTS ${CATCH_DIR}/CMakeLists.txt)
50+
enable_testing()
51+
set(CATCH_BUILD_TESTING Off CACHE STRING "")
52+
add_subdirectory(${CATCH_DIR})
53+
add_subdirectory(tests)
54+
else()
55+
message(STATUS "Catch2 not found, testing skipped")
56+
endif()
5457
endif()
5558

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ You can read the full documentation [here](https://h4tr3d.github.io/avcpp/).
2727
- GCC >= 9.0 (C++17 is required. [See](https://gcc.gnu.org/projects/cxx-status.html#cxx17), GCC from 6.0 may built code, but unchecked)
2828
- CMake (> 3.19)
2929

30-
>
3130
> [!NOTE]
3231
> Oldest versions of the FFmpeg (at least >=2.0) may be successfully built and work but is it not checked for now. Same notes valid for the GCC version from 6.0.
3332
@@ -118,6 +117,7 @@ Refer to CMake documentation for more details that can cover some special cases.
118117
- `AV_ENABLE_STATIC` - Bool, enable static library build, On by default.
119118
- `AV_ENABLE_SHARED` - Bool, enable shared library build, On by default.
120119
- `AV_BUILD_EXAMPLES` - Bool, enable examples build, On by default.
120+
- `AV_BUILD_TESTS` - Bool, enable tests build, On by default.
121121
- C++ related
122122
- `CMAKE_CXX_STANDARD` - Can be defined globally to override default C++ version. C++17 required at least.
123123
- FFmpeg related:

0 commit comments

Comments
 (0)