Skip to content

Commit

Permalink
build: Add support for linking to shared falcosecurity libraries.
Browse files Browse the repository at this point in the history
* cmake/modules/falcosecurity-libs.cmake (USE_BUNDLED_FALCOSECURITY_LIBS):
New option.  Look for libsinsp via pkg-config unless it's enabled.
* userspace/sysdig/CMakeLists.txt: Adjust link directives accordingly.
Remove extraneous zlib include.

Signed-off-by: Maxim Cournoyer <[email protected]>
  • Loading branch information
Apteryks committed May 8, 2024
1 parent c1ee30f commit 9327969
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
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
9 changes: 4 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 @@ -108,7 +107,7 @@ if(NOT WIN32)
include_directories(${PROJECT_BINARY_DIR}/driver/src)

target_link_libraries(sysdig
sinsp
$<IF:$<BOOL:${USE_BUNDLED_FALCOSECURITY_LIBS}>,sinsp,PkgConfig::LIBSINSP>
"${LUAJIT_LIB}"
"${YAMLCPP_LIB}")

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

target_link_libraries(csysdig
sinsp
$<IF:$<BOOL:${USE_BUNDLED_FALCOSECURITY_LIBS}>,sinsp,PkgConfig::LIBSINSP>
"${LUAJIT_LIB}"
"${CURSES_LIBRARIES}"
"${YAMLCPP_LIB}")
Expand All @@ -140,12 +139,12 @@ else()
add_definitions(-DNOCURSESUI)

target_link_libraries(sysdig
sinsp
$<IF:$<BOOL:${USE_BUNDLED_FALCOSECURITY_LIBS}>,sinsp,PkgConfig::LIBSINSP>
"${LUAJIT_LIB}"
"${YAMLCPP_LIB}")

target_link_libraries(csysdig
sinsp
$<IF:$<BOOL:${USE_BUNDLED_FALCOSECURITY_LIBS}>,sinsp,PkgConfig::LIBSINSP>
"${LUAJIT_LIB}"
"${YAMLCPP_LIB}")

Expand Down

0 comments on commit 9327969

Please sign in to comment.