<div dir="ltr">Hi,<div class="gmail_extra"><br><div class="gmail_quote">On Mon, Aug 19, 2013 at 6:23 PM, Magnus Hagdorn <span dir="ltr"><<a href="mailto:magnus.hagdorn@ed.ac.uk" target="_blank">magnus.hagdorn@ed.ac.uk</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi there,<br>
I have the following problem with cmake:<br>
<br>
I would like to set the installation path for plugins to be ${LIB_INSTALL_DIR}/${PROJECT_<u></u>NAME}. As I understand it, the LIB_INSTALL_DIR is relative to CMAKE_INSTALL_PREFIX if it is not an absolute path. Installation works fine for both cases when LIB_INSTALL_DIR is absolute and when it is relative. So far so good.<br>
<br>
Now, my problem is that I would like to generate a header file containing the installation path for my plugins so the program can find them. My header input file contains<br>
<br>
#define PLUGIN_DIR "${PLUGIN_INSTALL_DIR}"<br>
<br>
which works if LIB_INSTALL_DIR is absolute but it doesn't work if it is a relative path in which case I'd need<br>
<br>
#define PLUGIN_DIR "${CMAKE_INSTALL_PREFIX}/${<u></u>PLUGIN_INSTALL_DIR}"<br>
<br>
which presumably won't work on windows systems anyway because of the unix dir separator. what's the best way of solving this issue?<br></blockquote><div><br></div><div>I'd solve this inside cmake and setup a custom cmake variable which is then used in the h.cmake-file for configure_file.</div>
<div><br></div><div>However note that doing this makes your application non-relocatable, i.e. its not possible to move it around anymore. So you may want to reconsider this and merely store a relative path as plugin-dir in the header and then absolutify this during the runtime of the program based on the location of the binary or something like that. Makes handling the plugin-install-dir-is-absolute case a bit more work since you need to determine the location.</div>
<div><br></div><div>Andreas</div><div> </div></div></div></div>