From 3b1a5cafadbd0695530415943d59f32c84ff69b1 Mon Sep 17 00:00:00 2001 From: Chuck Atkins Date: Tue, 18 Sep 2018 13:59:19 -0400 Subject: [PATCH] Use a version check to provide backwards comatible imported target names. --- cmake/config.cmake.in | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmake/config.cmake.in b/cmake/config.cmake.in index 8baabf07..8d52ae14 100644 --- a/cmake/config.cmake.in +++ b/cmake/config.cmake.in @@ -1,5 +1,9 @@ @PACKAGE_INIT@ if(NOT TARGET @PROJECT_NAME@::@NLOHMANN_JSON_TARGET_NAME@) include("${CMAKE_CURRENT_LIST_DIR}/@NLOHMANN_JSON_TARGETS_EXPORT_NAME@.cmake") + if((NOT TARGET @NLOHMANN_JSON_TARGET_NAME@) AND + (PACKAGE_FIND_VERSION VERSION_LESS 3.2.0)) + add_library(@NLOHMANN_JSON_TARGET_NAME@ ALIAS @PROJECT_NAME@::@NLOHMANN_JSON_TARGET_NAME@) + endif() endif() check_required_components("@PROJECT_NAME@")