-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
CMake Best Practices - Second Edition
By :
In the previous section, we learned about how to use functions and macros to provide useful utility in CMake projects. Now, we can learn about how we can move these functions and macros to a separate CMake module.
Creating and using a basic CMake module file is extremely simple:
<module_name>.cmake file under your project.<module_name>.cmake file.<module_name>.cmake in the desired file.Alright – let’s follow these steps and create a module together. As a follow-up to our previous Git branch name example, let’s extend the scope and write a CMake module that provides the ability to retrieve the branch name, head commit hash, current author name, and current author email information by using the git command. For this part, we will follow the chapter13/ex01_git_utility example. The example folder contains a CMakeLists.txt file...