Subversion Repositories Scribus

Rev

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

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