Add "prefix name" to include shared library generated header #10256
-
Hi! I have project directories distributions separated by modules, something like this: ├── project-src
│ ├── module_1
│ │ ├── submodule_11
│ │ │ ├── include
│ │ │ │ ├── header_11.hpp
│ │ │ ├── src
│ │ │ ├── meson.build
│ │ ├── submodule_2
│ │ ├── meson.build
│ ├── module_2
│ │ ├── submodule_21
│ │ │ ├── include
│ │ │ │ ├── header_21.hpp
│ │ │ ├── src
│ │ │ ├── meson.build
│ │ ├── submodule_22
│ │ ├── meson.build
│ ├── meson.build
├── meson.build Most of these "submodules" are compiled as shared libraries, the thing is that if I use So, is there a way to add something to the shared library creation such as a prefix? To be able to include the header such as: Without adding the folder |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
I'm not sure I understand your goal? In However, you cannot ever use Meson doesn't care which one you use, it is the compiler itself which absolutely enforces this. So either you give up on having a directory prefix, or you actually create the directory prefix as part of your on-disk project structure. |
Beta Was this translation helpful? Give feedback.
I'm not sure I understand your goal?
In
submodule_11/meson.build
you can do incdir_11 = include_directories('include') and later use the incdir_11 variable in any target to enable#include <header_11.hpp>
.However, you cannot ever use
#include <submodule_11/header_11.hpp>
because the compiler itself will then look for a file namedsubmodule_11/header_11.hpp
and you must therefore have that exact filename including leading directory prefix on disk somewhere.Meson doesn't care which one you use, it is the compiler itself which absolutely enforces this. So either you give up on having a directory prefix, or you actually create the directory prefix as part of your on-disk project structure.