From: Manuel Nickschas Date: Tue, 20 Nov 2018 22:33:56 +0000 (+0100) Subject: cmake: Create imported target for Boost, if it doesn't exist yet X-Git-Tag: test-travis-01~85 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=02f740a0fed75951f474fc94c23901505a031c5b cmake: Create imported target for Boost, if it doesn't exist yet Older versions of CMake's FindBoost.cmake don't create imported targets for the library. Create it ourselves if necessary. --- diff --git a/CMakeLists.txt b/CMakeLists.txt index a27d1a6f..9037c89b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -335,6 +335,14 @@ set_package_properties(Boost PROPERTIES TYPE REQUIRED URL "https://www.boost.org/" DESCRIPTION "Boost libraries for C++" ) +# Older versions don't define the imported target +if (NOT TARGET Boost::boost) + add_library(Boost::boost INTERFACE IMPORTED GLOBAL) + if (Boost_INCLUDE_DIRS) + set_target_properties(Boost::boost PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${Boost_INCLUDE_DIRS}") + endif() +endif() find_package(ZLIB REQUIRED) set_package_properties(ZLIB PROPERTIES TYPE REQUIRED