Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying CMake Best Practices
  • Table Of Contents Toc
  • Feedback & Rating feedback
CMake Best Practices

CMake Best Practices - Second Edition

By : Berner, Mustafa Kemal Gilor
close
close
CMake Best Practices

CMake Best Practices

By: Berner, Mustafa Kemal Gilor

Overview of this book

Discover the cutting-edge advancements in CMake with the new edition of CMake Best Practices. This book focuses on real-world applications and techniques to leverage CMake, avoiding outdated hacks and overwhelming documentation. You’ll learn how to use CMake presets for streamlined project configurations and embrace modern package management with Conan 2.0. Covering advanced methods to integrate third-party libraries and optimize cross-platform builds, this updated edition introduces new tools and techniques to enhance software quality, including testing frameworks, fuzzers, and automated documentation generation. Through hands-on examples, you’ll become proficient in structuring complex projects, ensuring that your builds run smoothly across different environments. Whether you’re integrating tools for continuous integration or packaging software for distribution, this book equips you with the skills needed to excel in modern software development. By the end of the book, you’ll have mastered setting up and maintaining robust software projects using CMake to streamline your development workflow and produce high-quality software.
Table of Contents (22 chapters)
close
close
Lock Free Chapter
1
Part 1 – The Basics
5
Part 2 – Practical CMake – Getting Your Hands Dirty with CMake
14
Part 3 – Mastering the Details

Fundamental building blocks of modules – functions and macros

It is clear that we need some basic building blocks to create utility modules. The most fundamental building blocks for utility modules are functions and macros, so it is essential to learn their working principles well. Let’s start by learning about functions.

Functions

Let’s remember what we learned in Chapter 1, Kickstarting CMake, about functions. A function is a CMake language feature to define a logical code block that can be invoked to execute CMake commands. A function starts with function(…), has a body that contains CMake commands, and ends with the endfunction() CMake command. The function() command needs a name as the first argument and optional function argument names, shown as follows:

function(<name> [<arg1> ...])
  <commands>
endfunction()

A function defines a new variable scope, so changes made on CMake variables are only visible in the...

Visually different images
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
CMake Best Practices
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist download Download options font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon