Upstream status: https://github.com/draios/sysdig/pull/2093 diff --git a/cmake/modules/falcosecurity-libs.cmake b/cmake/modules/falcosecurity-libs.cmake index 7cee8a3c4..dd59c1b32 100644 --- a/cmake/modules/falcosecurity-libs.cmake +++ b/cmake/modules/falcosecurity-libs.cmake @@ -16,6 +16,19 @@ # limitations under the License. # +option(USE_BUNDLED_FALCOSECURITY_LIBS "Enable building of the bundled falcosecurity libraries" ${USE_BUNDLED_DEPS}) + +if(NOT USE_BUNDLED_FALCOSECURITY_LIBS) + find_package(PkgConfig REQUIRED) + pkg_check_modules(LIBSINSP REQUIRED IMPORTED_TARGET libsinsp) + message(STATUS "Found libsinsp: + include: ${LIBSINSP_INCLUDE_DIRS} + lib: ${LIBSINSP_LIBRARIES} + cflags: ${LIBSINSP_CFLAGS}") + return() +endif() + +# else(): using bundled falcosecurity libs set(FALCOSECURITY_LIBS_CMAKE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/falcosecurity-libs-repo") set(FALCOSECURITY_LIBS_CMAKE_WORKING_DIR "${CMAKE_BINARY_DIR}/falcosecurity-libs-repo") diff --git a/userspace/sysdig/CMakeLists.txt b/userspace/sysdig/CMakeLists.txt index 60f8072ad..0cb179ccc 100644 --- a/userspace/sysdig/CMakeLists.txt +++ b/userspace/sysdig/CMakeLists.txt @@ -20,7 +20,6 @@ if(NOT WIN32) include(ncurses) endif() # NOT WIN32 -include(zlib) include(luajit) include_directories("${PROJECT_BINARY_DIR}/userspace/sinspui") @@ -84,6 +83,12 @@ if(USE_BUNDLED_DEPS) add_dependencies(csysdig luajit) endif() +if(USE_BUNDLED_FALCOSECURITY_LIBS) + set(SINSP_LIB sinsp) +else() + set(SINSP_LIB PkgConfig::LIBSINSP) +endif() + target_include_directories( sysdig PUBLIC @@ -108,7 +113,7 @@ if(NOT WIN32) include_directories(${PROJECT_BINARY_DIR}/driver/src) target_link_libraries(sysdig - sinsp + "${SINSP_LIB}" "${LUAJIT_LIB}" "${YAMLCPP_LIB}") @@ -117,7 +122,7 @@ if(NOT WIN32) endif() target_link_libraries(csysdig - sinsp + "${SINSP_LIB}" "${LUAJIT_LIB}" "${CURSES_LIBRARIES}" "${YAMLCPP_LIB}") @@ -140,12 +145,12 @@ else() add_definitions(-DNOCURSESUI) target_link_libraries(sysdig - sinsp + "${SINSP_LIB}" "${LUAJIT_LIB}" "${YAMLCPP_LIB}") target_link_libraries(csysdig - sinsp + "${SINSP_LIB}" "${LUAJIT_LIB}" "${YAMLCPP_LIB}")