summaryrefslogtreecommitdiff
path: root/cmake/modules/AddVersionFile.cmake
blob: 1cce0b993b95726034349d127d499f75f0e2f643 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
set(ADD_VERSION_FILE_DIR "${CMAKE_CURRENT_LIST_DIR}")

function(add_version_file OUTPUT TEMPLATE)
	add_custom_target(
		${OUTPUT}
		BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT}"
		DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${TEMPLATE}"
		WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
		COMMAND
			cmake
			-DOUTPUT='${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT}'
			-DTEMPLATE='${CMAKE_CURRENT_SOURCE_DIR}/${TEMPLATE}'
			-P "${ADD_VERSION_FILE_DIR}/generate_version_file.cmake"
	)
endfunction()