diff options
author | João Valverde <joao.valverde@tecnico.ulisboa.pt> | 2018-08-23 22:03:28 +0100 |
---|---|---|
committer | João Valverde <j@v6e.pt> | 2018-08-25 18:07:21 +0000 |
commit | d0b97a420d557042938ac5d6bf075fcd84df9371 (patch) | |
tree | 4075a2072c60cf242d25b2706ce08ebd6f78750a /epan/CMakeLists.txt | |
parent | e75905a583432e8b20cecdde71c41d17cb781392 (diff) |
CMake: Modernize config-file package support
A CMake config-file package provides support for downstreams using
CMake and Wireshark libraries to easily configure the libwireshark
dependency with:
find_package(Wireshark CONFIG [REQUIRED])
target_link_libraries(foo epan)
The FindWireshark.cmake file is no longer needed.
See cmake-package(7) for more details on CMake's package system.
Change-Id: Ie8af1d44417a99dd08d37959f7b2ffca88572ec2
Reviewed-on: https://code.wireshark.org/review/29208
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot
Reviewed-by: João Valverde <j@v6e.pt>
Diffstat (limited to 'epan/CMakeLists.txt')
-rw-r--r-- | epan/CMakeLists.txt | 60 |
1 files changed, 36 insertions, 24 deletions
diff --git a/epan/CMakeLists.txt b/epan/CMakeLists.txt index 486feda6fd..d48138dc6d 100644 --- a/epan/CMakeLists.txt +++ b/epan/CMakeLists.txt @@ -263,29 +263,6 @@ add_lemon_files(LEMON_FILES LIBWIRESHARK_FILES dtd_grammar.lemon ) -set(epan_LIBS - wiretap - wsutil - ${CARES_LIBRARIES} - ${GCRYPT_LIBRARIES} - #${GEOIP_LIBRARIES} - ${GLIB2_LIBRARIES} - ${GIO2_LIBRARIES} - ${GTHREAD2_LIBRARIES} - ${GNUTLS_LIBRARIES} - ${KERBEROS_LIBRARIES} - ${LUA_LIBRARIES} - ${LZ4_LIBRARIES} - ${M_LIBRARIES} - ${NGHTTP2_LIBRARIES} - ${PCAP_LIBRARIES} - ${SMI_LIBRARIES} - ${SNAPPY_LIBRARIES} - ${WIN_PSAPI_LIBRARY} - ${LIBXML2_LIBRARIES} - ${JSONGLIB_LIBRARIES} -) - set_source_files_properties( ${LIBWIRESHARK_FILES} PROPERTIES @@ -306,6 +283,10 @@ add_library(epan add_dependencies(epan version) +if(ENABLE_PLUGINS) + target_compile_definitions(epan PUBLIC HAVE_PLUGINS) +endif() + set_target_properties(epan PROPERTIES COMPILE_DEFINITIONS "WS_BUILD_DLL" LINK_FLAGS "${WS_LINK_FLAGS}" @@ -374,11 +355,42 @@ set_target_properties(epan PROPERTIES FOLDER "DLLs" ) -target_link_libraries(epan ${epan_LIBS}) +target_link_libraries(epan + PUBLIC + wiretap + wsutil + ${GLIB2_LIBRARIES} + PRIVATE + ${CARES_LIBRARIES} + ${GCRYPT_LIBRARIES} + ${GIO2_LIBRARIES} + ${GTHREAD2_LIBRARIES} + ${GNUTLS_LIBRARIES} + ${KERBEROS_LIBRARIES} + ${LUA_LIBRARIES} + ${LZ4_LIBRARIES} + ${M_LIBRARIES} + ${NGHTTP2_LIBRARIES} + ${PCAP_LIBRARIES} + ${SMI_LIBRARIES} + ${SNAPPY_LIBRARIES} + ${WIN_PSAPI_LIBRARY} + ${LIBXML2_LIBRARIES} + ${JSONGLIB_LIBRARIES} +) + +target_include_directories(epan + INTERFACE + $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}> + $<INSTALL_INTERFACE:include/wireshark> + PUBLIC + ${GLIB2_INCLUDE_DIRS} +) add_dependencies(epan lemon) install(TARGETS epan + EXPORT WiresharkTargets LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} |