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)
2
2
3
3
INCLUDE (${CMAKE_ROOT} /Modules/ExternalProject.cmake)
4
4
INCLUDE (${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
+
5
13
INCLUDE (external/libseccomp.cmake)
6
14
INCLUDE (external/libcap.cmake)
7
15
INCLUDE (external/libtclap.cmake)
8
16
9
- SET (CMAKE_C_FLAGS "-std=gnu99 -Wall -static " )
17
+ SET (CMAKE_C_FLAGS "-std=gnu99 -Wall" )
10
18
SET (CMAKE_C_FLAGS_DEBUG "-g -pedantic" )
11
19
SET (CMAKE_C_FLAGS_RELEASE "-O2" )
12
- SET (CMAKE_CXX_FLAGS "-std=gnu++14 -Wall -static " )
20
+ SET (CMAKE_CXX_FLAGS "-std=gnu++14 -Wall" )
13
21
SET (CMAKE_CXX_FLAGS_DEBUG "-g -pedantic" )
14
22
SET (CMAKE_CXX_FLAGS_RELEASE "-O3" )
15
23
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
+
16
29
EXECUTE_PROCESS (COMMAND uname -r
17
30
OUTPUT_VARIABLE BUILD_KERNEL_RELEASE)
18
31
ADD_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):
46
46
47
47
-DWITH_BOXES=YES|NO
48
48
49
+ To control wheather sio2jail binary is statically or dinamically linked use
50
+ option (STATIC by default):
51
+
52
+ -DLINK=STATIC|DYNAMIC
53
+
49
54
For example, to skip man pages, use libtclap from /opt/tclap directory and
50
55
ignore system libseccomp run:
51
56
Original file line number Diff line number Diff line change 5
5
ADD_LIBRARY (seccomp STATIC IMPORTED )
6
6
7
7
IF (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 ()
8
13
FIND_FILE (
9
14
libseccomp_LIB_PATH
10
- NAMES libseccomp.a
15
+ NAMES " ${libseccomp_LIB_FILE_NAME} "
11
16
PATHS "${LIBSECCOMP_PREFIX} " "${LIBSECCOMP_PREFIX} /lib" "${LIBSECCOMP_PREFIX} /usr/lib"
12
17
)
13
18
FIND_PATH (
@@ -52,7 +57,11 @@ IF((NOT DEFINED LIBSECCOMP_BUILD_OWN AND (NOT EXISTS "${libseccomp_LIB_PATH}" OR
52
57
53
58
ExternalProject_Get_Property(seccomp_project
54
59
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 ()
56
65
SET (libseccomp_INC_PATH "${INSTALL_DIR} /include" )
57
66
58
67
ADD_DEPENDENCIES (seccomp seccomp_project)
You can’t perform that action at this time.
0 commit comments