[CMake] copy on install

Tim St. Clair timothysc at gmail.com
Fri Feb 5 08:53:42 EST 2010


Response Below
Inline...

On Fri, Feb 5, 2010 at 12:05 AM, Alan W. Irwin
<irwin at beluga.phys.uvic.ca> wrote:
> On 2010-02-04 22:44-0600 Tim St. Clair wrote:
>>
>> On Thu, Feb 4, 2010 at 6:14 PM, Alan W. Irwin <irwin at beluga.phys.uvic.ca>
>> wrote:
>>>
>>> Why not simply use install(FILES ... PERMISSIONS .... RENAME ...  )?
>>>
>>> You would have to use the target property LOCATION to find the
>>> (cross-platform) filename associated with the target, and you would have
>>> to
>>> specify the appropriate PERMISSIONS, but I think this method of using
>>> install(FILES ...) should work fine unless and until a feature request
>>> for a
>>> RENAME option for install(TARGETS....) is implemented.
>>>
>>
>> I like this solution however when I try it... it does not expand the
>> $(OutDir) which was yielded when I called get_target_property
>> w/LOCATION.
>
> I have never had trouble with the LOCATION property.  I use it as follows:
>
> get_target_property(variable_name target_name LOCATION)
> message(STATUS "variable_name=${variable_name}")
>
> which outputs the full path name of the target.  Don't you get that?
>

Yup, on windows LOCATION output =
c:\My_Src_Path\$(OutDir)\my_target.exe

I was thinking about using ${CMAKE_BUILD_TYPE}_LOCATION($(OutDir) =
Release, Debug...) but on windows there is no guarantee that will be
the default config, and when you change build configurations your
install and package targets will light on fire because they are pin'd
to a certain config.

For the time being I have just duplicated the targets (which is
non-ideal) as it increases the build time.  I'm thinking this is a
limitation in CMAKE.  It would be nice if you could have aliases for
install targets which would copy on windows, and soflink &&|| copy on
*nix.

Cheers,
Tim

> Alan
> __________________________
> Alan W. Irwin
>
> Astronomical research affiliation with Department of Physics and Astronomy,
> University of Victoria (astrowww.phys.uvic.ca).
>
> Programming affiliations with the FreeEOS equation-of-state implementation
> for stellar interiors (freeeos.sf.net); PLplot scientific plotting software
> package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of
> Linux Links project (loll.sf.net); and the Linux Brochure Project
> (lbproject.sf.net).
> __________________________
>
> Linux-powered Science
> __________________________
>



-- 
Cheers,
Timothy St. Clair


More information about the CMake mailing list