Does meson pass something like -DDebug or -DRelease when compiling? #9948
-
I'm trying to create a network application that would require me to switch between localhost and the actual ip of the machine when test. Is it possible to detect with meson is compiling in release mode and add a definition to the c++ code? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
You can check the value of You can check |
Beta Was this translation helpful? Give feedback.
-
Alternative answer: if your application accepts the IP address as a command line option rather than a compile-time constant you can just pass localhost as a manually specified value in the |
Beta Was this translation helpful? Give feedback.
You can check the value of
get_option('debug')
to check whether the compiler has been instructed to include debug info.You can check
get_option('buildtype')
to see if the build profile is "release" i.e. has the debug and optimization settings typically associated with release builds. There is also ab_ndebug
core option which has a possible value of "if-release" which only passes-DNDEBUG
when the buildtype is a release (or plain) build.