tests(CMakeLists): robustify against add'l versions of Boost (#2608)

* tests/CMakeLists: Robustify against add'l versions of Boost

* refactor: simpler impl

Co-authored-by: Henry Schreiner <henryschreineriii@gmail.com>
This commit is contained in:
Eric Cousineau 2020-10-18 20:42:48 -04:00 committed by GitHub
parent 0b9acc4009
commit c513b5e3c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -226,12 +226,12 @@ find_package(Boost 1.56)
if(Boost_FOUND)
if(NOT TARGET Boost::headers)
add_library(Boost::headers IMPORTED INTERFACE)
if(TARGET Boost::boost)
# Classic FindBoost
add_library(Boost::headers ALIAS Boost::boost)
set_property(TARGET Boost::boost PROPERTY INTERFACE_LINK_LIBRARIES Boost::boost)
else()
# Very old FindBoost, or newer Boost than CMake in older CMakes
add_library(Boost::headers IMPORTED INTERFACE)
set_property(TARGET Boost::headers PROPERTY INTERFACE_INCLUDE_DIRECTORIES
${Boost_INCLUDE_DIRS})
endif()