Skip to content

Commit 5953b8c

Browse files
author
Dean Michael Berris
committed
Re-ordering OpenSSL library linking in preparation for non-required OpenSSL.
1 parent 7988d51 commit 5953b8c

File tree

1 file changed

+23
-10
lines changed

1 file changed

+23
-10
lines changed

libs/network/test/CMakeLists.txt

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
include_directories(${CPP-NETLIB_SOURCE_DIR})
77
find_package( Boost 1.41.0 COMPONENTS unit_test_framework system regex date_time thread filesystem )
88
find_package( OpenSSL )
9-
include_directories(${OPENSSL_INCLUDE_DIR})
9+
if (OPENSSL_FOUND)
10+
include_directories(${OPENSSL_INCLUDE_DIR}})
11+
endif()
1012
find_package( Threads )
1113
set(Boost_USE_STATIC_LIBS ON)
1214
set(Boost_USE_MULTITHREADED ON)
@@ -21,15 +23,26 @@ if (Boost_FOUND)
2123
add_executable(cpp-netlib-http_message_test http_message_test.cpp)
2224
add_executable(cpp-netlib-message_transform_test message_transform_test.cpp)
2325
add_executable(cpp-netlib-url_test url_test.cpp)
24-
target_link_libraries(cpp-netlib-hello_world ${Boost_SYSTEM_LIBRARY} ${Boost_REGEX_LIBRARY} ${Boost_DATE_TIME_LIBRARY} ${Boost_THREAD_LIBRARY} ${CMAKE_THREAD_LIBS_INIT} ${OPENSSL_LIBRARIES} )
25-
target_link_libraries(cpp-netlib-http_1_0_test ${Boost_LIBRARIES} ${OPENSSL_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${OPENSSL_LIBRARIES})
26-
target_link_libraries(cpp-netlib-http_1_1_test ${Boost_LIBRARIES} ${OPENSSL_LIBRARIES})
27-
target_link_libraries(cpp-netlib-http_message_test ${Boost_LIBRARIES} ${OPENSSL_LIBRARIES})
28-
target_link_libraries(cpp-netlib-message_test ${Boost_LIBRARIES} ${OPENSSL_LIBRARIES})
29-
target_link_libraries(cpp-netlib-message_transform_test ${Boost_LIBRARIES} ${OPENSSL_LIBRARIES})
30-
target_link_libraries(cpp-netlib-http_localhost_tests ${Boost_LIBRARIES} ${OPENSSL_LIBRARIES})
31-
target_link_libraries(cpp-netlib-https_localhost_tests ${Boost_LIBRARIES} ${OPENSSL_LIBRARIES})
32-
target_link_libraries(cpp-netlib-url_test ${Boost_LIBRARIES} ${OPENSSL_LIBRARIES})
26+
target_link_libraries(cpp-netlib-hello_world ${Boost_SYSTEM_LIBRARY} ${Boost_REGEX_LIBRARY} ${Boost_DATE_TIME_LIBRARY} ${Boost_THREAD_LIBRARY} ${CMAKE_THREAD_LIBS_INIT})
27+
target_link_libraries(cpp-netlib-http_1_0_test ${Boost_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
28+
target_link_libraries(cpp-netlib-http_1_1_test ${Boost_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
29+
target_link_libraries(cpp-netlib-http_message_test ${Boost_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
30+
target_link_libraries(cpp-netlib-message_test ${Boost_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
31+
target_link_libraries(cpp-netlib-message_transform_test ${Boost_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
32+
target_link_libraries(cpp-netlib-http_localhost_tests ${Boost_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
33+
target_link_libraries(cpp-netlib-https_localhost_tests ${Boost_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
34+
target_link_libraries(cpp-netlib-url_test ${Boost_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
35+
if (OPENSSL_FOUND)
36+
target_link_libraries(cpp-netlib-hello_world ${OPENSSL_LIBRARIES})
37+
target_link_libraries(cpp-netlib-http_1_0_test ${OPENSSL_LIBRARIES})
38+
target_link_libraries(cpp-netlib-http_1_1_test ${OPENSSL_LIBRARIES})
39+
target_link_libraries(cpp-netlib-http_message_test ${OPENSSL_LIBRARIES} )
40+
target_link_libraries(cpp-netlib-message_test ${OPENSSL_LIBRARIES} )
41+
target_link_libraries(cpp-netlib-message_transform_test ${OPENSSL_LIBRARIES} )
42+
target_link_libraries(cpp-netlib-http_localhost_tests ${OPENSSL_LIBRARIES} )
43+
target_link_libraries(cpp-netlib-https_localhost_tests ${OPENSSL_LIBRARIES} )
44+
target_link_libraries(cpp-netlib-url_test ${OPENSSL_LIBRARIES} )
45+
endif()
3346
set_target_properties(cpp-netlib-hello_world cpp-netlib-http_1_0_test cpp-netlib-http_1_1_test cpp-netlib-message_test cpp-netlib-http_message_test cpp-netlib-message_transform_test cpp-netlib-http_localhost_tests cpp-netlib-https_localhost_tests cpp-netlib-url_test PROPERTIES RUNTIME_OUTPUT_DIRECTORY ../../../build/tests)
3447
add_test(cpp-netlib-hello_world python httplib_acceptance.py ../../../build/tests/cpp-netlib-hello_world ../../../build/tests/cpp-netlib-hello_world.passed)
3548
add_test(cpp-netlib-http_1_0_test ../../../build/tests/cpp-netlib-http_1_0_test)

0 commit comments

Comments
 (0)