Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ project(NIFTI
DESCRIPTION "Niftilib is a set of i/o libraries for reading and writing files in the nifti-1 data format. nifti-1 is a binary file format for storing medical image data, e.g. magnetic resonance image (MRI) and functional MRI (fMRI) brain images."
LANGUAGES C)

# Sources needing POSIX interfaces (strdup, popen) request them with
# _POSIX_C_SOURCE at the top of the file.
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED ON)
set(CMAKE_C_EXTENSIONS OFF)
Comment thread
seanm marked this conversation as resolved.
Resolved

list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/cmake)
include(nifti_macros)

Expand Down
4 changes: 4 additions & 0 deletions cifti/afni_xml.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/* strdup() is POSIX, not ISO C11; must precede every #include.
C23 adds it, so this define goes away once C23 is the floor. */
#define _POSIX_C_SOURCE 200809L

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
Expand Down
3 changes: 3 additions & 0 deletions nifti2/nifti2_io.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/* popen()/pclose() in the PIGZ write path are POSIX, not ISO C11. */
#define _POSIX_C_SOURCE 200809L

#define NIFTI2_IO_C

#include <assert.h>
Expand Down
3 changes: 3 additions & 0 deletions niftilib/nifti1_io.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/* popen()/pclose() in the PIGZ write path are POSIX, not ISO C11. */
#define _POSIX_C_SOURCE 200809L

#define NIFTI1_IO_C

#include <stdint.h>
Expand Down
Loading