Prechádzať zdrojové kódy

Linux: Fix missing feature macro for using strdup

This adds _XOPEN_SOURCE = 500.

Fixes #1055.
Camilla Löwy 8 rokov pred
rodič
commit
079518617c
2 zmenil súbory, kde vykonal 4 pridanie a 1 odobranie
  1. 1 0
      README.md
  2. 3 1
      src/CMakeLists.txt

+ 1 - 0
README.md

@@ -202,6 +202,7 @@ information on what to include when reporting a bug.
 - [Linux] Bugfix: Event processing did not detect joystick disconnection (#932)
 - [Linux] Bugfix: The joystick device path could be truncated (#1025)
 - [Linux] Bugfix: `glfwInit` would fail if inotify creation failed (#833)
+- [Linux] Bugfix: `strdup` was used without any required feature macro (#1055)
 - [Cocoa] Added support for Vulkan window surface creation via
           [MoltenVK](https://moltengl.com/moltenvk/) (#870)
 - [Cocoa] Added support for loading a `MainMenu.nib` when available

+ 3 - 1
src/CMakeLists.txt

@@ -74,7 +74,9 @@ set_target_properties(glfw PROPERTIES
                       POSITION_INDEPENDENT_CODE ON
                       FOLDER "GLFW3")
 
-target_compile_definitions(glfw PRIVATE -D_GLFW_USE_CONFIG_H)
+target_compile_definitions(glfw PRIVATE
+                           -D_GLFW_USE_CONFIG_H
+                           $<$<BOOL:${UNIX}>:_XOPEN_SOURCE=500>)
 target_include_directories(glfw PUBLIC
                            $<BUILD_INTERFACE:${GLFW_SOURCE_DIR}/include>
                            $<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>)