Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMartin Hořeňovský2025-08-21 20:55:27 +0200
committerMartin Hořeňovský2025-08-21 20:58:55 +0200
commit78a9518a2847f82cb65124d65eaf0b0be8d90cdc (patch)
tree7aa15dc9b70c200f6a593604570d467ba2fb88a0
parent3e82ef9317d4bb43d81b660404db3c3c5880aa7d (diff)
downloadcatch3-78a9518a2847f82cb65124d65eaf0b0be8d90cdc.tar.gz
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
-rw-r--r--CMakeLists.txt10
1 files 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 "$<TARGET_FILE_BASE_NAME:Catch2>")
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 "$<TARGET_FILE_BASE_NAME:Catch2WithMain>")
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
)
]]