mesonbuild/meson

Meson does not respect `target_include_directories(PRIVATE)` in CMake subprojects

Open

#13,818 创建于 2024年10月23日

在 GitHub 查看
 (0 评论) (0 反应) (0 负责人)Python (4,978 star) (1,465 fork)batch import
buggood first issuemodule:cmake

描述

Describe the bug target_include_directories(libfoo PRIVATE) implies that these private headers will not be propagated to the user of the libfoo.

To Reproduce https://github.com/artem/meson-bug-demo/tree/cmake-module branch cmake-module

Expected behavior test.c does not see private-include/private.h

Autogenerated meson.build by the cmake module:

project('meow', 'c')
libmeow_dir = include_directories('private-include', 'public-include', '__CMake_build', '.')
libmeow_sys = include_directories(is_system : true)
libmeow_inc = [libmeow_dir, libmeow_sys]
libmeow_src = files('meow.c')
libmeow = static_library(
  'libmeow',
  libmeow_src,
  build_by_default : false,
  link_args : [],
  link_with : [],
  include_directories : libmeow_inc,
  install : false,
  override_options : [],
  objects : [],
  c_args : [],
  pic : false
)
libmeow_dep = declare_dependency(
  link_args : [],
  link_with : libmeow,
  compile_args : [],
  include_directories : libmeow_inc
)

system parameters

  • meson 1.3.2
  • ninja 1.11.1

P.S. Relevant meson code from master branch: https://github.com/mesonbuild/meson/blob/7813354/mesonbuild/cmake/interpreter.py#L1171-L1175

贡献者指南