diff --git a/meson.build b/meson.build index d8db6b0ce9..2237b9f2eb 100644 --- a/meson.build +++ b/meson.build @@ -157,6 +157,7 @@ wx_dep = dependency('wxWidgets', version: '>=' + get_option('wx_version'), if wx_dep.found() deps += wx_dep + wx_defines_dep = wx_dep else build_shared = true if get_option('default_library') == 'static' @@ -184,11 +185,16 @@ else wx = cmake.subproject('wxWidgets', options: opt_var) - deps += [ - wx.dependency('wxmono'), - wx.dependency('wxregex'), - wx.dependency('wxscintilla') - ] + deps += wx.dependency('wxmono') + foreach cmake_target: ['wxregex', 'wxscintilla', 'wxlexilla'] + if wx.target_list().contains(cmake_target) + deps += wx.dependency(cmake_target) + endif + endforeach + + # meson doesn't let you get defines from a library that has sources which need to be built, + # but allows it if you use partial_dependency() to get only includes and compile args. + wx_defines_dep = wx.dependency('wxmono').partial_dependency(compile_args: true, includes: true) if host_machine.system() == 'windows' or host_machine.system() == 'darwin' deps += [ @@ -233,7 +239,7 @@ check_deps = [ ] if host_machine.system() == 'linux' - if cc.get_define('__WXGTK3__', dependencies: wx_dep, prefix: '#include ') != '' + if cc.get_define('__WXGTK3__', dependencies: wx_defines_dep, prefix: '#include ') != '' check_deps += [['libportal-gtk3', [], 'libportal', [], []]] else check_deps += [['libportal', [], 'libportal', [], []]]