You look for cellular activities which correspond to cancerous behavior, and when you see them, you tell that cell to kill itself
That's kind of what's already supposed to happen naturally inside the human body. Cells are supposed to kill themselves if they are severely malfunctioned or are likely to become cancerous. However, if enough of these fail-safe mechanisms are damages within a cell, then that cell becomes cancerous. That's why cancer is so difficult to treat, and why your own immune system has difficulty attacking it -- the cancer cells have gone rogue and are no longer "following orders" to kill themselves.
So, if you were able to insert genes into cells, which would allow the cells to kill themselves upon activation by a certain light wavelength, then what would happen? Say you illuminate the tumour with that particular wavelength. Perhaps 99.9% of the cells will undergo apoptosis, as instructed. But maybe 0.1% acquired a mutation which disabled your fail-safe genes. Now what? Congratulations -- the cancer has now evolved to be resistant to your light-induced apoptosis commands. And you're back to square one.