# CMAKE\_CFG\_INTDIR and file(INSTALL)

**URL:** https://discourse.cmake.org/t/cmake-cfg-intdir-and-file-install/2169
**Category:** Usage
**Created:** [November 13, 2020, 2:19pm UTC](https://discourse.cmake.org/t/cmake-cfg-intdir-and-file-install/2169 "2020-11-13T14:19:04Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![starseeker](https://discourse.cmake.org/user_avatar/discourse.cmake.org/starseeker/32/4923_2.png) [@starseeker](https://discourse.cmake.org/u/starseeker)
#### Post date: [November 13, 2020, 2:19pm UTC](https://discourse.cmake.org/t/cmake-cfg-intdir-and-file-install/2169/1 "2020-11-13T14:19:04Z")

</div>

When attempting to use an install line of the following form with the NSIS package generator:

```auto
add_custom_command(
      OUTPUT ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/outfile
      COMMAND gen_file ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/outfile
      DEPENDS gen_file
      )
install(FILES ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/outfile DESTINATION data)

```

I’m getting the following error and I’m not sure how to interpret it:

```auto
CMake Error at C:/project/build/cmake_install.cmake:65 (file):
   file INSTALL cannot find
   "C:/project/build/$(Configuration)/outfile":
   File exists.

```

The configuration is Release, and if I look in the release directory the file is indeed present - what is this error referring to? (The same build, by the way, does work with Release configuration of the Ninja Multi-Config generator on Linux…)

---

<div class="post-metadata">

### Author: ![Angew](https://discourse.cmake.org/user_avatar/discourse.cmake.org/angew/32/229_2.png) [@Angew](https://discourse.cmake.org/u/Angew)
#### Post date: [November 13, 2020, 2:24pm UTC](https://discourse.cmake.org/t/cmake-cfg-intdir-and-file-install/2169/2 "2020-11-13T14:24:06Z")

</div>

`${CMAKE_CFG_INTDIR}` expands to `$(Configuration)` under VS. `$(Configuration)` is a Visual Studio User macro and is thus only interpreted correctly when VS is interpreting the path. The arguments to `install()` are instead interpreted by CMake at install time (they are embedded in `cmake_install.cmake`), and so `$(Configuration)` is just a literal string in that context.

Since `install()` supports generator expressions in the source arguments, you can use a suitable genex there instead:

```auto
install(FILES ${CMAKE_BINARY_DIR}/$<CONFIG>/outfile DESTINATION data)

```
