summaryrefslogtreecommitdiff
path: root/cmake/kicad.cmake
blob: 126d2e4ef7cb2e26ea4639d6c733076a2e4e3b72 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
function(kicad_schematic_to_pdf source target)
	get_filename_component(name ${source} NAME)
	get_filename_component(dir ${source} DIRECTORY)
	file(RELATIVE_PATH rel "${CMAKE_SOURCE_DIR}" "${dir}")
	set(name_pdf "${name}.pdf")
	set(pdf ${CMAKE_BINARY_DIR}/${rel}/${name_pdf})

	add_custom_command(
		OUTPUT
			${pdf}
		COMMAND
			kicad-cli sch export pdf --output ${pdf} ${source}
		DEPENDS
			${source}
	)

	add_custom_target(
		"${target}"
		ALL
		DEPENDS
			${pdf}
	)
endfunction()