Detailed Explanation of CMakeLists.txt

Detailed Explanation of CMakeLists.txt

In the previous article, “Introduction to CMake Build Tool for ESP32,” we introduced the most basic usage of CMake with a “Hello World” program. Today, we will provide a detailed explanation of the CMakeLists.txt file. CMakeLists.txt The CMakeLists.txt file is the core configuration file for the CMake build tool. It contains a series of instructions … Read more

Getting Started with CMake for Large Projects

Getting Started with CMake for Large Projects

Most open-source storage systems are built on the Linux operating system. This article introduces storage technology while also covering some Linux content, focusing on practicality. It will be helpful for both application development and kernel understanding. When our project consists of thousands of files, manually writing a Makefile will be a nightmare. Fortunately, CMake helps … Read more

CMake: Splitting Source Code into Modules

CMake: Splitting Source Code into Modules

Introduction: Projects usually start with a single CMakeLists.txt file, which grows over time. In this article, we will demonstrate a mechanism to split the CMakeLists.txt into smaller units. The motivation for splitting CMakeLists.txt into modules: The main CMakeLists.txt is easier to read; CMake modules can be reused in other projects Combined with functions, modules can … Read more

Integrating External Libraries in CMake

Integrating External Libraries in CMake

Hello, today we will delve into a very practical and challenging topic—Integrating External Libraries in CMake: How to Manage Third-Party Libraries Using find_package and ExternalProject. In most C++ projects, integrating external libraries is an indispensable part. Efficiently and elegantly managing these dependencies, especially during multi-platform builds, is a skill every developer needs to master. 1. … Read more

Mastering CMake Basics: Practical Compilation from Scratch

Mastering CMake Basics: Practical Compilation from Scratch

1. Introduction to CMake CMake is a cross-platform installation (compilation) tool that can describe the installation (compilation process) for all platforms using simple statements. It can output various makefiles or project files, and can test the C++ features supported by the compiler, similar to automake under UNIX. The configuration file for CMake is named CMakeLists.txt. … Read more

CMake Variables: Master Common Variables and Environment Variables

CMake Variables: Master Common Variables and Environment Variables

1. CMake Variable Reference and Definition (1) Use ${} to reference variables. In statements like IF, use the variable name directly without ${}. (2) Custom variables can be defined implicitly and explicitly. For example, the PROJECT command implicitly defines <projectname>_BINARY_DIR and <projectname>_SOURCE_DIR. Explicitly defining variables can be done using the SET command. For example: SET(HELLO_SRC … Read more

Creating Libraries with CMake: Official Tutorial Step 2

Creating Libraries with CMake: Official Tutorial Step 2

Previous Highlights: CMake Hello, World CMake Variables CMake Official Tutorial (Basic Project Setup) Following the previous article, we will start creating a library. This article corresponds to Step 2 of the official tutorial, and after reading it, you will gain the following knowledge: 1. Creating Library Programs 2. Controlling Compilation via Option Definitions 3. Defining … Read more

How to Write CMakeLists.txt Files?

How to Write CMakeLists.txt Files?

Click on the “Computer Vision Life” above to select “Star” Quickly get the latest content This article is adapted from 3D Vision Workshop. This article summarizes the method of writing CMakeLists.txt files on the linux platform. 1 General Modules at the Beginning 1.1 CMake Version Requirements cmake_minimum_required( VERSION 2.8 ) # Project file name loop_closure, … Read more

Getting Started with CMake: From Hello World to Complex Projects

Getting Started with CMake: From Hello World to Complex Projects

Hello, today we are going to delve into a topic that many people pay attention to but often do not take seriously—Getting Started with CMake: From Hello World to Complex Multi-Module Project Builds. Today, we will start from scratch and explore how to use CMake to build projects, making it a powerful assistant for managing … Read more

CMake Tutorial: Supporting GDB Debugging

CMake Tutorial: Supporting GDB Debugging

Table of Contents 1. Introduction 2. How to Support GDB Debugging 3. Code Examples [1] Write demo.c [2] Write CMakeLists.txt [3] Compile [4] GDB Debugging 1. Introduction The combination of CMake and GDB indeed makes the development work of C or C++ easier, enabling cross-platform project builds and source-level debugging. This article details how to … Read more