I was under the impression that GNUInstallDirs treated certain directories specially:
<dir>other than the
RUNSTATEDIR, the value of
CMAKE_INSTALL_<dir>is prefixed with
usr/if it is not user-specified as an absolute path. For example, the
usr/include. This is required by the GNU Coding Standards, which state:
When building the complete GNU system, the prefix will be empty and
/usrwill be a symbolic link to
CMAKE_INSTALL_FULL_<dir>is computed by prepending just
/to the value of
CMAKE_INSTALL_<dir>if it is not user-specified as an absolute path. For example, the
/etc. This is required by the GNU Coding Standards.
When trying to take advantage of this, if I use the
/usr prefix, the files that are installed to
CMAKE_INSTALL_SYSCONFDIR are placed in
/usr/etc which I can’t imagine ever being the correct location. This appears to be a direct conflict of the documentation above.
If I use the
/ prefix, it appears to forget to prepend the
/usr when I use
cmake --install with
--prefix /. It does work if I configure with
-DCMAKE_INSTALL_PREFIX=/ but only sometimes. I haven’t figured out why it doesn’t always work.
Anyways, I think I’ve gotten it to work (usually) when using the
/ prefix but I feel like I’m missing something. I created a very basic testcase. Simply:
cmake . -DCMAKE_INSTALL_PREFIX=/usr; DESTDIR=bob cmake --install . should be enough to show what I’m talking about.
Am I misusing this somehow or misunderstanding the documentation?