Fixed pkg-config

This commit is contained in:
gabime 2024-01-13 13:50:46 +02:00
parent 32d83ee246
commit e6e2ffbf51
2 changed files with 11 additions and 13 deletions

View File

@ -352,7 +352,7 @@ if(SPDLOG_INSTALL)
# ---------------------------------------------------------------------------------------
# Include files
# ---------------------------------------------------------------------------------------
install(DIRECTORY include/ DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" PATTERN "fmt/bundled" EXCLUDE)
install(DIRECTORY include/ DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
install(
TARGETS spdlog fmt
EXPORT spdlog
@ -373,10 +373,8 @@ if(SPDLOG_INSTALL)
else()
set(PKG_CONFIG_LIBDIR "\${exec_prefix}/${CMAKE_INSTALL_LIBDIR}")
endif()
get_target_property(PKG_CONFIG_DEFINES spdlog INTERFACE_COMPILE_DEFINITIONS)
string(REPLACE ";" " -D" PKG_CONFIG_DEFINES "${PKG_CONFIG_DEFINES}")
string(CONCAT PKG_CONFIG_DEFINES "-D" "${PKG_CONFIG_DEFINES}")
configure_file("cmake/${PROJECT_NAME}.pc.in" "${pkg_config}" @ONLY)
configure_file("cmake/spdlog.pc.in" "${pkg_config}" @ONLY)
message(STATUS "Installing pkg-config ${pkg_config} in ${pkgconfig_install_dir}")
install(FILES "${pkg_config}" DESTINATION "${pkgconfig_install_dir}")
# ---------------------------------------------------------------------------------------

View File

@ -1,13 +1,13 @@
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=${prefix}
includedir=@PKG_CONFIG_INCLUDEDIR@
libdir=@PKG_CONFIG_LIBDIR@
libdir=${exec_prefix}/lib
includedir=${prefix}/include
Name: lib@PROJECT_NAME@
Name: @PROJECT_NAME@
Description: Fast C++ logging library.
URL: https://github.com/gabime/@PROJECT_NAME@
Version: @SPDLOG_VERSION@
CFlags: -I${includedir} @PKG_CONFIG_DEFINES@
Libs: -L${libdir} -lspdlog -pthread
Requires: @PKG_CONFIG_REQUIRES@
URL: https://github.com/gabime/spdlog.git
Version: @PROJECT_VERSION@
Requires: fmt
Libs: -L${libdir} -lspdlog
Cflags: -I${includedir}