[CMake] ?==?utf-8?q? ?==?utf-8?q? ?= Looking for an explanation: What exactly means "install" in cmake language

Cornelis Bockemühl cornelis at bockemuehl.ch
Tue Oct 8 11:32:45 EDT 2019


After stripping down the question to "can I install an imported target"? - with the purpose to copy the shared libraries also into the lib directory of the importing project - I could actually also use Google and look for an answer that somebody else might have been asked.

And indeed: this seems to be a rather common question!

And the "official answer" seems to be something like "this bug is a feature". It must have been a change request already years ago, and it was refused with different arguments, like:

1) proper RPATH handling is not possible in this case, because CMake cannot know the way how the shared library was built initially, so it is not able to manipulate it.

At first this looks plausible, but then I was thinking that in Linux you always deal with ELF binaries, and there you have tools to manipulate RPATH/RUNPATH easily, and in Windows there is nothing similar - and others I don't know...

2) the target is already installed, so it makes no sense to install it again; it would only be a waste of disk space.

Well, in my case it would make a lot of sense, and also for any kind of packager that might use the install directory it would be much easier if all the stuff is already in one location.

3...) maybe others - I did not follow further.

In any case the conclusion is: It's like it is, and all my confusion came basically from this strange behaviour - that "install" is not always really "install" (but now I know at least when and why!). And the only way around - if I want to avoid the configure_file solution - would be to do some proper install(FILES...) instead - together with a little hacking regarding what the right files actually are.

Best regards, Cornelis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20191008/d5023739/attachment.html>


More information about the CMake mailing list