# CMake ExternalProject addon forcing install path to c:/program files and ignoring INSTALL\_PATH option

**URL:** <https://discourse.cmake.org/t/cmake-externalproject-addon-forcing-install-path-to-c-program-files-and-ignoring-install-path-option/342>\
**Category:** Code\
**Created:** [December 9, 2019, 11:16pm UTC](https://discourse.cmake.org/t/cmake-externalproject-addon-forcing-install-path-to-c-program-files-and-ignoring-install-path-option/342 "2019-12-09T23:16:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ethindp](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/e/eb9ed0/32.png) [@ethindp](https://discourse.cmake.org/u/ethindp)\
**Post date:** [December 9, 2019, 11:16pm UTC](https://discourse.cmake.org/t/cmake-externalproject-addon-forcing-install-path-to-c-program-files-and-ignoring-install-path-option/342/1 "2019-12-09T23:16:30Z")

</div>

This is incredibly confusing. I have the following CMake code in my CMakeLists.txt:

```cmake
list(APPEND CMAKE_ARGS "-DSCRIPT_API=C#" "-DBSF_ENABLE_EXCEPTIONS=On" "-DAUDIO_MODULE=OpenAudio" "-DBSF_PLUGIN_IMGUI=Off" "-DRENDER_API_MODULE=Vulkan" "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}")
ExternalProject_Add(
bsf
PREFIX "deps"
TMP_DIR "deps/tmp/bsf"
STAMP_DIR "deps/stamps/bsf"
LOG_DIR "deps/logs/bsf"
DOWNLOAD_DIR "deps/downloads/bsf"
SOURCE_DIR "deps/sources/bsf"
INSTALL_DIR "deps/install/bsf"
GIT_REPOSITORY "https://github.com/GameFoundry/bsf"
GIT_PROGRESS true
SOURCE_SUBDIR ""
BUILD_ALWAYS true
CMAKE_ARGS ${CMAKE_ARGS}
LOG_CONFIGURE true
LOG_DOWNLOAD true
LOG_UPDATE true
LOG_PATCH true
LOG_BUILD true
LOG_INSTALL true
LOG_TEST true
LOG_OUTPUT_ON_FAILURE true
BINARY_DIR "deps/bin"
)

```

Yet for some reason CMake is forcing the install path to c:\program files\bsf. It does this with everything else I try including this way and its downright irritating. Is there a way to get the expected behavior?

---

<div class="post-metadata">

**Author:** ![ethindp](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/e/eb9ed0/32.png) [@ethindp](https://discourse.cmake.org/u/ethindp)\
**Post date:** [December 10, 2019, 2:40am UTC](https://discourse.cmake.org/t/cmake-externalproject-addon-forcing-install-path-to-c-program-files-and-ignoring-install-path-option/342/2 "2019-12-10T02:40:02Z")

</div>

OK, so to fix this problem I had to explicitly define CMAKE\_INSTALL\_PREFIX in CMAKE\_ARGS.

---

<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:** [December 10, 2019, 2:25pm UTC](https://discourse.cmake.org/t/cmake-externalproject-addon-forcing-install-path-to-c-program-files-and-ignoring-install-path-option/342/3 "2019-12-10T14:25:43Z")

</div>

Defining `CMAKE_INSTALL_PREFIX` in `CMAKE_ARGS` is the intended way to do this.

The [ExternalProject](https://cmake.org/cmake/help/v3.16/module/ExternalProject.html) documentation for `INSTALL_DIR` states:

> … This does not actually configure the external project to install to the given prefix. That must be done by passing appropriate arguments to the external project configuration step
