Skip to content

DanNduati/learning_cmake

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CMake

CMake is a tool to manage building of source code.

Basic Top-Level CMakeLists.txt

The top-level CMakeLists.txt is the entry point of our project.There can be several CMakeLists.txt files in subdirectories (for example, libraries or other executables associated with the project). Example:

cmake_minimum_required(VERSION 3.22.2)
# set the project name and version
project(cmake_learn VERSION 1.0)
# Build 
add_executable(${PROJECT_NAME} main.cpp)

The first line is the version of CMake, which is required to process the file, the second is the project name and its versions.The next line specifies which binary to build and their related source files.

Build and Run

1. Classic method

mkdir build
cd build
cmake ..
make

2. Modern method

This method is cleaner and more cross-platform-friendly:

mkdir build
cmake -S . -B build
cmake --build build

CMake learning path

  • Basics of cmake
  • Build and run
  • Libraries
  • Submodules
  • Variables

About

Here's me learning yet another build system lol

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published