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 <kai.buschulte@cedalo.com>
pull/2581/head
Kai Buschulte 3 years ago
parent a883bda9c1
commit 5b02490fd2

@ -33,6 +33,7 @@ option(WITH_BUNDLED_DEPS "Build with bundled dependencies?" ON)
option(WITH_TLS "Include SSL/TLS support?" ON) option(WITH_TLS "Include SSL/TLS support?" ON)
option(WITH_TLS_PSK "Include TLS-PSK support (requires WITH_TLS)?" 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_EC "Include Elliptic Curve support (requires WITH_TLS)?" ON)
option(WITH_TESTS "Enable tests" ON)
if (WITH_TLS) if (WITH_TLS)
find_package(OpenSSL REQUIRED) find_package(OpenSSL REQUIRED)
add_definitions("-DWITH_TLS") add_definitions("-DWITH_TLS")
@ -162,6 +163,7 @@ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libmosquittopp.pc" DESTINATION "${CMA
# ======================================== # ========================================
# Testing # Testing
# ======================================== # ========================================
enable_testing() if(WITH_TESTS)
enable_testing()
add_subdirectory(test) add_subdirectory(test)
endif()

Loading…
Cancel
Save