Skip to content

Commit

Permalink
tests: Create option in cmake to disable tests
Browse files Browse the repository at this point in the history
Signed-off-by: Ben Collins <[email protected]>
  • Loading branch information
benmcollins committed Dec 24, 2024
1 parent eb4f9f4 commit d5eead9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
- ../configure
- make
- rm -rf *
- cmake ..
- cmake -DWITH_TESTS=NO ..
- make

- name: "CMake Build"
Expand Down
10 changes: 7 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ option(WITH_GNUTLS "Whether to use GnuTLS (default is auto detect)" ON)

# option(WITH_MBEDTLS "Enable using MBedTLS (default is disabled)" ON)

option(WITH_TESTS "Whether to build and run the testsuite (default is ON)" ON)

# Need at least one of these
if (WITH_GNUTLS)
if (NOT GNUTLS_AUTO)
Expand All @@ -51,9 +53,6 @@ if (WITH_OPENSSL)
pkg_check_modules(OPENSSL openssl>=1.1.0 ${OPENSSL_REQUIRED})
endif()

# Tests and coverage depend on this, but optional
pkg_check_modules(CHECK check>=0.9.10 IMPORTED_TARGET)

add_library(jwt SHARED)
add_library(jwt_static STATIC)
set_target_properties(jwt_static PROPERTIES OUTPUT_NAME jwt)
Expand Down Expand Up @@ -183,6 +182,11 @@ endif()

option(ENABLE_COVERAGE "Enable code coverage rules" OFF)

# Tests and coverage depend on this, but optional
if (WITH_TESTS)
pkg_check_modules(CHECK check>=0.9.10 IMPORTED_TARGET)
endif()

if (CHECK_FOUND)
include(CTest)

Expand Down

0 comments on commit d5eead9

Please sign in to comment.