Install and Set Up Clion on Archlinux

the installing process

Since Clion is available from the AUR you can simply install it with your favourite AUR package manager.
I switched from pacaur to yay but made an alias so I can still use the pacaur command (don’t ask me why). In my case I would write pacaur -S clion in the terminal, which downloads the package and runs the makepkg script.

And that’s how you install clion on Archlinux.

Setting up Clion

Setting up Clion is almost as easy as installing it.
Simply start up Clion. From there on you will be prompted if you want to import settings. If you already have a saved Clion configuration, you can import it at that point and everything will be set up as you already had it before.
If you don’t want to import settings, you can skip this step and select the themestyle you want to use.\

Toolchain

Next up you have to set up the toolchains. In my case, these where not detected automatically. If that’s the case for you, simply type in cmake or the path to each program like this:

clion toolchain setup

Obviously you need to have CMake, Make, GCC and GDB installed. You can install these by running sudo pacman -S cmake make gcc gdb

Plugins

After setting up the toolchain, you can install additional plugins. Being a big fan of VIM, I love to see a plugin to emulate VIM-style navigation.


And that’s it, you’re done with the set up process.

Example CMakeLists.txt

To use the built-in compiling/running/debugging features, you need to set up a CMakeLists.txt in your project. A simple one would look like this:

cmake_minimum_required(VERSION 3.13) #check minimum CMake version
project(project_name)
set(CMAKE_CXX_STANDARD 14)  #use C++ 14 standard         

# Add main.cpp file of project root directory as source file
set(SOURCE_FILES main.cpp)

# Add executable target with source files listed in SOURCE_FILES variable
add_executable(projecT_name ${SOURCE_FILES})a