@cryptotaxi247 / netdata-1 / commits / 3520c940a

Check for Snappy only when required. (#17319)

Snappy is only used by the Prometheus Remote Write exporter, so we should only be checking for it if that is enabled. We also should be checking with pkg-config _first_ instead of doing so after searching for the library directly.

Austin S. Hemmelgarn committed Apr 9, 2024 at 09:04 UTC 3520c940ad6211847939ec5892b120412d02a9f3
1 file changed +3 -9
CMakeLists.txt
+3 -9
@@ -302,15 +302,6 @@ check_include_file("inttypes.h" HAVE_INTTYPES_H)
302 check_include_file("stdint.h" HAVE_STDINT_H)
303 check_include_file("sys/capability.h" HAVE_SYS_CAPABILITY_H)
304
305 -#
306 -# check libraries we need
307 -#
308 -
309 -include(CheckLibraryExists)
310 -
311 -check_library_exists(snappy snappy_compress "" HAVE_SNAPPY_LIB)
312 -#check_include_file("snappy.h" HAVE_SNAPPY_H)
313 -
305 #
306 # check symbols
307 #
@@ -1991,6 +1982,9 @@ endif()
1982 if(ENABLE_EXPORTER_PROMETHEUS_REMOTE_WRITE)
1983 pkg_check_modules(SNAPPY snappy)
1984 if (NOT SNAPPY_FOUND)
1985 + include(CheckLibraryExists)
1986 + check_library_exists(snappy snappy_compress "" HAVE_SNAPPY_LIB)
1987 +
1988 if(HAVE_SNAPPY_LIB)
1989 set(SNAPPY_INCLUDE_DIRS "")
1990 set(SNAPPY_CFLAGS_OTHER "")