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?
Yes, but preprocessing is usually done at
cmakeinvocation step, not during install. This is done usingconfigure_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 commandfile().Finally, you need to install your configured file. Be sure to
and not just
since the latter command would install your source file.