I was under the impression that GNUInstallDirs treated certain directories specially:
/
For
<dir>
other than theSYSCONFDIR
,LOCALSTATEDIR
andRUNSTATEDIR
, the value ofCMAKE_INSTALL_<dir>
is prefixed withusr/
if it is not user-specified as an absolute path. For example, theINCLUDEDIR
valueinclude
becomesusr/include
. This is required by the GNU Coding Standards, which state:When building the complete GNU system, the prefix will be empty and
/usr
will be a symbolic link to/
.
/usr
For
<dir>
equal toSYSCONFDIR
,LOCALSTATEDIR
orRUNSTATEDIR
, theCMAKE_INSTALL_FULL_<dir>
is computed by prepending just/
to the value ofCMAKE_INSTALL_<dir>
if it is not user-specified as an absolute path. For example, theSYSCONFDIR
valueetc
becomes/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?