# Definition of "main file" as used in cmake-generator-expressions(7)

**URL:** https://discourse.cmake.org/t/definition-of-main-file-as-used-in-cmake-generator-expressions-7/649
**Category:** Usage
**Created:** [February 18, 2020, 9:38am UTC](https://discourse.cmake.org/t/definition-of-main-file-as-used-in-cmake-generator-expressions-7/649 "2020-02-18T09:38:19Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![jwuttke](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/j/9dc877/32.png) [@jwuttke](https://discourse.cmake.org/u/jwuttke)
#### Post date: [February 18, 2020, 9:38am UTC](https://discourse.cmake.org/t/definition-of-main-file-as-used-in-cmake-generator-expressions-7/649/1 "2020-02-18T09:38:19Z")

</div>

Help page cmake-generator-expresions(7), section Target-Dependent Queries, depends heavily on the notion of a “main file”. What is meant by this?

---

<div class="post-metadata">

### Author: ![hex](https://discourse.cmake.org/user_avatar/discourse.cmake.org/hex/32/363_2.png) [@hex](https://discourse.cmake.org/u/hex)
#### Post date: [February 18, 2020, 12:03pm UTC](https://discourse.cmake.org/t/definition-of-main-file-as-used-in-cmake-generator-expressions-7/649/2 "2020-02-18T12:03:06Z")

</div>

I guess this “main file” is meant to be a top-level `<target>`. A top-level target is one created by one of the [`add_executable()`](https://cmake.org/cmake/help/v3.17/command/add_executable.html#command:add_executable), [`add_library()`](https://cmake.org/cmake/help/v3.17/command/add_library.html#command:add_library), or [`add_custom_target()`](https://cmake.org/cmake/help/v3.17/command/add_custom_target.html#command:add_custom_target) commands (but not targets generated by CMake like `install` ).

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [February 18, 2020, 2:41pm UTC](https://discourse.cmake.org/t/definition-of-main-file-as-used-in-cmake-generator-expressions-7/649/3 "2020-02-18T14:41:34Z")

</div>

@brad.king

---

<div class="post-metadata">

### Author: ![brad.king](https://discourse.cmake.org/user_avatar/discourse.cmake.org/brad.king/32/11_2.png) [@brad.king](https://discourse.cmake.org/u/brad.king)
#### Post date: [February 18, 2020, 3:12pm UTC](https://discourse.cmake.org/t/definition-of-main-file-as-used-in-cmake-generator-expressions-7/649/4 "2020-02-18T15:12:20Z")

</div>

@jwuttke that documentation could certainly use clarification. The use of “main file” refers to the runtime artifact for shared libraries and executables (`.so`, `.dll`, or `.exe` but not their `.lib` import library), and for static libraries it refers to the static library itself.

---

<div class="post-metadata">

### Author: ![jwuttke](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/j/9dc877/32.png) [@jwuttke](https://discourse.cmake.org/u/jwuttke)
#### Post date: [February 20, 2020, 6:51am UTC](https://discourse.cmake.org/t/definition-of-main-file-as-used-in-cmake-generator-expressions-7/649/5 "2020-02-20T06:51:18Z")

</div>

Thanks to all of you. See now [https://gitlab.kitware.com/cmake/cmake/merge\_requests/4378](https://gitlab.kitware.com/cmake/cmake/merge_requests/4378)
