From afb69071d5346b84e38fbcb0c8c32eddfef02a55 Mon Sep 17 00:00:00 2001 From: Alexander Shpilkin Date: Thu, 19 May 2022 17:48:57 +0300 Subject: [PATCH 1/2] Allow absolute CMAKE_INSTALL_LIBDIR --- CMakeLists.txt | 5 +++++ cmake/spdlog.pc.in | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dc6b0ded..8e733345 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -298,6 +298,11 @@ if(SPDLOG_INSTALL) # --------------------------------------------------------------------------------------- # 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) string(REPLACE ";" " -D" PKG_CONFIG_DEFINES "${PKG_CONFIG_DEFINES}") string(CONCAT PKG_CONFIG_DEFINES "-D" "${PKG_CONFIG_DEFINES}") diff --git a/cmake/spdlog.pc.in b/cmake/spdlog.pc.in index 861707c3..f3a56439 100644 --- a/cmake/spdlog.pc.in +++ b/cmake/spdlog.pc.in @@ -1,7 +1,7 @@ prefix=@CMAKE_INSTALL_PREFIX@ exec_prefix=${prefix} includedir=${prefix}/include -libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@ +libdir=@PKG_CONFIG_LIBDIR@ Name: lib@PROJECT_NAME@ Description: Fast C++ logging library. From 876880fb3f0791d0e1571f207ff9d991ae71b3b0 Mon Sep 17 00:00:00 2001 From: Alexander Shpilkin Date: Thu, 19 May 2022 17:49:16 +0300 Subject: [PATCH 2/2] Reflect CMAKE_INSTALL_INCLUDEDIR in pkg-config --- CMakeLists.txt | 5 +++++ cmake/spdlog.pc.in | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8e733345..f3edf3af 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -298,6 +298,11 @@ if(SPDLOG_INSTALL) # --------------------------------------------------------------------------------------- # Install pkg-config file # --------------------------------------------------------------------------------------- + if (IS_ABSOLUTE "${CMAKE_INSTALL_INCLUDEDIR}") + set(PKG_CONFIG_INCLUDEDIR "${CMAKE_INSTALL_INCLUDEDIR}") + else() + set(PKG_CONFIG_INCLUDEDIR "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}") + endif() if (IS_ABSOLUTE "${CMAKE_INSTALL_LIBDIR}") set(PKG_CONFIG_LIBDIR "${CMAKE_INSTALL_LIBDIR}") else() diff --git a/cmake/spdlog.pc.in b/cmake/spdlog.pc.in index f3a56439..ffab5d6f 100644 --- a/cmake/spdlog.pc.in +++ b/cmake/spdlog.pc.in @@ -1,6 +1,6 @@ prefix=@CMAKE_INSTALL_PREFIX@ exec_prefix=${prefix} -includedir=${prefix}/include +includedir=@PKG_CONFIG_INCLUDEDIR@ libdir=@PKG_CONFIG_LIBDIR@ Name: lib@PROJECT_NAME@