From 26634752d0412ecee5d124a461423460eaf3af9b Mon Sep 17 00:00:00 2001 From: Dennis Klein Date: Fri, 3 May 2019 19:43:27 +0200 Subject: FindBoost: Introduce new imported target Boost::headers --- Help/release/dev/FindBoost-fphsa.rst | 5 +++++ Modules/FindBoost.cmake | 20 +++++++++++++++----- 2 files changed, 20 insertions(+), 5 deletions(-) create mode 100644 Help/release/dev/FindBoost-fphsa.rst diff --git a/Help/release/dev/FindBoost-fphsa.rst b/Help/release/dev/FindBoost-fphsa.rst new file mode 100644 index 0000000..42ef2cd --- /dev/null +++ b/Help/release/dev/FindBoost-fphsa.rst @@ -0,0 +1,5 @@ +FindBoost-fphsa +--------------- + +* The :module:`FindBoost` module defines a new imported target + ``Boost::headers`` (same as ``Boost::boost``). diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index 0581c55..9932b14 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -72,8 +72,9 @@ and saves search results persistently in CMake cache entries:: The following :prop_tgt:`IMPORTED` targets are also defined:: - Boost::boost - Target for header-only dependencies + Boost::headers - Target for header-only dependencies (Boost include directory) + alias: Boost::boost Boost:: - Target for specific component dependency (shared or static library); is lower- case @@ -2062,15 +2063,24 @@ endif() # ------------------------------------------------------------------------ if(Boost_FOUND) - # For header-only libraries - if(NOT TARGET Boost::boost) - add_library(Boost::boost INTERFACE IMPORTED) + # The builtin CMake package in Boost 1.70+ introduces a new name + # for the header-only lib, let's provide the same UI in module mode + if(NOT TARGET Boost::headers) + add_library(Boost::headers INTERFACE IMPORTED) if(Boost_INCLUDE_DIRS) - set_target_properties(Boost::boost PROPERTIES + set_target_properties(Boost::headers PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${Boost_INCLUDE_DIRS}") endif() endif() + # Define the old target name for header-only libraries for backwards + # compat. + if(NOT TARGET Boost::boost) + add_library(Boost::boost INTERFACE IMPORTED) + set_target_properties(Boost::boost + PROPERTIES INTERFACE_LINK_LIBRARIES Boost::headers) + endif() + foreach(COMPONENT ${Boost_FIND_COMPONENTS}) if(_Boost_IMPORTED_TARGETS AND NOT TARGET Boost::${COMPONENT}) string(TOUPPER ${COMPONENT} UPPERCOMPONENT) -- cgit v0.12