3

In Meson, is it possible to get a string absolute path from an object created by a call to include_directories?

My use case:

    include_dirs = include_directories('include')
    lib = library(
        'mylib',
        source_files,
        include_directories: include_dirs
    )
    run_target('analyze',
        command: ['static_analysis',
            source_files,
            '-I', include_dirs.to_abs_path(),
        ]
    )

include_dirs.to_abs_path() does not exist, but I wonder if something similar is possible. Alternatively, files() exists(as used for source_files here); is there a directories()?

Aart Stuurman
  • 3,188
  • 4
  • 26
  • 44

1 Answers1

5

You probably found out how to achieve this by now, but if anyone is looking for the same thing, you can get the root directory by calling

dir_base = meson.current_source_dir()

This returns the directory of the current meson build file.
Then you could construct the include path by doing

dir_include = join_paths(dir_base, 'include')
DJSchaffner
  • 562
  • 7
  • 22