Remove old boost workaround

This commit is contained in:
Michael Legleux
2021-09-28 10:16:29 -07:00
committed by manojsdoshi
parent da26d11593
commit 0320d2169e

View File

@@ -2,49 +2,49 @@
NIH dep: boost NIH dep: boost
#]===================================================================] #]===================================================================]
if ((NOT DEFINED BOOST_ROOT) AND (DEFINED ENV{BOOST_ROOT})) if((NOT DEFINED BOOST_ROOT) AND(DEFINED ENV{BOOST_ROOT}))
set (BOOST_ROOT $ENV{BOOST_ROOT}) set(BOOST_ROOT $ENV{BOOST_ROOT})
endif () endif()
file (TO_CMAKE_PATH "${BOOST_ROOT}" BOOST_ROOT) file(TO_CMAKE_PATH "${BOOST_ROOT}" BOOST_ROOT)
if (WIN32 OR CYGWIN) if(WIN32 OR CYGWIN)
# Workaround for MSVC having two boost versions - x86 and x64 on same PC in stage folders # Workaround for MSVC having two boost versions - x86 and x64 on same PC in stage folders
if (DEFINED BOOST_ROOT) if(DEFINED BOOST_ROOT)
if (IS_DIRECTORY ${BOOST_ROOT}/stage64/lib) if(IS_DIRECTORY ${BOOST_ROOT}/stage64/lib)
set (BOOST_LIBRARYDIR ${BOOST_ROOT}/stage64/lib) set(BOOST_LIBRARYDIR ${BOOST_ROOT}/stage64/lib)
elseif (IS_DIRECTORY ${BOOST_ROOT}/stage/lib) elseif(IS_DIRECTORY ${BOOST_ROOT}/stage/lib)
set (BOOST_LIBRARYDIR ${BOOST_ROOT}/stage/lib) set(BOOST_LIBRARYDIR ${BOOST_ROOT}/stage/lib)
elseif (IS_DIRECTORY ${BOOST_ROOT}/lib) elseif(IS_DIRECTORY ${BOOST_ROOT}/lib)
set (BOOST_LIBRARYDIR ${BOOST_ROOT}/lib) set(BOOST_LIBRARYDIR ${BOOST_ROOT}/lib)
else () else()
message(WARNING "Did not find expected boost library dir. " message(WARNING "Did not find expected boost library dir. "
"Defaulting to ${BOOST_ROOT}") "Defaulting to ${BOOST_ROOT}")
set (BOOST_LIBRARYDIR ${BOOST_ROOT}) set(BOOST_LIBRARYDIR ${BOOST_ROOT})
endif () endif()
endif () endif()
endif () endif()
message (STATUS "BOOST_ROOT: ${BOOST_ROOT}") message(STATUS "BOOST_ROOT: ${BOOST_ROOT}")
message (STATUS "BOOST_LIBRARYDIR: ${BOOST_LIBRARYDIR}") message(STATUS "BOOST_LIBRARYDIR: ${BOOST_LIBRARYDIR}")
# uncomment the following as needed to debug FindBoost issues: # uncomment the following as needed to debug FindBoost issues:
#set (Boost_DEBUG ON) #set(Boost_DEBUG ON)
#[=========================================================[ #[=========================================================[
boost dynamic libraries don't trivially support @rpath boost dynamic libraries don't trivially support @rpath
linking right now (cmake's default), so just force linking right now (cmake's default), so just force
static linking for macos, or if requested on linux by flag static linking for macos, or if requested on linux by flag
#]=========================================================] #]=========================================================]
if (static) if(static)
set (Boost_USE_STATIC_LIBS ON) set(Boost_USE_STATIC_LIBS ON)
endif () endif()
set (Boost_USE_MULTITHREADED ON) set(Boost_USE_MULTITHREADED ON)
if (static AND NOT APPLE) if(static AND NOT APPLE)
set (Boost_USE_STATIC_RUNTIME ON) set(Boost_USE_STATIC_RUNTIME ON)
else () else()
set (Boost_USE_STATIC_RUNTIME OFF) set(Boost_USE_STATIC_RUNTIME OFF)
endif () endif()
# TBD: # TBD:
# Boost_USE_DEBUG_RUNTIME: When ON, uses Boost libraries linked against the # Boost_USE_DEBUG_RUNTIME: When ON, uses Boost libraries linked against the
find_package (Boost 1.70 REQUIRED find_package(Boost 1.70 REQUIRED
COMPONENTS COMPONENTS
chrono chrono
container container
@@ -57,16 +57,16 @@ find_package (Boost 1.70 REQUIRED
system system
thread) thread)
add_library (ripple_boost INTERFACE) add_library(ripple_boost INTERFACE)
add_library (Ripple::boost ALIAS ripple_boost) add_library(Ripple::boost ALIAS ripple_boost)
if (is_xcode) if(is_xcode)
target_include_directories (ripple_boost BEFORE INTERFACE ${Boost_INCLUDE_DIRS}) target_include_directories(ripple_boost BEFORE INTERFACE ${Boost_INCLUDE_DIRS})
target_compile_options (ripple_boost INTERFACE --system-header-prefix="boost/") target_compile_options(ripple_boost INTERFACE --system-header-prefix="boost/")
else () else()
target_include_directories (ripple_boost SYSTEM BEFORE INTERFACE ${Boost_INCLUDE_DIRS}) target_include_directories(ripple_boost SYSTEM BEFORE INTERFACE ${Boost_INCLUDE_DIRS})
endif() endif()
target_link_libraries (ripple_boost target_link_libraries(ripple_boost
INTERFACE INTERFACE
Boost::boost Boost::boost
Boost::chrono Boost::chrono
@@ -78,28 +78,19 @@ target_link_libraries (ripple_boost
Boost::regex Boost::regex
Boost::system Boost::system
Boost::thread) Boost::thread)
if (Boost_COMPILER) if(Boost_COMPILER)
target_link_libraries (ripple_boost INTERFACE Boost::disable_autolinking) target_link_libraries(ripple_boost INTERFACE Boost::disable_autolinking)
endif () endif()
if (san AND is_clang) if(san AND is_clang)
# TODO: gcc does not support -fsanitize-blacklist...can we do something else # TODO: gcc does not support -fsanitize-blacklist...can we do something else
# for gcc ? # for gcc ?
if (NOT Boost_INCLUDE_DIRS AND TARGET Boost::headers) if(NOT Boost_INCLUDE_DIRS AND TARGET Boost::headers)
get_target_property (Boost_INCLUDE_DIRS Boost::headers INTERFACE_INCLUDE_DIRECTORIES) get_target_property(Boost_INCLUDE_DIRS Boost::headers INTERFACE_INCLUDE_DIRECTORIES)
endif () endif()
message(STATUS "Adding [${Boost_INCLUDE_DIRS}] to sanitizer blacklist") message(STATUS "Adding [${Boost_INCLUDE_DIRS}] to sanitizer blacklist")
file (WRITE ${CMAKE_CURRENT_BINARY_DIR}/san_bl.txt "src:${Boost_INCLUDE_DIRS}/*") file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/san_bl.txt "src:${Boost_INCLUDE_DIRS}/*")
target_compile_options (opts target_compile_options(opts
INTERFACE INTERFACE
# ignore boost headers for sanitizing # ignore boost headers for sanitizing
-fsanitize-blacklist=${CMAKE_CURRENT_BINARY_DIR}/san_bl.txt) -fsanitize-blacklist=${CMAKE_CURRENT_BINARY_DIR}/san_bl.txt)
endif () endif()
# workaround for xcode 10.2 and boost < 1.69
# once we require Boost 1.69 or higher, this can be removed
# see: https://github.com/boostorg/asio/commit/43874d5
if (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" AND
CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 10.0.1.10010043 AND
Boost_VERSION LESS 106900)
target_compile_definitions (opts INTERFACE BOOST_ASIO_HAS_STD_STRING_VIEW)
endif ()