# How to Pass CMake variables into Wix fragments?

**URL:** https://discourse.cmake.org/t/how-to-pass-cmake-variables-into-wix-fragments/8664
**Category:** Usage
**Tags:** cpack:wix
**Created:** [August 2, 2023, 3:37pm UTC](https://discourse.cmake.org/t/how-to-pass-cmake-variables-into-wix-fragments/8664 "2023-08-02T15:37:54Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![gergap](https://discourse.cmake.org/user_avatar/discourse.cmake.org/gergap/32/3665_2.png) [@gergap](https://discourse.cmake.org/u/gergap)
#### Post date: [August 2, 2023, 3:37pm UTC](https://discourse.cmake.org/t/how-to-pass-cmake-variables-into-wix-fragments/8664/1 "2023-08-02T15:37:54Z")

</div>

I’m currently struggeling with a custom CPackWiXPatch file where I’m referencing a bmp file for a dialog banner.  
I can use a hardcoded path (for testing) which works, but I need to make this relative to CMAKE\_SOURCE\_DIR. It is easy in Wix to use variables like `<Binary Id="MyBitmap" SourceFile="$(var.FOOBAR)/bitmap.bmp" />` but I cannot modify the generated cpack\_variables.wxi file, which contains a fix set of variables. (This would be a nice feature, though).

By defining `SET(CPACK_WIX_PROPERTY_SETUPDIR "${CMAKE_SOURCE_DIR}\\km\\setup")`  
I can create the file `properties.wxi`, which gets included by the main Wix project, but I don’t know how I should use this.

1. The `$(var)` syntax requires a pre-processor define, not a property
2. `[SETUPDIR]\bitmap.bmp` produces a file not found error. The message contains the literal `[SETUPDIR`] string, so this doesn’t get replaced
3. `"!(bind.property.SETUPDIR)\bitmap.bmp" ` also doesn’t work.

How are these properties supposed to work?
