File tree 1 file changed +14
-3
lines changed
1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -46,6 +46,14 @@ install_headers(
46
46
jsoncpp_headers,
47
47
subdir : ' json' )
48
48
49
+ if get_option (' default_library' ) == ' shared' and meson .get_compiler(' cpp' ).get_id() == ' msvc'
50
+ dll_export_flag = ' -DJSON_DLL_BUILD'
51
+ dll_import_flag = ' -DJSON_DLL'
52
+ else
53
+ dll_export_flag = ''
54
+ dll_import_flag = ''
55
+ endif
56
+
49
57
jsoncpp_lib = library (
50
58
' jsoncpp' ,
51
59
[ jsoncpp_gen_sources,
@@ -56,7 +64,8 @@ jsoncpp_lib = library(
56
64
' src/lib_json/json_writer.cpp' ],
57
65
soversion : 20 ,
58
66
install : true ,
59
- include_directories : jsoncpp_include_directories)
67
+ include_directories : jsoncpp_include_directories,
68
+ cpp_args : dll_export_flag)
60
69
61
70
import (' pkgconfig' ).generate(
62
71
libraries : jsoncpp_lib,
@@ -82,7 +91,8 @@ jsoncpp_test = executable(
82
91
' src/test_lib_json/main.cpp' ],
83
92
include_directories : jsoncpp_include_directories,
84
93
link_with : jsoncpp_lib,
85
- install : false )
94
+ install : false ,
95
+ cpp_args : dll_import_flag)
86
96
test (
87
97
' unittest_jsoncpp_test' ,
88
98
jsoncpp_test)
@@ -92,7 +102,8 @@ jsontestrunner = executable(
92
102
' src/jsontestrunner/main.cpp' ,
93
103
include_directories : jsoncpp_include_directories,
94
104
link_with : jsoncpp_lib,
95
- install : false )
105
+ install : false ,
106
+ cpp_args : dll_import_flag)
96
107
test (
97
108
' unittest_jsontestrunner' ,
98
109
python,
You can’t perform that action at this time.
0 commit comments