# add dependinfo to custom target

**URL:** https://discourse.cmake.org/t/add-dependinfo-to-custom-target/1276
**Category:** Usage
**Created:** [May 27, 2020, 5:27am UTC](https://discourse.cmake.org/t/add-dependinfo-to-custom-target/1276 "2020-05-27T05:27:21Z")
**Posts on this page:** 2
**Page:** 1

<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: [May 27, 2020, 5:27am UTC](https://discourse.cmake.org/t/add-dependinfo-to-custom-target/1276/1 "2020-05-27T05:27:21Z")

</div>

When I set an executable:

```cmake
enable_language(CXX)
add_executable( MyProj_MyExe2 main.cc )

```

CMake populates `CMAKE_DEPENDS_LANGUAGES` in `DependInfo.cmake`:

```cmake
# The set of languages for which implicit dependencies are needed:
set(CMAKE_DEPENDS_LANGUAGES
  "CXX"
  )

```

for a custom target, it does not:

```cmake
# The set of languages for which implicit dependencies are needed:
set(CMAKE_DEPENDS_LANGUAGES
  )

```

How can I set `CMAKE_DEPENDS_LANGUAGES`? I tried by setting the Linker Language

```cmake
add_custom_target( MyProj_MyExe1 ALL
	DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/MyExe1
	SOURCES main.cc
)
set_target_properties( MyProj_MyExe1 PROPERTIES
	LINKER_LANGUAGE CXX
)

```

but it doesn’t work. Is `CMAKE_DEPENDS_LANGUAGES` a directory property?

---

<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: [November 9, 2020, 9:39pm UTC](https://discourse.cmake.org/t/add-dependinfo-to-custom-target/1276/2 "2020-11-09T21:39:29Z")

</div>

What is your `add_custom_target` trying to do? Custom targets (and commands) currently do not support depfile-like dependency discovery (except `add_custom_command(DEPFILE)` which only works with Ninja).
