aboutsummaryrefslogtreecommitdiffstats
path: root/meson.build
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2022-01-13 15:27:41 -0500
committerDavid Robillard <d@drobilla.net>2022-01-13 15:33:51 -0500
commitc4bb9e1ca60fd7e82548aa2e5d72e9ab7efda9ca (patch)
tree67da9e248bae7e66a7eeae98659592ea36c47bcd /meson.build
parent7d2183d13b298f33733e67184dd86a34a71723bf (diff)
downloadserd-c4bb9e1ca60fd7e82548aa2e5d72e9ab7efda9ca.tar.gz
serd-c4bb9e1ca60fd7e82548aa2e5d72e9ab7efda9ca.tar.bz2
serd-c4bb9e1ca60fd7e82548aa2e5d72e9ab7efda9ca.zip
Define _POSIX_C_SOURCE globally in the build system
Using inconsistent defines like this that affect the standard library implementation can cause issues. So, doing this consistently for the whole library is a better approach, although it unfortunately makes the code more difficult to compile manually.
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build10
1 files changed, 8 insertions, 2 deletions
diff --git a/meson.build b/meson.build
index bf29d82c..890c8894 100644
--- a/meson.build
+++ b/meson.build
@@ -105,6 +105,12 @@ sources = [
# System libraries
m_dep = cc.find_library('m', required: false)
+# System defines needed to expose platform APIs
+platform_args = []
+if host_machine.system() != 'windows'
+ platform_args += ['-D_POSIX_C_SOURCE=200809L']
+endif
+
# Determine library type and the flags needed to build it
library_name = versioned_name
if get_option('default_library') == 'both'
@@ -136,7 +142,7 @@ libserd = build_target(
sources,
version: meson.project_version(),
include_directories: include_directories(['include']),
- c_args: c_warnings + library_args,
+ c_args: c_warnings + platform_args + library_args,
dependencies: m_dep,
gnu_symbol_visibility: 'hidden',
install: true,
@@ -163,7 +169,7 @@ if get_option('utils')
endif
serdi = executable('serdi', 'src/serdi.c',
- c_args: c_warnings + prog_args,
+ c_args: c_warnings + platform_args + prog_args,
link_args: tool_link_args,
install: true,
dependencies: serd_dep)