Install a CMake configuration file

This commit is contained in:
Cristian Morales Vega 2020-11-06 10:00:32 +00:00
parent 2e44f23b05
commit 3396d3f24e
2 changed files with 25 additions and 2 deletions

View File

@ -460,6 +460,27 @@ set(PKGDATADIR "${CMAKE_INSTALL_FULL_DATADIR}/${CMAKE_PROJECT_NAME}")
install(FILES README.rst DESTINATION "${CMAKE_INSTALL_DOCDIR}")
install(
EXPORT nghttp2-targets
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/nghttp2"
NAMESPACE nghttp2::
FILE nghttp2-config.cmake
)
include(CMakePackageConfigHelpers)
write_basic_package_version_file(
nghttp2-config-version.cmake
VERSION ${nghttp2_VERSION}
COMPATIBILITY SameMajorVersion
)
install(
FILES
"${CMAKE_CURRENT_BINARY_DIR}/nghttp2-config-version.cmake"
DESTINATION
"${CMAKE_INSTALL_LIBDIR}/cmake/nghttp2"
)
add_subdirectory(lib)
#add_subdirectory(lib/includes)
add_subdirectory(third-party)

View File

@ -47,11 +47,13 @@ if(ENABLE_SHARED_LIB)
C_VISIBILITY_PRESET hidden
)
target_include_directories(nghttp2 INTERFACE
"${CMAKE_CURRENT_BINARY_DIR}/includes"
"${CMAKE_CURRENT_SOURCE_DIR}/includes"
"$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/includes>"
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/includes>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
)
install(TARGETS nghttp2
EXPORT nghttp2-targets
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")