Skip to content

Commit 6117c49

Browse files
apterykstherealbobo
authored andcommitted
build: Add support for linking to shared falcosecurity libraries.
* 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. Signed-off-by: Maxim Cournoyer <[email protected]>
1 parent eacd10b commit 6117c49

File tree

2 files changed

+25
-4
lines changed

2 files changed

+25
-4
lines changed

cmake/modules/falcosecurity-libs.cmake

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,21 @@
1616
# limitations under the License.
1717
#
1818

19+
option(USE_BUNDLED_FALCOSECURITY_LIBS
20+
"Enable building of the bundled falcosecurity libraries"
21+
${USE_BUNDLED_DEPS})
22+
23+
if(NOT USE_BUNDLED_FALCOSECURITY_LIBS)
24+
find_package(PkgConfig REQUIRED)
25+
pkg_check_modules(LIBSINSP REQUIRED IMPORTED_TARGET libsinsp)
26+
message(STATUS "Found libsinsp:
27+
include: ${LIBSINSP_INCLUDE_DIRS}
28+
lib: ${LIBSINSP_LIBRARIES}
29+
cflags: ${LIBSINSP_CFLAGS}")
30+
return()
31+
endif()
32+
33+
# else(): using bundled falcosecurity libs
1934
set(FALCOSECURITY_LIBS_CMAKE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/falcosecurity-libs-repo")
2035
set(FALCOSECURITY_LIBS_CMAKE_WORKING_DIR "${CMAKE_BINARY_DIR}/falcosecurity-libs-repo")
2136

userspace/sysdig/CMakeLists.txt

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,12 @@ if(USE_BUNDLED_DEPS)
8484
add_dependencies(csysdig luajit)
8585
endif()
8686

87+
if(USE_BUNDLED_FALCOSECURITY_LIBS)
88+
set(SINSP_LIB sinsp)
89+
else()
90+
set(SINSP_LIB PkgConfig::LIBSINSP)
91+
endif()
92+
8793
target_include_directories(
8894
sysdig
8995
PUBLIC
@@ -106,7 +112,7 @@ if(NOT WIN32)
106112
include_directories(${PROJECT_BINARY_DIR}/driver/src)
107113

108114
target_link_libraries(sysdig
109-
sinsp
115+
"${SINSP_LIB}"
110116
"${LUAJIT_LIB}"
111117
yaml-cpp)
112118

@@ -115,7 +121,7 @@ if(NOT WIN32)
115121
endif()
116122

117123
target_link_libraries(csysdig
118-
sinsp
124+
"${SINSP_LIB}"
119125
"${LUAJIT_LIB}"
120126
"${CURSES_LIBRARIES}"
121127
yaml-cpp)
@@ -138,12 +144,12 @@ else()
138144
add_definitions(-DNOCURSESUI)
139145

140146
target_link_libraries(sysdig
141-
sinsp
147+
"${SINSP_LIB}"
142148
"${LUAJIT_LIB}"
143149
yaml-cpp)
144150

145151
target_link_libraries(csysdig
146-
sinsp
152+
"${SINSP_LIB}"
147153
"${LUAJIT_LIB}"
148154
yaml-cpp)
149155

0 commit comments

Comments
 (0)