Skip to content

Commit

Permalink
Fix #440: disable tests and examples using BUILD_TESTING. (#442)
Browse files Browse the repository at this point in the history
By providing cmake with `BUILD_TESTING=OFF`, no test or example will be built.

`BUILD_TESTING` is `ON` by default, since we are using [`enable_testing`] along with `CTest`.


[`enable_testing`]: https://cmake.org/cmake/help/latest/command/enable_testing.html

Signed-off-by: thb-sb <[email protected]>
  • Loading branch information
thomas authored Jun 26, 2024
1 parent e3a8d62 commit 8f37521
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ endfunction()
add_subdirectory(oqsprov)

# Testing
include(CTest)
enable_testing()
add_subdirectory(test)

Expand Down
4 changes: 4 additions & 0 deletions CONFIGURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
4 changes: 4 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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})
Expand Down

0 comments on commit 8f37521

Please sign in to comment.