Merge pull request #1245 from chuckatkins/fix-target-namespace-backward-compatibility

Use a version check to provide backwards comatible CMake imported target names
This commit is contained in:
Niels Lohmann 2018-09-19 20:46:51 +02:00 committed by GitHub
commit e4bc98d036
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,5 +1,9 @@
@PACKAGE_INIT@ @PACKAGE_INIT@
if(NOT TARGET @PROJECT_NAME@::@NLOHMANN_JSON_TARGET_NAME@) if(NOT TARGET @PROJECT_NAME@::@NLOHMANN_JSON_TARGET_NAME@)
include("${CMAKE_CURRENT_LIST_DIR}/@NLOHMANN_JSON_TARGETS_EXPORT_NAME@.cmake") 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() endif()
check_required_components("@PROJECT_NAME@") check_required_components("@PROJECT_NAME@")