Subversion Repositories Scribus

Rev

Rev 20094 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
21543 craig 1
include_directories(
15474 craig 2
"${CMAKE_SOURCE_DIR}/scribus"
3
)
4
 
21543 craig 5
set(LRELEASE_EXECUTABLE ${Qt5_LRELEASE_EXECUTABLE})
18288 jghali 6
 
15474 craig 7
#Install our qm files, selected from *.qm in this directory
21543 craig 8
file( GLOB SCRIBUS_TS_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.ts )
9
message(STATUS ${CMAKE_CURRENT_SOURCE_DIR})
15474 craig 10
 
20094 craig 11
#Bit of a hack, preprocess all the filenames to generate our language string, needed for -DWANT_GUI_LANG=en_GB;de_DE , etc
21543 craig 12
foreach(TS_FILEPATH ${SCRIBUS_TS_FILES})
13
  get_filename_component(TS_FILENAME ${TS_FILEPATH} NAME)
14
  string(REGEX MATCH "\\.([0-9a-zA-Z_]*)\\." LANGSTR ${TS_FILENAME})
15
  string(REPLACE "." ""  LANGSTR ${LANGSTR})
16
  set(QM_LANGS ${QM_LANGS} ${LANGSTR})
17
endforeach(TS_FILEPATH)
15474 craig 18
 
21543 craig 19
message(STATUS "The following GUI languages will be installed: ${WANT_GUI_LANG}")
15474 craig 20
 
21
#If the user specified WANT_GUI_LANG, then we only create build/install targets for those languages
21543 craig 22
if(WANT_GUI_LANG)
23
  foreach(TS_FILEPATH ${SCRIBUS_TS_FILES})
24
	get_filename_component(TS_FILENAME ${TS_FILEPATH} NAME)
25
	string(REGEX MATCH "\\.([0-9a-zA-Z_]*)\\." LANGSTR ${TS_FILENAME})
26
	string(REPLACE "." ""  LANGSTR ${LANGSTR})
27
	foreach(WANTED_LANG ${WANT_GUI_LANG})
28
	  if(LANGSTR STREQUAL WANTED_LANG)
29
		#message(STATUS "You want to install ${LANGSTR}:${WANTED_LANG}")
30
		set(QM_FILENAME "scribus.${LANGSTR}.qm")
31
		add_custom_target("release_ts_${LANGSTR}" ALL
18288 jghali 32
		  COMMAND ${LRELEASE_EXECUTABLE} ${TS_FILEPATH} -silent -qm ${QM_FILENAME}
15474 craig 33
		  DEPENDS ${TS_FILEPATH}
34
		)
21543 craig 35
		install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${QM_FILENAME}" DESTINATION ${SHAREDIR}/translations)
36
	  endif(LANGSTR STREQUAL WANTED_LANG)
37
	endforeach(WANTED_LANG)
38
  endforeach(TS_FILEPATH)
39
else(WANT_GUI_LANG)
15474 craig 40
#Just install all of them
21543 craig 41
  foreach(TS_FILEPATH ${SCRIBUS_TS_FILES})
42
	get_filename_component(TS_FILENAME ${TS_FILEPATH} NAME)
43
	string(REGEX MATCH "\\.([0-9a-zA-Z_]*)\\." LANGSTR ${TS_FILENAME})
44
	string(REPLACE "." ""  LANGSTR ${LANGSTR})
45
	set(QM_FILENAME "scribus.${LANGSTR}.qm")
46
	add_custom_target("release_ts_${LANGSTR}" ALL
18288 jghali 47
	  COMMAND ${LRELEASE_EXECUTABLE} ${TS_FILEPATH} -silent -qm ${QM_FILENAME}
15474 craig 48
	  DEPENDS ${TS_FILEPATH}
49
	)
21543 craig 50
	install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${QM_FILENAME}" DESTINATION ${SHAREDIR}/translations)
51
  endforeach(TS_FILEPATH)
52
endif(WANT_GUI_LANG)
15474 craig 53