• Complain

Rafal Swidzinski - Modern CMake for C++: Discover a better approach to building, testing and packaging your software

Here you can read online Rafal Swidzinski - Modern CMake for C++: Discover a better approach to building, testing and packaging your software full text of the book (entire story) in english for free. Download pdf and epub, get meaning, cover and reviews about this ebook. year: 2022, publisher: Packt Publishing - ebooks Account, genre: Computer. Description of the work, (preface) as well as reviews are available. Best literature library LitArk.com created for fans of good reading and offers a wide selection of genres:

Romance novel Science fiction Adventure Detective Science History Home and family Prose Art Politics Computer Non-fiction Religion Business Children Humor

Choose a favorite category and find really read worthwhile books. Enjoy immersion in the world of imagination, feel the emotions of the characters or learn something new for yourself, make an fascinating discovery.

Rafal Swidzinski Modern CMake for C++: Discover a better approach to building, testing and packaging your software
  • Book:
    Modern CMake for C++: Discover a better approach to building, testing and packaging your software
  • Author:
  • Publisher:
    Packt Publishing - ebooks Account
  • Genre:
  • Year:
    2022
  • Rating:
    4 / 5
  • Favourites:
    Add to favourites
  • Your mark:
    • 80
    • 1
    • 2
    • 3
    • 4
    • 5

Modern CMake for C++: Discover a better approach to building, testing and packaging your software: summary, description and annotation

We offer to read an annotation, description, summary or preface (depends on what the author of the book "Modern CMake for C++: Discover a better approach to building, testing and packaging your software" wrote himself). If you haven't found the necessary information about the book — write in the comments, we will try to find it.

Write comprehensive professional-standard CMake projects and ensure the quality and simplicity of your solutions

Key Features
  • Understand and automate compilation and linking with CMake
  • Manage internal and external dependencies easily
  • Add quality checks and tests as an inherent step for your builds
Book Description

Creating top-notch software is an extremely difficult undertaking. Developers researching the subject have difficulty determining which advice is up-to-date and which approaches have already been replaced by easier, better practices. At the same time, most online resources offer limited explanation, while also lacking the proper context and structure.

This book offers simpler, more complete experience, as it treats the subject of building C++ solutions holistically. Modern CMake for C++ is an end-to-end guide to the automatization of complex tasks, including building, testing and packaging. Youll not only learn how to use the CMake language in CMake projects, but also discover what makes them maintainable, elegant and clean. The book later focuses on the structure of source directories, building targets and packages. As you progress, youll learn how to compile and link executables and libraries, how those processes work, and how to optimize builds in CMake for the best results. Youll also understand how to use external dependencies in your project - third-party libraries, testing frameworks, program analysis tools, and documentation generators. Finally, youll focus on exporting, installing, and packaging for internal and external purposes.

By the end of this book, youll be able to use CMake confidently on a professional level.

What you will learn
  • Understand best practices for building C++ code
  • Gain practical knowledge of the CMake language by focusing on the most useful aspects
  • Use cutting-edge tooling to guarantee code quality with tests and static and dynamic analysis
  • Discover how to manage, discover, download, and link dependencies with CMake
  • Build solutions that can be reused and maintained in the long term
  • Understand how to optimize build artifacts and the build process itself
Who This Book Is For

The book is for build engineers and software developers with knowledge of C/C++ programming who are looking to learn CMake to automate the process of building small and large software solutions. If you are just getting started with CMake, a long-time GNU make user, or someone simply looking to brush up on the latest best practices, this book is for you.

Table of Contents
  1. First Steps with CMake
  2. The CMake Language
  3. Setting up Your First CMake Project
  4. Working with Targets
  5. Compiling C++ Sources with CMake
  6. Linking with CMake
  7. Managing Dependencies in CMake
  8. Testing Frameworks
  9. Program Analysis Tools
  10. Generating Documentation
  11. Installing and Packaging
  12. Creating your Professional Chapter
  13. Appendix

Rafal Swidzinski: author's other books


Who wrote Modern CMake for C++: Discover a better approach to building, testing and packaging your software? Find out the surname, the name of the author of the book and a list of all author's works by series.

Modern CMake for C++: Discover a better approach to building, testing and packaging your software — read online for free the complete book (whole text) full work

Below is the text of the book, divided by pages. System saving the place of the last page read, allows you to conveniently read the book "Modern CMake for C++: Discover a better approach to building, testing and packaging your software" online for free, without having to search again every time where you left off. Put a bookmark, and you can go to the page where you finished reading at any time.

Light

Font size:

Reset

Interval:

Bookmark:

Make
Table of Contents
Modern CMake for C Copyright 2022 Packt Publishing All rights reserved No - photo 1
Modern CMake for C++

Copyright 2022 Packt Publishing

All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.

Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.

Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.

Early Access Publication: Modern CMake for C++

Early Access Production Reference: B17205

Published by Packt Publishing Ltd.

Livery Place

35 Livery Street

Birmingham

B3 2PB, UK

ISBN: 978-1-80107-005-8

www.packt.com
Modern CMake for C++

Welcome to Packt Early Access. Were giving you an exclusive preview of this book before it goes on sale. It can take many months to write a book, but our authors have cutting-edge information to share with you today. Early Access gives you an insight into the latest developments by making chapter drafts available. The chapters may be a little rough around the edges right now, but our authors will update them over time. Youll be notified when a new version is ready.

This title is in development, with more chapters still to be written, which means you have the opportunity to have your say about the content. We want to publish books that provide useful information to you and other customers, so well send questionnaires out to you regularly. All feedback is helpful, so please be open about your thoughts and opinions. Our editors will work their magic on the text of the book, so wed like your input on the technical elements and your experience as a reader. Well also provide frequent updates on how our authors have changed their chapters based on your feedback.

You can dip in and out of this book or follow along from start to finish; Early Access is designed to be flexible. We hope you enjoy getting to know more about the process of writing a Packt book. Join the exploration of new topics by contributing your ideas and see them come to life in print.

Modern CMake for C++
  1. First Steps with CMake
  2. The CMake Language
  3. Setting up Your First CMake Project
  4. Working with Targets
  5. Compiling C++ Sources with CMake
  6. Linking with CMake
  7. Managing Dependencies with CMake
  8. Testing Frameworks
  9. Program Analysis Tools
  10. Generating Documentation
  11. Installing and Packaging
  12. Creating your Professional Project
  13. Appendix: Miscellaneous Commands
1 First steps with CMake

There is something magical about turning source code into a working application. Not only the effect itself: a working mechanism that we devised and brought to life, but the very process, the very act of exercising the idea into existence.

As programmers we work in this loop: designing-coding-testing. We invent changes, we phrase them in a language that the compiler understands and we check if they work as intended. To create a proper, high-quality application from our source code we need to meticulously execute repetitive, error-prone tasks: invoking right commands, checking syntax, linking binary files, running tests, reporting issues and so on.

It takes effort to remember every step all the time. Instead, we want to stay focused on the actual coding, and delegate everything else to the automated tooling. Ideally - this process would be started with a single button, right after we changed our code. It would be smart, fast, extensible and work the same way across different operating systems and environments. It would be supported by multiple IDEs, but also by Continuous Integration pipelines which test our software after a change is submitted to a shared repository.

CMake is the answer to many such needs, but it requires a bit of work to configure and use correctly. This is not because CMake is unnecessarily complex, but because the subject that we're dealing with here is. Don't worry. We'll do with this whole learning process very methodically, and before you know it - you will become a building guru.

I know you're eager to rush off, and start writing your own CMake projects, and I applaud your attitude. Since your projects will be primarily for users (yourself included), it's important that you understand that perspective as well.

Let's start with just that: becoming a CMake power user. Well go through a few basics: what is this tool, how it works in principle and how to install it. Then we'll do a deep-dive on the command line and modes of operation. Finally, we'll wrap up with purposes of different files in a project and we'll touch on using CMake without one.

In this chapter were going to cover the following main topics:

  • Understanding the basics
  • Installing CMake on different platforms
  • Mastering the Command Line
  • Navigating the Project Files
  • Discovering Scripts and Modules
Technical requirement

You can find the code files present in this chapter on GitHub at https://github.com/PacktPublishing/Modern-CMake-for-Cpp

Understanding the basics

Compilation of C++ source code seems like a fairly straightforward process. When we take a small program like a classic hello.cpp:

chapter-01/01-hello/hello.cpp
#include int main() { std::cout << "Hello World!" << std::endl; return 0;}

All we need to do to get an executable is to run a single command. We call the compiler with a file name as an argument:

$ g++ hello.cpp -o a.out

Our code is correct so the compiler will silently produce an executable binary file that our machine can understand. We can run it by calling its name:

$ ./a.outHello World!$

However, as our projects grow we quickly understand that keeping everything in a single file is simply not possible. Clean code practices recommend that files should be kept small and in well-organized structures. Manual compilation of every file will be a tiresome and fragile process. There must be a better way.

What is CMake?

Lets say we automate building by writing a script that goes through our project tree and compiles everything. To avoid unnecessary compilation our script will detect if the source was modified since last time. Now wed like a convenient way to manage arguments that are passed to the compiler for each file - preferably do that based on configurable criteria. Our script should also know how to link all the compiled files in a binary, or even better: build whole solutions that can be reused, and incorporated as modules in bigger projects.

The more features we will add the more we will get to a full-fledged solution. Building software is a very versatile process and can span multiple different aspects:

  • Compiling executables and libraries
  • Managing dependencies
  • Testing
  • Installing
  • Packaging
Next page
Light

Font size:

Reset

Interval:

Bookmark:

Make

Similar books «Modern CMake for C++: Discover a better approach to building, testing and packaging your software»

Look at similar books to Modern CMake for C++: Discover a better approach to building, testing and packaging your software. We have selected literature similar in name and meaning in the hope of providing readers with more options to find new, interesting, not yet read works.


Reviews about «Modern CMake for C++: Discover a better approach to building, testing and packaging your software»

Discussion, reviews of the book Modern CMake for C++: Discover a better approach to building, testing and packaging your software and just readers' own opinions. Leave your comments, write what you think about the work, its meaning or the main characters. Specify what exactly you liked and what you didn't like, and why you think so.