diff options
author | Peter Wu <peter@lekensteyn.nl> | 2018-07-23 17:58:50 +0200 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2018-07-23 17:56:29 +0000 |
commit | cfda02a9b5f4b8be3b9e50353f38572f9d55826c (patch) | |
tree | b09a6457c1ca5f7bad3e4833ac6922e11b1c9485 /docbook/CMakeLists.txt | |
parent | 0890837669761a58f3f7b9164437a35ea1cf0562 (diff) |
CMake: fix build when some tools are not built
oss-fuzz disables all targets except for fuzzshark, be sure to check for
tool availability or the cmake step will fail.
Change-Id: Ia873fdc1b548033ac61622f61299b5af7dfb41d9
Link: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=9533
Fixes: v2.9.0rc0-1251-gffbd3151b5 ("CMake: Fixup our tools help dependencies.")
Reviewed-on: https://code.wireshark.org/review/28832
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Diffstat (limited to 'docbook/CMakeLists.txt')
-rw-r--r-- | docbook/CMakeLists.txt | 45 |
1 files changed, 27 insertions, 18 deletions
diff --git a/docbook/CMakeLists.txt b/docbook/CMakeLists.txt index 7d0edc9126..c1ddff0ab6 100644 --- a/docbook/CMakeLists.txt +++ b/docbook/CMakeLists.txt @@ -85,12 +85,17 @@ set(WSUG_TOOLS_HELP_FILES) set(GUIDE_INSTALL_DIRS) # General help output -# XXX We should probably do this conditionally, e.g. based on -# if (TARGET ${th_command}) ... -# However, if we do so we'll have to make sure this is processed after -# our targets are created. foreach(th_command ${WSUG_TOOLS_HELP_COMMANDS}) + if(NOT DEFINED BUILD_${th_command}) + # Catch typos, these commands must exist in CMakeOptions.txt + message(WARNING "BUILD_${th_command} is an unknown option") + endif() + if(NOT BUILD_${th_command}) + message(STATUS "WSUG: will not update ${th_command} output") + continue() + endif() + set(th_file ${CMAKE_CURRENT_SOURCE_DIR}/wsug_src/${th_command}-h.txt) list(APPEND WSUG_TOOLS_HELP_FILES ${th_file}) add_custom_command( @@ -103,20 +108,24 @@ endforeach() # Extra command output # Note that these won't work on Windows unless we make -F and -T write # to stdout and return 0 or wrap the commands similar to hhc.exe. -set(th_file ${CMAKE_CURRENT_SOURCE_DIR}/wsug_src/editcap-F.txt) -list(APPEND WSUG_TOOLS_HELP_FILES ${th_file}) -add_custom_command( - OUTPUT ${th_file} - COMMAND $<TARGET_FILE:editcap> -F > ${th_file} - DEPENDS $<TARGET_FILE:editcap> -) -set(th_file ${CMAKE_CURRENT_SOURCE_DIR}/wsug_src/editcap-T.txt) -list(APPEND WSUG_TOOLS_HELP_FILES ${th_file}) -add_custom_command( - OUTPUT ${th_file} - COMMAND $<TARGET_FILE:editcap> -T > ${th_file} - DEPENDS $<TARGET_FILE:editcap> -) +if(BUILD_editcap) + set(th_file ${CMAKE_CURRENT_SOURCE_DIR}/wsug_src/editcap-F.txt) + list(APPEND WSUG_TOOLS_HELP_FILES ${th_file}) + add_custom_command( + OUTPUT ${th_file} + COMMAND $<TARGET_FILE:editcap> -F > ${th_file} + DEPENDS $<TARGET_FILE:editcap> + ) + set(th_file ${CMAKE_CURRENT_SOURCE_DIR}/wsug_src/editcap-T.txt) + list(APPEND WSUG_TOOLS_HELP_FILES ${th_file}) + add_custom_command( + OUTPUT ${th_file} + COMMAND $<TARGET_FILE:editcap> -T > ${th_file} + DEPENDS $<TARGET_FILE:editcap> + ) +else() + message(STATUS "WSUG: will not update editcap output") +endif() add_custom_target(update_tools_help DEPENDS ${WSUG_TOOLS_HELP_FILES} |