Export pkg-config dependencies via the CMake cache

This will be useful when building GLFW as a CMake object library and
linking it into a larger library that exports pkg-config information.

Partly based on #1307 by @a3f.

Closes #1307.
This commit is contained in:
Camilla Löwy 2021-07-30 13:19:46 +02:00
parent d83849792b
commit 244948e174
3 changed files with 12 additions and 4 deletions

View File

@ -7,7 +7,7 @@ Name: GLFW
Description: A multi-platform library for OpenGL, window and input Description: A multi-platform library for OpenGL, window and input
Version: @GLFW_VERSION@ Version: @GLFW_VERSION@
URL: https://www.glfw.org/ URL: https://www.glfw.org/
Requires.private: @GLFW_PKG_DEPS@ Requires.private: @GLFW_PKG_CONFIG_REQUIRES_PRIVATE@
Libs: -L${libdir} -l@GLFW_LIB_NAME@ Libs: -L${libdir} -l@GLFW_LIB_NAME@
Libs.private: @GLFW_PKG_LIBS@ Libs.private: @GLFW_PKG_CONFIG_LIBS_PRIVATE@
Cflags: -I${includedir} Cflags: -I${includedir}

View File

@ -258,12 +258,17 @@ endif()
# Export GLFW library dependencies # Export GLFW library dependencies
#-------------------------------------------------------------------- #--------------------------------------------------------------------
foreach(arg ${glfw_PKG_DEPS}) foreach(arg ${glfw_PKG_DEPS})
set(GLFW_PKG_DEPS "${GLFW_PKG_DEPS} ${arg}") set(deps "${deps} ${arg}")
endforeach() endforeach()
foreach(arg ${glfw_PKG_LIBS}) foreach(arg ${glfw_PKG_LIBS})
set(GLFW_PKG_LIBS "${GLFW_PKG_LIBS} ${arg}") set(libs "${libs} ${arg}")
endforeach() endforeach()
set(GLFW_PKG_CONFIG_REQUIRES_PRIVATE "${deps}" CACHE INTERNAL
"GLFW pkg-config Requires.private")
set(GLFW_PKG_CONFIG_LIBS_PRIVATE "${libs}" CACHE INTERNAL
"GLFW pkg-config Libs.private")
#-------------------------------------------------------------------- #--------------------------------------------------------------------
# Create generated files # Create generated files
#-------------------------------------------------------------------- #--------------------------------------------------------------------

View File

@ -131,6 +131,8 @@ information on what to include when reporting a bug.
surface extension (#1793) surface extension (#1793)
- Added `GLFW_LIBRARY_TYPE` CMake variable for overriding the library type - Added `GLFW_LIBRARY_TYPE` CMake variable for overriding the library type
(#279,#1307,#1497,#1574,#1928) (#279,#1307,#1497,#1574,#1928)
- Added `GLFW_PKG_CONFIG_REQUIRES_PRIVATE` and `GLFW_PKG_CONFIG_LIBS_PRIVATE` CMake
variables exposing pkg-config dependencies (#1307)
- Made joystick subsystem initialize at first use (#1284,#1646) - Made joystick subsystem initialize at first use (#1284,#1646)
- Made `GLFW_DOUBLEBUFFER` a read-only window attribute - Made `GLFW_DOUBLEBUFFER` a read-only window attribute
- Updated the minimum required CMake version to 3.1 - Updated the minimum required CMake version to 3.1
@ -322,6 +324,7 @@ skills.
- Fredrik Ehnbom - Fredrik Ehnbom
- Robin Eklind - Robin Eklind
- Siavash Eliasi - Siavash Eliasi
- Ahmad Fatoum
- Felipe Ferreira - Felipe Ferreira
- Michael Fogleman - Michael Fogleman
- Gerald Franz - Gerald Franz