[CMake] get_target_property( LOCATION) and CMAKE_DEBUG_POSTFIX (aka: Installing PDB files)

Michael Hertling mhertling at online.de
Mon Feb 7 22:36:06 EST 2011


On 02/07/2011 08:54 PM, Mathieu Malaterre wrote:
> Dear all,
> 
>   I am trying to retrieve the full path of a dll to be able to compute
> the full path of the associated pdb file. I thought I could simply use
> the get_target_property( LOCATION) API, however it fails to return the
> actual name of the TARGET, for instance the value of
> CMAKE_DEBUG_POSTFIX it not taken into account (using cmake 2.8.3).

AFAIK, the LOCATION property is deprecated right because it doesn't
work well with different configurations, see [1] and especially [2].

>   Is there another API to retrieve the path to a dll file generated by
> cmake from its target name ?

Have you already tried the LOCATION_<CONFIG> target property?
                                   ^^^^^^^^^
Perhaps, you might also use the RUNTIME_OUTPUT_DIRECTORY[_<CONFIG>] and
[RUNTIME_]OUTPUT_NAME[_<CONFIG>] target properties to pre-construct the
target's full path, possibly in junction with the <CONFIG>_POSTFIX and
PREFIX properties or the CMAKE_SHARED_LIBRARY_(PREFIX|SUFFIX)[_<LANG>]
variables.

In CMake 2.8.4, there will be generator expressions for custom targets/
commands, so if you need the target's full path within the latters, you
should take a look at the latest 2.8.4 RC.

Regards,

Michael

[1] http://public.kitware.com/Bug/view.php?id=11671
[2] http://public.kitware.com/Bug/view.php?id=11671#c24538


More information about the CMake mailing list