Prefixing meson target_list name

37 Views Asked by At

Trying to incorporate a cmake subproject (VTK) into a meson project using the following in meson.build:

cmake = import('cmake')
opt_var = cmake.subproject_options()
opt_var.add_cmake_defines({'VTK_ENABLE_WRAPPING': 'OFF'})
opt_var.add_cmake_defines({'VTK_MODULE_ENABLE_VTK_sqlite': 'NO'})
opt_var.add_cmake_defines({'VTK_MODULE_ENABLE_VTK_hdf5': 'NO'})
vtk_proj = cmake.subproject('vtk', options: opt_var)
message('CMake targets:\n - ' + '\n - '.join(vtk_proj.target_list()))

outputs:

Message: CMake targets:
...
 - ChartsCore
 - CommonColor
 - CommonComputationalGeometry
 - CommonCore
...

which lists the necessary targets, however other subprojects using this dependency expect the target_list names to be prefixed with VTK::

Executing subproject VtkViewer
...
VtkViewer| WARNING: Subproject 'vtk' did not override 'VTK (modules: VTK::CommonCore, VTK::CommonColor, VTK::CommonExecutionModel, VTK::FiltersCore, VTK::RenderingCore, VTK::InteractionStyle, VTK::RenderingUI)' dependency and no variable name specified
VtkViewer| Dependency VTK (modules: VTK::CommonCore, VTK::CommonColor, VTK::CommonExecutionModel, VTK::FiltersCore, VTK::RenderingCore, VTK::InteractionStyle, VTK::RenderingUI) from subproject subprojects/vtk found: NO

Is there a way to modify or alias the target_list names with meson's CMake module?

An alternative would be a wrap file with the prefixed public names in the [provide] section. However, I haven't found documentation for a way to add cmake_defines to wrapfiles.

I am trying to avoid writing a meson.build file since the cmake infrastructure for this library is rather complicated.

0

There are 0 best solutions below