forked from OpenSCAP/openscap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
102 lines (99 loc) · 2.91 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
install(PROGRAMS "oscap-run-sce-script"
DESTINATION ${CMAKE_INSTALL_BINDIR}
)
if(ENABLE_OSCAP_UTIL)
file(GLOB UTILS_SOURCES "*.c")
if(HAVE_GETOPT_H)
list(REMOVE_ITEM UTILS_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/getopt.c")
endif()
add_executable(oscap ${UTILS_SOURCES})
target_link_libraries(oscap openscap)
if(WIN32)
set(OSCAP_UTIL_DESTINATION ".")
# Install the 'oscap' utility
install(TARGETS "oscap"
DESTINATION ${OSCAP_UTIL_DESTINATION}
)
# Install all recursively dependent DLLs for oscap.exe
set(APPS "\${CMAKE_INSTALL_PREFIX}/oscap.exe") # the \ before $ is required by BundleUtilities
set(VCPKG_DLL_DIR "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/bin")
install(CODE "
include(BundleUtilities)
fixup_bundle(\"${APPS}\" \"\" \"${VCPKG_DLL_DIR}\")
")
else()
set(OSCAP_UTIL_DESTINATION ${CMAKE_INSTALL_BINDIR})
# Install the 'oscap' utility
install(TARGETS "oscap"
DESTINATION ${OSCAP_UTIL_DESTINATION}
)
# Install manual page
install(FILES "oscap.8"
DESTINATION "${CMAKE_INSTALL_MANDIR}/man8"
)
endif()
endif()
if(ENABLE_OSCAP_UTIL_CHROOT)
install(PROGRAMS "oscap-chroot"
DESTINATION ${CMAKE_INSTALL_BINDIR}
)
install(FILES "oscap-chroot.8"
DESTINATION "${CMAKE_INSTALL_MANDIR}/man8"
)
endif()
if(ENABLE_OSCAP_UTIL_DOCKER)
configure_file("oscap-docker.in" "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/oscap-docker" @ONLY)
file(
COPY "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/oscap-docker"
DESTINATION ${CMAKE_CURRENT_BINARY_DIR}
FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
if(NOT PYTHON_SITE_PACKAGES_INSTALL_DIR)
execute_process(COMMAND
${OSCAP_DOCKER_PYTHON} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(False, False, prefix='${CMAKE_INSTALL_PREFIX}'))"
OUTPUT_VARIABLE PYTHON_SITE_PACKAGES_INSTALL_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE
)
endif()
install(DIRECTORY oscap_docker_python
DESTINATION ${PYTHON_SITE_PACKAGES_INSTALL_DIR}
)
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/oscap-docker
DESTINATION ${CMAKE_INSTALL_BINDIR}
)
install(FILES "oscap-docker.8"
DESTINATION "${CMAKE_INSTALL_MANDIR}/man8"
)
endif()
if(ENABLE_OSCAP_UTIL_SSH)
install(PROGRAMS "oscap-ssh"
DESTINATION ${CMAKE_INSTALL_BINDIR}
)
install(FILES "oscap-ssh.8"
DESTINATION "${CMAKE_INSTALL_MANDIR}/man8"
)
endif()
if(ENABLE_OSCAP_UTIL_VM)
install(PROGRAMS "oscap-vm"
DESTINATION ${CMAKE_INSTALL_BINDIR}
)
install(FILES "oscap-vm.8"
DESTINATION "${CMAKE_INSTALL_MANDIR}/man8"
)
endif()
if(ENABLE_OSCAP_UTIL_PODMAN)
install(PROGRAMS "oscap-podman"
DESTINATION ${CMAKE_INSTALL_BINDIR}
)
install(FILES "oscap-podman.8"
DESTINATION "${CMAKE_INSTALL_MANDIR}/man8"
)
endif()
if(ENABLE_OSCAP_UTIL_AS_RPM)
install(PROGRAMS "scap-as-rpm"
DESTINATION ${CMAKE_INSTALL_BINDIR}
)
install(FILES "scap-as-rpm.8"
DESTINATION "${CMAKE_INSTALL_MANDIR}/man8"
)
endif()