Looking at page 80 in 'Mastering CMake' fifth edition, is says that the
<proj>-targets.cmake "file contains code such as
`get_filename_component (_self "${CMAKE_CURRENT_LIST_FILE}" PATH)`
`get_filename_component (PREFIX "${_self}/../.." ABOSULTE)`"

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>

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.

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)

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?

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

TIA,

Izaak Beekman
===================================
(301)244-9367
Princeton University Doctoral Candidate
Mechanical and Aerospace Engineering
[email protected]

UMD-CP Visiting Graduate Student
Aerospace Engineering
[email protected]
[email protected]
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to