summaryrefslogtreecommitdiff
path: root/Modules/FindBoost.cmake
diff options
context:
space:
mode:
authorDennis Klein <d.klein@gsi.de>2019-05-03 19:43:27 +0200
committerDennis Klein <d.klein@gsi.de>2019-05-07 16:08:55 +0200
commit26634752d0412ecee5d124a461423460eaf3af9b (patch)
treed36725e594bc50707572b05a1d76b6606636f726 /Modules/FindBoost.cmake
parentd6c12f374d304df9cc93e753fa9afd2bf25cdb78 (diff)
downloadcmake-26634752d0412ecee5d124a461423460eaf3af9b.tar.gz
FindBoost: Introduce new imported target Boost::headers
Diffstat (limited to 'Modules/FindBoost.cmake')
-rw-r--r--Modules/FindBoost.cmake20
1 files changed, 15 insertions, 5 deletions
diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake
index 0581c551cf..9932b14daf 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)