Tweak write_cmake_config.py to also handle variable references looking @FOO@ (matching CMake's configure_file() function), and make it replace '\' 'n' in values with a newline literal since there's no good portable way of passing a real newline literal on a command line.
Use that to process all the .def.in files in llvm/include/Config and add llvm/lib/Target, which (indirectly, through llvm-c/Target.h) includes them.
Can you please also provide an error message?