| 1 |
# EvolutionMacros.cmake |
| 2 |
# |
| 3 |
# Utility macros for evolution-related files |
| 4 |
# |
| 5 |
# add_error_files(_part _file0) |
| 6 |
# Adds build and install rules to create .error files from .error.xml |
| 7 |
# files in the current source directory. The _file0 is expected to be |
| 8 |
# without the .xml extension. The macro can receive one or more error |
| 9 |
# files. There is created a custom "${_part}-error-files" target. |
| 10 |
# |
| 11 |
# add_eplug_file(_part _eplug_filename) |
| 12 |
# Adds build and install rules to create .eplug files from .eplug.xml |
| 13 |
# files in the current source directory. The _eplug_filename is expected |
| 14 |
# to be without the .xml extension. The macro can receive exactly one |
| 15 |
# eplug file. There is created a custom "${_part}-eplug-file" target. |
| 16 |
|
| 17 |
include(FindIntltool) |
| 18 |
|
| 19 |
macro(add_custom_xml_files _part _destination _targetsuffix _ext _mergeparam _file0) |
| 20 |
set(filedeps) |
| 21 |
|
| 22 |
foreach(file ${_file0} ${ARGN}) |
| 23 |
intltool_merge(${file}${_ext} ${file} --xml-style --utf8 ${_mergeparam}) |
| 24 |
|
| 25 |
get_filename_component(_path ${file} DIRECTORY) |
| 26 |
if(_path STREQUAL "") |
| 27 |
set(builtfile ${CMAKE_CURRENT_BINARY_DIR}/${file}) |
| 28 |
else(_path STREQUAL "") |
| 29 |
set(builtfile ${file}) |
| 30 |
endif(_path STREQUAL "") |
| 31 |
|
| 32 |
install(FILES ${builtfile} |
| 33 |
DESTINATION ${_destination} |
| 34 |
) |
| 35 |
|
| 36 |
list(APPEND filedeps ${builtfile}) |
| 37 |
endforeach(file) |
| 38 |
|
| 39 |
add_custom_target(${_part}-${_targetsuffix}-files ALL |
| 40 |
DEPENDS ${filedeps} |
| 41 |
) |
| 42 |
endmacro(add_custom_xml_files) |
| 43 |
|
| 44 |
macro(add_error_files _part _file0) |
| 45 |
add_custom_xml_files(${_part} ${errordir} error .xml --no-translations ${_file0} ${ARGN}) |
| 46 |
endmacro(add_error_files) |
| 47 |
|
| 48 |
macro(add_eplug_file _part _eplug_filename) |
| 49 |
set(PLUGINDIR "${plugindir}") |
| 50 |
set(SOEXT "${CMAKE_SHARED_MODULE_SUFFIX}") |
| 51 |
set(LOCALEDIR "${LOCALE_INSTALL_DIR}") |
| 52 |
|
| 53 |
configure_file(${_eplug_filename}.xml |
| 54 |
${CMAKE_CURRENT_BINARY_DIR}/${_eplug_filename}.in |
| 55 |
@ONLY |
| 56 |
) |
| 57 |
|
| 58 |
unset(PLUGINDIR) |
| 59 |
unset(SOEXT) |
| 60 |
unset(LOCALEDIR) |
| 61 |
|
| 62 |
add_custom_xml_files(${_part} ${plugindir} plugin .in --no-translations ${CMAKE_CURRENT_BINARY_DIR}/${_eplug_filename}) |
| 63 |
endmacro(add_eplug_file) |