1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
From d17821dc807d9f621d2696f4ca320a0720e993d4 Mon Sep 17 00:00:00 2001
From: Cole Mickens <cole.mickens@gmail.com>
Date: Wed, 24 Oct 2018 01:33:22 -0700
Subject: [PATCH] cmake: output share/fmt.pc
---
.gitignore | 1 +
CMakeLists.txt | 9 +++++++++
support/cmake/fmt.pc.in | 11 +++++++++++
3 files changed, 21 insertions(+)
create mode 100644 support/cmake/fmt.pc.in
diff --git a/.gitignore b/.gitignore
index 1e6172f..694f8f8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -31,3 +31,4 @@ CMakeFiles
FMT.build
Makefile
run-msbuild.bat
+fmt.pc
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7cf7482..d1bc955 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -202,6 +202,7 @@ if (FMT_INSTALL)
"Installation directory for cmake files, relative to ${CMAKE_INSTALL_PREFIX}.")
set(version_config ${PROJECT_BINARY_DIR}/fmt-config-version.cmake)
set(project_config ${PROJECT_BINARY_DIR}/fmt-config.cmake)
+ set(pkgconfig ${PROJECT_BINARY_DIR}/fmt.pc)
set(targets_export_name fmt-targets)
set (INSTALL_TARGETS fmt)
@@ -215,11 +216,18 @@ if (FMT_INSTALL)
set(FMT_INC_DIR ${CMAKE_INSTALL_INCLUDEDIR}/fmt CACHE STRING
"Installation directory for include files, relative to ${CMAKE_INSTALL_PREFIX}.")
+ set(FMT_PKGCONFIG_DIR "${CMAKE_INSTALL_PREFIX}/share/pkgconfig" CACHE PATH
+ "Installation directory for pkgconfig (.pc) files, relative to ${CMAKE_INSTALL_PREFIX}.")
+
# Generate the version, config and target files into the build directory.
write_basic_package_version_file(
${version_config}
VERSION ${FMT_VERSION}
COMPATIBILITY AnyNewerVersion)
+ configure_file(
+ "${PROJECT_SOURCE_DIR}/support/cmake/fmt.pc.in"
+ "${pkgconfig}"
+ @ONLY)
configure_package_config_file(
${PROJECT_SOURCE_DIR}/support/cmake/fmt-config.cmake.in
${project_config}
@@ -240,6 +248,7 @@ if (FMT_INSTALL)
install(TARGETS ${INSTALL_TARGETS} EXPORT ${targets_export_name}
DESTINATION ${FMT_LIB_DIR})
install(FILES ${FMT_HEADERS} DESTINATION ${FMT_INC_DIR})
+ install(FILES "${pkgconfig}" DESTINATION "${FMT_PKGCONFIG_DIR}")
endif ()
if (FMT_DOC)
diff --git a/support/cmake/fmt.pc.in b/support/cmake/fmt.pc.in
new file mode 100644
index 0000000..b203681
--- /dev/null
+++ b/support/cmake/fmt.pc.in
@@ -0,0 +1,11 @@
+prefix=@CMAKE_INSTALL_PREFIX@
+exec_prefix=@CMAKE_INSTALL_PREFIX@
+libdir=@INSTALL_LIB_DIR@
+includedir=@INSTALL_INC_DIR@
+
+Name: fmt
+Description: A modern formatting library
+Version: @VERSION@
+Libs: -L${libdir} -lfmt
+Cflags: -I${includedir}
+
--
2.16.2
|