[CMake] Converting a OpenCL program into a C++ header?

Alexander Neundorf a.neundorf-work at gmx.net
Mon Jun 21 15:06:58 EDT 2010


On Wednesday 16 June 2010, David Cole wrote:
> This script will work for your simple input. It will require extra escaping
> work if you need to embed double quotes or backslashes.

Another idea would be to convert it to something like
const char code[] = {0x5f, 0x5f, 0x6b, 0x65, ....}

then you don't have to care about the escaping.
Just... I think in cmake it is not possible to access single characters in a 
string.... maybe except a regexp which matches always the first character and 
remove it afterwards (...probably the slowest way at all to do this)....

Or write a tiny C program which does that translation for you and execute it 
via add_custom_command().

Alex


More information about the CMake mailing list