Find how a file is built
find_file_targetsFind CMake targets that compile a source file; return language, standard, flags, defines, includes, and exact compiler commands. For headers, match targets whose include paths contain them.
Instructions
Finds which targets (in which build directories and configurations) compile a given source file, and returns the effective language, standard, flags, defines and include directories from the File API together with the exact compiler command(s) from the build directory's compile_commands.json. For headers not listed as sources, returns targets whose include directories contain the file. Searches all known build directories unless buildDir is given.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file | Yes | Path to the file (absolute or relative to a workspace root). | |
| buildDir | No | Build directory (absolute, or relative to a workspace root). A source directory with a single build directory is also accepted. May be omitted when the workspace has exactly one build directory. | |
| configuration | No | Build configuration (e.g. Debug, Release) for multi-config generators. Defaults to the first one. | |
| includeBacktraces | No |