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 dependenciesI 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 |
Answered by
eli-schwartz
Dec 28, 2022
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 |
0 replies
Answer selected by
bgilbert
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.