Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Meson absolute path from include_directories

Tags:

meson-build

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()?

like image 397
Aart Stuurman Avatar asked Sep 05 '25 03:09

Aart Stuurman


1 Answers

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')
like image 157
DJSchaffner Avatar answered Sep 08 '25 00:09

DJSchaffner