Build Systems & Package Management Flashcards
7 cards from real CPP practice questions. Tap to flip, then mark Knew It or Still Learning โ missed cards come back until you master them.
Read the first 7 Build Systems & Package Management flashcards as text
What is the purpose of a `CMakePresets.json` file introduced in CMake 3.19?
Answer: Defines reusable configure, build, and test preset configurations sharable across teams
`CMakePresets.json` captures named sets of CMake variables and generator options so developers share identical build configurations.
Which Ninja feature makes it faster than recursive Make on large projects?
Answer: Ninja avoids recursive sub-make invocations and uses a single flat dependency graph
Ninja's flat, single-graph design eliminates the overhead of recursive make and unnecessary re-evaluations, resulting in faster incremental builds.
In vcpkg, what is a 'triplet' and why does it matter?
Answer: A specification of target architecture, OS, and linkage (e.g., x64-windows-static) that determines how packages are built
A vcpkg triplet encodes the target platform and link type (e.g., `x64-linux`, `arm-windows-static`), ensuring packages are compiled for the correct environment.
What does `make -j$(nproc)` accomplish on a Linux system?
Answer: Launches parallel make jobs up to the number of available CPU cores
`-j` sets the maximum parallel jobs and `$(nproc)` substitutes the logical CPU count, fully utilizing the machine.
Which CMake command is the modern replacement for the deprecated `include_directories()` global command?
Answer: target_include_directories()
`target_include_directories()` is the target-scoped, modern alternative that avoids polluting the global include path.
In Conan, what is the significance of the `build_requires` (or `tool_requires` in v2) section?
Answer: These are build-time tools (e.g., CMake, Ninja) needed only during compilation, not shipped with the artifact
`tool_requires` specifies executables like code generators or build tools that are consumed during the build but not part of the deployed package.
What does the CMake variable `CMAKE_TOOLCHAIN_FILE` specify?
Answer: A CMake script that configures compilers and tools for cross-compilation or package manager integration
`CMAKE_TOOLCHAIN_FILE` points to a script run early in configure to set up the compiler, sysroot, and flags, commonly used for cross-compilation or vcpkg integration.