Use FindAsn2Wrs to find asn2wrs.py

A first step to make it possible to reuse the UseAsn2Wrs for out of source builds.

Change-Id: Iefb34f943e06db3d6afed55ab69d3f26aa9d633d
Reviewed-on: https://code.wireshark.org/review/5253
Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
Maarten Bezemer 2014-11-11 17:11:11 +01:00 committed by Anders Broman
parent c083f50baf
commit fb01f59e69
2 changed files with 22 additions and 4 deletions

View File

@ -0,0 +1,16 @@
#
# Look for the asn2wrs.py utility
#
find_program( ASN2WRS_EXECUTABLE
NAMES
asn2wrs.py
HINTS
# First try to find it in wireshark sources
${CMAKE_SOURCE_DIR}/tools
)
include( FindPackageHandleStandardArgs )
find_package_handle_standard_args( ASN2WRS DEFAULT_MSG ASN2WRS_EXECUTABLE )
mark_as_advanced( ASN2WRS_EXECUTABLE )

View File

@ -1,5 +1,7 @@
#
MACRO(ASN2WRS)
find_package(Asn2Wrs REQUIRED)
set( DISSECTOR ${CMAKE_SOURCE_DIR}/epan/dissectors/packet-${PROTOCOL_NAME}.c )
if ( NOT PROTO_OPT )
@ -12,7 +14,7 @@ MACRO(ASN2WRS)
# cause EXCLUDE_FROM_ALL to be ignored.
ADD_CUSTOM_TARGET(generate_dissector-${PROTOCOL_NAME} ALL
COMMAND ${PYTHON_EXECUTABLE}
${CMAKE_SOURCE_DIR}/tools/asn2wrs.py
${ASN2WRS_EXECUTABLE}
${A2W_FLAGS}
${PROTO_OPT}
-c ${CMAKE_CURRENT_SOURCE_DIR}/${PROTOCOL_NAME}.cnf
@ -21,7 +23,7 @@ MACRO(ASN2WRS)
-O ${CMAKE_SOURCE_DIR}/epan/dissectors
${EXT_ASN_FILE_LIST} ${ASN_FILE_LIST} ${EXT_ASN_FILE_LIST_LATE}
DEPENDS
${CMAKE_SOURCE_DIR}/tools/asn2wrs.py
${ASN2WRS_EXECUTABLE}
${SRC_FILES}
${EXTRA_CNF}
)
@ -30,7 +32,7 @@ MACRO(ASN2WRS)
ADD_CUSTOM_TARGET( ${_asn2wrs_export_file}
WORKING_DIRECTORY .
COMMAND ${PYTHON_EXECUTABLE}
${CMAKE_SOURCE_DIR}/tools/asn2wrs.py
${ASN2WRS_EXECUTABLE}
-E
${A2W_FLAGS}
${PROTO_OPT}
@ -38,7 +40,7 @@ MACRO(ASN2WRS)
-D ${CMAKE_CURRENT_SOURCE_DIR}
${EXT_ASN_FILE_LIST} ${ASN_FILE_LIST} ${EXT_ASN_FILE_LIST_LATE}
DEPENDS
${CMAKE_SOURCE_DIR}/tools/asn2wrs.py
${ASN2WRS_EXECUTABLE}
${SRC_FILES}
${EXPORT_DEPENDS}
)