This commit is contained in:
parent
cb7b576edb
commit
88c8ce2808
@ -34,35 +34,19 @@ target_include_directories(${PROJECT_NAME} PRIVATE
|
||||
${CMAKE_CURRENT_BINARY_DIR}/src/autogen
|
||||
src)
|
||||
|
||||
# Helper function to create OpenSSL targets for cross-compilation
|
||||
function(ensure_openssl_targets)
|
||||
if(NOT TARGET OpenSSL::SSL)
|
||||
find_library(OPENSSL_SSL_LIB NAMES ssl
|
||||
PATHS /usr/local/lib /usr/local/lib64
|
||||
NO_DEFAULT_PATH)
|
||||
find_library(OPENSSL_CRYPTO_LIB NAMES crypto
|
||||
PATHS /usr/local/lib /usr/local/lib64
|
||||
NO_DEFAULT_PATH)
|
||||
|
||||
if(NOT OPENSSL_SSL_LIB OR NOT OPENSSL_CRYPTO_LIB)
|
||||
message(FATAL_ERROR "OpenSSL libraries not found")
|
||||
endif()
|
||||
|
||||
add_library(OpenSSL::Crypto STATIC IMPORTED)
|
||||
set_target_properties(OpenSSL::Crypto PROPERTIES
|
||||
IMPORTED_LOCATION ${OPENSSL_CRYPTO_LIB}
|
||||
INTERFACE_INCLUDE_DIRECTORIES /usr/local/include)
|
||||
|
||||
add_library(OpenSSL::SSL STATIC IMPORTED)
|
||||
set_target_properties(OpenSSL::SSL PROPERTIES
|
||||
IMPORTED_LOCATION ${OPENSSL_SSL_LIB}
|
||||
INTERFACE_INCLUDE_DIRECTORIES /usr/local/include
|
||||
INTERFACE_LINK_LIBRARIES OpenSSL::Crypto)
|
||||
endif()
|
||||
endfunction()
|
||||
# Find packages - handle OpenSSL for cross-compilation
|
||||
if(NOT TARGET OpenSSL::SSL)
|
||||
find_library(SSL_LIB ssl PATHS /usr/local/lib NO_DEFAULT_PATH REQUIRED)
|
||||
find_library(CRYPTO_LIB crypto PATHS /usr/local/lib NO_DEFAULT_PATH REQUIRED)
|
||||
|
||||
add_library(OpenSSL::Crypto STATIC IMPORTED)
|
||||
set_property(TARGET OpenSSL::Crypto PROPERTY IMPORTED_LOCATION ${CRYPTO_LIB})
|
||||
|
||||
add_library(OpenSSL::SSL STATIC IMPORTED)
|
||||
set_property(TARGET OpenSSL::SSL PROPERTY IMPORTED_LOCATION ${SSL_LIB})
|
||||
target_link_libraries(OpenSSL::SSL INTERFACE OpenSSL::Crypto)
|
||||
endif()
|
||||
|
||||
# Find packages
|
||||
ensure_openssl_targets()
|
||||
find_package(Drogon CONFIG REQUIRED)
|
||||
find_package(nlohmann_json REQUIRED)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user