[CMake] Best way to handle application data path for local run vs. installation
Alexander Neundorf
a.neundorf-work at gmx.net
Mon Nov 30 15:51:17 EST 2015
On Monday, November 30, 2015 16:13:03 Ruslan Baratov via CMake
wrote:
> On 30-Nov-15 09:10, Dmitry Marakasov wrote:
> > Hi!
> >
...
> > The best solution would be for cmake to fix path in executable file
> > right after installation, something similar to what cmake does with
> > rpaths.
>
> I doubt there is a general way to patch data section with string in
> executable. At least with different size and in safe manner. For
example
> Clang is smart enough to figure out 'strlen' of literal string at
> compile time, so changing string affects logic and hence is
dangerous.
> And rpaths unlike data is designed to be modifiable
Not really. CMake has extra code to make sure the build rpath is as long
as the install rpath will be, so it can be patched in later.
> (e.g. see
> install_name_tool for OS X) so it's okay to hack it back and forth.
>
> Second thought is that when you hardcode path in executable you
make it
> non-relocatable.
E.g. on Linux $ORIGIN could be used in the RPATH.
Alex
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20151130/32c1d22a/attachment-0001.html>
More information about the CMake
mailing list