From 27e4695ae6aa8da7bed66cdb7c80d9461fd1d4fe Mon Sep 17 00:00:00 2001 From: otegami Date: Wed, 24 Apr 2024 23:30:23 +0800 Subject: [PATCH] Add support for absolute CMAKE_INSTALL_*DIR --- CMakeLists.txt | 14 ++++++++++---- msgpack-c.pc.in | 7 +++---- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 14b6d2219..6a586aec0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,10 +28,16 @@ SET (VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_REVISION}) LIST (APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/") include(GNUInstallDirs) -SET (prefix ${CMAKE_INSTALL_PREFIX}) -SET (exec_prefix ${CMAKE_INSTALL_PREFIX}) -SET (libdir ${CMAKE_INSTALL_LIBDIR}) -SET (includedir ${CMAKE_INSTALL_INCLUDEDIR}) +if(IS_ABSOLUTE "${CMAKE_INSTALL_LIBDIR}") + set(MSGPACK_PKG_CONFIG_LIBDIR "${CMAKE_INSTALL_LIBDIR}") +else() + set(MSGPACK_PKG_CONFIG_LIBDIR "\${prefix}/${CMAKE_INSTALL_LIBDIR}") +endif() +if(IS_ABSOLUTE "${CMAKE_INSTALL_INCLUDEDIR}") + set(MSGPACK_PKG_CONFIG_INCLUDEDIR "${CMAKE_INSTALL_INCLUDEDIR}") +else() + set(MSGPACK_PKG_CONFIG_INCLUDEDIR "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}") +endif() OPTION (MSGPACK_32BIT "32bit compile" OFF) diff --git a/msgpack-c.pc.in b/msgpack-c.pc.in index 208066252..4aab02f55 100644 --- a/msgpack-c.pc.in +++ b/msgpack-c.pc.in @@ -1,7 +1,6 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ +prefix=@CMAKE_INSTALL_PREFIX@ +includedir=@MSGPACK_PKG_CONFIG_INCLUDEDIR@ +libdir=@MSGPACK_PKG_CONFIG_INCLUDEDIR@ Name: MessagePack Description: Binary-based efficient object serialization library