Instead of using the LOCATION property, you might consider doing something along these lines, using the LOCATION_Release, LOCATION_Debug, etc. properties. I do something similar to this on windows/MSVC to toss extra files around that have an executable's full path:

foreach(_configname ${CMAKE_CONFIGURATION_TYPES})
            get_target_property(${_configname}_BINARY
                ${_targetname}
                LOCATION_${_configname})
install(FILES ${_configname}_BINARY DESTINATION wherever RENAME whatever-you-need)
endforeach()


On 02/05/2010 07:53 AM, Tim St. Clair wrote:
Response Below
Inline...

On Fri, Feb 5, 2010 at 12:05 AM, Alan W. Irwin
<[email protected]>  wrote:
On 2010-02-04 22:44-0600 Tim St. Clair wrote:
On Thu, Feb 4, 2010 at 6:14 PM, Alan W. Irwin<[email protected]>
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
__________________________




--
Ryan Pavlik
HCI Graduate Student
Virtual Reality Applications Center
Iowa State University

[email protected]
http://academic.cleardefinition.com
Internal VRAC/HCI Site: http://tinyurl.com/rpavlik

_______________________________________________
Powered by www.kitware.com

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

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

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

Reply via email to