forked from netdata/netdata
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prefer Protobuf’s own CMake config over CMake's FindProtobuf. (netdat…
…a#17128) * Prefer Protobuf’s own CMake config over CMake's FindProtobuf. The FindProtobuf CMake module shipped by upstream CMake is broken for Protobuf version 22.0 and newer because it does not correctly pull in the new Abseil dependencies. Protobuf itself sometimes ships a CMake Package Configuration module that _does_ work correctly, so use that in preference to the Find module shipped with CMake. Upstream bug reference: https://gitlab.kitware.com/cmake/cmake/-/issues/24321 * Properly handle protoc executable. * Restructure to explicitly handle fallback case ourselves. This allows proper handling of compatibility code in a way that actually works for us without us needing to ship a special module to handle the compatibility case. * Switch to bundling protobuf via CMake instead of an external script. * Fix handling of Protobuf inclusion. - Add correct include directories for protoc. - Skip installing protobuf when installing the agent. * Drop spurious quotation marks. * Properly fix generator expression for protoc include paths. * Properly default to bundling protobuf in installer code. * Disable ASAN in unit tests. It doesn’t work with the modified protobuf handling and per discussion with the team is non-critical. * Change comment based on review. * Revert "Disable ASAN in unit tests." This reverts commit 6cb98b1. * Disable IPMI and NFACCT plugins for unit tests. We don’t actually have any unit tests for them, and they cause issues building reliably in the unit testing environment. * Disable ASAN for Abseil and Protobuf when vendoring them. * Switch to commit hashes for protobuf/abseil. * Restructure to better encapsulate protobuf handling as it’s own module. * Fix up bundled protobuf version handling. Google has complicated rules for C++ build environment support, so we really need to be checking compiler versions and not _just_ C++ standard version. * Fix warnings about invalid defines.
- Loading branch information
Showing
10 changed files
with
283 additions
and
183 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Extra tools for working with FetchContent on older CMake | ||
# | ||
# Copyright (c) 2024 Netdata Inc. | ||
# SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
# FetchContent_MakeAvailable_NoInstall | ||
# | ||
# Add a sub-project with FetchContent, but with the EXCLUDE_FROM_ALL | ||
# argument for the add_subdirectory part. | ||
# | ||
# CMake 3.28 and newer provide a way to do this with an extra argument | ||
# on FetchContent_Declare, but older versions need you to implement | ||
# the logic yourself. Once we no longer support CMake versions older | ||
# than 3.28, we can get rid of this macro. | ||
# | ||
# Unlike FetchContent_MakeAvailble, this only accepts a single project | ||
# to make available. | ||
macro(FetchContent_MakeAvailable_NoInstall name) | ||
include(FetchContent) | ||
|
||
FetchContent_GetProperties(${name}) | ||
|
||
if(NOT ${name}_POPULATED) | ||
FetchContent_Populate(${name}) | ||
add_subdirectory(${${name}_SOURCE_DIR} ${${name}_BINARY_DIR} EXCLUDE_FROM_ALL) | ||
endif() | ||
endmacro() |
Oops, something went wrong.