I have a numeric vector implementation in C; the whole implementation is based on TYPE and then i do s/TYPE/double/g to get an implementation for double and s/TYPE/int/ to get an implementation for int. Up until now I have based the filtering on a tiny sed script which is referenced with an add_custom_command() from the CMakeLists.txt file. That has worked fine on linux, but when trying to generate a Visual Studio solution it fails (in Visual Studio).
Since the process I am performing (search-replace in a file and store the output as a new file) is so simple I thought maybe this could be achieved with builtin CMake commands?
Joakim
In pure cmake you have at least 3 ways to go:
1)
configure_filecommand2) It is possible to use
FILE READorFILE STRINGSandFILE WRITEcommands to make any transformation during the cmake configure step.But
3) If it absolutely necessary to generate this file during the build, then you can use cmake in process script mode (
cmake -P) withadd_custom_command:Where
genscript.cmakeis helper script you need to write. It should generatevector.cwith 1) or 2) approach listened above.