Skip to content

Commit 21f5a0a

Browse files
committed
Added workaround to prevent building against new Asio headers
1 parent aee5267 commit 21f5a0a

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

CMakeModules/FindAsio.cmake

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,20 @@ FIND_PATH(ASIO_INCLUDE_DIR
1515

1616
SET(ASIO_FOUND "NO")
1717
IF(ASIO_INCLUDE_DIR)
18-
FIND_PACKAGE( Boost 1.37 )
19-
IF(Boost_FOUND)
20-
SET(ASIO_FOUND "YES")
21-
ENDIF()
18+
19+
set(ASIO_VERSION_H ${ASIO_INCLUDE_DIR}/asio/version.hpp)
20+
file(STRINGS ${ASIO_VERSION_H} AsioVersionLine REGEX "^#define ASIO_VERSION ")
21+
string(REGEX MATCHALL "[0-9]+" AsioHeaderVersionMatches "${AsioVersionLine}")
22+
list(GET AsioHeaderVersionMatches 0 AsioHeaderVersion)
23+
24+
# check version is less than 1.14.0 otherwise API changes break build
25+
if (${AsioHeaderVersion} LESS "101400")
26+
FIND_PACKAGE( Boost 1.37 )
27+
IF(Boost_FOUND)
28+
SET(ASIO_FOUND "YES")
29+
ENDIF()
30+
else()
31+
message("ASIO not compatible")
32+
endif()
33+
2234
ENDIF()

0 commit comments

Comments
 (0)