GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - apriorit/FindWiX: CMake module for building Windows Installer packages with WiX toolset

BranchesTags
Open more actions menu

Latest commit

 

History

17 Commits
17 Commits

Folders and files

NameName
Last commit message
Last commit date
cmake
cmake
 
 
samples
samples
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
appveyor.yml
appveyor.yml
 
 

Repository files navigation

FindWiX Build status

CMake module for building Windows Installer packages with WiX toolset

  • Introduction
    • Requirements
  • Usage
    • find_package()
    • wix_add_project()
    • WiX compile and link flags
    • CMake variables in WiX
    • CMake project dependencies in WiX
  • Samples
  • License
  • Version History

Introduction

A native solution for building Windows Installer packages in CMake is CPack. 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)

FindWiX comes to rescue in such cases.

Requirements

  • CMake 3.0 or higher
  • WiX toolset 3.0 or higher

Usage

find_package()

Add FindWiX to the module search path and call find_package:

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
find_package(WIX REQUIRED)

FindWiX will search for the installed WiX toolset, expose functions for creating installer packages and define the following variables:

  • WIX_FOUND - if false WiX toolset is absent
  • WIX_ROOT - path where WiX toolset 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.

wix_add_project(<name>
    source1 [source2 ...]
    [OUTPUT_NAME <msi_file_name>]
    [EXTENSIONS extension1 [extension2...]]
    [DEPENDS target1 [target2...]])

Where:

  • <name> - 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 <name>
  • EXTENSIONS - add one or more WiX extensions (for example WixUIExtension)
  • DEPENDS - add project dependencies for the correct build order

Example:

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:

set(WIX_COMPILE_FLAGS ${WIX_COMPILE_FLAGS} -wx)
set(WIX_LINK_FLAGS ${WIX_LINK_FLAGS} -wx)

CMake variables in WiX

FindWiX generates vars.wxi to make CMake variables available in WiX. Here is a fragment of vars.wxi:

<?xml version='1.0' encoding='UTF-8'?>
<Include>
    <?define ARGC='4' ?>
    <?define ARGN='Main.wxs;DEPENDS;CppExecutable' ?>
    <?define ARGV='WithExecutable;Main.wxs;DEPENDS;CppExecutable' ?>
    <?define ARGV0='WithExecutable' ?>
    <?define ARGV1='Main.wxs' ?>
    <?define ARGV2='DEPENDS' ?>
    <?define ARGV3='CppExecutable' ?>
    <?define CMAKE_AR='' ?>
    <?define CMAKE_AUTOMOC_COMPILER_PREDEFINES='ON' ?>
    <?define CMAKE_AUTOMOC_MACRO_NAMES='Q_OBJECT;Q_GADGET;Q_NAMESPACE' ?>
    ...
</Include>

To get access to those variables include vars.wxi into your wxs file:

<?include vars.wxi?> <!--cmake variables and their values-->

CMake project dependencies in WiX

Also FindWiX generates depends.wxi with file paths to CMake project dependencies. Here is a fragment of depends.wxi:

<?xml version='1.0' encoding='UTF-8'?>
<Include>
    <?define TARGET_FILE:CppExecutable='C:/my_proj/WithExecutable/Debug/CppExecutable.exe' ?>
    <?define TARGET_PDB_FILE:CppExecutable='C:/my_proj/WithExecutable/Debug/CppExecutable.pdb' ?>
    ...
</Include>

To get access to those variables include depends.wxi into your wxs file:

<?include depends.wxi?> <!--paths to cmake dependencies-->

Samples

Take a look at the samples folder to see how to use FindWiX.

License

Apriorit released 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

About

CMake module for building Windows Installer packages with WiX toolset

Topics

cmakecmake-moduleinstallerwixwix-toolset

Resources

Readme
BSD-3-Clause license
Activity
Custom properties

Stars

18 stars

Watchers

5 watching

Forks

5 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.