- workaround for CMake < 3.18 ALIAS target limitation to not point to non-GLOBAL IMPORTED target

This commit is contained in:
Sergey Rachev 2021-04-02 22:30:43 +02:00 committed by Christopher Dunn
parent a3914b792f
commit 2af4a4c6c8

View File

@ -6,9 +6,11 @@ cmake_policy(VERSION 3.0)
include ( "${CMAKE_CURRENT_LIST_DIR}/jsoncpp-targets.cmake" )
if(TARGET jsoncpp_static)
add_library(JsonCpp::JsonCpp ALIAS jsoncpp_static)
add_library(JsonCpp::JsonCpp INTERFACE IMPORTED )
set_target_properties(JsonCpp::JsonCpp PROPERTIES INTERFACE_LINK_LIBRARIES "jsoncpp_static")
elseif(TARGET jsoncpp_lib)
add_library(JsonCpp::JsonCpp ALIAS jsoncpp_lib)
add_library(JsonCpp::JsonCpp INTERFACE IMPORTED )
set_target_properties(JsonCpp::JsonCpp PROPERTIES INTERFACE_LINK_LIBRARIES "jsoncpp_lib")
endif()
check_required_components(JsonCpp)