Blame cmake/modules/EvolutionMacros.cmake

Packit 15f964
# EvolutionMacros.cmake
Packit 15f964
#
Packit 15f964
# Utility macros for evolution-related files
Packit 15f964
#
Packit 15f964
# add_error_files(_part _file0)
Packit 15f964
#    Adds build and install rules to create .error files from .error.xml
Packit 15f964
#    files in the current source directory. The _file0 is expected to be
Packit 15f964
#    without the .xml extension. The macro can receive one or more error
Packit 15f964
#    files. There is created a custom "${_part}-error-files" target.
Packit 15f964
#
Packit 15f964
# add_eplug_file(_part _eplug_filename)
Packit 15f964
#    Adds build and install rules to create .eplug files from .eplug.xml
Packit 15f964
#    files in the current source directory. The _eplug_filename is expected
Packit 15f964
#    to be without the .xml extension. The macro can receive exactly one
Packit 15f964
#    eplug file. There is created a custom "${_part}-eplug-file" target.
Packit 15f964
Packit 15f964
include(FindIntltool)
Packit 15f964
Packit 15f964
macro(add_custom_xml_files _part _destination _targetsuffix _ext _mergeparam _file0)
Packit 15f964
	set(filedeps)
Packit 15f964
Packit 15f964
	foreach(file ${_file0} ${ARGN})
Packit 15f964
		intltool_merge(${file}${_ext} ${file} --xml-style --utf8 ${_mergeparam})
Packit 15f964
Packit 15f964
		get_filename_component(_path ${file} DIRECTORY)
Packit 15f964
		if(_path STREQUAL "")
Packit 15f964
			set(builtfile ${CMAKE_CURRENT_BINARY_DIR}/${file})
Packit 15f964
		else(_path STREQUAL "")
Packit 15f964
			set(builtfile ${file})
Packit 15f964
		endif(_path STREQUAL "")
Packit 15f964
Packit 15f964
		install(FILES ${builtfile}
Packit 15f964
			DESTINATION ${_destination}
Packit 15f964
		)
Packit 15f964
Packit 15f964
		list(APPEND filedeps ${builtfile})
Packit 15f964
	endforeach(file)
Packit 15f964
Packit 15f964
	add_custom_target(${_part}-${_targetsuffix}-files ALL
Packit 15f964
		DEPENDS ${filedeps}
Packit 15f964
	)
Packit 15f964
endmacro(add_custom_xml_files)
Packit 15f964
Packit 15f964
macro(add_error_files _part _file0)
Packit 15f964
	add_custom_xml_files(${_part} ${errordir} error .xml --no-translations ${_file0} ${ARGN})
Packit 15f964
endmacro(add_error_files)
Packit 15f964
Packit 15f964
macro(add_eplug_file _part _eplug_filename)
Packit 15f964
	set(PLUGINDIR "${plugindir}")
Packit 15f964
	set(SOEXT "${CMAKE_SHARED_MODULE_SUFFIX}")
Packit 15f964
	set(LOCALEDIR "${LOCALE_INSTALL_DIR}")
Packit 15f964
Packit 15f964
	configure_file(${_eplug_filename}.xml
Packit 15f964
		${CMAKE_CURRENT_BINARY_DIR}/${_eplug_filename}.in
Packit 15f964
		@ONLY
Packit 15f964
	)
Packit 15f964
Packit 15f964
	unset(PLUGINDIR)
Packit 15f964
	unset(SOEXT)
Packit 15f964
	unset(LOCALEDIR)
Packit 15f964
Packit 15f964
	add_custom_xml_files(${_part} ${plugindir} plugin .in --no-translations ${CMAKE_CURRENT_BINARY_DIR}/${_eplug_filename})
Packit 15f964
endmacro(add_eplug_file)