Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ netdata_fixup_system_processor()

option(STATIC_BUILD "Use static linking instead of dynamic linking for the build." FALSE)
mark_as_advanced(STATIC_BUILD)
set(BUILD_SHARED_LIBS "${STATIC_BUILD}")
# Every bundled sub-project is linked into our own binaries and deliberately
# not installed, so they must always be static. Build intent lives in
# STATIC_BUILD; this knob only governs bundled libraries.
set(BUILD_SHARED_LIBS OFF)

if(STATIC_BUILD)
set(CMAKE_FIND_LIBRARY_PREFIXES "${CMAKE_STATIC_LIBRARY_PREFIX}")
Expand Down
5 changes: 0 additions & 5 deletions netdata-installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -773,11 +773,6 @@ if [ -n "${NETDATA_PREPARE_ONLY}" ]; then
exit 0
fi

# Let cmake know we don't want to link shared libs
if [ "${IS_NETDATA_STATIC_BINARY}" = "yes" ]; then
NETDATA_CMAKE_OPTIONS="${NETDATA_CMAKE_OPTIONS} -DBUILD_SHARED_LIBS=Off"
fi

# shellcheck disable=SC2086
if ! run_cmake_configure; then
fatal "Failed to configure Netdata sources." I000A
Expand Down
8 changes: 4 additions & 4 deletions packaging/cmake/Modules/NetdataEBPFLegacy.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ set(ebpf-legacy_BUILD_DIR "${CMAKE_BINARY_DIR}/ebpf-legacy-build")
function(netdata_fetch_legacy_ebpf_code)
netdata_identify_libc(_libc)

if(DEFINED BUILD_SHARED_LIBS)
if(NOT BUILD_SHARED_LIBS)
set(need_static TRUE)
endif()
# Static builds ship the flavor-neutral object set; keep this test aligned
# with netdata_bundle_libbpf() in NetdataLibBPF.cmake.
if(STATIC_BUILD)
set(need_static TRUE)
endif()

if(need_static)
Expand Down
2 changes: 1 addition & 1 deletion packaging/cmake/Modules/NetdataProtobuf.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ macro(netdata_detect_protobuf)
set(HAVE_PROTOBUF True)
else()
if(NOT ENABLE_BUNDLED_PROTOBUF)
if (NOT BUILD_SHARED_LIBS)
if(STATIC_BUILD)
set(Protobuf_USE_STATIC_LIBS On)
endif()

Expand Down
Loading