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 <wireshark@kaiser.cx>
Petri-Dish: Martin Kaiser <wireshark@kaiser.cx>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Dario Lombardo <lomato@gmail.com>
Reviewed-by: Roland Knall <rknall@gmail.com>
This commit is contained in:
Martin Kaiser 2017-08-30 23:20:21 +02:00 committed by Roland Knall
parent 4458d0b59f
commit ded1d1089a
1 changed files with 7 additions and 3 deletions

View File

@ -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
#