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.
This commit is contained in:
MaciejDziuban 2024-01-17 23:29:36 +01:00
parent 3ed6e9d89a
commit 708a48ca36
2 changed files with 3 additions and 4 deletions

View File

@ -316,10 +316,8 @@ if (MSVC90)
endif() endif()
# Workaround for -std=c99 on Linux disabling _DEFAULT_SOURCE (POSIX 2008 and more) # 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")
if (CMAKE_SYSTEM_NAME STREQUAL "Linux") target_compile_definitions(glfw PRIVATE _DEFAULT_SOURCE)
target_compile_definitions(glfw PRIVATE _DEFAULT_SOURCE)
endif()
endif() endif()
if (GLFW_BUILD_SHARED_LIBRARY) if (GLFW_BUILD_SHARED_LIBRARY)

View File

@ -29,6 +29,7 @@
#include <stdint.h> #include <stdint.h>
#include <time.h> #include <time.h>
#include <sys/types.h>
// POSIX-specific global timer data // POSIX-specific global timer data