summaryrefslogtreecommitdiff
path: root/xdiff/0001-flesh-out-CMakeLists.txt-for-managable-build-install.patch
blob: 44088bfec243ab1e08e91948e7e0186371a6bf96 (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
From 8e9a7001d70bc35322dc3326e252a3407d762ef2 Mon Sep 17 00:00:00 2001
From: John Vogel <jvogel4@stny.rr.com>
Date: Sat, 13 Jul 2024 04:13:24 -0400
Subject: [PATCH] flesh out CMakeLists.txt for managable build/install

---
 CMakeLists.txt | 46 ++++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 42 insertions(+), 4 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 49a0d2c..6d01a30 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,8 +1,46 @@
 cmake_minimum_required(VERSION 3.5.1)
 
-project(xdiff VERSION "0.1" LANGUAGES C)
+project(xdiff C)
 
-file(GLOB SRC "*.c" "*.h")
-list(SORT SRC)
+set(XDIFF_MAJOR_VERSION 2)
+set(XDIFF_MINOR_VERSION 45)
+set(XDIFF_PATCH_VERSION 0)
 
-add_library(xdiff STATIC ${SRC})
+set(XDIFF_VERSION
+	${XDIFF_MAJOR_VERSION}.${XDIFF_MINOR_VERSION}.${XDIFF_PATCH_VERSION})
+
+set(xdiff_LIB_SRCS
+	xdiffi.c
+	xemit.c
+	xhistogram.c
+	xmerge.c
+	xpatience.c
+	xprepare.c
+	xutils.c)
+
+add_library(xdiff ${xdiff_LIB_SRCS})
+
+option(BUILD_SHARED_LIBS "build a shared library" OFF)
+
+install(FILES
+	git-xdiff.h
+	xdiff.h
+	xdiffi.h
+	xemit.h
+	xinclude.h
+	xmacros.h
+	xprepare.h
+	xtypes.h
+	xutils.h
+	COMPONENT files
+	DESTINATION include/xdiff)
+
+set_target_properties(xdiff PROPERTIES
+	VERSION ${XDIFF_VERSION}
+	SOVERSION ${XDIFF_MAJOR_VERSION}.${XDIFF_MINOR_VERSION})
+
+install(TARGETS xdiff ${INSTALL_TARGETS_DEFAULT_ARGS}
+	COMPONENT libs
+	LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+	ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+	)
-- 
2.45.2