Browse Source

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.
Camilla Löwy 4 năm trước cách đây
mục cha
commit
244948e174
3 tập tin đã thay đổi với 12 bổ sung4 xóa
  1. 2 2
      CMake/glfw3.pc.in
  2. 7 2
      CMakeLists.txt
  3. 3 0
      README.md

+ 2 - 2
CMake/glfw3.pc.in

@@ -7,7 +7,7 @@ Name: GLFW
 Description: A multi-platform library for OpenGL, window and input
 Version: @GLFW_VERSION@
 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.private: @GLFW_PKG_LIBS@
+Libs.private: @GLFW_PKG_CONFIG_LIBS_PRIVATE@
 Cflags: -I${includedir}

+ 7 - 2
CMakeLists.txt

@@ -258,12 +258,17 @@ endif()
 # Export GLFW library dependencies
 #--------------------------------------------------------------------
 foreach(arg ${glfw_PKG_DEPS})
-    set(GLFW_PKG_DEPS "${GLFW_PKG_DEPS} ${arg}")
+    set(deps "${deps} ${arg}")
 endforeach()
 foreach(arg ${glfw_PKG_LIBS})
-    set(GLFW_PKG_LIBS "${GLFW_PKG_LIBS} ${arg}")
+    set(libs "${libs} ${arg}")
 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
 #--------------------------------------------------------------------

+ 3 - 0
README.md

@@ -131,6 +131,8 @@ information on what to include when reporting a bug.
    surface extension (#1793)
  - Added `GLFW_LIBRARY_TYPE` CMake variable for overriding the library type
    (#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 `GLFW_DOUBLEBUFFER` a read-only window attribute
  - Updated the minimum required CMake version to 3.1
@@ -322,6 +324,7 @@ skills.
  - Fredrik Ehnbom
  - Robin Eklind
  - Siavash Eliasi
+ - Ahmad Fatoum
  - Felipe Ferreira
  - Michael Fogleman
  - Gerald Franz