eexpress
eexpress

Reputation: 446

How to add multi compiler parameters to meson.build

Normally I use this to compile one of my vala code: valac --pkg gtk+-3.0 -X -lm %f


Now I try meson/ninja,

meson build --prefix=/usr

Then I edit the meson.build, add two lines. (After search a lot)

    link_args : '-X',
    link_args : '-lm',

The entire part is

executable(
    meson.project_name(),
    'src/Application.vala',
    dependencies: [
        dependency('gtk+-3.0')
    ],
    link_args : '-X',
    link_args : '-lm',
    install: true
)

ninja passed now, but it says:

meson.build:5: WARNING: Keyword argument "link_args" defined multiple times.
WARNING: This will be an error in future Meson releases.

So How to add multi compiler parameters correctly?

Upvotes: 2

Views: 2012

Answers (2)

Picaud Vincent
Picaud Vincent

Reputation: 10982

An alternative way is to use an array

executable(
    meson.project_name(),
    'src/Application.vala',
    dependencies: [
        dependency('gtk+-3.0')
    ],
    link_args : ['-X', '-lm',],   # <- here
    install: true
)

Upvotes: 1

aeldemery
aeldemery

Reputation: 91

you can try this instead, in the dependency section

meson.get_compiler('c').find_library('m', required: false),

That should add math library linkage for you.

Upvotes: 2

Related Questions