diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-10 20:34:10 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-10 20:34:10 +0000 |
commit | e4ba6dbc3f1e76890b22773807ea37fe8fa2b1bc (patch) | |
tree | 68cb5ef9081156392f1dd62a00c6ccc1451b93df /cmake/modules/UseCheckAPI.cmake | |
parent | Initial commit. (diff) | |
download | wireshark-e4ba6dbc3f1e76890b22773807ea37fe8fa2b1bc.tar.xz wireshark-e4ba6dbc3f1e76890b22773807ea37fe8fa2b1bc.zip |
Adding upstream version 4.2.2.upstream/4.2.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'cmake/modules/UseCheckAPI.cmake')
-rw-r--r-- | cmake/modules/UseCheckAPI.cmake | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/cmake/modules/UseCheckAPI.cmake b/cmake/modules/UseCheckAPI.cmake new file mode 100644 index 0000000..1518fb4 --- /dev/null +++ b/cmake/modules/UseCheckAPI.cmake @@ -0,0 +1,41 @@ +# Add a target to call checkAPIs.pl on the specified source files +# The target is excluded from the ALL targte so must be manually +# specified in a build command. +# The target is added to the top-level checkAPIs target +# +# Parameters: +# NAME: The name of the target, must be unique +# SWITCHES: Switches to be supplied to the script +# SOURCES: The sources to be checked + +include(CMakeParseArguments) + +macro( CHECKAPI ) + cmake_parse_arguments(CHECKAPI "DEBUG" "" "NAME;SWITCHES;SOURCES" ${ARGN} ) + + if (CHECKAPI_UNPARSED_ARGUMENTS) + message(FATAL_ERROR "CHECKAPIS Unknown argument: ${CHECKAPI_UNPARSED_ARGUMENTS}") + endif() + + if( CHECKAPI_DEBUG ) + set (CHECKAPI_SWITCHES ${CHECKAPI_SWITCHES --debug) + endif() + + set(TARGET_NAME checkAPI_${CHECKAPI_NAME}) + add_custom_target(${TARGET_NAME} + COMMAND ${PERL_EXECUTABLE} + ${CMAKE_SOURCE_DIR}/tools/checkAPIs.pl + ${CHECKAPI_SWITCHES} + ${CHECKAPI_SOURCES} + WORKING_DIRECTORY + ${CMAKE_CURRENT_SOURCE_DIR} + COMMENT + "Running ${TARGET_NAME}" + ) + add_dependencies(checkAPI ${TARGET_NAME}) + set_target_properties(${TARGET_NAME} + PROPERTIES FOLDER "Auxiliary/CheckAPIs" + EXCLUDE_FROM_ALL True + EXCLUDE_FROM_DEFAULT_BUILD True + ) +ENDMACRO() |