Make dependency include directories public

This fixes an issue in a rare case where both dependencies and glfw
are installed in different non-standard locations. This causes include
errors when using glfw with CMake.
This commit is contained in:
Undefine 2025-09-28 14:42:54 +02:00
parent 8e15281d34
commit facb84dd2a
No known key found for this signature in database
GPG Key ID: 83332CCE9678ED47

View File

@ -161,12 +161,12 @@ if (GLFW_BUILD_WAYLAND)
wayland-egl>=0.2.7 wayland-egl>=0.2.7
xkbcommon>=0.5.0) xkbcommon>=0.5.0)
target_include_directories(glfw PRIVATE ${Wayland_INCLUDE_DIRS}) target_include_directories(glfw PUBLIC ${Wayland_INCLUDE_DIRS})
if (NOT CMAKE_SYSTEM_NAME STREQUAL "Linux") if (NOT CMAKE_SYSTEM_NAME STREQUAL "Linux")
find_package(EpollShim) find_package(EpollShim)
if (EPOLLSHIM_FOUND) if (EPOLLSHIM_FOUND)
target_include_directories(glfw PRIVATE ${EPOLLSHIM_INCLUDE_DIRS}) target_include_directories(glfw PUBLIC ${EPOLLSHIM_INCLUDE_DIRS})
target_link_libraries(glfw PRIVATE ${EPOLLSHIM_LIBRARIES}) target_link_libraries(glfw PRIVATE ${EPOLLSHIM_LIBRARIES})
endif() endif()
endif() endif()
@ -174,43 +174,43 @@ endif()
if (GLFW_BUILD_X11) if (GLFW_BUILD_X11)
find_package(X11 REQUIRED) find_package(X11 REQUIRED)
target_include_directories(glfw PRIVATE "${X11_X11_INCLUDE_PATH}") target_include_directories(glfw PUBLIC "${X11_X11_INCLUDE_PATH}")
# Check for XRandR (modern resolution switching and gamma control) # Check for XRandR (modern resolution switching and gamma control)
if (NOT X11_Xrandr_INCLUDE_PATH) if (NOT X11_Xrandr_INCLUDE_PATH)
message(FATAL_ERROR "RandR headers not found; install libxrandr development package") message(FATAL_ERROR "RandR headers not found; install libxrandr development package")
endif() endif()
target_include_directories(glfw PRIVATE "${X11_Xrandr_INCLUDE_PATH}") target_include_directories(glfw PUBLIC "${X11_Xrandr_INCLUDE_PATH}")
# Check for Xinerama (legacy multi-monitor support) # Check for Xinerama (legacy multi-monitor support)
if (NOT X11_Xinerama_INCLUDE_PATH) if (NOT X11_Xinerama_INCLUDE_PATH)
message(FATAL_ERROR "Xinerama headers not found; install libxinerama development package") message(FATAL_ERROR "Xinerama headers not found; install libxinerama development package")
endif() endif()
target_include_directories(glfw PRIVATE "${X11_Xinerama_INCLUDE_PATH}") target_include_directories(glfw PUBLIC "${X11_Xinerama_INCLUDE_PATH}")
# Check for Xkb (X keyboard extension) # Check for Xkb (X keyboard extension)
if (NOT X11_Xkb_INCLUDE_PATH) if (NOT X11_Xkb_INCLUDE_PATH)
message(FATAL_ERROR "XKB headers not found; install X11 development package") message(FATAL_ERROR "XKB headers not found; install X11 development package")
endif() endif()
target_include_directories(glfw PRIVATE "${X11_Xkb_INCLUDE_PATH}") target_include_directories(glfw PUBLIC "${X11_Xkb_INCLUDE_PATH}")
# Check for Xcursor (cursor creation from RGBA images) # Check for Xcursor (cursor creation from RGBA images)
if (NOT X11_Xcursor_INCLUDE_PATH) if (NOT X11_Xcursor_INCLUDE_PATH)
message(FATAL_ERROR "Xcursor headers not found; install libxcursor development package") message(FATAL_ERROR "Xcursor headers not found; install libxcursor development package")
endif() endif()
target_include_directories(glfw PRIVATE "${X11_Xcursor_INCLUDE_PATH}") target_include_directories(glfw PUBLIC "${X11_Xcursor_INCLUDE_PATH}")
# Check for XInput (modern HID input) # Check for XInput (modern HID input)
if (NOT X11_Xi_INCLUDE_PATH) if (NOT X11_Xi_INCLUDE_PATH)
message(FATAL_ERROR "XInput headers not found; install libxi development package") message(FATAL_ERROR "XInput headers not found; install libxi development package")
endif() endif()
target_include_directories(glfw PRIVATE "${X11_Xi_INCLUDE_PATH}") target_include_directories(glfw PUBLIC "${X11_Xi_INCLUDE_PATH}")
# Check for X Shape (custom window input shape) # Check for X Shape (custom window input shape)
if (NOT X11_Xshape_INCLUDE_PATH) if (NOT X11_Xshape_INCLUDE_PATH)
message(FATAL_ERROR "X Shape headers not found; install libxext development package") message(FATAL_ERROR "X Shape headers not found; install libxext development package")
endif() endif()
target_include_directories(glfw PRIVATE "${X11_Xshape_INCLUDE_PATH}") target_include_directories(glfw PUBLIC "${X11_Xshape_INCLUDE_PATH}")
endif() endif()
if (UNIX AND NOT APPLE) if (UNIX AND NOT APPLE)