Generate & Install pkg-config File

This commit is contained in:
Nick White 2016-04-14 20:47:23 +01:00
parent 083d6c0d2f
commit b7e3a103c3
3 changed files with 23 additions and 0 deletions

9
.gitignore vendored
View File

@ -33,4 +33,13 @@ example/*
!example/makefile !example/makefile
!example/makefile.clang !example/makefile.clang
# generated files
generated
# Cmake
CMakeCache.txt
CMakeFiles
CMakeScripts
Makefile
cmake_install.cmake
install_manifest.txt

View File

@ -31,9 +31,11 @@ set(generated_dir "${CMAKE_CURRENT_BINARY_DIR}/generated")
set(config_install_dir "lib/cmake/${PROJECT_NAME}") set(config_install_dir "lib/cmake/${PROJECT_NAME}")
set(include_install_dir "include") set(include_install_dir "include")
set(pkgconfig_install_dir "lib/pkgconfig")
set(version_config "${generated_dir}/${PROJECT_NAME}ConfigVersion.cmake") set(version_config "${generated_dir}/${PROJECT_NAME}ConfigVersion.cmake")
set(project_config "${generated_dir}/${PROJECT_NAME}Config.cmake") set(project_config "${generated_dir}/${PROJECT_NAME}Config.cmake")
set(pkg_config "${generated_dir}/${PROJECT_NAME}.pc")
set(targets_export_name "${PROJECT_NAME}Targets") set(targets_export_name "${PROJECT_NAME}Targets")
set(namespace "${PROJECT_NAME}::") set(namespace "${PROJECT_NAME}::")
@ -44,6 +46,7 @@ write_basic_package_version_file(
# Note: use 'targets_export_name' # Note: use 'targets_export_name'
configure_file("cmake/Config.cmake.in" "${project_config}" @ONLY) configure_file("cmake/Config.cmake.in" "${project_config}" @ONLY)
configure_file("cmake/spdlog.pc.in" "${pkg_config}" @ONLY)
install( install(
TARGETS spdlog TARGETS spdlog
@ -58,6 +61,11 @@ install(
DESTINATION "${config_install_dir}" DESTINATION "${config_install_dir}"
) )
install(
FILES "${pkg_config}"
DESTINATION "${pkgconfig_install_dir}"
)
install( install(
EXPORT "${targets_export_name}" EXPORT "${targets_export_name}"
NAMESPACE "${namespace}" NAMESPACE "${namespace}"

6
cmake/spdlog.pc.in Normal file
View File

@ -0,0 +1,6 @@
prefix=@CMAKE_INSTALL_PREFIX@
includedir=${prefix}/include
Name: @PROJECT_NAME@
Description: Super fast C++ logging library.
Version: @PROJECT_VERSION@