Get CMake Built-in Modules Location

Get CMake Built-in Modules Location

When working with CMake, it is sometimes useful to inspect or debug how built-in modules such as FindGit.cmake are working. These built-in modules are part of CMake installation and are stored in a predefined directory referred to as CMAKE_ROOT. Knowing this location helps when examining default behavior, analyzing sources, or understanding how specific modules works. This tutorial explains how to get CMake built-in modules location.

CMake exposes system-level configuration details through a command-line option. Run the following command:

cmake --system-information | findstr "CMAKE_ROOT"
cmake --system-information | grep CMAKE_ROOT

Example output:

CMAKE_ROOT "C:/Program Files/cmake/share/cmake-4.3"
CMAKE_ROOT "/usr/share/cmake-4.3"

The provided directory contains CMake standard distribution files. Inside this location, a Modules subdirectory holds the collection of built-in modules.

Leave a Comment

Cancel reply

Your email address will not be published.