Cmake: ENABLE_STATIC -> BUILD_SHARED_LIBS

This commit is contained in:
Michael Mann 2025-05-20 19:37:12 +00:00 committed by AndersBroman
parent ab85787352
commit 67bb36a181
7 changed files with 8 additions and 15 deletions

View File

@ -984,11 +984,6 @@ endif() # ! MSVC
include(CheckCCompilerFlag)
include(CheckCXXCompilerFlag)
if(ENABLE_STATIC)
set(BUILD_SHARED_LIBS 0)
else()
set(BUILD_SHARED_LIBS 1)
endif()
function(test_compiler_flag _lang _this_flag _valid_flags_var)
string(MAKE_C_IDENTIFIER "${_lang}${_this_flag}_VALID" _flag_var)
@ -3498,7 +3493,7 @@ if(BUILD_dumpcap AND PCAP_FOUND)
#
# Instead, we just include source files for the relevant code
# to be built as part of dumpcap, so that they're built with
# ENABLE_STATIC defined, and will be able to be built with
# BUILD_SHARED_LIBS defined, and will be able to be built with
# the static version of libwsutil.
#
set(dumpcap_FILES
@ -3516,7 +3511,7 @@ if(BUILD_dumpcap AND PCAP_FOUND)
set_extra_executable_properties(dumpcap "Executables")
target_link_libraries(dumpcap ${dumpcap_LIBS})
target_include_directories(dumpcap SYSTEM PRIVATE ${NL_INCLUDE_DIRS})
target_compile_definitions(dumpcap PRIVATE ENABLE_STATIC)
target_compile_definitions(dumpcap PRIVATE BUILD_SHARED_LIBS)
executable_link_mingw_unicode(dumpcap)
install(TARGETS dumpcap
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}

View File

@ -80,7 +80,7 @@ if(WIN32)
endif()
option(ENABLE_PCAP "Enable libpcap support (required for capturing)" ON)
option(ENABLE_STATIC "Build Wireshark libraries statically" OFF)
option(BUILD_SHARED_LIBS "Build Wireshark libraries as shared" ON)
option(USE_STATIC "Always link statically with external libraries" OFF)
option(ENABLE_PLUGINS "Build with plugins" ON)
option(ENABLE_PLUGIN_IFDEMO "Build with plugin interface demo" OFF)

View File

@ -31,9 +31,6 @@
/* Define to 1 if we check hf conflict */
#cmakedefine ENABLE_CHECK_FILTER 1
/* Link Wireshark libraries statically */
#cmakedefine ENABLE_STATIC 1
/* Enable AddressSanitizer (and LeakSanitizer on clang/gcc) */
#cmakedefine ENABLE_ASAN 1

View File

@ -199,6 +199,7 @@ for Arm64 and Intel. wsbuglink:17294[]
=== Removed Features and Support
Wireshark no longer supports AirPcap and WinPcap.
Cmake option ENABLE_STATIC deprecated in favor of BUILD_SHARED_LIBS
// === Removed Dissectors

View File

@ -91,7 +91,7 @@
* be necessary, e.g. if what's declared is an array whose size is
* not given in the declaration.
*/
#ifdef ENABLE_STATIC
#ifdef BUILD_SHARED_LIBS
/*
* We're building all-static, so we're not building any DLLs.
*/
@ -99,7 +99,7 @@
#elif defined(__GNUC__)
/* GCC */
#define WS_DLL_PUBLIC_DEF __attribute__ ((dllimport))
#else /* ! ENABLE_STATIC && ! __GNUC__ */
#else /* ! BUILD_SHARED_LIBS && ! __GNUC__ */
/*
* Presumably MSVC, and we're not building all-static.
* Note: actually gcc seems to also support this syntax.

View File

@ -37,7 +37,7 @@ set_target_properties(writecap PROPERTIES
target_compile_definitions(writecap
PRIVATE
# Necessary to avoid C4273 inconsistent DLL linkage on MSVC
ENABLE_STATIC
BUILD_SHARED_LIBS
)
target_link_libraries(writecap

View File

@ -430,7 +430,7 @@ add_library(wsutil_static STATIC
)
target_compile_definitions(wsutil_static PRIVATE
ENABLE_STATIC
BUILD_SHARED_LIBS
BUILD_WSUTIL
)