Reputation: 24160
I am installing static file using CMake's INSTALL
command.
I want to post process the output file using CMake.
For example, static files have a string like
v={{VERSION}}
I want to replace {{VERSION}}
in the output files.
Is this possible with CMake?
Upvotes: 2
Views: 3398
Reputation: 34411
Yes, but preprocessing is usually done at cmake
invocation step, not during install. This is done using configure_file()
command.
Note that configure_file()
supports substituting values only in ${}
or @@
, so if you really need to configure a file with {{}}
, you might end up writing your own function using the CMake command file()
.
Finally, you need to install your configured file. Be sure to
install(FILES ${CMAKE_BINARY_DIR}/your.file)
and not just
install(FILES your.file)
since the latter command would install your source file.
Upvotes: 6