summaryrefslogtreecommitdiff
path: root/app/help/CMakeLists.txt
blob: efc7b23cfd23b909eb924aebad1eab93f1f0fca3 (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
project(messagefile)

#
# genhelp is used in ..\bin to generate the tooltip texts

add_executable(genhelp "")
target_sources(genhelp 
	PRIVATE
	genhelp.c)

target_link_libraries(genhelp 
	PUBLIC	
	cJSON
)

#
# interpreter for message source file

add_executable(genmessages "")

target_sources(genmessages PUBLIC
	genmessages.c
)

set_source_files_properties(
	genhelp.json messages.in xtrkcad.tip 
	PROPERTIES HEADER_FILE_ONLY TRUE
)

#
# Generate message include file and the input file for the help system

if(XTRKCAD_USE_GETTEXT)
	set(GENHELP_OPTS "-bhi" )
	set(GENMESSAGES_OPTS "-i18n")
else()
	set(GENHELP_OPTS "-bh" )
	set(GENMESSAGES_OPTS "")
endif()

add_custom_command(
       OUTPUT bllnhlp.c
       DEPENDS genhelp genhelp.json
       COMMAND genhelp ${GENHELP_OPTS} ${CMAKE_CURRENT_SOURCE_DIR}/genhelp.json ${CMAKE_CURRENT_BINARY_DIR}/bllnhlp.c
)

add_custom_target(balloonhelp ALL
	DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/bllnhlp.c
)

add_custom_command(
 	OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/messages.h ${CMAKE_CURRENT_BINARY_DIR}/messages.but
	DEPENDS genmessages ${CMAKE_CURRENT_SOURCE_DIR}/messages.in
 	COMMAND genmessages ${GENMESSAGES_OPTS} ${CMAKE_CURRENT_SOURCE_DIR}/messages.in ${CMAKE_CURRENT_BINARY_DIR}/messages.but
)

add_custom_target(msgfiles ALL
	DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/messages.h ${CMAKE_CURRENT_BINARY_DIR}/messages.but
)

install(
	FILES xtrkcad.tip
	DESTINATION ${XTRKCAD_SHARE_INSTALL_DIR}
)

set_target_properties(
	msgfiles
	balloonhelp
	genmessages
	genhelp
    PROPERTIES FOLDER HelpDocs
)