Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: Add support for linking to shared falcosecurity libraries. #2093

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
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
13 changes: 13 additions & 0 deletions cmake/modules/falcosecurity-libs.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
15 changes: 10 additions & 5 deletions userspace/sysdig/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ if(NOT WIN32)
include(ncurses)
endif() # NOT WIN32

include(zlib)
include(luajit)

include_directories("${PROJECT_BINARY_DIR}/userspace/sinspui")
Expand Down Expand Up @@ -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
Expand All @@ -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}")

Expand All @@ -117,7 +122,7 @@ if(NOT WIN32)
endif()

target_link_libraries(csysdig
sinsp
"${SINSP_LIB}"
"${LUAJIT_LIB}"
"${CURSES_LIBRARIES}"
"${YAMLCPP_LIB}")
Expand All @@ -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}")

Expand Down
Loading