Commit 534787e4 authored by Peter Wu's avatar Peter Wu Committed by Dario Lombardo

cmake: make WERROR_COMMON_FLAGS a normal string

Instead of checking for the boolean "FALSE", just set an empty string.
This avoids the need to check for WERROR_COMMON_FLAGS before using it.

The transformation is the same for all files, remove
"if (WERROR_COMMON_FLAGS)" and "endif()", reindent and add quotes (since
we have a string here and not a list).

Modelines have been added where missing.

Change-Id: I0ab05ae507c51fa77336d49a99a226399cc81b92
Reviewed-on: https://code.wireshark.org/review/17997
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: 's avatarPetri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: 's avatarJoão Valverde <j@v6e.pt>
Reviewed-by: 's avatarDario Lombardo <lomato@gmail.com>
Tested-by: 's avatarDario Lombardo <lomato@gmail.com>
parent 53c91974
......@@ -595,10 +595,11 @@ if(ENABLE_ASAN)
set(CMAKE_CXX_FLAGS "-fsanitize=address ${CMAKE_CXX_FLAGS}")
endif()
set(WERROR_COMMON_FLAGS "")
set(NO_ERROR_DEPRECATED_DECLARATIONS_COMPILE_FLAGS "")
if(NOT DISABLE_WERROR AND NOT ENABLE_EXTRA_COMPILER_WARNINGS)
if(CMAKE_C_COMPILER_ID MATCHES "MSVC")
set(WERROR_COMMON_FLAGS "/WX")
set(NO_ERROR_DEPRECATED_DECLARATIONS_COMPILE_FLAGS)
else()
check_c_compiler_flag(-Werror WERROR)
if (WERROR)
......@@ -606,8 +607,6 @@ if(NOT DISABLE_WERROR AND NOT ENABLE_EXTRA_COMPILER_WARNINGS)
set(NO_ERROR_DEPRECATED_DECLARATIONS_COMPILE_FLAGS "-Wno-error=deprecated-declarations")
endif()
endif()
else()
set(WERROR_COMMON_FLAGS FALSE)
endif()
#
......@@ -2620,13 +2619,11 @@ set(CLEAN_FILES
${udpdump_FILES}
)
if (WERROR_COMMON_FLAGS)
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
COMPILE_FLAGS ${WERROR_COMMON_FLAGS}
)
endif()
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
COMPILE_FLAGS "${WERROR_COMMON_FLAGS}"
)
install(
FILES
......
......@@ -30,13 +30,11 @@ set(CLEAN_FILES
${CAPCHILD_SRC}
)
if (WERROR_COMMON_FLAGS)
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
COMPILE_FLAGS ${WERROR_COMMON_FLAGS}
)
endif()
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
COMPILE_FLAGS "${WERROR_COMMON_FLAGS}"
)
file(GLOB CAPCHILD_HEADERS capture_session.h)
......@@ -66,3 +64,16 @@ CHECKAPI(
SOURCES
${CAPCHILD_SRC}
)
#
# Editor modelines - http://www.wireshark.org/tools/modelines.html
#
# Local variables:
# c-basic-offset: 8
# tab-width: 8
# indent-tabs-mode: t
# End:
#
# vi: set shiftwidth=8 tabstop=8 noexpandtab:
# :indentSize=8:tabSize=8:noTabs=false:
#
......@@ -52,13 +52,11 @@ set(CLEAN_FILES
${CAPUTILS_SRC}
)
if (WERROR_COMMON_FLAGS)
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
COMPILE_FLAGS ${WERROR_COMMON_FLAGS}
)
endif()
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
COMPILE_FLAGS "${WERROR_COMMON_FLAGS}"
)
add_library(caputils STATIC
......@@ -86,3 +84,16 @@ CHECKAPI(
SOURCES
${CAPUTILS_SRC}
)
#
# Editor modelines - http://www.wireshark.org/tools/modelines.html
#
# Local variables:
# c-basic-offset: 8
# tab-width: 8
# indent-tabs-mode: t
# End:
#
# vi: set shiftwidth=8 tabstop=8 noexpandtab:
# :indentSize=8:tabSize=8:noTabs=false:
#
......@@ -39,13 +39,11 @@ set(ECHLD_FILES
${DIRTY_FILES}
)
if (WERROR_COMMON_FLAGS)
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
COMPILE_FLAGS ${WERROR_COMMON_FLAGS}
)
endif()
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
COMPILE_FLAGS "${WERROR_COMMON_FLAGS}"
)
add_library(echld ${LINK_MODE_LIB}
......@@ -93,3 +91,16 @@ if(NOT ${ENABLE_STATIC})
ARCHIVE DESTINATION lib
)
endif()
#
# Editor modelines - http://www.wireshark.org/tools/modelines.html
#
# Local variables:
# c-basic-offset: 8
# tab-width: 8
# indent-tabs-mode: t
# End:
#
# vi: set shiftwidth=8 tabstop=8 noexpandtab:
# :indentSize=8:tabSize=8:noTabs=false:
#
......@@ -209,13 +209,11 @@ set(CLEAN_FILES
${LIBWIRESHARK_ASM_FILES}
)
if (WERROR_COMMON_FLAGS)
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
COMPILE_FLAGS ${WERROR_COMMON_FLAGS}
)
endif()
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
COMPILE_FLAGS "${WERROR_COMMON_FLAGS}"
)
# Cannot use $<$<BOOL:${HAVE_LIBLUA}>:$<TARGET_OBJECTS:wslua>> as that breaks
# get_target_property(_libwireshark_location epan LOCATION).
......
......@@ -35,13 +35,11 @@ set(CRYPT_FILES
)
source_group(crypt FILES ${CRYPT_FILES})
if(WERROR_COMMON_FLAGS)
set_source_files_properties(
${CRYPT_FILES}
PROPERTIES
COMPILE_FLAGS ${WERROR_COMMON_FLAGS}
)
endif()
set_source_files_properties(
${CRYPT_FILES}
PROPERTIES
COMPILE_FLAGS "${WERROR_COMMON_FLAGS}"
)
add_library(crypt OBJECT
${CRYPT_FILES}
......
......@@ -43,13 +43,11 @@ set(DFILTER_FILES
)
source_group(dfilter FILES ${DFILTER_FILES})
if(WERROR_COMMON_FLAGS)
set_source_files_properties(
${DFILTER_FILES}
PROPERTIES
COMPILE_FLAGS ${WERROR_COMMON_FLAGS}
)
endif()
set_source_files_properties(
${DFILTER_FILES}
PROPERTIES
COMPILE_FLAGS "${WERROR_COMMON_FLAGS}"
)
add_lex_files(LEX_FILES GENERATED_FILES
scanner.l
......
......@@ -1452,13 +1452,11 @@ set(CLEAN_FILES
${DISSECTOR_SUPPORT_SRC}
)
if(WERROR_COMMON_FLAGS)
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
COMPILE_FLAGS ${WERROR_COMMON_FLAGS}
)
endif()
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
COMPILE_FLAGS "${WERROR_COMMON_FLAGS}"
)
add_library(dissectors OBJECT
${DISSECTOR_FILES}
......
......@@ -33,13 +33,11 @@ set(CLEAN_FILES
${IDL2WRS_FILES}
)
if (WERROR_COMMON_FLAGS)
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
COMPILE_FLAGS ${WERROR_COMMON_FLAGS}
)
endif()
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
COMPILE_FLAGS "${WERROR_COMMON_FLAGS}"
)
add_executable(idl2wrs ${IDL2WRS_FILES})
set_target_properties(idl2wrs PROPERTIES FOLDER "Executables")
......
......@@ -41,13 +41,11 @@ set(FTYPE_FILES
)
source_group(ftype FILES ${FTYPE_FILES})
if(WERROR_COMMON_FLAGS)
set_source_files_properties(
${FTYPE_FILES}
PROPERTIES
COMPILE_FLAGS ${WERROR_COMMON_FLAGS}
)
endif()
set_source_files_properties(
${FTYPE_FILES}
PROPERTIES
COMPILE_FLAGS "${WERROR_COMMON_FLAGS}"
)
add_library(ftypes OBJECT
${FTYPE_FILES}
......
......@@ -35,13 +35,11 @@ set(NGHTTP2_FILES
)
source_group(nghttp2 FILES ${NGHTTP2_FILES})
if(WERROR_COMMON_FLAGS)
set_source_files_properties(
${NGHTTP2_FILES}
PROPERTIES
COMPILE_FLAGS ${WERROR_COMMON_FLAGS}
)
endif()
set_source_files_properties(
${NGHTTP2_FILES}
PROPERTIES
COMPILE_FLAGS "${WERROR_COMMON_FLAGS}"
)
add_library(nghttp2 OBJECT
${NGHTTP2_FILES}
......
......@@ -44,13 +44,11 @@ set(WMEM_FILES
)
source_group(wmem FILES ${WMEM_FILES})
if(WERROR_COMMON_FLAGS)
set_source_files_properties(
${WMEM_FILES}
PROPERTIES
COMPILE_FLAGS ${WERROR_COMMON_FLAGS}
)
endif()
set_source_files_properties(
${WMEM_FILES}
PROPERTIES
COMPILE_FLAGS "${WERROR_COMMON_FLAGS}"
)
add_library(wmem OBJECT
${WMEM_FILES}
......
......@@ -65,13 +65,11 @@ set(WSLUA_FILES
)
source_group(wslua FILES ${WSLUA_FILES})
if(WERROR_COMMON_FLAGS)
set_source_files_properties(
${WSLUA_FILES}
PROPERTIES
COMPILE_FLAGS ${WERROR_COMMON_FLAGS}
)
endif()
set_source_files_properties(
${WSLUA_FILES}
PROPERTIES
COMPILE_FLAGS "${WERROR_COMMON_FLAGS}"
)
# make-taps.pl depends on the current working directory
# to find the dissector files (contents of taps file
......
......@@ -84,13 +84,11 @@ set(CLEAN_FILES
${PLUGIN_FILES}
)
if (WERROR_COMMON_FLAGS)
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
COMPILE_FLAGS ${WERROR_COMMON_FLAGS}
)
endif()
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
COMPILE_FLAGS "${WERROR_COMMON_FLAGS}"
)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
......@@ -117,3 +115,16 @@ CHECKAPI(
${DISSECTOR_SRC}
${DISSECTOR_HEADERS}
)
#
# Editor modelines - http://www.wireshark.org/tools/modelines.html
#
# Local variables:
# c-basic-offset: 8
# tab-width: 8
# indent-tabs-mode: t
# End:
#
# vi: set shiftwidth=8 tabstop=8 noexpandtab:
# :indentSize=8:tabSize=8:noTabs=false:
#
......@@ -43,13 +43,11 @@ set(CLEAN_FILES
${PLUGIN_FILES}
)
if (WERROR_COMMON_FLAGS)
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
COMPILE_FLAGS ${WERROR_COMMON_FLAGS}
)
endif()
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
COMPILE_FLAGS "${WERROR_COMMON_FLAGS}"
)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
......@@ -76,3 +74,16 @@ CHECKAPI(
${DISSECTOR_SRC}
${DISSECTOR_HEADERS}
)
#
# Editor modelines - http://www.wireshark.org/tools/modelines.html
#
# Local variables:
# c-basic-offset: 8
# tab-width: 8
# indent-tabs-mode: t
# End:
#
# vi: set shiftwidth=8 tabstop=8 noexpandtab:
# :indentSize=8:tabSize=8:noTabs=false:
#
......@@ -37,13 +37,11 @@ set(CLEAN_FILES
${PLUGIN_FILES}
)
if (WERROR_COMMON_FLAGS)
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
COMPILE_FLAGS ${WERROR_COMMON_FLAGS}
)
endif()
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
COMPILE_FLAGS "${WERROR_COMMON_FLAGS}"
)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
......@@ -70,3 +68,16 @@ CHECKAPI(
${DISSECTOR_SRC}
${DISSECTOR_HEADERS}
)
#
# Editor modelines - http://www.wireshark.org/tools/modelines.html
#
# Local variables:
# c-basic-offset: 8
# tab-width: 8
# indent-tabs-mode: t
# End:
#
# vi: set shiftwidth=8 tabstop=8 noexpandtab:
# :indentSize=8:tabSize=8:noTabs=false:
#
......@@ -39,13 +39,11 @@ set(CLEAN_FILES
${PLUGIN_FILES}
)
if (WERROR_COMMON_FLAGS)
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
COMPILE_FLAGS ${WERROR_COMMON_FLAGS}
)
endif()
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
COMPILE_FLAGS "${WERROR_COMMON_FLAGS}"
)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
......@@ -72,3 +70,16 @@ CHECKAPI(
${DISSECTOR_SRC}
${DISSECTOR_HEADERS}
)
#
# Editor modelines - http://www.wireshark.org/tools/modelines.html
#
# Local variables:
# c-basic-offset: 8
# tab-width: 8
# indent-tabs-mode: t
# End:
#
# vi: set shiftwidth=8 tabstop=8 noexpandtab:
# :indentSize=8:tabSize=8:noTabs=false:
#
......@@ -42,13 +42,11 @@ set(CLEAN_FILES
${PLUGIN_FILES}
)
if (WERROR_COMMON_FLAGS)
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
COMPILE_FLAGS ${WERROR_COMMON_FLAGS}
)
endif()
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
COMPILE_FLAGS "${WERROR_COMMON_FLAGS}"
)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
......@@ -77,3 +75,16 @@ CHECKAPI(
${DISSECTOR_SUPPORT_SRC}
${DISSECTOR_HEADERS}
)
#
# Editor modelines - http://www.wireshark.org/tools/modelines.html
#
# Local variables:
# c-basic-offset: 8
# tab-width: 8
# indent-tabs-mode: t
# End:
#
# vi: set shiftwidth=8 tabstop=8 noexpandtab:
# :indentSize=8:tabSize=8:noTabs=false:
#
......@@ -60,13 +60,11 @@ set(CLEAN_FILES
${DISSECTOR_SUPPORT_CLEAN_SRC}
)
if (WERROR_COMMON_FLAGS)
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
COMPILE_FLAGS ${WERROR_COMMON_FLAGS}
)
endif()
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
COMPILE_FLAGS "${WERROR_COMMON_FLAGS}"
)
register_dissector_files(plugin.c
plugin
......@@ -96,3 +94,16 @@ CHECKAPI(
# ${LEX_FILES}
${LEMON_FILES}
)
#
# Editor modelines - http://www.wireshark.org/tools/modelines.html
#
# Local variables:
# c-basic-offset: 8
# tab-width: 8
# indent-tabs-mode: t
# End:
#
# vi: set shiftwidth=8 tabstop=8 noexpandtab:
# :indentSize=8:tabSize=8:noTabs=false:
#
......@@ -52,13 +52,11 @@ set(CLEAN_FILES
${PLUGIN_FILES}
)
if (WERROR_COMMON_FLAGS)
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
COMPILE_FLAGS ${WERROR_COMMON_FLAGS}
)
endif()
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
COMPILE_FLAGS "${WERROR_COMMON_FLAGS}"
)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
......@@ -87,3 +85,16 @@ CHECKAPI(
${DISSECTOR_SUPPORT_SRC}
${DISSECTOR_HEADERS}
)
#
# Editor modelines - http://www.wireshark.org/tools/modelines.html
#
# Local variables:
# c-basic-offset: 8
# tab-width: 8
# indent-tabs-mode: t
# End:
#
# vi: set shiftwidth=8 tabstop=8 noexpandtab:
# :indentSize=8:tabSize=8:noTabs=false:
#
......@@ -50,13 +50,11 @@ set(CLEAN_FILES
${PLUGIN_FILES}
)
if (WERROR_COMMON_FLAGS)
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
COMPILE_FLAGS ${WERROR_COMMON_FLAGS}
)
endif()
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
COMPILE_FLAGS "${WERROR_COMMON_FLAGS}"
)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
......@@ -85,3 +83,16 @@ CHECKAPI(
${DISSECTOR_SUPPORT_SRC}
${DISSECTOR_HEADERS}
)
#
# Editor modelines - http://www.wireshark.org/tools/modelines.html
#
# Local variables:
# c-basic-offset: 8
# tab-width: 8
# indent-tabs-mode: t
# End:
#
# vi: set shiftwidth=8 tabstop=8 noexpandtab:
# :indentSize=8:tabSize=8:noTabs=false:
#
......@@ -33,13 +33,11 @@ set(CLEAN_FILES
${PLUGIN_FILES}
)
if (WERROR_COMMON_FLAGS)
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
COMPILE_FLAGS ${WERROR_COMMON_FLAGS}
)
endif()
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
COMPILE_FLAGS "${WERROR_COMMON_FLAGS}"
)
add_plugin_library(stats_tree)
......@@ -59,3 +57,16 @@ CHECKAPI(
${CLEAN_FILES}
${PLUGIN_HEADERS}
)
#
# Editor modelines - http://www.wireshark.org/tools/modelines.html
#
# Local variables:
# c-basic-offset: 8
# tab-width: 8
# indent-tabs-mode: t
# End:
#
# vi: set shiftwidth=8 tabstop=8 noexpandtab:
# :indentSize=8:tabSize=8:noTabs=false:
#
......@@ -33,13 +33,11 @@ set(CLEAN_FILES
${PLUGIN_FILES}
)
if (WERROR_COMMON_FLAGS)
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
COMPILE_FLAGS ${WERROR_COMMON_FLAGS}
)
endif()
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
COMPILE_FLAGS "${WERROR_COMMON_FLAGS}"
)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
......@@ -79,3 +77,16 @@ install(TARGETS tpg
RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR}/${CPACK_PACKAGE_NAME}/plugins/${CPACK_PACKAGE_VERSION}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/${CPACK_PACKAGE_NAME}/plugins/${CPACK_PACKAGE_VERSION}
)
#
# Editor modelines - http://www.wireshark.org/tools/modelines.html
#
# Local variables:
# c-basic-offset: 8
# tab-width: 8
# indent-tabs-mode: t
# End:
#
# vi: set shiftwidth=8 tabstop=8 noexpandtab:
# :indentSize=8:tabSize=8:noTabs=false:
#
......@@ -37,13 +37,11 @@ set(CLEAN_FILES
${PLUGIN_FILES}
)
if (WERROR_COMMON_FLAGS)
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
COMPILE_FLAGS ${WERROR_COMMON_FLAGS}
)
endif()
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
COMPILE_FLAGS "${WERROR_COMMON_FLAGS}"
)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
......@@ -70,3 +68,16 @@ CHECKAPI(
${DISSECTOR_SRC}
${DISSECTOR_HEADERS}
)
#
# Editor modelines - http://www.wireshark.org/tools/modelines.html
#
# Local variables:
# c-basic-offset: 8
# tab-width: 8
# indent-tabs-mode: t
# End:
#
# vi: set shiftwidth=8 tabstop=8 noexpandtab:
# :indentSize=8:tabSize=8:noTabs=false:
#
......@@ -82,13 +82,11 @@ set(CLEAN_FILES
${PLUGIN_FILES}
)
if (WERROR_COMMON_FLAGS)
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
COMPILE_FLAGS ${WERROR_COMMON_FLAGS}
)
endif()
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
COMPILE_FLAGS "${WERROR_COMMON_FLAGS}"
)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
......@@ -117,3 +115,16 @@ CHECKAPI(
${DISSECTOR_SUPPORT_SRC}
${DISSECTOR_HEADERS}
)
#
# Editor modelines - http://www.wireshark.org/tools/modelines.html
#
# Local variables:
# c-basic-offset: 8
# tab-width: 8
# indent-tabs-mode: t
# End:
#
# vi: set shiftwidth=8 tabstop=8 noexpandtab:
# :indentSize=8:tabSize=8:noTabs=false:
#
......@@ -37,13 +37,11 @@ set(CLEAN_FILES
${PLUGIN_FILES}
)