blob: 6496b92dfea54f8d62509ea5317d2222f264e15d [file] [log] [blame]
Brad Bishope42b3e32020-01-15 22:08:42 -05001From f24f863f3a8ca86f44123a58613f62c3b511da1e Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Thu, 19 Dec 2019 18:23:41 -0800
4Subject: [PATCH] cmake: Use GNUInstallDirs instead of hard-coded paths
5
6This ensures that it can be built on platforms where libdir is not
7/usr/lib e.g. ppc64
8
9Upstream-Status: Submitted [https://github.com/apache/avro/pull/749]
10Signed-off-by: Khem Raj <raj.khem@gmail.com>
11---
12 lang/c/CMakeLists.txt | 2 +-
13 lang/c/src/CMakeLists.txt | 16 +++++++++-------
14 2 files changed, 10 insertions(+), 8 deletions(-)
15
16diff --git a/lang/c/CMakeLists.txt b/lang/c/CMakeLists.txt
17index 11cbf018e..6c8d7aaf3 100644
18--- a/lang/c/CMakeLists.txt
19+++ b/lang/c/CMakeLists.txt
20@@ -16,7 +16,7 @@
21 # specific language governing permissions and limitations
22 # under the License.
23 #
24-cmake_minimum_required(VERSION 2.4)
25+cmake_minimum_required(VERSION 3.1)
26 project(AvroC)
27 enable_testing()
28
29diff --git a/lang/c/src/CMakeLists.txt b/lang/c/src/CMakeLists.txt
30index 6f5659750..c1761c8de 100644
31--- a/lang/c/src/CMakeLists.txt
32+++ b/lang/c/src/CMakeLists.txt
33@@ -106,17 +106,19 @@ install(DIRECTORY
34 DESTINATION include
35 FILES_MATCHING PATTERN "*.h")
36
37+include(GNUInstallDirs)
38+
39 if (WIN32)
40 install(TARGETS avro-static
41- RUNTIME DESTINATION bin
42- LIBRARY DESTINATION lib
43- ARCHIVE DESTINATION lib
44+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
45+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
46+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
47 )
48 else(WIN32)
49 install(TARGETS avro-static avro-shared
50- RUNTIME DESTINATION bin
51- LIBRARY DESTINATION lib
52- ARCHIVE DESTINATION lib
53+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
54+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
55+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
56 )
57 endif(WIN32)
58
59@@ -126,7 +128,7 @@ set(prefix ${CMAKE_INSTALL_PREFIX})
60 set(VERSION ${AVRO_VERSION})
61 configure_file(avro-c.pc.in avro-c.pc)
62 install(FILES ${CMAKE_CURRENT_BINARY_DIR}/avro-c.pc
63- DESTINATION lib/pkgconfig)
64+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
65
66 add_executable(avrocat avrocat.c)
67 target_link_libraries(avrocat avro-static)
68--
692.24.1
70