File tree Expand file tree Collapse file tree 3 files changed +31
-4
lines changed
Expand file tree Collapse file tree 3 files changed +31
-4
lines changed Original file line number Diff line number Diff line change @@ -2,17 +2,30 @@ CMAKE_MINIMUM_REQUIRED(VERSION 3.0)
22
33INCLUDE (${CMAKE_ROOT} /Modules/ExternalProject.cmake)
44INCLUDE (${CMAKE_ROOT} /Modules/GNUInstallDirs.cmake)
5+
6+ IF (NOT DEFINED LINK)
7+ SET (LINK "STATIC" )
8+ ENDIF ()
9+ IF (NOT LINK MATCHES "STATIC|DYNAMIC" )
10+ MESSAGE (FATAL_ERROR "LINK should be one of STATIC, DYNAMIC" )
11+ ENDIF ()
12+
513INCLUDE (external/libseccomp.cmake)
614INCLUDE (external/libcap.cmake)
715INCLUDE (external/libtclap.cmake)
816
9- SET (CMAKE_C_FLAGS "-std=gnu99 -Wall -static " )
17+ SET (CMAKE_C_FLAGS "-std=gnu99 -Wall" )
1018SET (CMAKE_C_FLAGS_DEBUG "-g -pedantic" )
1119SET (CMAKE_C_FLAGS_RELEASE "-O2" )
12- SET (CMAKE_CXX_FLAGS "-std=gnu++14 -Wall -static " )
20+ SET (CMAKE_CXX_FLAGS "-std=gnu++14 -Wall" )
1321SET (CMAKE_CXX_FLAGS_DEBUG "-g -pedantic" )
1422SET (CMAKE_CXX_FLAGS_RELEASE "-O3" )
1523
24+ IF (LINK STREQUAL "STATIC" )
25+ SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -static" )
26+ SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static" )
27+ ENDIF ()
28+
1629EXECUTE_PROCESS (COMMAND uname -r
1730 OUTPUT_VARIABLE BUILD_KERNEL_RELEASE)
1831ADD_DEFINITIONS ('-DBUILD_KERNEL_RELEASE="${BUILD_KERNEL_RELEASE} " ')
Original file line number Diff line number Diff line change @@ -46,6 +46,11 @@ and wheather to install boxes scripts (NO by default):
4646
4747 -DWITH_BOXES=YES|NO
4848
49+ To control wheather sio2jail binary is statically or dinamically linked use
50+ option (STATIC by default):
51+
52+ -DLINK=STATIC|DYNAMIC
53+
4954For example, to skip man pages, use libtclap from /opt/tclap directory and
5055ignore system libseccomp run:
5156
Original file line number Diff line number Diff line change 55ADD_LIBRARY (seccomp STATIC IMPORTED )
66
77IF (NOT DEFINED LIBSECCOMP_BUILD_OWN OR LIBSECCOMP_BUILD_OWN STREQUAL "NO" )
8+ IF (LINK STREQUAL "STATIC" )
9+ SET (libseccomp_LIB_FILE_NAME "libseccomp.a" )
10+ ELSE ()
11+ SET (libseccomp_LIB_FILE_NAME "libseccomp.so" )
12+ ENDIF ()
813 FIND_FILE (
914 libseccomp_LIB_PATH
10- NAMES libseccomp.a
15+ NAMES " ${libseccomp_LIB_FILE_NAME} "
1116 PATHS "${LIBSECCOMP_PREFIX} " "${LIBSECCOMP_PREFIX} /lib" "${LIBSECCOMP_PREFIX} /usr/lib"
1217 )
1318 FIND_PATH (
@@ -52,7 +57,11 @@ IF((NOT DEFINED LIBSECCOMP_BUILD_OWN AND (NOT EXISTS "${libseccomp_LIB_PATH}" OR
5257
5358 ExternalProject_Get_Property(seccomp_project
5459 INSTALL_DIR)
55- SET (libseccomp_LIB_PATH "${INSTALL_DIR} /lib/libseccomp.a" )
60+ IF (LINK STREQUAL "STATIC" )
61+ SET (libseccomp_LIB_PATH "${INSTALL_DIR} /lib/libseccomp.a" )
62+ ELSE ()
63+ SET (libseccomp_LIB_PATH "${INSTALL_DIR} /lib/libseccomp.so" )
64+ ENDIF ()
5665 SET (libseccomp_INC_PATH "${INSTALL_DIR} /include" )
5766
5867 ADD_DEPENDENCIES (seccomp seccomp_project)
You can’t perform that action at this time.
0 commit comments