Invoke asn2wrs.py using a custom command

A custom target is defined to be always invalid, so asn2wrs.py is always invoked.
A custom command is able to convert input file(s) into output file(s), the actual command is only invoked in the provided dependencies are changed.
As an advantage the dependencies are correct, so cmake is able to determine when the output file is required, so it can be build in time.

Change-Id: I84be5d408cfc87cf88d67b6073bea439febbe712
Reviewed-on: https://code.wireshark.org/review/5255
Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
Maarten Bezemer 2014-11-12 13:39:07 +01:00 committed by Anders Broman
parent a1d4c0a792
commit cc8ed845ed
1 changed files with 4 additions and 3 deletions

View File

@ -21,7 +21,8 @@ MACRO(ASN2WRS)
# Don't use packet-${PROTOCOL_NAME}.c instead of generate_dissector, it will
# cause EXCLUDE_FROM_ALL to be ignored.
ADD_CUSTOM_TARGET(generate_dissector-${PROTOCOL_NAME} ALL
ADD_CUSTOM_COMMAND(
OUTPUT packet-${PROTOCOL_NAME}.c
COMMAND ${PYTHON_EXECUTABLE}
${ASN2WRS_EXECUTABLE}
${A2W_FLAGS}
@ -38,8 +39,8 @@ MACRO(ASN2WRS)
)
foreach( _asn2wrs_export_file IN LISTS EXPORT_FILES )
ADD_CUSTOM_TARGET( ${_asn2wrs_export_file}
WORKING_DIRECTORY .
ADD_CUSTOM_COMMAND(
OUTPUT ${_asn2wrs_export_file}
COMMAND ${PYTHON_EXECUTABLE}
${ASN2WRS_EXECUTABLE}
-E