How to write CMakeLists.txt on my own? What are the rules and commands to be used? I am getting a few errors when I do it on my own.
In any case, the CMake documentation is a valuable resource to learn CMake.
For simple examples on how to write CMakeLists.txt files for ITK projects, you can refer to the ITK examples, for example this one or pretty much any other example in this git repository.