1From 24e7adc8d67b3c8f7d275b4f9a7e70a61b73fcd4 Mon Sep 17 00:00:00 2001
2From: Peter Seiderer <ps.report@gmx.net>
3Date: Fri, 28 Jan 2022 13:11:01 +0100
4Subject: [PATCH] boost-fallback: only check for boost if really needed
5
6- only check for boost if really needed (in case of legacy c++ standard < c++17)
7
8Signed-off-by: Peter Seiderer <ps.report@gmx.net>
9---
10 src/cmake/boost-fallback/boost-fallback.cmake | 3 +++
11 1 file changed, 3 insertions(+)
12
13diff --git a/src/cmake/boost-fallback/boost-fallback.cmake b/src/cmake/boost-fallback/boost-fallback.cmake
14index 8285b0b9..0ecf8c6c 100644
15--- a/src/cmake/boost-fallback/boost-fallback.cmake
16+++ b/src/cmake/boost-fallback/boost-fallback.cmake
17@@ -55,6 +55,8 @@ try_compile(STD_SHARED_PTR_FOUND "${CMAKE_BINARY_DIR}/boost-fallback-compile-tes
18 try_compile(STD_ATOMIC_FOUND "${CMAKE_BINARY_DIR}/boost-fallback-compile-tests"
19     "${CMAKE_CURRENT_LIST_DIR}/test-stdatomic.cpp")
20
21+# search for boost only in case needed for legacy c++ standard < c++17
22+if(NOT ${STD_THREAD_FOUND} OR NOT ${STD_MUTEX_FOUND} OR NOT ${STD_SHARED_MUTEX_FOUND} OR NOT ${STD_SHARED_PTR_FOUND} OR NOT ${STD_ATOMIC_FOUND})
23 find_package(Boost COMPONENTS thread)
24 if( ${Boost_FOUND} )
25     try_compile(Boost_SHARED_PTR_FOUND "${CMAKE_BINARY_DIR}/boost-fallback-compile-tests"
26@@ -67,6 +69,7 @@ if( ${Boost_FOUND} )
27     try_compile(Boost_ATOMIC_FOUND "${CMAKE_BINARY_DIR}/boost-fallback-compile-tests"
28         "${CMAKE_CURRENT_LIST_DIR}/test-boostatomic.cpp")
29 endif( ${Boost_FOUND} )
30+endif()
31
32 # Link the target with the appropriate boost libraries(if required)
33 function(boostfallback_link target)
34--
352.34.1
36
37