]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cmake: enable selinux support 9133/head
authorKefu Chai <kchai@redhat.com>
Sun, 15 May 2016 12:39:53 +0000 (20:39 +0800)
committerKefu Chai <kchai@redhat.com>
Mon, 16 May 2016 15:09:06 +0000 (23:09 +0800)
Signed-off-by: Kefu Chai <kchai@redhat.com>
CMakeLists.txt
selinux/CMakeLists.txt [new file with mode: 0644]

index 8dbdcb510b166af4e7568348d48ea71ccee075da..e8d47a0f6bf10cd92c5164145eedd5d8c8ef1cbf 100644 (file)
@@ -353,6 +353,16 @@ include_directories(${Boost_INCLUDE_DIRS})
 
 find_package(Threads REQUIRED)
 
+option(WITH_SELINUX "build SELinux policy" OFF)
+if(WITH_SELINUX)
+  find_file(SELINUX_MAKEFILE selinux/devel/include/Makefile
+    PATH /usr/share)
+  if(NOT SELINUX_MAKEFILE)
+    message(FATAL_ERROR "Can't find selinux's Makefile")
+  endif()
+  add_subdirectory(selinux)
+endif(WITH_SELINUX)
+
 # find out which platform we are building on
 if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
   set(LINUX ON)
diff --git a/selinux/CMakeLists.txt b/selinux/CMakeLists.txt
new file mode 100644 (file)
index 0000000..d0a7e54
--- /dev/null
@@ -0,0 +1,11 @@
+add_custom_target(
+  ceph.pp ALL
+  COMMAND ln -sf ${CMAKE_CURRENT_SOURCE_DIR}/ceph.* .
+  COMMAND make -f ${SELINUX_MAKEFILE} ceph.pp
+  DEPENDS ceph.te ceph.fc ceph.if)
+
+set(datadir ${CMAKE_INSTALL_PREFIX}/share/selinux)
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ceph.pp
+  DESTINATION ${datadir}/packages)
+install(FILES ceph.if
+  DESTINATION ${datadir}/devel/include/contrib)