From 708a48ca36e192ec833e52fdf697fa5592f4a9dd Mon Sep 17 00:00:00 2001 From: MaciejDziuban Date: Wed, 17 Jan 2024 23:29:36 +0100 Subject: [PATCH] Fix compilation on Linux without X11 and Wayland In file news.dox it is mentioned that it should be possible to disable both X11 and Wayland backends to compile GLFW with only null platform. This actually does not compile due to missing definintion of clockid_t and CLOCK_REALTIME. This commit fixes compilation errors. --- src/CMakeLists.txt | 6 ++---- src/posix_time.h | 1 + 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 5acac0d0..7b84ecf2 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -316,10 +316,8 @@ if (MSVC90) endif() # Workaround for -std=c99 on Linux disabling _DEFAULT_SOURCE (POSIX 2008 and more) -if (GLFW_BUILD_X11 OR GLFW_BUILD_WAYLAND) - if (CMAKE_SYSTEM_NAME STREQUAL "Linux") - target_compile_definitions(glfw PRIVATE _DEFAULT_SOURCE) - endif() +if (CMAKE_SYSTEM_NAME STREQUAL "Linux") + target_compile_definitions(glfw PRIVATE _DEFAULT_SOURCE) endif() if (GLFW_BUILD_SHARED_LIBRARY) diff --git a/src/posix_time.h b/src/posix_time.h index 94374adb..f27027e6 100644 --- a/src/posix_time.h +++ b/src/posix_time.h @@ -29,6 +29,7 @@ #include #include +#include // POSIX-specific global timer data