visual studio code [cmake] CMake 3.9 or higher is required. You are running version 3.3.2
Hi in Visual Studio Code it shows when I want to build my project:
CMake 3.9 or higher is required. You are running version 3.3.2
I dont know how to upgrade the cmake version...
It still shows:
$ cmake --version
cmake version 3.3.2
CMake suite maintained and supported by Kitware (kitware.com/cmake).
$ sudo cmake --version
cmake version 3.22.1
CMake suite maintained and supported by Kitware (kitware.com/cmake).
My main problem is that I want to use cmake 3.9 in Visual Studio Code. But as I run it as normal user I guess I have no access to the sudo cmake :(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( https://code.visualstudio.com/docs/cpp/cmake-linux
Thank you :D
It would've been helpful if you had provided your linux distribution.
If it's a debian based system, running sudo apt install cmake
should update it.
If it's Arch based, run sudo pacman -S cmake
If its something besides that, you will have to figure out your package manager and install cmake using that.
My colleague had the same issue using a similar version of Xilinx tools. For some reason the cmake version that comes with the crosscompiling environment is used as the default path for cmake.
For the console adding
export "PATH=/path/to/cmake/bin/dir:${PATH}"
(where /path/to/cmake/bin/dir
is the directory containing the cmake executable) to the end of ~/.bashrc
worked for "fixing" bash. Note that this may result in different tools being used. For this reason I recommend installing cmake into a custom directory. (My colleague had to install cmake by unpacking a .tar.gz
file containing the binary files anyways, so the cmake tools ended up in a separate dir anyways.)
The IDE probably doesn't use the bash environment variables, but usually you can speficy the absolute path for the cmake executable instead of using cmake
by modifying the settings. For Visual Studio Code you can go to Settings and edit Cmake: Cmake path
in Extensions > CMake tools configuration
and change it to /usr/local/bin/cmake
.