I have installed cmake like this -

sudo apt-get install cmake

But whenever I try to compile my c++ code.. I always get the below error -

CMake Error at CMakeLists.txt:2 (cmake_minimum_required):
  CMake 2.8.7 or higher is required.  You are running version 2.8.2

When I did cmake --version I got this -

username@phx7b02c-ee1b:~/build$ cmake --version
cmake version 2.8.2

Somehow it is not downloading the latest version of cmake? Any thoughts?

I am running Ubuntu -

username@phx7b02c-ee1b:~$ uname -a
Linux phx7b02c-ee1b 2.6.35-22-server #33-Ubuntu SMP Sun Sep 19 20:48:58 UTC 2010 x86_64 GNU/Linux
  • what's your program? what's your gcc version? did you apt-get update before apt-get install cmake ? – PersianGulf Oct 11 '13 at 22:04
  • 2
    What release of Ubuntu are you running? I'm thinking the solution is to run a more recent version with up-to-date repos. – Joseph R. Oct 11 '13 at 22:16
  • I have already provided ubuntu version in my code I guess.. Let me know if there is anything I am missing? – arsenal Oct 12 '13 at 0:00
  • @TechGeeky: Only indirectly. We can guess from kernel version that you're probably running Ubuntu 10.04 LTS. If so, then Joseph R.'s comment is apt: even if you're restricting yourself to LTS releases only, there's a newer version of Ubuntu which does have the CMake version you require. – Warren Young Oct 12 '13 at 0:43

Baseon your uname -a you look to be running a pretty old version of Ubuntu: (2.6.35-22-server is the Linux Kernel version). You're likely using the latest version of CMake that's available via packages for your particular version of Ubuntu.

According too this Ubuntu page:“cmake” package in Ubuntu:

The Lucid Lynx (supported) cmake trunk series
  2.8.1-4~lucid1     backports (main)        2010-05-28
  2.8.0-5ubuntu1     release (main)          2009-12-18

You're apparently at your latest version available. You might want to check out the Kitware site to see if a newer version is available as a binary installation or try the .deb file from a newer version of Ubuntu/Debian. Use caution with the second approach!


You can always build it from source, which should not be too much trouble. Not surprisingly, CMake uses cmake to build if available, but according to the Readme.txt in the tarball, it will use the system (POSIX) make otherwise.

If you are not used to building from source, the major complication for most people is probably working out dependencies. You need the "-dev" or "-devel" packages, the same as you would if you were using a library in your own code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.