From 62f3e034755c43759da819781bc23882a2ea3e01 Mon Sep 17 00:00:00 2001 From: Sergey Rachev Date: Sat, 27 Feb 2021 22:35:57 +0100 Subject: [PATCH] - declare namespaced export target to simplify the library usage When the static libary is available use it as exported alias, otherwise use shared library. Cmake takes care about import library when Windows platform DLL is used --- jsoncppConfig.cmake.in | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/jsoncppConfig.cmake.in b/jsoncppConfig.cmake.in index e3fa4b9..9caa006 100644 --- a/jsoncppConfig.cmake.in +++ b/jsoncppConfig.cmake.in @@ -5,6 +5,12 @@ cmake_policy(VERSION 3.0) include ( "${CMAKE_CURRENT_LIST_DIR}/jsoncpp-targets.cmake" ) +if(TARGET jsoncpp_static) + add_library(JsonCpp::JsonCpp ALIAS jsoncpp_static) +elseif(TARGET jsoncpp_lib) + add_library(JsonCpp::JsonCpp ALIAS jsoncpp_lib) +endif() + check_required_components(JsonCpp) cmake_policy(POP) \ No newline at end of file