Skip to content

Commit 4ea7592

Browse files
AVRO-4180: [C++] Add pkg-config file (#3479)
* [C++] Add pkg-config file * [C++] Bump minimum required CMake version to 3.20 Required for the cmake_path function for generating the pkg-config file. * [C++] Correctly join paths for pkg-config file * Add ASLv2 to the new file * [C++] add License field to pkg-config file --------- Co-authored-by: Martin Grigorov <martin-g@users.noreply.github.com>
1 parent c39d0ac commit 4ea7592

2 files changed

Lines changed: 44 additions & 1 deletion

File tree

lang/c++/CMakeLists.txt

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# specific language governing permissions and limitations
1717
# under the License.
1818
#
19-
cmake_minimum_required (VERSION 3.12)
19+
cmake_minimum_required (VERSION 3.20)
2020

2121
set (CMAKE_LEGACY_CYGWIN_WIN32 0)
2222

@@ -306,3 +306,14 @@ install(FILES
306306
"${CMAKE_CURRENT_BINARY_DIR}/avro-cpp-config-version.cmake"
307307
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/avro-cpp
308308
)
309+
310+
cmake_path(APPEND pc_install_includedir "\${prefix}" "${CMAKE_INSTALL_INCLUDEDIR}")
311+
cmake_path(APPEND pc_install_libdir "\${exec_prefix}" "${CMAKE_INSTALL_LIBDIR}")
312+
configure_file(
313+
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/avro-cpp.pc.in"
314+
"${CMAKE_CURRENT_BINARY_DIR}/avro-cpp.pc"
315+
@ONLY
316+
)
317+
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/avro-cpp.pc"
318+
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig"
319+
)

lang/c++/cmake/avro-cpp.pc.in

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one
3+
# or more contributor license agreements. See the NOTICE file
4+
# distributed with this work for additional information
5+
# regarding copyright ownership. The ASF licenses this file
6+
# to you under the Apache License, Version 2.0 (the
7+
# "License"); you may not use this file except in compliance
8+
# with the License. You may obtain a copy of the License at
9+
#
10+
# https://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing,
13+
# software distributed under the License is distributed on an
14+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
# KIND, either express or implied. See the License for the
16+
# specific language governing permissions and limitations
17+
# under the License.
18+
#
19+
prefix=@CMAKE_INSTALL_PREFIX@
20+
exec_prefix=${prefix}
21+
includedir=@pc_install_includedir@
22+
libdir=@pc_install_libdir@
23+
24+
Name: avro-cpp
25+
Description: C++ library for parsing Avro data
26+
URL: https://avro.apache.org/
27+
License: Apache-2.0
28+
Version: @AVRO_VERSION@
29+
30+
Cflags: -I${includedir}
31+
Libs: -L${libdir} -lavrocpp
32+
Requires: fmt

0 commit comments

Comments
 (0)