Skip to content

Commit 09cb513

Browse files
authored
Merge 6f6613a into 94cda30
2 parents 94cda30 + 6f6613a commit 09cb513

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

CMakeLists.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,11 +177,15 @@ if(JSONCPP_WITH_CMAKE_PACKAGE)
177177
include(CMakePackageConfigHelpers)
178178
install(EXPORT jsoncpp
179179
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/jsoncpp
180-
FILE jsoncppConfig.cmake)
180+
FILE jsoncpp-targets.cmake)
181+
configure_package_config_file(jsoncppConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/jsoncppConfig.cmake
182+
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/jsoncpp)
183+
181184
write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/jsoncppConfigVersion.cmake"
182185
VERSION ${PROJECT_VERSION}
183186
COMPATIBILITY SameMajorVersion)
184-
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/jsoncppConfigVersion.cmake
187+
install(FILES
188+
${CMAKE_CURRENT_BINARY_DIR}/jsoncppConfigVersion.cmake ${CMAKE_CURRENT_BINARY_DIR}/jsoncppConfig.cmake
185189
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/jsoncpp)
186190
endif()
187191

jsoncppConfig.cmake.in

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
cmake_policy(PUSH)
2+
cmake_policy(VERSION 3.0)
3+
4+
@PACKAGE_INIT@
5+
6+
include ( "${CMAKE_CURRENT_LIST_DIR}/jsoncpp-targets.cmake" )
7+
8+
if(TARGET jsoncpp_static)
9+
add_library(JsonCpp::JsonCpp INTERFACE IMPORTED )
10+
set_target_properties(JsonCpp::JsonCpp PROPERTIES INTERFACE_LINK_LIBRARIES "jsoncpp_static")
11+
elseif(TARGET jsoncpp_lib)
12+
add_library(JsonCpp::JsonCpp INTERFACE IMPORTED )
13+
set_target_properties(JsonCpp::JsonCpp PROPERTIES INTERFACE_LINK_LIBRARIES "jsoncpp_lib")
14+
endif()
15+
16+
check_required_components(JsonCpp)
17+
18+
cmake_policy(POP)

0 commit comments

Comments
 (0)