mirror of
https://github.com/open-source-parsers/jsoncpp.git
synced 2025-01-14 01:47:54 +08:00
Merge branch 'cmake-config-improvements' #1271
(creating merge-commit late, after accidental "rebase-and-merge")
This commit is contained in:
commit
bb34617267
@ -177,11 +177,16 @@ if(JSONCPP_WITH_CMAKE_PACKAGE)
|
|||||||
include(CMakePackageConfigHelpers)
|
include(CMakePackageConfigHelpers)
|
||||||
install(EXPORT jsoncpp
|
install(EXPORT jsoncpp
|
||||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/jsoncpp
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/jsoncpp
|
||||||
FILE jsoncppConfig.cmake)
|
FILE jsoncpp-targets.cmake)
|
||||||
|
configure_package_config_file(jsoncppConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/jsoncppConfig.cmake
|
||||||
|
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/jsoncpp)
|
||||||
|
|
||||||
write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/jsoncppConfigVersion.cmake"
|
write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/jsoncppConfigVersion.cmake"
|
||||||
VERSION ${PROJECT_VERSION}
|
VERSION ${PROJECT_VERSION}
|
||||||
COMPATIBILITY SameMajorVersion)
|
COMPATIBILITY SameMajorVersion)
|
||||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/jsoncppConfigVersion.cmake
|
install(FILES
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/jsoncppConfigVersion.cmake ${CMAKE_CURRENT_BINARY_DIR}/jsoncppConfig.cmake
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/jsoncpp-namespaced-targets.cmake
|
||||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/jsoncpp)
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/jsoncpp)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
7
jsoncpp-namespaced-targets.cmake
Normal file
7
jsoncpp-namespaced-targets.cmake
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
if (TARGET 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 INTERFACE IMPORTED)
|
||||||
|
set_target_properties(JsonCpp::JsonCpp PROPERTIES INTERFACE_LINK_LIBRARIES "jsoncpp_lib")
|
||||||
|
endif ()
|
11
jsoncppConfig.cmake.in
Normal file
11
jsoncppConfig.cmake.in
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
cmake_policy(PUSH)
|
||||||
|
cmake_policy(VERSION 3.0)
|
||||||
|
|
||||||
|
@PACKAGE_INIT@
|
||||||
|
|
||||||
|
include ( "${CMAKE_CURRENT_LIST_DIR}/jsoncpp-targets.cmake" )
|
||||||
|
include ( "${CMAKE_CURRENT_LIST_DIR}/jsoncpp-namespaced-targets.cmake" )
|
||||||
|
|
||||||
|
check_required_components(JsonCpp)
|
||||||
|
|
||||||
|
cmake_policy(POP)
|
Loading…
x
Reference in New Issue
Block a user