From 78a9518a2847f82cb65124d65eaf0b0be8d90cdc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ho=C5=99e=C5=88ovsk=C3=BD?= Date: Thu, 21 Aug 2025 20:55:27 +0200 Subject: [PATCH] Don't add / to start of pkg-config file path when DESTDIR is unset This broke installation on Windows, because the suddenly started with a '/' instead of a drive letter. Closes #3019 --- CMakeLists.txt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 33377f5d..96ef39a4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -195,17 +195,23 @@ if(NOT_SUBPROJECT) "set(include_dir \"${CMAKE_INSTALL_INCLUDEDIR}\")" "set(lib_dir \"${CMAKE_INSTALL_LIBDIR}\")" [[ + message(STATUS "DESTDIR: $ENV{DESTDIR}") + set(DESTDIR_PREFIX "") + if (DEFINED ENV{DESTDIR}) + set(DESTDIR_PREFIX "$ENV{DESTDIR}") + endif () + message(STATUS "PREFIX: ${DESTDIR_PREFIX}") set(lib_name "$") configure_file( "${impl_pc_file}" - "$ENV{DESTDIR}/${CMAKE_INSTALL_PREFIX}/${install_pkgconfdir}/catch2.pc" + "${DESTDIR_PREFIX}${CMAKE_INSTALL_PREFIX}/${install_pkgconfdir}/catch2.pc" @ONLY ) set(lib_name "$") configure_file( "${main_pc_file}" - "$ENV{DESTDIR}/${CMAKE_INSTALL_PREFIX}/${install_pkgconfdir}/catch2-with-main.pc" + "${DESTDIR_PREFIX}${CMAKE_INSTALL_PREFIX}/${install_pkgconfdir}/catch2-with-main.pc" @ONLY ) ]]