[CMake] CMAKE install command post process the file

Eric Noulard eric.noulard at gmail.com
Wed Dec 28 04:38:47 EST 2011


2011/12/28 vivek goel <goelvivek2011 at gmail.com>:
> I am installing static file using cmake INSTALL command
>
> I want to post process the output file using cmake
>
> example
>
> Static files are having string like v={{VERSION}}
>
> I want to replace {{VERSION}} in the output files.
>
> Is it possible with cmake ? using utility like sed.

You should try to use
configure_file
cmake command.

You'll need to replace {{VERSION}} in your static files with @VERSION at .
You may then

configure_file(${CMAKE_CURRENT_SOURCE_DIR}/static_file.in
${CMAKE_CURRENT_BINARY_DIR}/static_file @ONLY)
install(${CMAKE_CURRENT_BINARY_DIR}/static_file DESTINATION ...)


-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org


More information about the CMake mailing list