From 31ba9e773c604fe909c711bdc32a7f74ab7b86a2 Mon Sep 17 00:00:00 2001 From: Gleb Mazovetskiy Date: Wed, 9 Oct 2019 11:53:15 +0100 Subject: [PATCH] CMake: Explicitly enable POSIX extensions This is needed when compiling on non-Linux platforms, such as Amiga, Switch, etc. --- CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index bf235bb9e..11b4563ea 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -326,6 +326,11 @@ if(WIN32) endif() endif() +if(NOT WIN32 AND NOT APPLE) + # Enable POSIX extensions such as `readlink` and `ftruncate`. + add_definitions(-D_POSIX_C_SOURCE=200809L) +endif() + if(HAIKU) target_link_libraries(devilutionx PRIVATE network) endif()