From 14fae910eceacdb793d97d894f81b94631f313f3 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 8 Dec 2021 14:27:23 +0000 Subject: [PATCH] Added workaround to prevent building against new Asio headers --- CMakeModules/FindAsio.cmake | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/CMakeModules/FindAsio.cmake b/CMakeModules/FindAsio.cmake index 433d5c73c..aca5f82d0 100644 --- a/CMakeModules/FindAsio.cmake +++ b/CMakeModules/FindAsio.cmake @@ -15,8 +15,20 @@ FIND_PATH(ASIO_INCLUDE_DIR SET(ASIO_FOUND "NO") IF(ASIO_INCLUDE_DIR) - FIND_PACKAGE( Boost 1.37 ) - IF(Boost_FOUND) - SET(ASIO_FOUND "YES") - ENDIF() + + set(ASIO_VERSION_H ${ASIO_INCLUDE_DIR}/asio/version.hpp) + file(STRINGS ${ASIO_VERSION_H} AsioVersionLine REGEX "^#define ASIO_VERSION ") + string(REGEX MATCHALL "[0-9]+" AsioHeaderVersionMatches "${AsioVersionLine}") + list(GET AsioHeaderVersionMatches 0 AsioHeaderVersion) + + # check version is less than 1.14.0 otherwise API changes break build + if (${AsioHeaderVersion} LESS "101400") + FIND_PACKAGE( Boost 1.37 ) + IF(Boost_FOUND) + SET(ASIO_FOUND "YES") + ENDIF() + else() + message("ASIO not compatible") + endif() + ENDIF()