This is an automated email from the ASF dual-hosted git repository.

mgrigorov pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/avro.git


The following commit(s) were added to refs/heads/main by this push:
     new 4ea7592e23 AVRO-4180: [C++] Add pkg-config file (#3479)
4ea7592e23 is described below

commit 4ea7592e2368e530c30667b6473e999ed771f64e
Author: Stephan Lachnit <[email protected]>
AuthorDate: Tue Nov 4 07:39:42 2025 +0100

    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 <[email protected]>
---
 lang/c++/CMakeLists.txt       | 13 ++++++++++++-
 lang/c++/cmake/avro-cpp.pc.in | 32 ++++++++++++++++++++++++++++++++
 2 files changed, 44 insertions(+), 1 deletion(-)

diff --git a/lang/c++/CMakeLists.txt b/lang/c++/CMakeLists.txt
index 03f4dfb8ab..28729f243a 100644
--- a/lang/c++/CMakeLists.txt
+++ b/lang/c++/CMakeLists.txt
@@ -16,7 +16,7 @@
 # specific language governing permissions and limitations
 # under the License.
 #
-cmake_minimum_required (VERSION 3.12)
+cmake_minimum_required (VERSION 3.20)
 
 set (CMAKE_LEGACY_CYGWIN_WIN32 0)
 
@@ -306,3 +306,14 @@ install(FILES
     "${CMAKE_CURRENT_BINARY_DIR}/avro-cpp-config-version.cmake"
     DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/avro-cpp
 )
+
+cmake_path(APPEND pc_install_includedir "\${prefix}" 
"${CMAKE_INSTALL_INCLUDEDIR}")
+cmake_path(APPEND pc_install_libdir "\${exec_prefix}" 
"${CMAKE_INSTALL_LIBDIR}")
+configure_file(
+    "${CMAKE_CURRENT_SOURCE_DIR}/cmake/avro-cpp.pc.in"
+    "${CMAKE_CURRENT_BINARY_DIR}/avro-cpp.pc"
+    @ONLY
+)
+install(FILES "${CMAKE_CURRENT_BINARY_DIR}/avro-cpp.pc"
+        DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig"
+)
diff --git a/lang/c++/cmake/avro-cpp.pc.in b/lang/c++/cmake/avro-cpp.pc.in
new file mode 100644
index 0000000000..e37d602f36
--- /dev/null
+++ b/lang/c++/cmake/avro-cpp.pc.in
@@ -0,0 +1,32 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+prefix=@CMAKE_INSTALL_PREFIX@
+exec_prefix=${prefix}
+includedir=@pc_install_includedir@
+libdir=@pc_install_libdir@
+
+Name: avro-cpp
+Description: C++ library for parsing Avro data
+URL: https://avro.apache.org/
+License: Apache-2.0
+Version: @AVRO_VERSION@
+
+Cflags: -I${includedir}
+Libs: -L${libdir} -lavrocpp
+Requires: fmt

Reply via email to