You do not need to add additional custom targets to your CMake scripts, since the Makefiles generated by CMake already contain .o targets for each .cc file. For instance. if you have a source file called mySourceFile.cc , there will be a Makefile in your build directory that defines the target <Some Path>/mySourceFile.cc.o . If you cd into your build directory, you can use grep or ack-grep to find the Makefile that defines this target, then cd into this Makefile and create it.
eg. suppose the ack-grep mySourceFile.cc.o prints something like:
foo/bar/Makefile 119:x/y/z/mySourceFile.o: x/y/z/mySourceFile.cc.o 123:x/y/z/mySourceFile.cc.o: 124:
Then you can build mySourceFile.cc.o by doing:
cd foo/bar && make x/y/z/mySourceFile.cc.o
source share