Actually, you can just check for the version number. In the Terminal, it's done like this...
$ xcode-select -version
It will return...
xcode-select version 2339.
At least some sort of version number if it's installed.
In your code, you should be able to run a terminal command that does this silently without actually opening the terminal and reading/checking for a version number. All I have is the command line tools installed in 10.6.8 and 10.10.5. The terminal command works on both.