[sysprof: 1/4] build: Add feature test flags to project-wide preprocessor flags



commit 50679dba044f37ed4aeae5c6b58550baefe968dd
Author: Philip Withnall <withnall endlessm com>
Date:   Mon Jul 6 11:25:32 2020 +0100

    build: Add feature test flags to project-wide preprocessor flags
    
    Rather than defining them piecemeal in each C and H file, and having
    problems with headers being included in different orders so that
    `_POSIX_C_SOURCE` gets a value which is too low, just define the feature
    test flags in `meson.build`.
    
    See `man 7 feature_test_macros`.
    
    This is useful for when building sysprof as a subproject beneath a
    project which doesn’t define these macros, or which targets an older C
    standard than `gnu11`.
    
    Signed-off-by: Philip Withnall <withnall endlessm com>

 meson.build | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/meson.build b/meson.build
index e1e9b42..26f289f 100644
--- a/meson.build
+++ b/meson.build
@@ -87,7 +87,10 @@ add_project_arguments([
   '-I' + meson.build_root(), # config.h
 ], language: 'c')
 
-global_c_args = []
+global_c_args = [
+  '-D_GNU_SOURCE',
+  '-D_POSIX_C_SOURCE=200809L',
+]
 test_c_args = [
   '-Wcast-align',
   '-Wdeclaration-after-statement',


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]