From 02e0eaa1043d38202406757fafcc030493d211e1 Mon Sep 17 00:00:00 2001 From: Biswapriyo Nath Date: Wed, 14 Sep 2022 21:55:40 +0530 Subject: [PATCH] cmake: Fix pkgconfig path relocation in mingw This fixes patch relocation of the output of pkgconfig by adding missing keywords like prefix, exec_prefix, libdir and includedir. The pkgconfig output changes are like following: * Before: $ pkg-config -libs libssh -lssh * After: $ pkg-config -libs libssh -LF:/msys64/ucrt64/lib -lssh See https://people.freedesktop.org/~dbn/pkg-config-guide.html for further documentation. Signed-off-by: Biswapriyo Nath Reviewed-by: Jakub Jelen (cherry picked from commit 425353d98696702a1978d3ed06a6681821eeeb10) --- CMakeLists.txt | 2 +- libssh.pc.cmake | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7bc3331c..fa025e41 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -125,7 +125,7 @@ add_subdirectory(src) # pkg-config file if (UNIX OR MINGW) -configure_file(libssh.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/libssh.pc) +configure_file(libssh.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/libssh.pc @ONLY) install( FILES ${CMAKE_CURRENT_BINARY_DIR}/libssh.pc diff --git a/libssh.pc.cmake b/libssh.pc.cmake index b37cb3fc..f288b94d 100644 --- a/libssh.pc.cmake +++ b/libssh.pc.cmake @@ -1,6 +1,10 @@ -Name: ${PROJECT_NAME} -Description: The SSH Library -Version: ${PROJECT_VERSION} -Libs: -L${CMAKE_INSTALL_FULL_LIBDIR} -lssh -Cflags: -I${CMAKE_INSTALL_FULL_INCLUDEDIR} +prefix=@CMAKE_INSTALL_PREFIX@ +exec_prefix=${prefix} +libdir=@CMAKE_INSTALL_FULL_LIBDIR@ +includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ +Name: @PROJECT_NAME@ +Description: The SSH Library +Version: @PROJECT_VERSION@ +Libs: -L${libdir} -lssh +Cflags: -I${includedir}