From c9939d271b31b06efc6e770dabd51293721eed70 Mon Sep 17 00:00:00 2001 From: Frank Lichtenheld Date: Mon, 20 Mar 2023 13:37:05 +0100 Subject: [PATCH] CMake: Reorder includes to prefer asio By adding the asio includes first we have a better chance to force using "our" asio. This can be important since some parts of the code require a patched version. The actual "core" parts of the code work fine with upstream asio however, so I also do not want to force the patched asio by requiring a special header name or directory structure. So this is a compromise solution which hopefully works for most use-cases. Signed-off-by: Frank Lichtenheld (cherry picked from commit bc7f4be01b6249e8616988139a694908a132985c) --- cmake/findcoredeps.cmake | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/cmake/findcoredeps.cmake b/cmake/findcoredeps.cmake index 6886743e..3d03a8c8 100644 --- a/cmake/findcoredeps.cmake +++ b/cmake/findcoredeps.cmake @@ -80,20 +80,24 @@ function(add_core_dependencies target) endif () else () list(APPEND CMAKE_PREFIX_PATH - ${DEP_DIR}/mbedtls/mbedtls-${PLAT} - ${DEP_DIR}/lz4/lz4-${PLAT} ${DEP_DIR}/asio/asio + ${DEP_DIR}/lz4/lz4-${PLAT} + ${DEP_DIR}/mbedtls/mbedtls-${PLAT} ) list(APPEND CMAKE_LIBRARY_PATH ${DEP_DIR}/mbedtls/mbedtls-${PLAT}/library ) endif () - find_package(lz4 REQUIRED) + # asio should go first since some of our code requires + # a patched version. So we want to prefer its include + # directories. find_package(asio REQUIRED) - target_link_libraries(${target} lz4::lz4) target_link_libraries(${target} asio::asio) + find_package(lz4 REQUIRED) + target_link_libraries(${target} lz4::lz4) + add_ssl_library(${target}) if (APPLE)