[CMake] Non-build output

Stefan Buschmann s_buschmann at gmx.de
Sun Jun 20 16:35:10 EDT 2010


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



More information about the CMake mailing list