Solved. I have built CMake from source using these steps:
sudo apt remove cmakewget https://cmake.org/files/v3.8/cmake-3.8.2.tar.gztar xf cmake-3.8.2.tar.gzcd cmake-3.8.2./configuresudo make installcmake --version
If after cmake --version
cmake is still not found, we have to add the installed cmake bin directory path in .bashrc
:
vim ~/.bashrcexport PATH=/home/ubuntu/cmake-3.8.2/bin#savesource ~/.bashrccmake --version