Skip to content

Commit 46c3aed

Browse files
authored
remove OpenSSL requirement for testing (#440)
Enable building of gloo_test without requiring OpenSSL to be present. If OpenSSL is not present, SSL/TLS related tests are not linked. If OpenSSL is present, then TLS tests are compiled and linked. Signed-off-by: Nathan Brown <[email protected]>
1 parent fe67c4b commit 46c3aed

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

gloo/test/CMakeLists.txt

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
find_package(OpenSSL 1.1.1 REQUIRED EXACT)
1+
find_package(OpenSSL 1.1.1 EXACT)
22

33
set(GLOO_TEST_SRCS
44
"${CMAKE_CURRENT_SOURCE_DIR}/allgather_test.cc"
@@ -13,7 +13,6 @@ set(GLOO_TEST_SRCS
1313
"${CMAKE_CURRENT_SOURCE_DIR}/gatherv_test.cc"
1414
"${CMAKE_CURRENT_SOURCE_DIR}/main.cc"
1515
"${CMAKE_CURRENT_SOURCE_DIR}/memory_test.cc"
16-
"${CMAKE_CURRENT_SOURCE_DIR}/openssl_utils.cc"
1716
"${CMAKE_CURRENT_SOURCE_DIR}/reduce_test.cc"
1817
"${CMAKE_CURRENT_SOURCE_DIR}/send_recv_test.cc"
1918
)
@@ -29,8 +28,16 @@ if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
2928
list(APPEND GLOO_TEST_LIBRARIES rt)
3029
endif()
3130

31+
if(${OpenSSL_FOUND})
32+
list(APPEND GLOO_TEST_SRCS
33+
"${CMAKE_CURRENT_SOURCE_DIR}/openssl_utils.cc"
34+
)
35+
list(APPEND GLOO_TEST_LIBRARIES OpenSSL::SSL OpenSSL::Crypto)
36+
endif()
37+
38+
3239
add_executable(gloo_test ${GLOO_TEST_SRCS})
33-
target_link_libraries(gloo_test gloo gtest ${GLOO_TEST_LIBRARIES} OpenSSL::SSL OpenSSL::Crypto)
40+
target_link_libraries(gloo_test gloo gtest ${GLOO_TEST_LIBRARIES})
3441

3542
if(MSVC AND USE_LIBUV)
3643
add_custom_command(TARGET gloo_test POST_BUILD

0 commit comments

Comments
 (0)