2010/6/20 Clark Gaebel <cg.wowus...@gmail.com>:
> 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?
>
> For bonus points, how would this interact with "make install"?

Concerning install:

Your target foo may be installed with
install(TARGETS foo DESTINATION where/you/want)

Your config file with
install(FILE foo.conf DESTINATION where/you/want)

Now if you want to put the foo.conf near to foo **in the build tree**
**and assuming foo.conf is in the same source dir as foo sources**
you may do:
configure_file(foo.conf foo.conf COPYONLY)

this should copy foo.conf from source tree to binary tree.
It may be a problem if you usually do in-source build so you may
a) rename foo.conf to foo.conf.in in the source
b) do
   configure_file(foo.conf.in foo.conf COPYONLY)


-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org
_______________________________________________
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