Note: This Text Tutorial has extracted from this video.
Author: savolla
Source: TheChernoProject
-
vim
-
g++
-
codeline
-
cmake
sudo pacman -S vim g++ cmake aurman -S codeline # compilation may be a bit slow with makepkg
mkdir helloWorld
cd helloWorld
mkdir src
touch src/Main.cpp
chmod 755 src/Main.cpp
vim CMakeLists.txt
cmake_minimum_required (VERSION 3.5)
project (HelloWorld)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror -std=c++14")
set (source_dir "${PROJECT_SOURCE_DIR}/src/")
file (GLOB source_files "${source_dir}/*.cpp")
add_executable (HelloWorld ${source_files})
3. write and quit. let's create a bash script this script will actually use CMakeLists.txt file to generate our files
touch build.sh # create the file
chmod +x build.sh # make it executable
#!/bin/bash
cmake -G "CodeLite - Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug
./build.sh
6. After you run the script you will see there are bunch of new files created in the helloWorld directory. The most important files are;
- HelloWorld.project
- HelloWorld.workspace
codelite HelloWorld.workspace & // we used & to send the process to background