From 7cad6d75390668ad2b6bec8432a2e408a992e1bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ho=C5=99e=C5=88ovsk=C3=BD?= Date: Sat, 9 Aug 2025 23:05:08 +0200 Subject: [PATCH] Handle DESTDIR env var when generating pkgconfig files Having the ability to configure the installation path at config time, and the ability to change the prefix at install time is not enough, apparently people also use env var to redirect them instead. Closes #3006 --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4b4e4f58..33377f5d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -198,14 +198,14 @@ if(NOT_SUBPROJECT) set(lib_name "$") configure_file( "${impl_pc_file}" - "${CMAKE_INSTALL_PREFIX}/${install_pkgconfdir}/catch2.pc" + "$ENV{DESTDIR}/${CMAKE_INSTALL_PREFIX}/${install_pkgconfdir}/catch2.pc" @ONLY ) set(lib_name "$") configure_file( "${main_pc_file}" - "${CMAKE_INSTALL_PREFIX}/${install_pkgconfdir}/catch2-with-main.pc" + "$ENV{DESTDIR}/${CMAKE_INSTALL_PREFIX}/${install_pkgconfdir}/catch2-with-main.pc" @ONLY ) ]]