File tree 1 file changed +22
-0
lines changed
1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,28 @@ function(add_boost_if_needed)
32
32
)
33
33
endif ()
34
34
35
+ # Prevent use of std::unary_function, which was removed in C++17,
36
+ # and will generate warnings with newer compilers for Boost
37
+ # older than 1.80.
38
+ # See: https://github.com/boostorg/config/pull/430.
39
+ include (CMakePushCheckState)
40
+ cmake_push_check_state(RESET)
41
+ set (CMAKE_REQUIRED_DEFINITIONS -DBOOST_NO_CXX98_FUNCTION_BASE)
42
+ set (CMAKE_REQUIRED_INCLUDES ${Boost_INCLUDE_DIR} )
43
+ include (TryAppendCXXFlags)
44
+ set (CMAKE_REQUIRED_FLAGS ${working_compiler_werror_flag} )
45
+ set (CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
46
+ check_cxx_source_compiles("
47
+ #include <boost/config.hpp>
48
+ " NO_DIAGNOSTICS_BOOST_NO_CXX98_FUNCTION_BASE
49
+ )
50
+ cmake_pop_check_state()
51
+ if (NO_DIAGNOSTICS_BOOST_NO_CXX98_FUNCTION_BASE)
52
+ target_compile_definitions (Boost::headers INTERFACE
53
+ BOOST_NO_CXX98_FUNCTION_BASE
54
+ )
55
+ endif ()
56
+
35
57
if (BUILD_TESTS)
36
58
include (CheckCXXSourceCompiles)
37
59
set (CMAKE_REQUIRED_INCLUDES ${Boost_INCLUDE_DIR} )
You can’t perform that action at this time.
0 commit comments