CMake: Make sure system headers are treated as such.
Use target_include_directories instead of include_directories in a few places as recommended at https://cmake.org/cmake/help/latest/command/include_directories.html Doing so lets us mark a bunch of dependency includes SYSTEM PRIVATE, in particular LIBXML2_INCLUDE_DIRS. On macOS this keeps us from triggering the nullability warnings described at https://www.wireshark.org/lists/wireshark-dev/202004/msg00056.html (This might also keep the Visual Studio code analyzer from complaining about various Qt headers, but I haven't tested this.)
This commit is contained in:
parent
3c404abf2c
commit
270c8ed746
|
@ -13,24 +13,6 @@ if (HAVE_HFI_SECTION_INIT)
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
include_directories(
|
|
||||||
${BROTLI_INCLUDE_DIRS}
|
|
||||||
${GLIB2_INCLUDE_DIRS}
|
|
||||||
${CARES_INCLUDE_DIRS}
|
|
||||||
${GCRYPT_INCLUDE_DIRS}
|
|
||||||
${GTHREAD2_INCLUDE_DIRS}
|
|
||||||
${GNUTLS_INCLUDE_DIRS}
|
|
||||||
${KERBEROS_INCLUDE_DIRS}
|
|
||||||
${LUA_INCLUDE_DIRS}
|
|
||||||
${LZ4_INCLUDE_DIRS}
|
|
||||||
${NGHTTP2_INCLUDE_DIRS}
|
|
||||||
${SMI_INCLUDE_DIRS}
|
|
||||||
${SNAPPY_INCLUDE_DIRS}
|
|
||||||
${ZLIB_INCLUDE_DIRS}
|
|
||||||
${ZSTD_INCLUDE_DIRS}
|
|
||||||
${LIBXML2_INCLUDE_DIRS}
|
|
||||||
)
|
|
||||||
|
|
||||||
add_definitions(
|
add_definitions(
|
||||||
${LIBXML2_DEFINITIONS}
|
${LIBXML2_DEFINITIONS}
|
||||||
${KERBEROS_DEFINITIONS}
|
${KERBEROS_DEFINITIONS}
|
||||||
|
@ -41,6 +23,7 @@ add_subdirectory(dfilter)
|
||||||
add_subdirectory(dissectors)
|
add_subdirectory(dissectors)
|
||||||
add_subdirectory(ftypes)
|
add_subdirectory(ftypes)
|
||||||
add_subdirectory(wmem)
|
add_subdirectory(wmem)
|
||||||
|
|
||||||
if(LUA_FOUND)
|
if(LUA_FOUND)
|
||||||
add_subdirectory(wslua)
|
add_subdirectory(wslua)
|
||||||
endif()
|
endif()
|
||||||
|
@ -365,6 +348,20 @@ target_include_directories(epan
|
||||||
|
|
||||||
target_include_directories(epan SYSTEM PUBLIC ${GLIB2_INCLUDE_DIRS})
|
target_include_directories(epan SYSTEM PUBLIC ${GLIB2_INCLUDE_DIRS})
|
||||||
|
|
||||||
|
target_include_directories(epan
|
||||||
|
SYSTEM PRIVATE
|
||||||
|
${BROTLI_INCLUDE_DIRS}
|
||||||
|
${CARES_INCLUDE_DIRS}
|
||||||
|
${GLIB2_INCLUDE_DIRS}
|
||||||
|
${GNUTLS_INCLUDE_DIRS}
|
||||||
|
${GTHREAD2_INCLUDE_DIRS}
|
||||||
|
${LIBXML2_INCLUDE_DIRS}
|
||||||
|
${LUA_INCLUDE_DIRS}
|
||||||
|
${NGHTTP2_INCLUDE_DIRS}
|
||||||
|
${SMI_INCLUDE_DIRS}
|
||||||
|
${ZLIB_INCLUDE_DIRS}
|
||||||
|
)
|
||||||
|
|
||||||
add_dependencies(epan lemon)
|
add_dependencies(epan lemon)
|
||||||
|
|
||||||
install(TARGETS epan
|
install(TARGETS epan
|
||||||
|
|
|
@ -60,6 +60,11 @@ add_library(crypt OBJECT
|
||||||
${CRYPT_FILES}
|
${CRYPT_FILES}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
target_include_directories(crypt
|
||||||
|
SYSTEM PRIVATE
|
||||||
|
${GCRYPT_INCLUDE_DIRS}
|
||||||
|
)
|
||||||
|
|
||||||
set_target_properties(crypt PROPERTIES
|
set_target_properties(crypt PROPERTIES
|
||||||
FOLDER "Libs/epan/crypt"
|
FOLDER "Libs/epan/crypt"
|
||||||
COMPILE_DEFINITIONS "WS_BUILD_DLL"
|
COMPILE_DEFINITIONS "WS_BUILD_DLL"
|
||||||
|
|
|
@ -2052,6 +2052,20 @@ add_library(dissectors OBJECT
|
||||||
${DISSECTOR_SUPPORT_SRC}
|
${DISSECTOR_SUPPORT_SRC}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
target_include_directories(dissectors
|
||||||
|
SYSTEM PRIVATE
|
||||||
|
${GCRYPT_INCLUDE_DIRS}
|
||||||
|
${GNUTLS_INCLUDE_DIRS}
|
||||||
|
${KERBEROS_INCLUDE_DIRS}
|
||||||
|
${LIBXML2_INCLUDE_DIRS}
|
||||||
|
${LZ4_INCLUDE_DIRS}
|
||||||
|
${NGHTTP2_INCLUDE_DIRS}
|
||||||
|
${SMI_INCLUDE_DIRS}
|
||||||
|
${SNAPPY_INCLUDE_DIRS}
|
||||||
|
${ZLIB_INCLUDE_DIRS}
|
||||||
|
${ZSTD_INCLUDE_DIRS}
|
||||||
|
)
|
||||||
|
|
||||||
set_target_properties(dissectors PROPERTIES
|
set_target_properties(dissectors PROPERTIES
|
||||||
FOLDER "Libs/epan/dissectors"
|
FOLDER "Libs/epan/dissectors"
|
||||||
COMPILE_DEFINITIONS "WS_BUILD_DLL"
|
COMPILE_DEFINITIONS "WS_BUILD_DLL"
|
||||||
|
|
|
@ -146,6 +146,11 @@ add_library(wslua OBJECT
|
||||||
${WSLUA_FILES}
|
${WSLUA_FILES}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
target_include_directories(wslua
|
||||||
|
SYSTEM PRIVATE
|
||||||
|
${LUA_INCLUDE_DIRS}
|
||||||
|
)
|
||||||
|
|
||||||
set_target_properties(wslua PROPERTIES
|
set_target_properties(wslua PROPERTIES
|
||||||
FOLDER "Libs/epan/wslua"
|
FOLDER "Libs/epan/wslua"
|
||||||
COMPILE_DEFINITIONS "WS_BUILD_DLL"
|
COMPILE_DEFINITIONS "WS_BUILD_DLL"
|
||||||
|
|
|
@ -9,10 +9,6 @@
|
||||||
|
|
||||||
ADD_CUSTOM_CMAKE_INCLUDE()
|
ADD_CUSTOM_CMAKE_INCLUDE()
|
||||||
|
|
||||||
include_directories(
|
|
||||||
${GCRYPT_INCLUDE_DIRS}
|
|
||||||
)
|
|
||||||
|
|
||||||
set(WIRESHARK_WIDGET_HEADERS
|
set(WIRESHARK_WIDGET_HEADERS
|
||||||
widgets/additional_toolbar.h
|
widgets/additional_toolbar.h
|
||||||
widgets/apply_line_edit.h
|
widgets/apply_line_edit.h
|
||||||
|
@ -713,15 +709,16 @@ add_library(qtui OBJECT
|
||||||
wireshark-tap-register.c
|
wireshark-tap-register.c
|
||||||
)
|
)
|
||||||
|
|
||||||
target_include_directories(qtui SYSTEM
|
target_include_directories(qtui
|
||||||
PUBLIC
|
SYSTEM PUBLIC
|
||||||
${QT_INCLUDE_DIRS}
|
${QT_INCLUDE_DIRS}
|
||||||
${WINSPARKLE_INCLUDE_DIRS}
|
${WINSPARKLE_INCLUDE_DIRS}
|
||||||
${SPEEXDSP_INCLUDE_DIRS}
|
${SPEEXDSP_INCLUDE_DIRS}
|
||||||
PRIVATE
|
SYSTEM PRIVATE
|
||||||
# Can't use imported target, linking object libraries for usage requirements
|
# Can't use imported target, linking object libraries for usage requirements
|
||||||
# requires CMake 3.12
|
# requires CMake 3.12
|
||||||
${PCAP_INCLUDE_DIRS}
|
${PCAP_INCLUDE_DIRS}
|
||||||
|
${GCRYPT_INCLUDE_DIRS}
|
||||||
)
|
)
|
||||||
|
|
||||||
target_compile_definitions(qtui
|
target_compile_definitions(qtui
|
||||||
|
|
Loading…
Reference in New Issue