~writer-devs/writer/trunk

69.1.1 by harp37 at gmail
CMake is nearly there.
1
include(ParseArguments)
2
find_package(Valadoc REQUIRED)
3
4
macro(valadoc target outdir)
5
	parse_arguments(ARGS "PACKAGES;OPTIONS;CUSTOM_VAPIS" "" ${ARGN})
6
	set(vala_pkg_opts "")
7
	foreach(pkg ${ARGS_PACKAGES})
8
		list(APPEND vala_pkg_opts "--pkg=${pkg}")
9
	endforeach(pkg ${ARGS_PACKAGES})
10
11
	set(vapi_dir_opts "")
12
	foreach(src ${ARGS_CUSTOM_VAPIS})
13
		get_filename_component(pkg ${src} NAME_WE)
14
		list(APPEND vala_pkg_opts "--pkg=${pkg}")
15
		
16
		get_filename_component(path ${src} PATH)
17
		list(APPEND vapi_dir_opts "--vapidir=${path}")
18
	endforeach(src ${ARGS_DEFAULT_ARGS})
19
	list(REMOVE_DUPLICATES vapi_dir_opts)
20
21
	add_custom_command(TARGET ${target}
22
	COMMAND
23
		${VALADOC_EXECUTABLE}
24
	ARGS
25
		"--force"
26
		"-b" ${CMAKE_CURRENT_SOURCE_DIR}
27
		"-o" ${outdir}
28
		"--package-name=${CMAKE_PROJECT_NAME}"
29
		"--package-version=${PROJECT_VERSION}"
30
		${vala_pkg_opts}
31
		${vapi_dir_opts}
32
		${ARGS_OPTIONS}
33
		${in_files} 
34
	DEPENDS
35
		${in_files}
36
		${ARGS_CUSTOM_VAPIS}
37
	)
38
endmacro(valadoc)