4.5.2 : Make python module

Then, we create the function which will build a python module :
1
2
3
4
5
6
7
8
9
10
11
12
function(createPythonModule targetName setupFile moduleSrc)
	configure_file(${setupFile} ${CMAKE_CURRENT_BINARY_DIR}/setup.py @ONLY)
	configure_file(${SCRIPT_CALL_PYTHON_SETUP} ${CMAKE_CURRENT_BINARY_DIR}/scriptCallPythonSetup.sh @ONLY)
	add_custom_command(
		OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/dist
		COMMAND ${CMAKE_CURRENT_BINARY_DIR}/scriptCallPythonSetup.sh
		COMMENT "Install ${targetName} python module"
		DEPENDS ${moduleSrc}
		WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
	)
	add_custom_target("${targetName}" ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/dist)
endfunction(createPythonModule)