mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-08-30 21:45:37 +00:00
[#3732] Meson: Fix GTest detection
This commit is contained in:
@@ -6,7 +6,7 @@ TEST(Fixture, testWithLongLongLongName) {
|
|||||||
EXPECT_LT(1, 2);
|
EXPECT_LT(1, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main() {
|
int main(int argc, char* argv[]) {
|
||||||
testing::InitGoogleTest();
|
testing::InitGoogleTest(&argc, argv);
|
||||||
return RUN_ALL_TESTS();
|
return RUN_ALL_TESTS();
|
||||||
}
|
}
|
||||||
|
30
meson.build
30
meson.build
@@ -249,20 +249,32 @@ if netconf_opt.enabled() and NETCONF_DEP.get_variable(
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
# Google Test
|
# Google Test
|
||||||
GTEST_DEP = dependency('gtest', required: TESTS_OPT.enabled() or FUZZ_OPT.enabled())
|
GTEST_DEP = disabler()
|
||||||
if GTEST_DEP.found()
|
if FUZZ_OPT.enabled() or TESTS_OPT.enabled()
|
||||||
result = cpp.run(
|
GTEST_DEP = dependency('gtest', required: false)
|
||||||
fs.read('compiler-checks/gtest.cc'),
|
if GTEST_DEP.found()
|
||||||
name: 'Check if a simple GTest test runs.',
|
# Wrap dependencies cannot be used in compiler checks: https://github.com/mesonbuild/meson/issues/11575
|
||||||
dependencies: [GTEST_DEP],
|
# Should never be a wrap dependency at this point, but somehow it happens on Alpine systems.
|
||||||
)
|
if GTEST_DEP.type_name() != 'internal'
|
||||||
if result.returncode() != 0
|
result = cpp.run(
|
||||||
GTEST_DEP = disabler()
|
fs.read('compiler-checks/gtest.cc'),
|
||||||
|
name: 'Check if a simple GTest test runs.',
|
||||||
|
dependencies: [GTEST_DEP, threads_dep],
|
||||||
|
)
|
||||||
|
if result.returncode() != 0
|
||||||
|
GTEST_DEP = disabler()
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
if not GTEST_DEP.found()
|
||||||
gtest_subproject = subproject('gtest', required: false)
|
gtest_subproject = subproject('gtest', required: false)
|
||||||
if gtest_subproject.found()
|
if gtest_subproject.found()
|
||||||
GTEST_DEP = gtest_subproject.get_variable('gtest_dep')
|
GTEST_DEP = gtest_subproject.get_variable('gtest_dep')
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
if not GTEST_DEP.found()
|
||||||
|
error('Dependency not found: GTest.')
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Crypto
|
# Crypto
|
||||||
|
Reference in New Issue
Block a user