`/` special case in CMAKE_INSTALL_PREFIX is inconsistent with autoconf
Hi folks,
this is about the special cases in CMAKE_INSTALL_PREFIX introduced by https://github.com/Kitware/CMake/commit/c8bd37ec685c02736618af83ac894e96fc1e6ab8.
In particular, I'm not a fan of automatically rewriting the /
to /usr
. The justification
given is that GNU states that
When building the complete GNU system, the prefix will be empty
# and ``/usr`` will be a symbolic link to ``/``.
which to me doesn't justify the this special case. Moreover, it's inconsistent with GNU autoconf, e.g.
./configure --prefix=/
make
make install DESTDIR=/foo/bar
will install things in /foo/bar/{bin,lib,...}
, while for CMake, after that commit, commands like
cmake -DCMAKE_INSTALL_PREFIX=/
make
make install DESTDIR=/foo/bar
will end up in /foo/bar/usr/{bin,lib,...}
. There also doesn't really seem to be a good way to disable
this behavior other than setting each of the individual directories to an absolute path, which I hope
you will agree with me is not a very nice solution. Now, you might wonder why I care about this, since
cmake -DCMAKE_INSTALL_PREFIX=/foo/bar
make
make install
would ostensibly do what I want. However, there's a subtle distinction between this command and the
previous. The primary difference here is moving that install to a target machine. The prefix is supposed
to refer to the target machine's layout (which in my case does not use /usr), and some build processes do
rely on that by embedding prefix-derived paths into the resulting binaries, which would fail for the
/foo/bar
case. I recognize that at this point it might be too late to remove that special case, but
I'd love to at least have some way to specify at the
command line that no, really, I do want / to be my prefix.