From b377a138acb8558738d877c78692f65af78ca116 Mon Sep 17 00:00:00 2001 From: Lukas Woodtli Date: Wed, 5 Feb 2025 17:23:53 +0100 Subject: [PATCH] cmake: Add option for disabling unit tests Building the unit tests can now be disabled with a CMake cache variable. This is useful on platforms where `CUnit` is not available or when working on an embedded platform. --- CMakeLists.txt | 9 ++++++--- README.md | 6 ++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7b826fe..f43d66d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,6 +4,9 @@ project(wakaama C) include(wakaama.cmake) -# Enable "test" target -enable_testing() -add_subdirectory(tests) +option(WAKAAMA_UNIT_TESTS "Enable build of Unit Tests" ON) + +if(WAKAAMA_UNIT_TESTS) + enable_testing() + add_subdirectory(tests) +endif() diff --git a/README.md b/README.md index a391056..0119072 100644 --- a/README.md +++ b/README.md @@ -172,6 +172,12 @@ tools/ci/run_ci.sh --run-build pytest -v tests/integration ``` +### Disabling Unit Tests + +Building the unit tests can be controlled by the CMake cache variable: + +- `WAKAAMA_UNIT_TESTS`: The tests are enabled by default + ## Examples There are some example applications provided to test the server, client and bootstrap capabilities of Wakaama.