LLVM backend for TOY

I am trying to write LLVM backend for TOY.
I created Folder called TOY under llvm-project/llvm/lib/Target.
I did the following :
Defining registers and register sets
Defining the calling convention
Defining the instruction set
Implementing frame lowering
Printing an instruction
Selecting an instruction
Adding instruction encoding
Supporting a subtarget
Lowering to multiple instructions

To register a TOY:
I edited following files to include TOY:
llvm_root_dir/include/llvm/ MC/MCExpr.h

When I try to build using cmake -G Ninja …/llvm -DLLVM_TARGETS_TO_BUILD=“TOY” -DCMAKE_BUILD_TYPE=Release
I am getting error as llvm-build: error: invalid target to enable: ‘TOY’ (not in project)

Thank You

I guess you are following Fraser Cormack’LLVM-LEG tutorial which is more than 6 years old & LLVM changes a lot since then.
A one-line error message doesn’t say much about where is the problem. You can also share your Github repository link or error log if someone gets time to lookup.

If you are just following the tutorial then Fraser’s commits-history in the repository is a good way to find your mistake. His first commit is adding the skeleton of LEG backend which should be build correctly by you.