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
This commit is contained in:
Martin Hořeňovský
2025-08-09 23:05:08 +02:00
parent 644821ce28
commit 7cad6d7539

View File

@@ -198,14 +198,14 @@ if(NOT_SUBPROJECT)
set(lib_name "$<TARGET_FILE_BASE_NAME:Catch2>") set(lib_name "$<TARGET_FILE_BASE_NAME:Catch2>")
configure_file( configure_file(
"${impl_pc_file}" "${impl_pc_file}"
"${CMAKE_INSTALL_PREFIX}/${install_pkgconfdir}/catch2.pc" "$ENV{DESTDIR}/${CMAKE_INSTALL_PREFIX}/${install_pkgconfdir}/catch2.pc"
@ONLY @ONLY
) )
set(lib_name "$<TARGET_FILE_BASE_NAME:Catch2WithMain>") set(lib_name "$<TARGET_FILE_BASE_NAME:Catch2WithMain>")
configure_file( configure_file(
"${main_pc_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 @ONLY
) )
]] ]]