summaryrefslogtreecommitdiff
path: root/utilities/CMakeLists.txt
blob: bf5348173726ba637992115d685e971d67942881 (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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
######################################################################
# Basic utility programs and their joy.
#
# The general assumption is that each of these utilities is built from
# a single source file, which shares its name with the utility itself (appended with .cpp),
# and then linked against the SWORD library.
#
# This list will be built and installed, if so chosen
#
# These are in alphbetical order now - please keep them that way
# if you edit this list in the future.
#
SET(install_UTILITIES
	addld
	emptyvss
	imp2gbs
	imp2ld
	imp2vs
	installmgr
	mkfastmod
	mod2imp
	mod2osis
	mod2vpl
	tei2mod
	vpl2mod
	vs2osisref
	vs2osisreftxt
	xml2gbs
	osis2mod
)

IF(WITH_ZLIB OR WITH_INTERNAL_ZLIB)
	SET(install_UTILITIES ${install_UTILITIES} mod2zmod)
ENDIF(WITH_ZLIB OR WITH_INTERNAL_ZLIB)

######################################################################
# These utilities will be built, but they will not be installed
#
# Again, I have gone to great lengths of travail to make this list
# alphabetical.  If you add utilities to this list, please do so in a
# way that maintains this.
SET(noinstall_UTILITIES
	addgb
	addvs
	gbfidx
	genbookutil
	modwrite
	step2vpl
	stepdump
	treeidxutil
)

#####################################################################
# This will loop over both of the above utility lists and add build targets
# to the system for each one of them.
#

FOREACH(UTIL ${install_UTILITIES} ${noinstall_UTILITIES})
	ADD_EXECUTABLE("${UTIL}"	"${UTIL}.cpp")
	IF(BUILDING_SHARED)
		TARGET_LINK_LIBRARIES("${UTIL}" sword)
	ELSE(BUILDING_SHARED)
		TARGET_LINK_LIBRARIES("${UTIL}" sword_static)
	ENDIF(BUILDING_SHARED)
ENDFOREACH(UTIL ${install_UTILITIES})

####################################################################
# Just to be difficult, we have a single C file that is a utility
# and, therefore, needs its own treatment.
#

ADD_EXECUTABLE(lexdump	lexdump.c)
IF(BUILDING_SHARED)
	TARGET_LINK_LIBRARIES(lexdump sword)
ELSE(BUILDING_SHARED)
	TARGET_LINK_LIBRARIES(lexdump sword_static)
ENDIF(BUILDING_SHARED)

####################################################################
# Install the utilities
#
# We do this here, rather than up in the main install file, because
# a) it fits more logically and b) the scope of ${install_UTILITIES}
# is limited to CMake files in this directory and below, so rather than
# replicate the above list in another place, we'll just handle our
# own install, since this whole directory is optional, anyway.
#
FOREACH(UTIL ${install_UTILITIES})
	INSTALL(TARGETS ${UTIL}
        RUNTIME DESTINATION "${BINDIR}"
		COMPONENT utilities
	)
ENDFOREACH(UTIL ${install_UTILITIES})

ADD_SUBDIRECTORY("${CMAKE_CURRENT_SOURCE_DIR}/diatheke")