Rename dissectors.c.in and fix CMake on removals

"dissectors.c.in" is an input file for "make-dissectors" which outputs
"dissectors.c", but does not contain C code. Rename it to
"dissectors.in.txt" instead.

When a dissector is removed from the list, the dissectors.c file was not
properly generated even if CMake was re-run. Fix this by adding an
additional dependency on the input file. autotools likely suffers from
the same problem with removed files, I have not tried to fix that.

Restore's João's original approach using file(GENERATE) to avoid using
configure_file, this requires CMake 2.8.12.

Change-Id: Id07cd8ef502186a90d41b3bb77ed0d9c94845af9
Fixes: v2.5.0rc0-1763-gfe0c2b0485 ("Rewrite make-dissector-reg.py in C")
Reviewed-on: https://code.wireshark.org/review/24659
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: João Valverde <j@v6e.pt>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
This commit is contained in:
Peter Wu 2017-11-30 02:05:07 +00:00
parent 28b463649f
commit f8b67cb931
4 changed files with 10 additions and 10 deletions

2
.gitignore vendored
View File

@ -32,7 +32,7 @@ epan/dissectors/mesa
epan/dissectors/xcbproto
epan/dissectors/packet-ncp2222.c
epan/dissectors/dissectors.c
epan/dissectors/dissectors.c.in
epan/dissectors/dissectors.in.txt
epan/dissectors/make-dissectors
epan/dtd_parse.c
epan/dtd_preparse.c

View File

@ -50,7 +50,7 @@ if(WIN32)
# Needed for GREATER_EQUAL operator
cmake_minimum_required(VERSION 3.7)
else()
cmake_minimum_required(VERSION 2.8.11)
cmake_minimum_required(VERSION 2.8.12)
endif()
#Where to find local cmake scripts

View File

@ -1871,15 +1871,15 @@ target_link_libraries(make-dissectors ${GLIB2_LIBRARIES})
# We pass the arguments to make-dissectors in a file to avoid limitations
# with the number of arguments handled by main().
#
string(REPLACE ";" "\n" dissectors_c_in_contents "${ALL_DISSECTOR_SRC}\n")
file(WRITE
"${CMAKE_CURRENT_BINARY_DIR}/dissectors.c.in"
"${dissectors_c_in_contents}"
file(GENERATE
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/dissectors.in.txt"
CONTENT "$<JOIN:${ALL_DISSECTOR_SRC},\n>\n"
)
add_custom_command(
OUTPUT dissectors.c
COMMAND make-dissectors dissectors.c @dissectors.c.in
COMMAND make-dissectors dissectors.c @dissectors.in.txt
DEPENDS make-dissectors ${ALL_DISSECTOR_SRC}
"${CMAKE_CURRENT_BINARY_DIR}/dissectors.in.txt"
COMMENT "Making dissectors.c"
)

View File

@ -1946,11 +1946,11 @@ x11-dissector: $(top_srcdir)/tools/process-x11-fields.pl $(srcdir)/x11-fields $(
#
dissectors.c: make-dissectors $(ALL_DISSECTORS_SRC)
@echo Making dissectors.c
@echo $^ | tr ' ' '\n' | $(GREP) '\.c$$' > $@.in && \
$(builddir)/make-dissectors $@ @$@.in
@echo $^ | tr ' ' '\n' | $(GREP) '\.c$$' > dissectors.in.txt && \
$(builddir)/make-dissectors $@ @dissectors.in.txt
MOSTLYCLEANFILES = \
dissectors.c.in
dissectors.in.txt
DISTCLEANFILES = \
$(NODIST_GENERATED_FILES)