From the course: Advanced C++: Building Projects with CMake
Unlock this course with a free trial
Join today to access over 24,900 courses taught by industry experts.
Defining custom commands to generate output - C++ Tutorial
From the course: Advanced C++: Building Projects with CMake
Defining custom commands to generate output
- [Instructor] Custom commands are a powerful feature in CMake that let us extend our build process beyond just compiling code. They are essential for real world projects where you need to generate files, process resources, or run scripts as part of your build. In this video, we'll create a custom command that generates a text file containing real project and build information. We'll keep working with the top level CMakeLists.txt file. Use add_custom_command to create a, well, custom command. Next, the OUTPUT command tells CMake to generate a file called build_info.txt in the top level build folder. The first command writes the text ImageLite Build Information to the file. Note that we're using add_custom_command with CMake's built-in -E script mode commands, which are intentionally designed to be cross-platform. The second command appends the CMake version after it. We're relying on predefined CMake variables to fetch the information we want to include in this file. Here…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
(Locked)
Creating custom commands and targets in CMake6m 14s
-
(Locked)
Integrating the core and filter libraries7m 37s
-
(Locked)
Adding external dependencies4m 30s
-
(Locked)
Creating custom targets5m 14s
-
(Locked)
Defining custom commands to generate output5m 15s
-
(Locked)
Pre-build and post-build commands3m 19s
-
(Locked)
-
-
-
-