Linux autocompletions work with complete.
 ]➬complete -p  cmake
 complete -F _cmake cmake
So _cmake is in charge.
]➬type _cmake > cmake.sh
And now just see/debug it. You modify in for example _cmake_mine and call to test it:
. cmake.sh
complete -F _cmake_mine cmake
To get help for any builtin bash command (no man bullshit):
 help complete
 help [[
 help for
Have fun! ;)