gnu: Add date.
[jackhill/guix/guix.git] / gnu / packages / patches / date-output-pkg-config-files.patch
1 From e56b2dce7e89a92e1b9b35caa13b3e938c4cedea Mon Sep 17 00:00:00 2001
2 From: Cole Mickens <cole.mickens@gmail.com>
3 Date: Sun, 26 Jan 2020 01:27:08 -0800
4 Subject: [PATCH] CMakeLists.txt: output date.pc for pkg-config
5
6 ---
7 CMakeLists.txt | 15 +++++++++++++++
8 date.pc.in | 10 ++++++++++
9 2 files changed, 25 insertions(+)
10 create mode 100644 date.pc.in
11
12 diff --git a/CMakeLists.txt b/CMakeLists.txt
13 index f30c473..fe778e8 100644
14 --- a/CMakeLists.txt
15 +++ b/CMakeLists.txt
16 @@ -128,6 +128,15 @@ if( BUILD_TZ_LIB )
17 endif( )
18 endif( )
19
20 +if ( BUILD_TZ_LIB )
21 + # Cflags: -I${includedir} @TZ_COMPILE_DEFINITIONS@
22 + set( TZ_COMPILE_DEFINITIONS "$<IF:$<TARGET_EXISTS:tz>,-D$<JOIN:$<TARGET_PROPERTY:tz,INTERFACE_COMPILE_DEFINITIONS>, -D>,>" )
23 + configure_file(date.pc.in date.pc.cf @ONLY)
24 + file( GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/date.pc"
25 + INPUT "${CMAKE_CURRENT_BINARY_DIR}/date.pc.cf" )
26 +
27 +endif( )
28 +
29 #[===================================================================[
30 installation
31 #]===================================================================]
32 @@ -171,6 +180,12 @@ install (
33 FILES cmake/dateConfig.cmake "${version_config}"
34 DESTINATION ${CONFIG_LOC})
35
36 +if ( BUILD_TZ_LIB )
37 + install(
38 + FILES ${CMAKE_BINARY_DIR}/date.pc
39 + DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
40 +endif( )
41 +
42 #[===================================================================[
43 testing
44 #]===================================================================]
45 diff --git a/date.pc.in b/date.pc.in
46 new file mode 100644
47 index 0000000..b9c4623
48 --- /dev/null
49 +++ b/date.pc.in
50 @@ -0,0 +1,10 @@
51 +prefix=@CMAKE_INSTALL_PREFIX@
52 +exec_prefix=@CMAKE_INSTALL_BINDIR@
53 +libdir=@CMAKE_INSTALL_LIB@
54 +includedir=@CMAKE_INSTALL_INCLUDE@
55 +
56 +Name: date
57 +Description: A date and time library based on the C++11/14/17 <chrono> header
58 +Version: @PACKAGE_VERSION@
59 +Libs: -L${libdir} -ltz
60 +Cflags: -I${includedir} @TZ_COMPILE_DEFINITIONS@