Progmasoft Git

catch3

Progmasoft Catch3: an independently maintained C++17 test framework with a parallel runner, property checks, snapshots and structured results.

Clonegit clone https://git.progmasoft.com/catch3

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
Commit
78a9518a2847f82cb65124d65eaf0b0be8d90cdc
Author
Martin Hořeňovský ·
Parents
3e82ef9317d4

Files · Download .tar.gz

Changes

 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 "$<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
          )
        ]]