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

View File

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