CMake
What it actually generates, the configure/build/install workflow, and modern, target-based CMakeLists.txt.
sudo apt update
sudo apt install cmake -y
cmake_minimum_required(VERSION 3.20) project(MyApp VERSION 1.0 LANGUAGES CXX) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) add_executable(myapp src/main.cpp)cmake_minimum_required must be the first line — it also sets which CMake behaviors ("policies") are active, so an old CMakeLists.txt keeps building the same way even on a newer CMake. project() declares the project name, version, and languages, and must come before any target is defined.
include(FetchContent) FetchContent_Declare( googletest GIT_REPOSITORY https://github.com/google/googletest.git GIT_TAG v1.14.0 ) FetchContent_MakeAvailable(googletest) target_link_libraries(tests PRIVATE gtest_main)FetchContent_MakeAvailable downloads the dependency once (cached for later builds), then runs its CMakeLists.txt as if it were add_subdirectory()'d in — its targets (gtest_main above) become directly linkable, same as any target you defined yourself.
{
"version": 6,
"configurePresets": [
{
"name": "release",
"binaryDir": "${sourceDir}/build/release",
"cacheVariables": { "CMAKE_BUILD_TYPE": "Release" }
}
]
}