Subversion Repositories Scribus

Rev

Rev 18481 | Go to most recent revision | 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
 
18481 craig 5
SET(LRELEASE_EXECUTABLE ${Qt5_LRELEASE_EXECUTABLE})
18288 jghali 6
 
15474 craig 7
#Install our qm files, selected from *.qm in this directory
8
FILE( GLOB SCRIBUS_TS_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.ts )
9
MESSAGE(STATUS ${CMAKE_CURRENT_SOURCE_DIR})
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
15474 craig 12
FOREACH(TS_FILEPATH ${SCRIBUS_TS_FILES})
13
  GET_FILENAME_COMPONENT(TS_FILENAME ${TS_FILEPATH} NAME)
15817 craig 14
  STRING(REGEX MATCH "\\.([0-9a-zA-Z_]*)\\." LANGSTR ${TS_FILENAME})
15474 craig 15
  STRING(REPLACE "." ""  LANGSTR ${LANGSTR})
16
  SET(QM_LANGS ${QM_LANGS} ${LANGSTR})
17
ENDFOREACH(TS_FILEPATH)
18
 
19
MESSAGE(STATUS "The following GUI languages will be installed: ${WANT_GUI_LANG}")
20
 
21
#If the user specified WANT_GUI_LANG, then we only create build/install targets for those languages
22
IF(WANT_GUI_LANG)
23
  FOREACH(TS_FILEPATH ${SCRIBUS_TS_FILES})
24
	GET_FILENAME_COMPONENT(TS_FILENAME ${TS_FILEPATH} NAME)
15817 craig 25
	STRING(REGEX MATCH "\\.([0-9a-zA-Z_]*)\\." LANGSTR ${TS_FILENAME})
15474 craig 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
		)
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)
40
#Just install all of them
41
  FOREACH(TS_FILEPATH ${SCRIBUS_TS_FILES})
42
	GET_FILENAME_COMPONENT(TS_FILENAME ${TS_FILEPATH} NAME)
15817 craig 43
	STRING(REGEX MATCH "\\.([0-9a-zA-Z_]*)\\." LANGSTR ${TS_FILENAME})
15474 craig 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
	)
50
	INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/${QM_FILENAME}" DESTINATION ${SHAREDIR}/translations)
51
  ENDFOREACH(TS_FILEPATH)
52
ENDIF(WANT_GUI_LANG)
53