Skip to content

Commit 4cfd0de

Browse files
bgilbertjpakkane
authored andcommitted
minizip-ng: fix tests on MSVC
Upstream's test_main.cc declares its main() function to be GTEST_API_, thus declaring main() to be dllimport, which is not allowed. Bypass the problem by using the main function from gtest_main.
1 parent af3c8cd commit 4cfd0de

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

subprojects/packagefiles/minizip-ng/meson.build

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -251,11 +251,11 @@ minizip_ng_dep = declare_dependency(
251251
link_with: minizip_ng,
252252
)
253253

254-
gtest_dep = dependency(
255-
'gtest',
254+
gtestmain_dep = dependency(
255+
'gtest_main',
256256
required: get_option('tests'),
257257
)
258-
if gtest_dep.found()
258+
if gtestmain_dep.found()
259259
testdir = meson.current_source_dir()
260260
subdir('test')
261261
endif

subprojects/packagefiles/minizip-ng/test/meson.build

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ test_srcs = files(
3434
'test_stream_crypt.cc',
3535
)
3636

37-
test_srcs += files('test_main.cc')
38-
3937
if cpp.get_id() == 'msvc'
4038
test_srcs += 'test_file.cc'
4139
endif
@@ -46,7 +44,7 @@ test(
4644
'gtest_minizip',
4745
test_srcs,
4846
cpp_args: margs,
49-
dependencies: [gtest_dep, testlib_dep],
47+
dependencies: [gtestmain_dep, testlib_dep],
5048
),
5149
workdir: testdir,
5250
timeout: 300,

0 commit comments

Comments
 (0)