https://github.com/apriorit/findwix
CMake module for building Windows Installer packages with WiX toolset
https://github.com/apriorit/findwix
cmake cmake-module installer wix wix-toolset
Last synced: about 2 months ago
JSON representation
CMake module for building Windows Installer packages with WiX toolset
- Host: GitHub
- URL: https://github.com/apriorit/findwix
- Owner: apriorit
- License: bsd-3-clause
- Created: 2018-05-31T10:44:46.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2022-10-31T22:10:16.000Z (over 2 years ago)
- Last Synced: 2025-01-18T21:31:50.890Z (3 months ago)
- Topics: cmake, cmake-module, installer, wix, wix-toolset
- Language: CMake
- Homepage:
- Size: 17.6 KB
- Stars: 18
- Watchers: 6
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# FindWiX [](https://ci.appveyor.com/project/apriorit/findwix)
[CMake](https://cmake.org) module for building [Windows Installer](https://en.wikipedia.org/wiki/Windows_Installer) packages with [WiX toolset](http://wixtoolset.org)
* [Introduction](#introduction)
* [Requirements](#requirements)
* [Usage](#usage)
* [find_package()](#find_package)
* [wix_add_project()](#wix_add_project)
* [WiX compile and link flags](#wix-compile-and-link-flags)
* [CMake variables in WiX](#cmake-variables-in-wix)
* [CMake project dependencies in WiX](#cmake-project-dependencies-in-wix)
* [Samples](#samples)
* [License](#license)
* [Version History](#version-history)# Introduction
A native solution for building [Windows Installer](https://en.wikipedia.org/wiki/Windows_Installer) packages in [CMake](https://cmake.org) is [CPack](https://cmake.org/cmake/help/v3.0/module/CPack.html). However it has several drawbacks:
- limited to one installer project (cannot created several installers, for example `client.msi` and `server.msi`)
- cannot directly work with `wsx` files (hard to convert existings installer source code to [CMake](https://cmake.org))[FindWiX](https://github.com/apriorit/FindWiX) comes to rescue in such cases.
## Requirements
- [CMake 3.0](https://cmake.org/download/) or higher
- [WiX toolset 3.0](http://wixtoolset.org/releases/) or higher# Usage
## find_package()
Add [FindWiX](https://github.com/apriorit/FindWiX) to the module search path and call `find_package`:
```cmake
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
find_package(WIX REQUIRED)
```
[FindWiX](https://github.com/apriorit/FindWiX) will search for the installed [WiX toolset](http://wixtoolset.org), expose functions for creating installer packages and define the following variables:
- `WIX_FOUND` - if false [WiX toolset](http://wixtoolset.org) is absent
- `WIX_ROOT` - path where [WiX toolset](http://wixtoolset.org) is installed
- `WIX_COMPILE_FLAGS` - flags to be used when compiling `wxs` source files
- `WIX_LINK_FLAGS` - flags to be used when linking `wixobj` files## wix_add_project()
This function creates a new target for WiX project. It compiles one or several `wsx` files to `wixobj` files and then links them together into the resulting `msi` file.```cmake
wix_add_project(
source1 [source2 ...]
[OUTPUT_NAME ]
[EXTENSIONS extension1 [extension2...]]
[DEPENDS target1 [target2...]])
```Where:
- `` - name of the project target
- `source1 [source2 ...]` - one or several `wsx` files
- `OUTPUT_NAME` - allows to set a name for the resulting `msi` file, if omitted the name is set to ``
- `EXTENSIONS` - add one or more WiX extensions (for example `WixUIExtension`)
- `DEPENDS` - add project dependencies for the correct build order
Example:
```cmake
wix_add_project(my_project
main.wxs one_more.wxs
OUTPUT_NAME "NameSample"
EXTENSIONS WixUIExtension WixUtilExtension
DEPENDS CppExecutable)
```## WiX compile and link flags
You could do some fine tuning, for example treat warnings as errors:
```cmake
set(WIX_COMPILE_FLAGS ${WIX_COMPILE_FLAGS} -wx)
set(WIX_LINK_FLAGS ${WIX_LINK_FLAGS} -wx)
```## CMake variables in WiX
[FindWiX](https://github.com/apriorit/FindWiX) generates `vars.wxi` to make [CMake](https://cmake.org) variables available in WiX. Here is a fragment of `vars.wxi`:
```xml
...```
To get access to those variables include `vars.wxi` into your `wxs` file:
```xml
```## CMake project dependencies in WiX
Also [FindWiX](https://github.com/apriorit/FindWiX) generates `depends.wxi` with file paths to [CMake](https://cmake.org) project dependencies. Here is a fragment of `depends.wxi`:
```xml
...```
To get access to those variables include `depends.wxi` into your `wxs` file:
```xml
```# Samples
Take a look at the [samples](samples/) folder to see how to use [FindWiX](https://github.com/apriorit/FindWiX).# License
[Apriorit](http://www.apriorit.com/) released [FindWiX](https://github.com/apriorit/FindWiX) under the OSI-approved 3-clause BSD license. You can freely use it in your commercial or opensource software.# Version History
## Version 1.0.0 (20 Sep 2018)
- Initial public release