forked from Codesire-Deng/co_context
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build(cmake): support install & find_package()
- Loading branch information
1 parent
12335d6
commit f604c85
Showing
4 changed files
with
74 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
include(GNUInstallDirs) | ||
|
||
install(TARGETS co_context | ||
EXPORT co_context_targets | ||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} | ||
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} | ||
) | ||
|
||
install(DIRECTORY "${co_context_SOURCE_DIR}/include/co_context" | ||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} | ||
) | ||
|
||
install(DIRECTORY "${co_context_SOURCE_DIR}/include/uring" | ||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} | ||
) | ||
|
||
install(EXPORT co_context_targets | ||
FILE co_context_targets.cmake | ||
NAMESPACE co_context:: | ||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/co_context | ||
) | ||
|
||
include(CMakePackageConfigHelpers) | ||
|
||
configure_package_config_file(${co_context_SOURCE_DIR}/cmake/templates/Config.cmake.in | ||
"${CMAKE_CURRENT_BINARY_DIR}/co_context-config.cmake" | ||
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/co_context | ||
) | ||
|
||
write_basic_package_version_file( | ||
"${CMAKE_CURRENT_BINARY_DIR}/co_context-config-version.cmake" | ||
COMPATIBILITY SameMinorVersion) | ||
|
||
install(FILES | ||
"${CMAKE_CURRENT_BINARY_DIR}/co_context-config.cmake" | ||
"${CMAKE_CURRENT_BINARY_DIR}/co_context-config-version.cmake" | ||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/co_context | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
@PACKAGE_INIT@ | ||
|
||
include(CMakeFindDependencyMacro) | ||
find_dependency(Threads REQUIRED) | ||
find_dependency(mimalloc QUIET) | ||
|
||
# Get the linux kernel version to liburingcxx | ||
message(STATUS "target_kernel_version = ${CMAKE_SYSTEM_VERSION}") | ||
set(kernel_version ${CMAKE_SYSTEM_VERSION}) | ||
string(REGEX MATCH "^([0-9]+)\.([0-9]+)" kernel_version ${kernel_version}) | ||
string(REGEX MATCH "^([0-9]+)" kernel_version_major ${kernel_version}) | ||
string(REGEX REPLACE "^([0-9]+)\\." "" kernel_version_minor ${kernel_version}) | ||
message(STATUS "kernel_version_major = ${kernel_version_major}") | ||
message(STATUS "kernel_version_minor = ${kernel_version_minor}") | ||
add_compile_definitions(LIBURINGCXX_KERNEL_VERSION_MAJOR=${kernel_version_major}) | ||
add_compile_definitions(LIBURINGCXX_KERNEL_VERSION_MINOR=${kernel_version_minor}) | ||
unset(kernel_version) | ||
|
||
include("${CMAKE_CURRENT_LIST_DIR}/co_context_targets.cmake") | ||
|
||
check_required_components(co_context) |