diff --git a/cmake/modules/TDEMacros.cmake b/cmake/modules/TDEMacros.cmake index eef5568..b99aa80 100644 --- a/cmake/modules/TDEMacros.cmake +++ b/cmake/modules/TDEMacros.cmake @@ -160,6 +160,24 @@ macro( tde_add_luts ) endmacro( tde_add_luts ) +################################################# +##### +##### tde_file_to_cpp( ) + +macro( tde_file_to_cpp _src _dst _var ) + if( IS_ABSOLUTE ${_dst} ) + set( dst ${_dst} ) + else( ) + set( dst "${CMAKE_CURRENT_BINARY_DIR}/${_dst}" ) + endif( ) + file( READ ${_src} text ) + string( REGEX REPLACE "\n" "\\\\n\"\n\"" text "${text}" ) + set( text "/* Generated by CMake */\n\nconst char *${_var} = \n\n\"${text}\";\n" ) + string( REGEX REPLACE "\n\"\";\n$" ";\n" text "${text}" ) + file( WRITE ${dst} "${text}" ) +endmacro( ) + + ################################################# ##### ##### tde_install_la_file( )