Allow absolute CMAKE_INSTALL_LIBDIR

This commit is contained in:
Alexander Shpilkin 2022-05-19 17:48:57 +03:00
parent 0d8197cc9d
commit afb69071d5
No known key found for this signature in database
GPG Key ID: 55F6F5B75637BD38
2 changed files with 6 additions and 1 deletions

View File

@ -298,6 +298,11 @@ if(SPDLOG_INSTALL)
# --------------------------------------------------------------------------------------- # ---------------------------------------------------------------------------------------
# Install pkg-config file # Install pkg-config file
# --------------------------------------------------------------------------------------- # ---------------------------------------------------------------------------------------
if (IS_ABSOLUTE "${CMAKE_INSTALL_LIBDIR}")
set(PKG_CONFIG_LIBDIR "${CMAKE_INSTALL_LIBDIR}")
else()
set(PKG_CONFIG_LIBDIR "\${exec_prefix}/${CMAKE_INSTALL_LIBDIR}")
endif()
get_target_property(PKG_CONFIG_DEFINES spdlog INTERFACE_COMPILE_DEFINITIONS) get_target_property(PKG_CONFIG_DEFINES spdlog INTERFACE_COMPILE_DEFINITIONS)
string(REPLACE ";" " -D" PKG_CONFIG_DEFINES "${PKG_CONFIG_DEFINES}") string(REPLACE ";" " -D" PKG_CONFIG_DEFINES "${PKG_CONFIG_DEFINES}")
string(CONCAT PKG_CONFIG_DEFINES "-D" "${PKG_CONFIG_DEFINES}") string(CONCAT PKG_CONFIG_DEFINES "-D" "${PKG_CONFIG_DEFINES}")

View File

@ -1,7 +1,7 @@
prefix=@CMAKE_INSTALL_PREFIX@ prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=${prefix} exec_prefix=${prefix}
includedir=${prefix}/include includedir=${prefix}/include
libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@ libdir=@PKG_CONFIG_LIBDIR@
Name: lib@PROJECT_NAME@ Name: lib@PROJECT_NAME@
Description: Fast C++ logging library. Description: Fast C++ logging library.