summaryrefslogtreecommitdiff
path: root/cmake/modules/UseMakeDissectorReg.cmake
blob: d805ef20e1e688ef3039f361d7aa7ebc987d37b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#
MACRO(REGISTER_DISSECTOR_FILES _outputfile _registertype )
	include(LocatePythonModule)
	locate_python_module(make-dissector-reg REQUIRED PATHS ${CMAKE_SOURCE_DIR}/tools)

	if(${_registertype} STREQUAL "dissectors" )
	    set( _makeregistertype "dissectorsinfile" )
	    set( _ftmp "${CMAKE_CURRENT_BINARY_DIR}/_regc.tmp" )
	    set( _depends ${ARGN} )
	    file(REMOVE ${_ftmp})
	    foreach(f ${_depends})
	      file(APPEND ${_ftmp} "${f}\n")
	    endforeach()
	    set( _sources ${_ftmp} )
	else()
	    set( _makeregistertype ${_registertype} )
	    set( _sources ${ARGN} )
	    set( _depends ${_sources} )
	endif()
	ADD_CUSTOM_COMMAND(
	    OUTPUT
	      ${_outputfile}
	    COMMAND ${PYTHON_EXECUTABLE}
	      ${PY_MAKE-DISSECTOR-REG}
	      ${CMAKE_CURRENT_SOURCE_DIR}
	      ${_makeregistertype}
	      ${_sources}
	    DEPENDS
	      ${_depends}
	      ${PY_MAKE-DISSECTOR-REG}
	)
ENDMACRO(REGISTER_DISSECTOR_FILES)