Skip to content

Commit 0fae829

Browse files
[cmake] OpenSSL targets are checked
1 parent 8b1cecb commit 0fae829

2 files changed

Lines changed: 13 additions & 3 deletions

File tree

example/CMakeLists.txt

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ foreach(SRC ${ALL_EXAMPLES})
77
get_filename_component(NAME ${SRC} NAME_WLE )
88
# ticker requires
99
if (NAME STREQUAL ticker)
10-
if (TARGET Boost::json)
10+
if (TARGET Boost::json AND OPENSSL_FOUND)
1111
add_executable(boost_cobalt_example_${NAME} ${SRC} )
1212
target_link_libraries(boost_cobalt_example_${NAME} PUBLIC Boost::cobalt Boost::json Boost::url OpenSSL::SSL)
1313
target_compile_definitions(boost_cobalt_example_${NAME} PUBLIC)
@@ -40,8 +40,17 @@ foreach(SRC ${ALL_EXAMPLES})
4040
continue()
4141
endif()
4242

43+
if (NAME STREQUAL http)
44+
if (OPENSSL_FOUND)
45+
add_executable(boost_cobalt_example_${NAME} ${SRC})
46+
target_link_libraries(boost_cobalt_example_${NAME} PUBLIC Boost::cobalt Boost::cobalt::io OpenSSL::SSL)
47+
target_compile_definitions(boost_cobalt_example_${NAME} PUBLIC)
48+
endif()
49+
continue()
50+
endif()
51+
4352
add_executable(boost_cobalt_example_${NAME} ${SRC})
44-
target_link_libraries(boost_cobalt_example_${NAME} PUBLIC Boost::cobalt Boost::cobalt::io OpenSSL::SSL)
53+
target_link_libraries(boost_cobalt_example_${NAME} PUBLIC Boost::cobalt Boost::cobalt::io)
4554
target_compile_definitions(boost_cobalt_example_${NAME} PUBLIC)
4655
if (NAME STREQUAL echo_server)
4756
target_link_libraries(boost_cobalt_example_${NAME} PUBLIC Boost::cobalt::io)

test/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,6 @@ add_executable(boost_cobalt_io_test EXCLUDE_FROM_ALL
3636
io/endpoint.cpp
3737
io/lookup.cpp
3838
)
39-
target_link_libraries(boost_cobalt_io_test Boost::cobalt::io Boost::unit_test_framework OpenSSL::SSL OpenSSL::Crypto Boost::url)
39+
40+
target_link_libraries(boost_cobalt_io_test Boost::cobalt::io Boost::unit_test_framework Boost::url)
4041
add_dependencies(tests boost_cobalt_main boost_cobalt_basic_tests boost_cobalt_static_tests boost_cobalt_experimental boost_cobalt_io_test)

0 commit comments

Comments
 (0)