From ded1d1089adfa969f660d0ddbb94394b27fa4b0f Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Wed, 30 Aug 2017 23:20:21 +0200 Subject: [PATCH] CMake: fix extcaps dependency list When compiling the list of dependencies for the extcaps target, add only those targets that we're actually building. If we skip an extcap, e.g. because we're missing libraries to build it, don't add this extcap to the dependency list. This issue was observed on a Debian box that had no libssh-gcrypt-dev package installed. Running cmake would create a warning about non-existent dependencies of the extcaps target. -- Configuring done CMake Warning (dev) at CMakeLists.txt:3217 (add_dependencies): Policy CMP0046 is not set: Error on non-existent dependency in add_dependencies. Run "cmake --help-policy CMP0046" for policy details. Use the cmake_policy command to set the policy and suppress this warning. The dependency target "ciscodump" of target "extcaps" does not exist. This warning is for project developers. Use -Wno-dev to suppress it. Change-Id: I7335173fce9833423b0e9443589143cc1a122ac0 Reviewed-on: https://code.wireshark.org/review/23321 Reviewed-by: Martin Kaiser Petri-Dish: Martin Kaiser Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu Reviewed-by: Dario Lombardo Reviewed-by: Roland Knall --- CMakeLists.txt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 98c095e61c..8f165c0138 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2815,6 +2815,8 @@ if (WIN32) endif() endif() +add_custom_target(extcaps) + if(ENABLE_EXTCAP AND BUILD_androiddump) if(EXTCAP_ANDROIDDUMP_LIBPCAP) if(HAVE_LIBPCAP) @@ -2844,6 +2846,7 @@ if(ENABLE_EXTCAP AND BUILD_androiddump) set_extcap_executable_properties(androiddump) target_link_libraries(androiddump ${androiddump_LIBS}) install(TARGETS androiddump RUNTIME DESTINATION ${EXTCAP_DIR}) + add_dependencies(extcaps androiddump) endif() if(ENABLE_EXTCAP AND BUILD_sshdump AND LIBSSH_FOUND) @@ -2864,6 +2867,7 @@ if(ENABLE_EXTCAP AND BUILD_sshdump AND LIBSSH_FOUND) target_link_libraries(sshdump ${sshdump_LIBS}) target_include_directories(sshdump PUBLIC ${LIBSSH_INCLUDE_DIR}) install(TARGETS sshdump RUNTIME DESTINATION ${EXTCAP_DIR}) + add_dependencies(extcaps sshdump) elseif (BUILD_sshdump) #message( WARNING "Cannot find libssh, cannot build sshdump" ) endif() @@ -2887,6 +2891,7 @@ if(ENABLE_EXTCAP AND BUILD_ciscodump AND LIBSSH_FOUND) target_link_libraries(ciscodump ${ciscodump_LIBS}) target_include_directories(ciscodump PUBLIC ${LIBSSH_INCLUDE_DIR}) install(TARGETS ciscodump RUNTIME DESTINATION ${EXTCAP_DIR}) + add_dependencies(extcaps ciscodump) elseif (BUILD_ciscodump) #message( WARNING "Cannot find libssh, cannot build ciscodump" ) endif() @@ -2907,6 +2912,7 @@ if(ENABLE_EXTCAP AND BUILD_udpdump) set_extcap_executable_properties(udpdump) target_link_libraries(udpdump ${udpdump_LIBS}) install(TARGETS udpdump RUNTIME DESTINATION ${EXTCAP_DIR}) + add_dependencies(extcaps udpdump) endif() if(ENABLE_EXTCAP AND BUILD_randpktdump) @@ -2927,6 +2933,7 @@ if(ENABLE_EXTCAP AND BUILD_randpktdump) set_extcap_executable_properties(randpktdump) target_link_libraries(randpktdump ${randpktdump_LIBS}) install(TARGETS randpktdump RUNTIME DESTINATION ${EXTCAP_DIR}) + add_dependencies(extcaps randpktdump) endif() if(ENABLE_APPLICATION_BUNDLE) @@ -3229,9 +3236,6 @@ if (NOT "${SHELLCHECK_EXECUTABLE}" STREQUAL "SHELLCHECK_EXECUTABLE-NOTFOUND") ) endif() -add_custom_target(extcaps) -add_dependencies(extcaps sshdump ciscodump udpdump randpktdump androiddump) - # # Editor modelines - http://www.wireshark.org/tools/modelines.html #