<div dir="ltr">Looking at page 80 in ‘Mastering CMake’ fifth edition, is says that the <proj>-targets.cmake “file contains code such as<div>`get_filename_component (_self “${CMAKE_CURRENT_LIST_FILE}” PATH)`</div><div>
`get_filename_component (PREFIX “${_self}/../..” ABOSULTE)`”</div><div><br></div><div>I’m on Mac OS X using CMake 2.8.12 and was emulating a Linux style install directory structure, meaning that I was putting libraries in ${CMAKE_INSTALL_PREFIX}/lib… header like files in ${CMAKE_INSTALL_PREFIX}/include and the <proj>-config.cmake and <proj>-targets.cmake are getting installed to ${CMAKE_INSTALL_PREFIX}/share/<proj></div>
<div><br></div><div>It seems, however, that the paths to targets in <proj>-targets.cmake are always specified as ${CMAKE_CURRENT_LISTFILE}/<path-passed-as-DESTINATION-argument-to-install>. This is of course a problem for me since, the paths to targets in the installed <proj>-targets.cmake file are now wrong, they are not given the correct location relative to that file.</div>
<div><br></div><div>Am I wrong in my assumption that the <proj>-targets.cmake file will know where it is being installed and where all the project’s targets are installed and be able to compute relative or full paths to them? (It seems as though it is doing this incorrectly at the moment)</div>
<div><br></div><div>Do I need to use a different directory structure for the install so that the <proj>-targets.cmake and <proj>-config.cmake are installed in ${CMAKE_INSTALL_PREFIX}/<package-name> and the targets are installed in appropriate subdirectories of that, like bin, lib, include, etc?</div>
<div><br></div><div>For reasons I don’t understand, I could successfully import this project when installed to the ${CMAKE_INSTALL_PREFIX} location and when installed using `make DESTDIR=alternate/dir install` EXCEPT when using CMAKE_MACOSX_RPATH=1 in the original project, the link step of the importing project fails to pass -Wl,-rpath,path/to/installed/dylib</div>
<div><br></div><div>TIA,</div><div><br clear="all"><div>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></div>
</div></div>