Added cmake standard branch for disabling the building of tests
@@ -143,6 +143,10 @@ endif (USE_S2N_PQ_CRYTPO)
# end PQ-Crypto
#######################################
+if (BUILD_TESTING)
+ include(CTest)
+ enable_testing()
+
file(GLOB TESTLIB_SRC "tests/testlib/*.c")
file(GLOB TESTLIB_HEADERS "tests/testlib/*.h" "tests/s2n_test.h")
@@ -155,9 +159,6 @@ target_link_libraries(testss2n PUBLIC ${CMAKE_PROJECT_NAME})
file (GLOB TEST_LD_PRELOAD "tests/LD_PRELOAD/*.c")
add_library(allocator_overrides SHARED ${TEST_LD_PRELOAD})
-include(CTest)
-enable_testing()
-
file(GLOB UNITTESTS_SRC "tests/unit/*.c")
foreach(test_case ${UNITTESTS_SRC})
string(REGEX REPLACE ".+\\/(.+)\\.c" "\\1" test_case_name ${test_case})
@@ -186,6 +187,7 @@ add_executable(s2nd "bin/s2nd.c" "bin/echo.c")
target_link_libraries(s2nd ${CMAKE_PROJECT_NAME})
target_include_directories(s2nd PRIVATE api)
target_compile_options(s2nd PRIVATE -std=c99 -D_POSIX_C_SOURCE=200112L)
+endif()
#install the s2n files
install(FILES ${API_HEADERS} DESTINATION "include/" COMPONENT Development)
