diff options
author | Dennis Klein <d.klein@gsi.de> | 2019-05-03 17:43:27 (GMT) |
---|---|---|
committer | Dennis Klein <d.klein@gsi.de> | 2019-05-07 14:08:55 (GMT) |
commit | 26634752d0412ecee5d124a461423460eaf3af9b (patch) | |
tree | d36725e594bc50707572b05a1d76b6606636f726 | |
parent | d6c12f374d304df9cc93e753fa9afd2bf25cdb78 (diff) | |
download | CMake-26634752d0412ecee5d124a461423460eaf3af9b.zip CMake-26634752d0412ecee5d124a461423460eaf3af9b.tar.gz CMake-26634752d0412ecee5d124a461423460eaf3af9b.tar.bz2 |
FindBoost: Introduce new imported target Boost::headers
-rw-r--r-- | Help/release/dev/FindBoost-fphsa.rst | 5 | ||||
-rw-r--r-- | Modules/FindBoost.cmake | 20 |
2 files changed, 20 insertions, 5 deletions
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::<C> - Target for specific component dependency (shared or static library); <C> 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) |