From db2012d24cb5c4694916d5abf711723f23081dd2 Mon Sep 17 00:00:00 2001 From: Mark Stemm Date: Tue, 2 Nov 2021 15:21:38 -0700 Subject: [PATCH] Detect strlcpy on the fly (musl libc) Detect strlcpy on the fly, as was done in https://github.com/falcosecurity/libs/pull/110. Signed-off-by: Mark Stemm --- cmake/modules/falcosecurity-libs.cmake | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cmake/modules/falcosecurity-libs.cmake b/cmake/modules/falcosecurity-libs.cmake index d7571f99ab0..ab24df1e035 100644 --- a/cmake/modules/falcosecurity-libs.cmake +++ b/cmake/modules/falcosecurity-libs.cmake @@ -63,5 +63,15 @@ set(USE_BUNDLED_JSONCPP ON CACHE BOOL "") list(APPEND CMAKE_MODULE_PATH "${FALCOSECURITY_LIBS_SOURCE_DIR}/cmake/modules") +include(CheckSymbolExists) +check_symbol_exists(strlcpy "string.h" HAVE_STRLCPY) +if(HAVE_STRLCPY) + message(STATUS "Existing strlcpy found, will *not* use local definition by setting -DHAVE_STRLCPY.") + add_definitions(-DHAVE_STRLCPY) +else() + message(STATUS "No strlcpy found, will use local definition") +endif() + include(libscap) include(libsinsp) +