Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make FindPTLS cmake aware of MBEDTLS flag #1810

Merged
merged 1 commit into from
Dec 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 59 additions & 29 deletions cmake/FindPTLS.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,30 @@

if (PICOQUIC_FETCH_PTLS)
set(PTLS_CORE_LIBRARY picotls-core)
set(PTLS_OPENSSL_LIBRARY picotls-openssl)
set(PTLS_MINICRYPTO_LIBRARY picotls-minicrypto)
if(WITH_FUSION)
set(PTLS_FUSION_LIBRARY picotls-fusion)
set(PTLS_WITH_FUSION_DEFAULT ON)
set(PTLS_LIBRARIES ${PTLS_CORE_LIBRARY} ${PTLS_OPENSSL_LIBRARY} ${PTLS_FUSION_LIBRARY} ${PTLS_MINICRYPTO_LIBRARY})

if(WITH_MBEDTLS)
find_package_handle_standard_args(PTLS REQUIRED_VARS
PTLS_CORE_LIBRARY
PTLS_MINICRYPTO_LIBRARY
PTLS_INCLUDE_DIR)

if(PTLS_FOUND)
set(PTLS_LIBRARIES ${PTLS_CORE_LIBRARY} ${PTLS_MINICRYPTO_LIBRARY})
set(PTLS_INCLUDE_DIRS ${PTLS_INCLUDE_DIR})
set(PTLS_WITH_FUSION_DEFAULT OFF)
endif()
else()
set(PTLS_WITH_FUSION_DEFAULT OFF)
set(PTLS_LIBRARIES ${PTLS_CORE_LIBRARY} ${PTLS_OPENSSL_LIBRARY} ${PTLS_MINICRYPTO_LIBRARY})
unset(PTLS_FUSION_LIBRARY)
set(PTLS_OPENSSL_LIBRARY picotls-openssl)
if(WITH_FUSION)
set(PTLS_FUSION_LIBRARY picotls-fusion)
set(PTLS_WITH_FUSION_DEFAULT ON)
set(PTLS_LIBRARIES ${PTLS_CORE_LIBRARY} ${PTLS_OPENSSL_LIBRARY} ${PTLS_FUSION_LIBRARY} ${PTLS_MINICRYPTO_LIBRARY})
else()
set(PTLS_WITH_FUSION_DEFAULT OFF)
set(PTLS_LIBRARIES ${PTLS_CORE_LIBRARY} ${PTLS_OPENSSL_LIBRARY} ${PTLS_MINICRYPTO_LIBRARY})
unset(PTLS_FUSION_LIBRARY)
endif()
endif()
set(PTLS_INCLUDE_DIRS ${picotls_SOURCE_DIR}/include)
else(PICOQUIC_FETCH_PTLS)
Expand All @@ -25,39 +39,55 @@ else(PICOQUIC_FETCH_PTLS)
set(PTLS_HINTS ${PTLS_PREFIX}/lib ${CMAKE_BINARY_DIR}/../picotls ../picotls)

find_library(PTLS_CORE_LIBRARY picotls-core HINTS ${PTLS_HINTS})
find_library(PTLS_OPENSSL_LIBRARY picotls-openssl HINTS ${PTLS_HINTS})
find_library(PTLS_FUSION_LIBRARY picotls-fusion HINTS ${PTLS_HINTS})
find_library(PTLS_MINICRYPTO_LIBRARY picotls-minicrypto HINTS ${PTLS_HINTS})

if(NOT PTLS_FUSION_LIBRARY)
include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set PTLS_FOUND to TRUE
# if all listed variables are TRUE
if(WITH_MBEDTLS)
find_package_handle_standard_args(PTLS REQUIRED_VARS
PTLS_CORE_LIBRARY
PTLS_OPENSSL_LIBRARY
PTLS_MINICRYPTO_LIBRARY
PTLS_INCLUDE_DIR)

if(PTLS_FOUND)
set(PTLS_LIBRARIES ${PTLS_CORE_LIBRARY} ${PTLS_OPENSSL_LIBRARY} ${PTLS_MINICRYPTO_LIBRARY})
set(PTLS_LIBRARIES ${PTLS_CORE_LIBRARY} ${PTLS_MINICRYPTO_LIBRARY})
set(PTLS_INCLUDE_DIRS ${PTLS_INCLUDE_DIR})
set(PTLS_WITH_FUSION_DEFAULT OFF)
endif()
else()
include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set PTLS_FOUND to TRUE
# if all listed variables are TRUE
find_package_handle_standard_args(PTLS REQUIRED_VARS
PTLS_CORE_LIBRARY
PTLS_OPENSSL_LIBRARY
PTLS_FUSION_LIBRARY
PTLS_MINICRYPTO_LIBRARY
PTLS_INCLUDE_DIR)
find_library(PTLS_OPENSSL_LIBRARY picotls-openssl HINTS ${PTLS_HINTS})
find_library(PTLS_FUSION_LIBRARY picotls-fusion HINTS ${PTLS_HINTS})

if(PTLS_FOUND)
set(PTLS_LIBRARIES ${PTLS_CORE_LIBRARY} ${PTLS_OPENSSL_LIBRARY} ${PTLS_FUSION_LIBRARY} ${PTLS_MINICRYPTO_LIBRARY})
set(PTLS_INCLUDE_DIRS ${PTLS_INCLUDE_DIR})
set(PTLS_WITH_FUSION_DEFAULT ON)
if(NOT PTLS_FUSION_LIBRARY)
include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set PTLS_FOUND to TRUE
# if all listed variables are TRUE

find_package_handle_standard_args(PTLS REQUIRED_VARS
PTLS_CORE_LIBRARY
PTLS_OPENSSL_LIBRARY
PTLS_MINICRYPTO_LIBRARY
PTLS_INCLUDE_DIR)

if(PTLS_FOUND)
set(PTLS_LIBRARIES ${PTLS_CORE_LIBRARY} ${PTLS_OPENSSL_LIBRARY} ${PTLS_MINICRYPTO_LIBRARY})
set(PTLS_INCLUDE_DIRS ${PTLS_INCLUDE_DIR})
set(PTLS_WITH_FUSION_DEFAULT OFF)
endif()
else()
include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set PTLS_FOUND to TRUE
# if all listed variables are TRUE
find_package_handle_standard_args(PTLS REQUIRED_VARS
PTLS_CORE_LIBRARY
PTLS_OPENSSL_LIBRARY
PTLS_FUSION_LIBRARY
PTLS_MINICRYPTO_LIBRARY
PTLS_INCLUDE_DIR)

if(PTLS_FOUND)
set(PTLS_LIBRARIES ${PTLS_CORE_LIBRARY} ${PTLS_OPENSSL_LIBRARY} ${PTLS_FUSION_LIBRARY} ${PTLS_MINICRYPTO_LIBRARY})
set(PTLS_INCLUDE_DIRS ${PTLS_INCLUDE_DIR})
set(PTLS_WITH_FUSION_DEFAULT ON)
endif()
endif()
endif()
endif(PICOQUIC_FETCH_PTLS)
Expand Down
Loading