@@ -9,13 +9,13 @@ project(
99 # 2. /include/json/version.h
1010 # 3. /CMakeLists.txt
1111 # IMPORTANT: also update the SOVERSION!!
12- version : ' 1.9.4 ' ,
12+ version : ' 1.9.6 ' ,
1313 default_options : [
1414 ' buildtype=release' ,
1515 ' cpp_std=c++11' ,
1616 ' warning_level=1' ],
1717 license : ' Public Domain' ,
18- meson_version : ' >= 0.49 .0' )
18+ meson_version : ' >= 0.54 .0' )
1919
2020
2121jsoncpp_headers = files ([
@@ -50,7 +50,7 @@ jsoncpp_lib = library(
5050 ' src/lib_json/json_value.cpp' ,
5151 ' src/lib_json/json_writer.cpp' ,
5252 ]),
53- soversion : 25 ,
53+ soversion : 26 ,
5454 install : true ,
5555 include_directories : jsoncpp_include_directories,
5656 cpp_args : dll_export_flag)
@@ -62,6 +62,43 @@ import('pkgconfig').generate(
6262 filebase : ' jsoncpp' ,
6363 description : ' A C++ library for interacting with JSON' )
6464
65+ cmakeconf = configuration_data ()
66+ cmakeconf.set(' MESON_LIB_DIR' , get_option (' libdir' ))
67+ cmakeconf.set(' MESON_INCLUDE_DIR' , get_option (' includedir' ))
68+
69+ fs = import (' fs' )
70+ if get_option (' default_library' ) == ' shared'
71+ shared_name = fs.name(jsoncpp_lib.full_path())
72+ endif
73+ if get_option (' default_library' ) == ' static'
74+ static_name = fs.name(jsoncpp_lib.full_path())
75+ endif
76+ if get_option (' default_library' ) == ' both'
77+ shared_name = fs.name(jsoncpp_lib.get_shared_lib().full_path())
78+ static_name = fs.name(jsoncpp_lib.get_static_lib().full_path())
79+ endif
80+
81+ if get_option (' default_library' ) == ' shared' or get_option (' default_library' ) == ' both'
82+ cmakeconf.set(' MESON_SHARED_TARGET' , '''
83+ add_library(jsoncpp_lib IMPORTED SHARED)
84+ set_target_properties(jsoncpp_lib PROPERTIES
85+ IMPORTED_LOCATION "''' + join_paths (' ${PACKAGE_PREFIX_DIR}' , get_option (' libdir' ), shared_name) + ''' "
86+ INTERFACE_INCLUDE_DIRECTORIES "''' + join_paths (' ${PACKAGE_PREFIX_DIR}' , get_option (' includedir' )) + ' ")' )
87+ endif
88+ if get_option (' default_library' ) == ' static' or get_option (' default_library' ) == ' both'
89+ cmakeconf.set(' MESON_STATIC_TARGET' , '''
90+ add_library(jsoncpp_static IMPORTED STATIC)
91+ set_target_properties(jsoncpp_static PROPERTIES
92+ IMPORTED_LOCATION "''' + join_paths (' ${PACKAGE_PREFIX_DIR}' , get_option (' libdir' ), static_name) + ''' "
93+ INTERFACE_INCLUDE_DIRECTORIES "''' + join_paths (' ${PACKAGE_PREFIX_DIR}' , get_option (' includedir' )) + ' ")' )
94+ endif
95+
96+ import (' cmake' ).configure_package_config_file(
97+ name : ' jsoncpp' ,
98+ input : ' jsoncppConfig.cmake.meson.in' ,
99+ configuration : cmakeconf)
100+ install_data (' jsoncpp-namespaced-targets.cmake' , install_dir : join_paths (get_option (' libdir' ), ' cmake' , jsoncpp_lib.name()))
101+
65102# for libraries bundling jsoncpp
66103jsoncpp_dep = declare_dependency (
67104 include_directories : jsoncpp_include_directories,
0 commit comments