[CMake] installing/overwriting single file

Dixon, Shane Shane.Dixon at atmel.com
Wed Nov 4 13:28:57 EST 2009


I think you could add foo_new.cxx to a target and do something like this:
 
SET_TARGET_PROPERTIES( MyFoo PROPERTIES
  OUTPUT_NAME "foo.cxx" )
INSTALL( TARGET MyFoo )
 
I don't think you need the destination if you're just installing to ${CMAKE_PREFIX_PATH}, but I could be wrong.
 
Another option might be to copy the foo_new.cxx to the binary directory using configure_file and then install from there.  I've done that before and it works.
 
CONFIGURE_FILE( ${CMAKE_SOURCE_DIR}/foo_new.cxx ${CMAKE_BINARY_DIR}/foo.cxx COPY_ONLY )
INSTALL( FILES ${CMAKE_BINARY_DIR}/foo.cxx )


--
Shane Dixon
Linux Engineer
Atmel Corporation



 

________________________________

From: cmake-bounces at cmake.org [mailto:cmake-bounces at cmake.org] On Behalf Of Randy Heiland
Sent: Wednesday, November 04, 2009 11:19 AM
To: cmake at cmake.org
Subject: [CMake] installing/overwriting single file


During an 'install', I would like to copy/overwrite a source file to a destination file.  How?  Something like the following (in syntax), although I am assuming that it is only legal to copy a file into a dir (and therefore the 'foo.cxx' isn't allow)? 

INSTALL(FILES  
    ${CMAKE_SOURCE_DIR}/foo_new.cxx
    DESTINATION ${CMAKE_INSTALL_PREFIX}/foo.cxx
    )

thanks, Randy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20091104/4d5fd813/attachment.htm>


More information about the CMake mailing list