Skip to content

Commit 993e4e2

Browse files
sergeyrachevcdunn2001
authored andcommitted
- isolated namespace targets into separate file
1 parent 2af4a4c commit 993e4e2

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ if(JSONCPP_WITH_CMAKE_PACKAGE)
186186
COMPATIBILITY SameMajorVersion)
187187
install(FILES
188188
${CMAKE_CURRENT_BINARY_DIR}/jsoncppConfigVersion.cmake ${CMAKE_CURRENT_BINARY_DIR}/jsoncppConfig.cmake
189+
${CMAKE_CURRENT_SOURCE_DIR}/jsoncpp-namespaced-targets.cmake
189190
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/jsoncpp)
190191
endif()
191192

jsoncpp-namespaced-targets.cmake

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
if (TARGET jsoncpp_static)
2+
add_library(JsonCpp::JsonCpp INTERFACE IMPORTED)
3+
set_target_properties(JsonCpp::JsonCpp PROPERTIES INTERFACE_LINK_LIBRARIES "jsoncpp_static")
4+
elseif (TARGET jsoncpp_lib)
5+
add_library(JsonCpp::JsonCpp INTERFACE IMPORTED)
6+
set_target_properties(JsonCpp::JsonCpp PROPERTIES INTERFACE_LINK_LIBRARIES "jsoncpp_lib")
7+
endif ()

jsoncppConfig.cmake.in

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,7 @@ cmake_policy(VERSION 3.0)
44
@PACKAGE_INIT@
55

66
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()
7+
include ( "${CMAKE_CURRENT_LIST_DIR}/jsoncpp-namespaced-targets.cmake" )
158

169
check_required_components(JsonCpp)
1710

0 commit comments

Comments
 (0)