توضیحاتی در مورد کتاب Modern CMake for C++: Discover a better approach to building, testing and packaging your software
نام کتاب : Modern CMake for C++: Discover a better approach to building, testing and packaging your software
ویرایش : 1
عنوان ترجمه شده به فارسی : CMake مدرن برای C++: روش بهتری برای ساخت، آزمایش و بسته بندی نرم افزار خود کشف کنید
سری :
نویسندگان : Rafal Swidzinski
ناشر : Packt Publishing
سال نشر : 2022
تعداد صفحات : 460
ISBN (شابک) : 9781801070058
زبان کتاب : English
فرمت کتاب : pdf
حجم کتاب : 11 مگابایت
بعد از تکمیل فرایند پرداخت لینک دانلود کتاب ارائه خواهد شد. درصورت ثبت نام و ورود به حساب کاربری خود قادر خواهید بود لیست کتاب های خریداری شده را مشاهده فرمایید.
فهرست مطالب :
Cover
Title page
Copyright and Credits
Dedications
Contributors
Table of Contents
Preface
Section 1: Introducing CMake
Chapter 1: First Steps with CMake
Technical requirements
Understanding the basics
What is CMake?
How does it work?
Installing CMake on different platforms
Docker
Windows
Linux
macOS
Building from the source
Mastering the command line
CMake
CTest
CPack
The CMake GUI
CCMake
Navigating the project files
The source tree
The build tree
Listfiles
CMakeLists.txt
CMakeCache.txt
The Config-files for packages
The cmake_install.cmake, CTestTestfile.cmake, and CPackConfig.cmake files
CMakePresets.json and CMakeUserPresets.json
Ignoring files in Git
Discovering scripts and modules
Scripts
Utility modules
Find-modules
Summary
Further reading
Chapter 2: The CMake Language
Technical requirements
The basics of the CMake Language syntax
Comments
Command invocations
Command arguments
Working with variables
Variable references
Using the environment variables
Using the cache variables
How to correctly use the variable scope in CMake
Using lists
Understanding control structures in CMake
Conditional blocks
Loops
Command definitions
Useful commands
The message() command
The include() command
The include_guard() command
The file() command
The execute_process() command
Summary
Further reading
Chapter 3: Setting Up Your First CMake Project
Technical requirements
Basic directives and commands
Specifying the minimum CMake version – cmake_minimum_required()
Defining languages and metadata – project()
Partitioning your project
Scoped subdirectories
Nested projects
External projects
Thinking about the project structure
Scoping the environment
Discovering the operating system
Cross-compilation – what are host and target systems?
Abbreviated variables
Host system information
Does the platform have 32-bit or 64-bit architecture?
What is the endianness of the system?
Configuring the toolchain
Setting the C++ standard
Insisting on standard support
Vendor-specific extensions
Interprocedural optimization
Checking for supported compiler features
Compiling a test file
Disabling in-source builds
Summary
Further reading
Section 2: Building With CMake
Chapter 4: Working with Targets
Technical requirements
The concept of a target
Dependency graph
Visualizing dependencies
Target properties
What are transitive usage requirements?
Dealing with conflicting propagated properties
Meet the pseudo targets
Build targets
Writing custom commands
Using a custom command as a generator
Using a custom command as a target hook
Understanding generator expressions
General syntax
Types of evaluation
Examples to try out
Summary
Further reading
Chapter 5: Compiling C++ Sources with CMake
Technical requirements
The basics of compilation
How compilation works
Initial configuration
Managing sources for targets
Preprocessor configuration
Providing paths to included files
Preprocessor definitions
Configuring the headers
Configuring the optimizer
General level
Function inlining
Loop unrolling
Loop vectorization
Managing the process of compilation
Reducing compilation time
Finding mistakes
Summary
Further reading
Chapter 6: Linking with CMake
Technical requirements
Getting the basics of linking right
Building different library types
Static libraries
Shared libraries
Shared modules
Position-independent code
Solving problems with the One Definition Rule
Dynamically linked duplicated symbols
Use namespaces – don't count on a linker
The order of linking and unresolved symbols
Separating main() for testing
Summary
Further reading
Chapter 7: Managing Dependencies with CMake
Technical requirements
How to find installed packages
Discovering legacy packages with FindPkgConfig
Writing your own find-modules
Working with Git repositories
Providing external libraries through Git submodules
Git-cloning dependencies for projects that don't use Git
Using ExternalProject and FetchContent modules
ExternalProject
FetchContent
Summary
Further reading
Section 3: Automating With CMake
Chapter 8: Testing Frameworks
Technical requirements
Why are automated tests worth the trouble?
Using CTest to standardize testing in CMake
Build-and-test mode
Test mode
Creating the most basic unit test for CTest
Structuring our projects for testing
Unit-testing frameworks
Catch2
GTest
GMock
Generating test coverage reports
Avoiding the SEGFAULT gotcha
Summary
Further reading
Chapter 9: Program Analysis Tools
Technical requirements
Enforcing the formatting
Using static checkers
Clang-Tidy
Cpplint
Cppcheck
include-what-you-use
Link what you use
Dynamic analysis with Valgrind
Memcheck
Memcheck-Cover
Summary
Further reading
Chapter 10: Generating Documentation
Technical requirements
Adding Doxygen to your project
Generating documentation with a modern look
Summary
Further reading
Other documentation generation utilities
Chapter 11: Installing and Packaging
Technical requirements
Exporting without installation
Installing projects on the system
Installing logical targets
Low-level installation
Invoking scripts during installation
Creating reusable packages
Understanding the issues with relocatable targets
Installing target export files
Writing basic config-files
Creating advanced config-files
Generating package version files
Defining components
How to use components in find_package()
How to use components in the install() command
Packaging with CPack
Summary
Further reading
Chapter 12: Creating Your Professional Project
Technical requirements
Planning our work
Project layout
Object libraries
Shared libraries versus static libraries
Project file structure
Building and managing dependencies
Building the Calc library
Building the Calc Console executable
Testing and program analysis
Preparing the coverage module
Preparing the Memcheck module
Applying testing scenarios
Adding static analysis tools
Installing and packaging
Installation of the library
Installation of the executable
Packaging with CPack
Providing the documentation
Automatic documentation generation
Not-so-technical documents of professional project
Summary
Further reading
Appendix: Miscellaneous Commands
The string() command
Search and replace
Manipulation
Comparison
Hashing
Generation
JSON
The list() command
Reading
Searching
Modification
Ordering
The file() command
Reading
Writing
Filesystem
Path conversion
Transfer
Locking
Archiving
The math() command
Index
Other Books You May Enjoy