meson-build

how to set meson link dependency for buildin lib as "-lm -lrt"


on meson build, dependencies are resolved by pkg-config/cmake ...

but for system libs, no docs. I only find 2 of them:

then how can I link -lm -lrt ?

all guess fail.


Solution

  • ok, method found in doc:

    cc = meson.get_compiler('c')
    m_dep = cc.find_library('m', required : false)
    executable("abc", dependencies : m_dep)
    

    for common libs that's not good design. why not make it easy? such as:

    m_dep = dependency('m', method : 'build-in')