
Learn how to set up a g++ based c++ project on ubuntu, write and compile a simple program, modularize with separate source files and headers, and resolve linking errors.
Explore how build systems automate compiling and linking for multi-file C++ projects, manage dependencies, and cut build times by rebuilding only changed files using Make.
Discover why a meta build system matters: CMake generates platform-specific build files to enable cross-platform C++ projects, solving inconsistencies between makefile based builds on Windows and Linux.
Install cmake on linux by using apt repository, downloading official binaries, or building from source, then verify with cmake --version and add the executable to your path.
Create a top-level CMakeLists.txt, prepare a separate build directory, and run cmake to generate Makefiles and build system files for your cross-platform C++ project.
Learn to generate the first executable with CMake by naming the executable, listing sources, and producing a Makefile, while setting a project name and minimum CMake version.
Create two libraries, my_math for mathematical operations and my_print for printing, and link them to the calculator executable in CMake to establish a reusable, cross-project library structure.
Define cmake targets with properties and dependencies, such as the calculator depending on my map and my print for linking, and use public, interface, and private keywords to control propagation.
Learn how to add multiple executables in a single CMake build, why two targets with the same name are disallowed, and how executables and libraries are named across operating systems.
Organize a multi-library CMake project using subdirectories, with dedicated CMakeLists.txt in each subfolder, using add_subdirectory to build my_math and my_print libraries and link them to the executable.
Move header files into their library sub-directories under include and place source files under src, and include headers in their respective cpp files with #include to avoid compatibility issues.
Learn how to include header files with CMake by using target_include_directories, setting PUBLIC scope, and configuring include directories to make headers accessible from multiple folders.
Explain how PUBLIC, INTERFACE, and PRIVATE set target properties such as INTERFACE_INCLUDE_DIRECTORIES and propagate include dirs to dependents. Use a simple rule to choose PUBLIC, INTERFACE, or PRIVATE.
Learn how to propagate target properties with public, private, and interface scopes, fix include paths with target_include_directories, and organize headers to trace dependencies across libraries.
Master CMake scripting with -P to run scripts without build files, print messages in modes, and understand variables as strings and lists, including quotes and dereferencing.
Explore how CMake handles quoted and unquoted arguments across five examples, showing how set VAR aa bb cc forms a list, how semicolons and quotes affect message() output.
Learn to manipulate cmake variables, dereference the name string, and print results with the message command and generated expressions.
Explore core list and string operations in CMake, using list() sub-commands like append, insert, remove_at, reverse, sort, and string() for find, replace, case conversion, comparison, plus file() operations.
Explore CMake control flow with if-else and looping commands, learn about constants, variables, and unary and binary tests, and understand how to check defined status, commands, and file existence.
Learn CMake looping commands, including while and foreach, with conditions and end markers. See iteration over item lists and numeric ranges, using in lists to handle lists of lists.
Explore defining and calling custom functions in CMake with the function command, including arguments, dereferencing variables, and handling name clashes by renaming duplicates with underscores.
Learn how CMake handles named and optional function arguments, using argc, argv, argn and argv1 to count, list, and print provided arguments.
Learn how CMake creates function and directory scopes that isolate variables, how the PARENT_SCOPE argument propagates changes to the parent scope, and why add_subdirectory differs from macros and include.
Discover how CMake macros compare to functions, emphasizing that macros perform text replacement without creating a new scope, accept named arguments, and are case-insensitive in usage.
Explore global CMake variables, including persistent cache variables stored in CMakeCache.txt and environment variables, and learn to set cache variables with the cache keyword.
Learn to manipulate cache variables in CMake by setting a cache variable with set() in CMakeLists, printing it with message, and using edit, FORCE, or -D to modify CMakeCache.txt entries.
Explore CMake cache variables, including the CMake version and its major, minor, and patch parts, and understand differences between the top-level project name, current project name, and generator options.
Learn how to install and export packages with CMake by using the install and find_package commands to share libraries and headers with the community.
Install the my_math library using the cmake install() command, copying header files via FILES to /user/local/include and targets via TARGETS to /user/local/lib, then run sudo make install.
Master exporting a cmake package by creating ABC-config.cmake, installing with install and EXPORT to generate my_export.cmake, and using generator expressions to share include dirs safely.
Use the my_math package with find_package in CMake and check the my_math_FOUND variable. Build an executable from main.cpp, including addition.h and division.h, then link the my_math library and run CMake.
Master external library linking in cmake by diagnosing common problems, using find_package() modes: module mode and config mode, and writing FindXYZ.cmake when needed, with pkg-config and config modules.
Install OpenCV from source with cmake, including mandatory dependencies like libavcodec-dev, libavformat-dev, and libswscale-dev, then build, install, and write a simple C++ program using the library.
Create an App_OpenCV project with main.cpp and a CMakeLists.txt to read a JPEG image and display it, using OpenCV configured via OpenCVconfig.cmake.
Learn to link gtk3 in a CMake project using pkg-config, locate gtk+-3.0.pc file, configure FindPkgConfig, set GTK-3 prefix, and manage PKG_CONFIG_PATH for cross-platform builds.
Explore how to locate libraries and headers with cmake using find_library() and find_path(), including hints, path suffixes, and NAMES options, to set abc_LIBRARY and abc_INCLUDE.
Learn to write a find* module by building a FindGTK3.cmake from scratch, using find_library, find_path, and find_package_handle_standard_args to locate gtk-3 and its headers.
Engage in a bonus lecture that invites you to share difficult topics and rate the course, guiding future topics while you reinforce cross-platform C++ project building with CMake.
Learning CMake was never so easy!
Welcome to the course Master CMake for Cross-Platform C++ Project Building, where you will learn the CMake tool from the beginning. After completing this course, you'll be able to
Build CMake based projects,
Export your project, and
Link your executable against any CMake/ Non-Cmake based library
Enroll Now and enjoy the 3.5-hours ride to learn the most powerful way of building the C++ projects.
This course is made after extensive research on Stackoverflow, Quora, Reddit, Youtube, and other Q&A websites to handpick the concepts which are difficult to understand for the beginners. The course starts with compiling a simple C++ code; and, over the modules, various functionalities are added as the complexity increases.
The broad outline of the course is as follows:
Section 1:
Problems associated with NOT using a build system
Difference between a build system (Make) and a meta-build system (CMake).
Section 2:
Installation of CMake
First executable using the CMake
Section 3:
Managing large projects using sub-directories
Section 4:
Variables, Lists, and Strings
Scripting Capabilities of CMake
Section 5:
Flow Control commands (If-else commands and the Loops)
Functions, Scopes, Macros, Modules, and Listfiles.
Section 6:
Configuring a project using Cache Variables
Concept of Libraries
Using Ninja Build System with CMake
Section 7:
Installation a package that is developed by someone else
Export our package so that someone else can use it
Section 8:(Read through Section)
Miscellaneous small concepts, FAQs and tips
Section 9:
Problems while installing and using External Libraries
Using External Libraries developed using both CMake and Non-CMake based build systems
Enroll Now and enjoy the 3.5-hours ride to learn the most powerful way of building the C++ projects.