aboutsummaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-support/avro/avro-c++/0002-Add-package-configuration-files.patch
blob: ecb1251860a81fcddacdb0c3fcfce6e8285907bf (plain)
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
From 56feaa90d070a5011f380d3ae47c01643b9fafe0 Mon Sep 17 00:00:00 2001
From: Rui Costa <rui.ms.costa@ctw.bmwgroup.com>
Date: Fri, 22 Mar 2024 13:27:38 +0000
Subject: [PATCH 2/2] Add package configuration files

Upstream-Status: Pending
---
 lang/c++/CMakeLists.txt            | 35 +++++++++++++++++++++++++++---
 lang/c++/cmake/AvroCppConfig.cmake |  5 +++++
 2 files changed, 37 insertions(+), 3 deletions(-)
 create mode 100644 lang/c++/cmake/AvroCppConfig.cmake

diff --git a/CMakeLists.txt b/CMakeLists.txt
index d94ba42d3..2e5a394cb 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -140,12 +140,16 @@ set (CPACK_PACKAGE_FILE_NAME "avrocpp-${AVRO_VERSION_MAJOR}")

 include (CPack)

-install (TARGETS avrocpp avrocpp_s
+install (TARGETS avrocpp
+    EXPORT AvroCppTargets
     LIBRARY DESTINATION lib
     ARCHIVE DESTINATION lib
-    RUNTIME DESTINATION lib)
+    RUNTIME DESTINATION lib
+    INCLUDES DESTINATION include)

-install (TARGETS avrogencpp RUNTIME DESTINATION bin)
+install (TARGETS avrogencpp
+    EXPORT AvroCppTargets
+    RUNTIME DESTINATION bin)

 install (DIRECTORY api/ DESTINATION include/avro
     FILES_MATCHING PATTERN *.hh)
@@ -155,3 +159,28 @@ if (NOT CMAKE_BUILD_TYPE)
       "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
       FORCE)
 endif (NOT CMAKE_BUILD_TYPE)
+
+# Create cmake config files
+include(CMakePackageConfigHelpers)
+write_basic_package_version_file(
+    "${CMAKE_CURRENT_BINARY_DIR}/AvroCppConfigVersion.cmake"
+    VERSION ${AVRO_VERSION_MAJOR}.${AVRO_VERSION_MINOR}.${AVRO_VERSION_PATCH}
+    COMPATIBILITY AnyNewerVersion
+)
+
+configure_file(cmake/AvroCppConfig.cmake
+    "${CMAKE_CURRENT_BINARY_DIR}/AvroCppConfig.cmake"
+    COPYONLY
+)
+
+set(ConfigPackageLocation lib/cmake/avrocpp)
+install(EXPORT AvroCppTargets
+    FILE AvroCppTargets.cmake
+    NAMESPACE AvroCpp::
+    DESTINATION ${ConfigPackageLocation}
+)
+install(FILES
+    "cmake/AvroCppConfig.cmake"
+    "${CMAKE_CURRENT_BINARY_DIR}/AvroCppConfigVersion.cmake"
+    DESTINATION ${ConfigPackageLocation}
+    COMPONENT Devel)
diff --git a/cmake/AvroCppConfig.cmake b/cmake/AvroCppConfig.cmake
new file mode 100644
index 000000000..deb8aaa31
--- /dev/null
+++ b/cmake/AvroCppConfig.cmake
@@ -0,0 +1,5 @@
+include(CMakeFindDependencyMacro)
+find_dependency(Boost 1.38 REQUIRED
+    COMPONENTS filesystem iostreams program_options regex system)
+
+include("${CMAKE_CURRENT_LIST_DIR}/AvroCppTargets.cmake")
--
2.44.0