Add pkg-config files generation.

PiperOrigin-RevId: 347812826
Change-Id: I1722d39759628ad976b99887c8406cff08195009
This commit is contained in:
Anton D. Kachalov 2020-12-16 06:45:33 -08:00 committed by Copybara-Service
parent f29b0091fc
commit 4763959227
5 changed files with 37 additions and 0 deletions

View File

@ -50,6 +50,7 @@ include(SapiOptions)
include(SapiDeps) include(SapiDeps)
include(SapiUtil) include(SapiUtil)
include(SapiBuildDefs) include(SapiBuildDefs)
include(GNUInstallDirs)
# Allow the header generator to auto-configure include paths # Allow the header generator to auto-configure include paths
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

10
cmake/sandbox2.pc.in Normal file
View File

@ -0,0 +1,10 @@
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=@CMAKE_INSTALL_FULL_BINDIR@
libdir=@CMAKE_INSTALL_FULL_LIBDIR@
includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
Name: sandbox2
Description: Sandbox2 is a C++ security sandbox for Linux using seccomp and BPF
Version: @PROJECT_VERSION@
Libs: -L${libdir} -lsandbox2_sandbox2
Cflags: -I${includedir}

10
cmake/sapi.pc.in Normal file
View File

@ -0,0 +1,10 @@
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=@CMAKE_INSTALL_FULL_BINDIR@
libdir=@CMAKE_INSTALL_FULL_LIBDIR@
includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
Name: sapi
Description: Sandboxed API makes sandboxing C/C++ libraries easier by auto-generating library API interfaces that call into sandboxed libraries using a custom RPC layer. Sandboxed API uses Sandbox2 as its underlying sandboxing technology.
Version: @PROJECT_VERSION@
Libs: -L${libdir} -lsapi
Cflags: -I${includedir}

View File

@ -216,3 +216,11 @@ foreach(_file ${_sapi_headers})
string(REPLACE ${CMAKE_CURRENT_LIST_DIR} "" _dir ${_dir}) string(REPLACE ${CMAKE_CURRENT_LIST_DIR} "" _dir ${_dir})
install(FILES ${_file} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/sandboxed_api/${_dir}) install(FILES ${_file} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/sandboxed_api/${_dir})
endforeach() endforeach()
configure_file(
"${PROJECT_SOURCE_DIR}/cmake/sapi.pc.in"
"${PROJECT_BINARY_DIR}/sapi.pc"
@ONLY
)
install(FILES "${PROJECT_BINARY_DIR}/sapi.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")

View File

@ -999,3 +999,11 @@ if(SAPI_ENABLE_TESTS)
ENVIRONMENT "TEST_SRCDIR=${PROJECT_BINARY_DIR}" ENVIRONMENT "TEST_SRCDIR=${PROJECT_BINARY_DIR}"
) )
endif() endif()
configure_file(
"${PROJECT_SOURCE_DIR}/cmake/sandbox2.pc.in"
"${PROJECT_BINARY_DIR}/sandbox2.pc"
@ONLY
)
install(FILES "${PROJECT_BINARY_DIR}/sandbox2.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")