From d0177f5fda2f06b4d7402e4aa3551ec7e40d8258 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20M=C3=B6ller?= Date: Fri, 2 Aug 2024 17:35:35 +0200 Subject: [PATCH] include CTest only when testing enabled --- .github/workflows/build.yml | 1 + CMakeLists.txt | 6 ++++-- tests/CMakeLists.txt | 1 - 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c2358ca..f6837d4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -76,6 +76,7 @@ jobs: -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_COMPILE_WARNING_AS_ERROR=ON + -DFAIRYCAM_ENABLE_TESTING=ON ${{ matrix.os == 'windows-latest' && '-DOpenCV_DIR="C:/opencv/opencv/build/"' || '' }} - name: Build diff --git a/CMakeLists.txt b/CMakeLists.txt index 6c406ba..ce1b460 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -58,10 +58,12 @@ target_sources(doctest PUBLIC add_subdirectory(src/) # tests -include(CTest) -enable_testing() if(FAIRYCAM_ENABLE_TESTING) + include(CTest) + enable_testing() + add_subdirectory(tests) + if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC" AND NOT APPLE) add_subdirectory(fuzzer_example) endif() diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 5177c54..a02c68d 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,4 +1,3 @@ - find_package(OpenCV REQUIRED) find_package(Poco REQUIRED Foundation Net)