Stop Using the Default Compiler? CMake Compiler Configuration Enables Code Compilation Anywhere!

Stop Using the Default Compiler? CMake Compiler Configuration Enables Code Compilation Anywhere!

Click the blue textFollow the author 1. Background Introduction CMake compiler configuration not only relates to performance but also directly affects the maintainability and portability of the code. By explicitly specifying the compiler and its options, you can ensure consistent behavior of the code across different platforms and reduce maintenance costs. Limitations of using the … Read more

Is Your CMake Build Slow? A Deep Dive into Build Types!

Is Your CMake Build Slow? A Deep Dive into Build Types!

Click the blue textFollow the blogger 1. Overview of CMake Build Types In CMake, “build type” refers to a set of predefined settings and options used to control the compilation and linking process. It is essentially a variable <span>CMAKE_BUILD_TYPE</span> that can be explicitly set or determined by CMake based on default rules. The build type … Read more

How to Install CMake on OpenWRT

How to Install CMake on OpenWRT

• OpenWRT’s opkg supports most software packages, but some specific domain packages still require source installation, such as the SRS server (streaming media server). Source programming typically requires CMake. This article attempts to compile and install CMake from source in OpenWRT system based on Host mode, summarizing the problems encountered and their solutions as follows. … Read more

Journey 6|Understanding CMakeLists in the VP Toolchain Example

Journey 6|Understanding CMakeLists in the VP Toolchain Example

01 Introduction In the article Journey 6|Introduction to VP and Practical Use of Single Operators we introduced what VP is and demonstrated how to use the VP API with the single operator rotate as an example. In Journey 6|Understanding Log Printing in the VP Toolchain Example we discussed how to write the header files for … Read more

CMake Documentation Reading Notes – Simple ‘Hello World’ Project

CMake Documentation Reading Notes - Simple 'Hello World' Project

First, install gcc-g++ and cmake. Taking CentOS as an example: yum install gcc-c++ yum install cmake First, create a main.cpp file that includes a main function, and create a CMakeLists.txt file. The purpose of the CMakeLists.txt file is to guide CMake in compiling the C++ program on the current operating system. main.cpp #include <iostream> int … Read more

Using CMake: A C++ Project Build Tool

Using CMake: A C++ Project Build Tool

Using CMake: A C++ Project Build Tool CMake is a popular cross-platform build system that generates standardized build files, allowing C++ projects to be easily compiled and managed across different operating systems and development environments. In this article, we will introduce the basic usage of CMake and how to use it to create a simple … Read more

Common Syntax of CMake (Loops)

Common Syntax of CMake (Loops)

Previous exciting content:CMake Hello, WorldCMake VariablesCMake Official Tutorial (Basic Project Setup)CMake Official Tutorial (Library Creation)CMake Official Tutorial (Usage Requirements)CMake Official Tutorial (Installation and Testing)CMake Common Syntax (if Statement)CMake Common Syntax (Cache Variables)CMake Common Syntax (Environment Variables)CMake Common Syntax (Mathematical Calculations)CMake Common Syntax (Strings)CMake Common Syntax (Lists) CMake primarily has two types of loops: foreach and … Read more

CMake Insights: A Case Study with FAST-LIO

CMake Insights: A Case Study with FAST-LIO

Review: Why do we use Make and CMake tools? The main reasons are to automate the build process, manage dependencies, and simplify cross-platform development for complex project compilation requirements: Large C++ projects often consist of multiple source files, header files, and library dependencies, making manual compilation commands (like <span>g++</span>) error-prone and inefficient. Dependency Management: Build … Read more

CMake Mastery (5): Comprehensive Guide to add_library – Static and Dynamic Libraries

CMake Mastery (5): Comprehensive Guide to add_library - Static and Dynamic Libraries

Master the Core Logic of Library Building from Compilation Principles to Industrial Practices 1. Essential Differences Between Static and Dynamic Libraries Core Feature Comparison Feature Static Library (<span>.a</span>/<span>.lib</span>) Dynamic Library (<span>.so</span>/<span>.dll</span>) Linking Method Compiled into the executable file at build time Loaded dynamically at runtime Memory Usage Multiple loads of the same library will consume … Read more

CMake from Beginner to Pro (1): A Minimal Introduction to CMake – Environment Setup and First Project

CMake from Beginner to Pro (1): A Minimal Introduction to CMake - Environment Setup and First Project

1. Why Use CMake? In C++ projects, manually managing the build chain (especially for large projects with multiple platforms and modules) can introduce significant complexity. CMake addresses the following issues with its declarative syntax: Cross-platform builds: Generates build files for the corresponding platform (Makefile/MSVC project/Xcode project) Dependency management: Automatically finds third-party libraries (such as OpenCV, … Read more