Compiler tests on dependencies overridden by parent project #11223
-
I'm using a third-party project project('proj', 'c')
jpeg = dependency('libjpeg')
# Check some property of the dependency
cc = meson.get_compiler('c')
has_func = cc.has_function('jpeg_finish_decompress', dependencies: jpeg) This builds fine. But when I bundle project('super', 'c')
# equivalently, dependency('libjpeg') with --force-fallback-for libjpeg
subproject('libjpeg')
subproject('proj') ...setup fails: subprojects/proj/meson.build:5:0: ERROR: Dependencies must be external dependencies I understand why: project('proj', 'c')
jpeg = dependency('libjpeg')
if jpeg.external()
cc = meson.get_compiler('c')
has_func = cc.has_function('jpeg_finish_decompress', dependencies: jpeg)
else
# libjpeg injected by parent project. Make a safe assumption.
has_func = true
endif |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Yes -- it is called However, you may be able to get away with not doing compiler checks at all, if you can guard the |
Beta Was this translation helpful? Give feedback.
Yes -- it is called
jpeg.type_name()
and for dependencies produced by declare_dependency from a subproject, it will be== 'internal'
.However, you may be able to get away with not doing compiler checks at all, if you can guard the
dependency()
with a version check that covers all versions where that function was added.