diff --git a/CMakeLists.txt b/CMakeLists.txt index 7f721499..364c5f5e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -87,6 +87,7 @@ endfunction() add_subdirectory(oqsprov) # Testing +include(CTest) enable_testing() add_subdirectory(test) diff --git a/CONFIGURE.md b/CONFIGURE.md index 626513d3..6fa66003 100644 --- a/CONFIGURE.md +++ b/CONFIGURE.md @@ -97,6 +97,10 @@ void load_oqs_provider(OSSL_LIB_CTX *libctx) { See [`examples/static_oqsprovider.c`](examples/static_oqsprovider.c) for a complete example of how to load oqsprovider using `OSSL_PROVIDER_add_builtin`. +### BUILD_TESTING + +By setting this to "OFF", no tests or examples will be compiled. + ## Convenience build script options For anyone interested in building the complete software stack diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 43ec0ca8..d221343c 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -1,3 +1,7 @@ +if(NOT BUILD_TESTING) + return() +endif() + if (OQS_PROVIDER_BUILD_STATIC) add_executable(example_static_oqsprovider static_oqsprovider.c) target_link_libraries(example_static_oqsprovider PRIVATE ${OPENSSL_CRYPTO_LIBRARY} oqsprovider) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 9c4c0854..50a85d34 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,3 +1,7 @@ +if(NOT BUILD_TESTING) + return() +endif() + include(GNUInstallDirs) if (CMAKE_GENERATOR MATCHES "Visual Studio") set(OQS_PROV_BINARY_DIR ${CMAKE_BINARY_DIR}/lib/${CMAKE_BUILD_TYPE})