Skip to content

Commit

Permalink
icm auto option for ssl
Browse files Browse the repository at this point in the history
  • Loading branch information
iboB committed Oct 12, 2024
1 parent 08f685d commit f6b780b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
9 changes: 6 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ include(./get_cpm.cmake)

#######################################
# cmake lib
CPMAddPackage(gh:iboB/[email protected].1)
CPMAddPackage(gh:iboB/[email protected].2)

set(CMAKE_MODULE_PATH
${CMAKE_MODULE_PATH}
Expand All @@ -20,14 +20,15 @@ set(CMAKE_MODULE_PATH
include(icm_dev_mode)
include(icm_add_lib)
include(icm_bigobj)
include(icm_option)

#######################################
# options

option(FISHNETS_STATIC "fishnets: build as static lib" OFF)
option(FISHNETS_BUILD_TESTS "fishnets: build tests" ${ICM_DEV_MODE})
option(FISHNETS_BUILD_EXAMPLES "fishnets: build examples" ${ICM_DEV_MODE})
option(FISHNETS_SSL "fisnets: add ssl and secure websocket support" ON)
icm_auto_option(FISHNETS_SSL "fisnets: add ssl and secure websocket support" AUTO)

if(ICM_DEV_MODE)
mark_as_advanced(FISHNETS_BUILD_TESTS FISHNETS_BUILD_EXAMPLES)
Expand All @@ -39,8 +40,10 @@ CPMAddPackage(gh:iboB/[email protected])
CPMAddPackage(gh:iboB/[email protected])

find_package(Threads REQUIRED)
set(fishnetsHaveSsl FALSE)
if(FISHNETS_SSL)
find_package(OpenSSL REQUIRED)
find_package(OpenSSL ${FISHNETS_SSL_REQUIRED})
set(fishnetsHaveSsl TRUE)
endif()

if(NOT TARGET Boost::boost)
Expand Down
2 changes: 1 addition & 1 deletion code/fishnets/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ target_link_libraries(fishnets
itlib::itlib
)

if(FISHNETS_SSL)
if(fishnetsHaveSsl)
target_link_libraries(fishnets PRIVATE
OpenSSL::SSL
OpenSSL::Crypto
Expand Down
2 changes: 1 addition & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ target_link_libraries(fishnets-TestNullSSLSettings PUBLIC fishnets)

macro(fishnets_dual_test test)
add_doctest_lib_test(${test}-ws fishnets ${ARGN} LIBRARIES xec::xec fishnets-TestNullSSLSettings)
if(FISHNETS_SSL)
if(fishnetsHaveSsl)
add_doctest_lib_test(${test}-ssl fishnets ${ARGN} LIBRARIES xec::xec fishnets-TestSSLSettings)
endif()
endmacro()
Expand Down

0 comments on commit f6b780b

Please sign in to comment.