# Minimum required CMake version cmake_minimum_required(VERSION 3.10)
---
For a clean, professional project, it is best practice to use "out-of-source" builds, which keeps your generated build files separate from your source code. A simple example — Modern CMake minimal cmake pdf free download
# Minimal CMake in 10 Minutes
Build and run your project:
```bash cmake . This will generate build files in the current directory.
: A two-page visual reference for common commands like target_link_libraries and include_directories . 1. Create these two files:<
Here's a minimal example of a CMakeLists.txt file that builds a simple C++ executable:
add_executable(myapp main.cpp) </code></pre> <h2>Step-by-Step</h2> <h3>1. Create these two files:</h3> <p><strong>main.cpp</strong></p> <pre><code class="language-cpp">#include <iostream> int main() std::cout << "Hello, CMake!\n"; return 0; int main() std::cout <