diff options
author | Chris Robinson <[email protected]> | 2016-01-21 06:08:18 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2016-01-21 06:08:18 -0800 |
commit | 0a9e9858f983b7b4c6b92c3d9ecf69a9d3ecb3f6 (patch) | |
tree | b499e1ccd1724d4a2ba6eafcc5aa9ab3ebe968d2 /CMakeLists.txt | |
parent | 8f26ad4ba237b3ad42fd1e28a7d800e4dc9e7fe4 (diff) |
Always define _XOPEN_SOURCE if _POSIX_C_SOURCE is too
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) |