Hi IOhannes,

On Mon, 08 Sep 2025 14:57:28 +0200 =?utf-8?q?IOhannes_m_zm=C3=B6lnig_=28Debian/GNU=29?= <[email protected]> wrote:
this works nicely with CMake-3.x.

however, for reasons unknown to me, the very same code with CMake-4.x
installs the files to /usr/lib/$(DEB_HOST_MULTIARCH)

I looked into it, and it turns out CMake 4 gained some code in GNUInstallDirs.cmake to automatically update the CMAKE_INSTALL_<dir> variables if the CMAKE_INSTALL_PREFIX is changed after the initial configuration step, to deal with the special cases for the "/" and "/usr" prefixes (/lib/MULTIARCH, /etc, ...).

The code tries to be smart and not update the variables if they have a non-default value. However, "lib" happens to be the initial default for LIBDIR, so the CMake will happily (and wrongly) update your manually set variable when the CMAKE_INSTALL_PREFIX is initialized with "/usr".

I will file a bug with upstream. In the meantime, I found that using an equivalent but not string-equal value works around the issue. For example, both -DCMAKE_INSTALL_LIBDIR=./lib or -DMCAKE_INSTALL_LIBDIR=lib/ seem to work.


Cheers
Timo


--
⢀⣴⠾⠻⢶⣦⠀   ╭────────────────────────────────────────────────────╮
⣾⠁⢠⠒⠀⣿⡁   │ Timo Röhling                                       │
⢿⡄⠘⠷⠚⠋⠀   │ 9B03 EBB9 8300 DF97 C2B1  23BF CC8C 6BDD 1403 F4CA │
⠈⠳⣄⠀⠀⠀⠀   ╰────────────────────────────────────────────────────╯

Attachment: signature.asc
Description: PGP signature

Reply via email to