CMake: Support Boost 1.70 config mode

Below CMake 3.15 we disable config mode by default, this can
be overridden via -DBoost_NO_BOOST_CMAKE=OFF

Resolves #174
This commit is contained in:
Dennis Klein 2019-06-27 13:47:10 +02:00 committed by Dennis Klein
parent a866c6d936
commit 09853e3031

View File

@ -91,6 +91,13 @@ if(BUILD_FAIRMQ)
find_package2(PUBLIC FairLogger REQUIRED find_package2(PUBLIC FairLogger REQUIRED
VERSION 1.2.0 VERSION 1.2.0
) )
if(NOT DEFINED Boost_NO_BOOST_CMAKE AND CMAKE_VERSION VERSION_LESS 3.15)
# Since Boost 1.70 a CMake package is shipped by default. Unfortunately, it has a number
# of problems that are only fixed in Boost 1.71 or CMake 3.15. By default we skip the
# BoostConfig lookup. This can be overridden on the command line via -DBoost_NO_BOOST_CMAKE=OFF
set(Boost_NO_BOOST_CMAKE ON)
endif()
find_package2(PUBLIC Boost REQUIRED find_package2(PUBLIC Boost REQUIRED
VERSION 1.64 VERSION 1.64
@ -237,7 +244,11 @@ if(PROJECT_PACKAGE_DEPENDENCIES)
foreach(dep IN LISTS PROJECT_PACKAGE_DEPENDENCIES) foreach(dep IN LISTS PROJECT_PACKAGE_DEPENDENCIES)
if(${dep}_VERSION) if(${dep}_VERSION)
if(${dep} STREQUAL Boost) if(${dep} STREQUAL Boost)
if(Boost_VERSION_MAJOR)
set(version_str "${BGreen}${${dep}_VERSION_MAJOR}.${${dep}_VERSION_MINOR}${CR}")
else()
set(version_str "${BGreen}${${dep}_MAJOR_VERSION}.${${dep}_MINOR_VERSION}${CR}") set(version_str "${BGreen}${${dep}_MAJOR_VERSION}.${${dep}_MINOR_VERSION}${CR}")
endif()
else() else()
set(version_str "${BGreen}${${dep}_VERSION}${CR}") set(version_str "${BGreen}${${dep}_VERSION}${CR}")
endif() endif()
@ -270,6 +281,13 @@ if(PROJECT_PACKAGE_DEPENDENCIES)
elseif(${dep} STREQUAL DDS) elseif(${dep} STREQUAL DDS)
get_target_property(dds_include DDS::dds_intercom_lib INTERFACE_INCLUDE_DIRECTORIES) get_target_property(dds_include DDS::dds_intercom_lib INTERFACE_INCLUDE_DIRECTORIES)
get_filename_component(prefix ${dds_include}/.. ABSOLUTE) get_filename_component(prefix ${dds_include}/.. ABSOLUTE)
elseif(${dep} STREQUAL Boost)
if(TARGET Boost::headers)
get_target_property(boost_include Boost::headers INTERFACE_INCLUDE_DIRECTORIES)
else()
get_target_property(boost_include Boost::boost INTERFACE_INCLUDE_DIRECTORIES)
endif()
get_filename_component(prefix ${boost_include}/.. ABSOLUTE)
elseif(${dep} STREQUAL Doxygen) elseif(${dep} STREQUAL Doxygen)
get_target_property(doxygen_bin Doxygen::doxygen INTERFACE_LOCATION) get_target_property(doxygen_bin Doxygen::doxygen INTERFACE_LOCATION)
get_filename_component(prefix ${doxygen_bin} DIRECTORY) get_filename_component(prefix ${doxygen_bin} DIRECTORY)