I one more quick point: I don't want to install the libraries to standard locations because there may be multiple Fortran compilers installed on a given system, and client code cannot be built and linked using a different compiler than the library. Therefore the library and mod files and CMake package-config files are disambiguated by adding the compiler ID to the install path and package name. This way versions of the library built with different compilers can be installed and accessible on the same system. <br>
<br>On Friday, May 2, 2014, Izaak Beekman <<a href="mailto:ibeekman@umiacs.umd.edu">ibeekman@umiacs.umd.edu</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">Hi,<div>After much head scratching and googling, I found a way to get the dynamic library built in a project of mine to have the correct install name, so long as `DESTDIR=/some/path` is NOT specified upon install. Basically I want to export the library from both the build tree and the install tree so that client projects can choose whether or not they want to install the project (which provides static and dynamic libraries) or just link against it from the build tree. (If they choose to link against the dylib in the build tree the this could cause them issues down the road, for example if they `make clean`,  but the implications of linking against a dylib in the build tree seem fairly obvious.) Right now I am doing this by using the CMAKE_INSTALL_NAME_DIR variable. I just have the full path to the install directory in that variable. This way when I build it CMake is smart enough to use the build tree as the install name, then change it during the install. However, it would be nice to be able to support DESTDIR.</div>

<div><br></div><div>Is there a way to do this? Or a better way than I am currently doing it? Should I be building a framework or bundle on mac… the using `fixup_bundle()` or the like… This seems like overkill for this library, but maybe it’s the only portable easy way to do this. Or maybe I could call install_name_tool after the install to ensure that the dylib knows the full absolute path to itself?</div>

<div><br></div><div>Other than explicitly setting the </div><div><div>Izaak Beekman<br>===================================<br>(301)244-9367<br>UMD-CP Visiting Graduate Student<br>Aerospace Engineering<br><a href="javascript:_e(%7B%7D,'cvml','ibeekman@umiacs.umd.edu');" target="_blank">ibeekman@umiacs.umd.edu</a><br>

<a href="javascript:_e(%7B%7D,'cvml','ibeekman@umd.edu');" target="_blank">ibeekman@umd.edu</a></div>
</div></div>
</blockquote><br><br>-- <br>Izaak Beekman<br>===================================<br>(301)244-9367<br>Princeton University Doctoral Candidate<br>Mechanical and Aerospace Engineering<br><a href="mailto:ibeekman@princeton.edu" target="_blank">ibeekman@princeton.edu</a><br>
<br>UMD-CP Visiting Graduate Student<br>Aerospace Engineering<br><a href="mailto:ibeekman@umiacs.umd.edu" target="_blank">ibeekman@umiacs.umd.edu</a><br><a href="mailto:ibeekman@umd.edu" target="_blank">ibeekman@umd.edu</a><br>