diff options
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 35 |
1 files changed, 25 insertions, 10 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 78059dba..2fb0632b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -98,16 +98,31 @@ ELSE() ENDIF() ENDIF() -# Check if _POSIX_C_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") - 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) +if(NOT WIN32) + # Check if _POSIX_C_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") + 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) + ENDIF() ENDIF() UNSET(OLD_REQUIRED_FLAGS) ENDIF() |