From 5b02490fd28af1413301cec608ab87ab0ab8874e Mon Sep 17 00:00:00 2001 From: Kai Buschulte Date: Wed, 29 Jun 2022 15:42:34 +0200 Subject: [PATCH] Introduce a CMake WITH_TESTS option To enable or disable tests in the build step and to circumvent the CUnit build dependency. Signed-off-by: Kai Buschulte --- CMakeLists.txt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 77ef82d1..f19a2c1b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,6 +33,7 @@ option(WITH_BUNDLED_DEPS "Build with bundled dependencies?" ON) option(WITH_TLS "Include SSL/TLS support?" ON) option(WITH_TLS_PSK "Include TLS-PSK support (requires WITH_TLS)?" ON) option(WITH_EC "Include Elliptic Curve support (requires WITH_TLS)?" ON) +option(WITH_TESTS "Enable tests" ON) if (WITH_TLS) find_package(OpenSSL REQUIRED) add_definitions("-DWITH_TLS") @@ -162,6 +163,7 @@ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libmosquittopp.pc" DESTINATION "${CMA # ======================================== # Testing # ======================================== -enable_testing() - -add_subdirectory(test) +if(WITH_TESTS) + enable_testing() + add_subdirectory(test) +endif()