Sunday, April 28, 2024
 Popular · Latest · Hot · Upcoming
16
rated 0 times [  16] [ 0]  / answers: 1 / hits: 51271  / 3 Years ago, sun, september 26, 2021, 6:48:14

Using CLion on Windows (a C++ IDE), I'd like to install the latest version of cmake on Ubuntu 18.04.3 LTS run via WSL (the current version of CLion requires cmake > 3.15, while I have only version 3.10.2 installed).



Following cmake installation instructions found in a related answer, an error occurs when bootstrapping CMake (first step in A-3 in linked answer):



-- Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR (missing: OPENSSL_CRYPTO_LIBRARY) (found version "1.1.1")
CMake Error at Utilities/cmcurl/CMakeLists.txt:454 (message):
Could not find OpenSSL. Install an OpenSSL development package or
configure CMake with -DCMAKE_USE_OPENSSL=OFF to build without OpenSSL.

-- Configuring incomplete, errors occurred!


I have already installed libssl-dev as recommended in another cmake-related thread.



Any ideas on how this issue can be fixed?


More From » c++

 Answers
2

I ran into the same problem last year. My solution was this:


run the following in your WSL terminal


sudo apt-get update
sudo apt-get install apt-transport-https ca-certificates gnupg software-properties-common wget

After that is finished


wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | sudo apt-key add -

Next add the updated repository by typing in the following


sudo apt-add-repository 'deb https://apt.kitware.com/ubuntu/ bionic main'
sudo apt-get update

Finally


sudo apt-get install cmake

And it should be updated to the latest version.


Note: if the above doesn't work, be very careful when trying the below steps. It is not elegant, it is not clean, but it does work.


If this does not work. Go to https://cmake.org/download/ and download the Latest Ubuntu version. If you have a folder where you maintain all your projects I suggest downloading the file into your top most directory where your projects are.


For example all my projects are in a folder called "Github" so I would download the file into my "Github" Folder. If there is not a top level directory create a cmake folder in the C drive or what ever drive you save your projects to.


Next after its finished downloading Extract the file (through winrar/winzip/7zip/ or terminal) into that same directory. Once extracted cd into the folder (cmake-{version number}) and do the following commands.


cmake .
make
make install

This will make the latest version of cmake and then install the required components. It can take a while to have everything build and installed.


Once that is done you are going to want to locate the /bin/ folder inside your cmake folder. Make sure a file called "cmake" is in this folder. Copy the path of this directory and type the following


sudo nano ~/.bash_aliases

You can use vi or vim or whatever text editor you want from within the terminal.
At the end of the file type the following


alias cmake="{PATH to /bin/ folder}/cmake"

Make sure if you copied the path from windows explorer you replace with /
save the file and exit.


Restart your terminal and type


cmake --version

It should show up with whichever version you just downloaded.


Congrats you now have the updated version of cmake.


As per the comment by John, this is version specific, these exact same directions (for the first method at least) are available here for the latest version of CMake.


[#4261] Monday, September 27, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
tiowift

Total Points: 119
Total Questions: 113
Total Answers: 110

Location: South Sudan
Member since Sun, Jul 11, 2021
3 Years ago
;