diff options
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 9326f270..dac8d998 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -103,29 +103,16 @@ ELSE() ENDIF() if(NOT WIN32) - # Check if _POSIX_C_SOURCE needs to be set for POSIX functions + # Check if _POSIX_C_SOURCE and _XOPEN_SOURCE needs to be set for POSIX functions CHECK_SYMBOL_EXISTS(posix_memalign stdlib.h HAVE_POSIX_MEMALIGN_DEFAULT) IF(NOT HAVE_POSIX_MEMALIGN_DEFAULT) SET(OLD_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) - SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -D_POSIX_C_SOURCE=200809L") + SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700") CHECK_SYMBOL_EXISTS(posix_memalign stdlib.h HAVE_POSIX_MEMALIGN_POSIX) IF(NOT HAVE_POSIX_MEMALIGN_POSIX) SET(CMAKE_REQUIRED_FLAGS ${OLD_REQUIRED_FLAGS}) ELSE() - ADD_DEFINITIONS(-D_POSIX_C_SOURCE=200809L) - ENDIF() - ENDIF() - - # Check if _XOPEN_SOURCE needs to be set (if POSIX < 2008) - CHECK_SYMBOL_EXISTS(scandir dirent.h HAVE_SCANDIR_DEFAULT) - IF(NOT HAVE_SCANDIR_DEFAULT) - SET(OLD_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) - SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -D_XOPEN_SOURCE=700") - CHECK_SYMBOL_EXISTS(scandir dirent.h HAVE_SCANDIR_XOPEN) - IF(NOT HAVE_SCANDIR_XOPEN) - SET(CMAKE_REQUIRED_FLAGS ${OLD_REQUIRED_FLAGS}) - ELSE() - ADD_DEFINITIONS(-D_XOPEN_SOURCE=700) + ADD_DEFINITIONS(-D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700) ENDIF() ENDIF() UNSET(OLD_REQUIRED_FLAGS) |