Am 20.06.2010 19:14, schrieb Clark Gaebel:
How would I go about placing a text file in the same directory as a
target's output?

For example, let's say I have a target called "foo", which creates an
executable. "foo" has a config file called "foo.conf" that should always
go in the same directory. At the moment, it resides in the src/
directory for the "foo" target. How would I get it to automatically copy
into the same directory as the foo executable as part of the build process?
To copy files as part of the build process, you can use the cmake binary 'copy' command, e.g.:

execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${src} ${dest})

For bonus points, how would this interact with "make install"?
To install files, use the install() directive with FILES, e.g.:

install(FILES ${CMAKE_SOURCE_DIR}/README DESTINATION ${YOUR_INSTALL_DIR})

Regards,
   -- Clark
Stefan

_______________________________________________
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