TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags
[wireshark-sm.git] / cmake / modules / UseCheckAPI.cmake
blob472289f7207bb5c4ffea30726e232486da38d389
1 # Add a target to call checkAPIs.pl on the specified source files
2 # The target is excluded from the ALL targte so must be manually
3 # specified in a build command.
4 # The target is added to the top-level checkAPIs target
6 # Parameters:
7 #   NAME:       The name of the target, must be unique
8 #   SWITCHES:   Switches to be supplied to the script
9 #   SOURCES:    The sources to be checked
11 include(CMakeParseArguments)
13 macro( CHECKAPI )
14         cmake_parse_arguments(CHECKAPI "DEBUG" "" "NAME;SWITCHES;SOURCES" ${ARGN} )
16         if (CHECKAPI_UNPARSED_ARGUMENTS)
17                 message(FATAL_ERROR "CHECKAPIS Unknown argument: ${CHECKAPI_UNPARSED_ARGUMENTS}")
18         endif()
20         if( CHECKAPI_DEBUG )
21                 set (CHECKAPI_SWITCHES ${CHECKAPI_SWITCHES --debug)
22         endif()
24         set(TARGET_NAME checkAPI_${CHECKAPI_NAME})
25         add_custom_target(${TARGET_NAME}
26                 COMMAND ${PERL_EXECUTABLE}
27                   ${CMAKE_SOURCE_DIR}/tools/checkAPIs.pl
28                   ${CHECKAPI_SWITCHES}
29                   ${CHECKAPI_SOURCES}
30                 DEPENDS
31                   ${CHECKAPI_SOURCES}
32                 WORKING_DIRECTORY
33                   ${CMAKE_CURRENT_SOURCE_DIR}
34                 COMMENT
35                   "Running ${TARGET_NAME}"
36         )
37         add_dependencies(checkAPI ${TARGET_NAME})
38         set_target_properties(${TARGET_NAME}
39                 PROPERTIES FOLDER "Auxiliary/CheckAPIs"
40                 EXCLUDE_FROM_ALL True
41                 EXCLUDE_FROM_DEFAULT_BUILD True
42         )
43 ENDMACRO()