[CMake] how to use the cmake functions get_prerequisites and get_filename_component for target dependency installation?

Stefan Dänzer stefan.daenzer at gmail.com
Tue Jun 24 04:42:16 EDT 2014


Dear list members,

we have set up a cmake project with external shared library dependencies.
We want to package the binaries and dependencies of our project using
CPack. However we are getting different results on windows and linux
systems when trying to find dependencies of our targets.

We had a look at the GetPrerequisites Module of CMake (2.8.12).We have
successfully used the following CMake code to get the full path of a CMake
target (BINARY) dependency (_libFile) on linux, however we don't get a the
full path of the dependency on windows. On Windows the variable
dependency_realpath holds something like
${CMAKE_SOURCE_DIR}/DEPENDENCY_FILE, which is not the correct path to the
dependency.

string(TOUPPER "${CMAKE_BUILD_TYPE}" CONFIG)
GET_TARGET_PROPERTY(MY_BINARY_LOCATION ${BINARY} LOCATION_${CONFIG} )
GET_PREREQUISITES(${MY_BINARY_LOCATION} DEPENDENCIES 0 0 "" "")

foreach( DEPENDENCY_FILE ${DEPENDENCIES})
    get_filename_component( dependency_realpath ${DEPENDENCY_FILE} REALPATH)

So the question would be: Why are we getting different results for the
dependency locations on windows and linux?

Disclaimer: this is a clone question also asked on
http://stackoverflow.com/questions/24367033/how-to-use-the-cmake-functions-get-prerequisites-and-get-filename-component-for

Regards,

Stefan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20140624/e6eb3667/attachment-0001.html>


More information about the CMake mailing list