# How do I force an EXE import to always use RELEASE?

**URL:** https://discourse.cmake.org/t/how-do-i-force-an-exe-import-to-always-use-release/6723
**Category:** Usage
**Created:** [October 25, 2022, 8:58pm UTC](https://discourse.cmake.org/t/how-do-i-force-an-exe-import-to-always-use-release/6723 "2022-10-25T20:58:03Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![JRR](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/j/ecccb3/32.png) [@JRR](https://discourse.cmake.org/u/JRR)
#### Post date: [October 25, 2022, 8:58pm UTC](https://discourse.cmake.org/t/how-do-i-force-an-exe-import-to-always-use-release/6723/1 "2022-10-25T20:58:03Z")

</div>

We’ve done library export/imports for awhile and they’re great! We follow the documentation from the [Importing and Exporting Guide](https://cmake.org/cmake/help/latest/guide/importing-exporting/index.html#creating-relocatable-packages) and it all works beautifully.

We are now delving into executable exports/imports.

It seems to be working fine. We compile R, and D versions of the exe and the relocatable cmake files are being generated for this fine.

The problem we have is we only want to use the _R_elease files when using the tools. While we deploy both Release and Debug to the deploy location so Devs can access the Debug version if needed, we only want to use the _R_elease version.

However, when we are building a debug version of the tool, we are using the _D_ebug version of the exe.

I’ve achieved what I wanted by deleting the `foo-debug.cmake` file from the relocation package. But that feels hacky to me.

Can you teach me or refer me to documentation for the correct CMake way to always use the _R_elease version of an exported/imported tool even when working on a Debug image?

---

<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: [October 25, 2022, 9:56pm UTC](https://discourse.cmake.org/t/how-do-i-force-an-exe-import-to-always-use-release/6723/2 "2022-10-25T21:56:04Z")

</div>

Already asked here:

> [@How do I export (or import) just the Release version of an exeutable](https://discourse.cmake.org/t/how-do-i-export-or-import-just-the-release-version-of-an-exeutable/6707):
>
> I’ve followed the instructions for creating relocatable export packages as defined in the documenation at this location [[https://cmake.org/cmake/help/latest/guide/importing-exporting/index.html#exporting-targets](https://cmake.org/cmake/help/latest/guide/importing-exporting/index.html#exporting-targets)] We have a tool that generates Release and Debug images of the executables and creates the cmake files that allow me to use find\_package to get an imported exe target to use. I LOVE THIS! However, I only want to use the Release version of the executables. We may want to use the Debug v…

---

<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: [October 25, 2022, 9:56pm UTC](https://discourse.cmake.org/t/how-do-i-force-an-exe-import-to-always-use-release/6723/3 "2022-10-25T21:56:09Z")

</div>


