From b7e3a103c3e5a7998b8a6504dd87e09d29828045 Mon Sep 17 00:00:00 2001 From: Nick White Date: Thu, 14 Apr 2016 20:47:23 +0100 Subject: [PATCH] Generate & Install pkg-config File --- .gitignore | 9 +++++++++ CMakeLists.txt | 8 ++++++++ cmake/spdlog.pc.in | 6 ++++++ 3 files changed, 23 insertions(+) create mode 100644 cmake/spdlog.pc.in diff --git a/.gitignore b/.gitignore index 6c04147d..567f694f 100644 --- a/.gitignore +++ b/.gitignore @@ -33,4 +33,13 @@ example/* !example/makefile !example/makefile.clang +# generated files +generated +# Cmake +CMakeCache.txt +CMakeFiles +CMakeScripts +Makefile +cmake_install.cmake +install_manifest.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 2cbcc653..f11d7327 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,9 +31,11 @@ set(generated_dir "${CMAKE_CURRENT_BINARY_DIR}/generated") set(config_install_dir "lib/cmake/${PROJECT_NAME}") set(include_install_dir "include") +set(pkgconfig_install_dir "lib/pkgconfig") set(version_config "${generated_dir}/${PROJECT_NAME}ConfigVersion.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(namespace "${PROJECT_NAME}::") @@ -44,6 +46,7 @@ write_basic_package_version_file( # Note: use 'targets_export_name' configure_file("cmake/Config.cmake.in" "${project_config}" @ONLY) +configure_file("cmake/spdlog.pc.in" "${pkg_config}" @ONLY) install( TARGETS spdlog @@ -58,6 +61,11 @@ install( DESTINATION "${config_install_dir}" ) +install( + FILES "${pkg_config}" + DESTINATION "${pkgconfig_install_dir}" +) + install( EXPORT "${targets_export_name}" NAMESPACE "${namespace}" diff --git a/cmake/spdlog.pc.in b/cmake/spdlog.pc.in new file mode 100644 index 00000000..2c94a0ad --- /dev/null +++ b/cmake/spdlog.pc.in @@ -0,0 +1,6 @@ +prefix=@CMAKE_INSTALL_PREFIX@ +includedir=${prefix}/include + +Name: @PROJECT_NAME@ +Description: Super fast C++ logging library. +Version: @PROJECT_VERSION@