# Building on Windows

**URL:** https://discourse.kitware.com/t/building-on-windows/748
**Category:** Build & Install
**Created:** [December 27, 2021, 8:12pm UTC](https://discourse.kitware.com/t/building-on-windows/748 "2021-12-27T20:12:12Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Stan\_Hammon](https://discourse.kitware.com/user_avatar/discourse.kitware.com/stan_hammon/32/487_2.png) [@Stan\_Hammon](https://discourse.kitware.com/u/Stan_Hammon)
#### Post date: [December 27, 2021, 8:12pm UTC](https://discourse.kitware.com/t/building-on-windows/748/1 "2021-12-27T20:12:12Z")

</div>

This is intended to be a guide for building the sequence of `cmb-superbuild`, `smtk`, and `cmb` on Windows.

In Windows, you are limited to build Release or RelWithDebInfo (Release with Debug Info). CMake will not configure either the `cmb-superbuild` or `smtk` in `Debug` for reasons [INSERT REASON HERE].

You should take care to not make your build path too verbose. Especially for `smtk`, the nested directories and file name can be quite long. If you use a build path longer than about 42 characters, you may run afoul of the windows path length limit.

These steps were performed on:  
Windows 11  
Qt 5.15.2  
MSVC 2019 (compiler)  
Qt Creator 6.0.0

# CMB\_SUPERBUILD

## Command Line:

Run

```auto
cmake -GNinja -DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo -DQt5_DIR:PATH=C:\Qt\5.15.2\msvc2019_64\lib\cmake\Qt5 -DCMAKE_PREFIX_PATH:STRING=install -DDEVELOPER_MODE_cmb:BOOL=ON -DDEVELOPER_MODE_smtk:BOOL=ON ../source

```

in the build directory.

In an exploded format:

```auto
cmake 
-GNinja 
-DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo 
-DQt5_DIR:PATH=C:\Qt\5.15.2\msvc2019_64\lib\cmake\Qt5 <--- set to location of Qt5Config.cmake
-DCMAKE_PREFIX_PATH:STRING=install 
-DDEVELOPER_MODE_cmb:BOOL=ON 
-DDEVELOPER_MODE_smtk:BOOL=ON 
../source <--- path adjusted for your build environment

```

## Qt Creator:

Open the Project Build settings (in Project tab) - if CMake parameters are not yet populated, run cmake to do an initial setup.

In the Key-Value edit window, you should find and set:

```auto
DEVELOPER_MODE_cmb:BOOL=ON
DEVELOPER_MODE_smtk:BOOL=ON

```

# SMTK

## Command line:

Run

```auto
cmake -GNinja -CC:\projects\cmb-superbuild\RelWithDebInfo\smtk-developer-config.cmake -DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo -D_smtk_superbuild_prefix:PATH=C:\projects\cmb-superbuild\RelWithDebInfo\install -DSMTK_UNIFIED_INSTALL_TREE:BOOL=ON -DSMTK_DLL_PATHS:STRING=C:/Qt/5.15.2\msvc2019_64/bin -DSMTK_USE_SYSTEM_MOAB:BOOL=ON -DLibArchive_INCLUDE_DIR=C:\projects\cmb-superbuild-commandline/RelWithDebInfo\install\include -DLibArchive_LIBRARY=C:\projects\cmb-superbuild-commandline/RelWithDebInfo\install\lib\archive.lib ../source

```

in the build directory.

In an exploded format:

```auto
cmake 
-GNinja 
-CC:\projects\cmb-superbuild\RelWithDebInfo\smtk-developer-config.cmake <--- path adjusted for your build environment
-DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo 
-D_smtk_superbuild_prefix:PATH=C:\projects\cmb-superbuild\RelWithDebInfo\install <--- path adjusted for your build environment
-DSMTK_UNIFIED_INSTALL_TREE:BOOL=ON  
-DSMTK_DLL_PATHS:STRING=C:/Qt/5.15.2\msvc2019_64/bin <--- set to location of Qt DLLs
-DSMTK_USE_SYSTEM_MOAB:BOOL=ON 
-DLibArchive_INCLUDE_DIR=C:\projects\cmb-superbuild/RelWithDebInfo\install\include <--- path adjusted for your build environment
-DLibArchive_LIBRARY=C:\projects\cmb-superbuild/RelWithDebInfo\install\lib\archive.lib <--- path adjusted for your build environment
../source <--- path adjusted for your build environment

```

## Qt Creator:

Open the Project Build settings (in Project tab) - if CMake parameters are not yet populated, run cmake to do an initial setup.

Add/Edit these `Initial CMake Parameters` to those already present:

```auto
-CC:/projects/cmb-superbuild/5_15_VS19_64RDb/smtk-developer-config.cmake
-DCMAKE_PREFIX_PATH:STRING=%{Qt:QT_INSTALL_PREFIX};C:/projects/cmb-superbuild/5_15_VS19_64RDb/install/share/cmake/pybind11
-DLibArchive_INCLUDE_DIR=C:/projects/cmb-superbuild/5_15_VS19_64RDb/install/include
-DLibArchive_LIBRARY=C:/projects/cmb-superbuild/5_15_VS19_64RDb/install/lib/archive.lib

```

# CMB

## Command line:

Run

```auto
cmake -GNinja -DCMAKE_BUILD_TYPE:STRING=RelWithDebInf -Dsmtk_DIR:PATH=C:\projects\smtk\RelWithDebInfo ../source

```

in the build directory.

In an exploded format:

```auto
cmake 
-GNinja 
-DCMAKE_BUILD_TYPE:STRING=RelWithDebInf 
-Dsmtk_DIR:PATH=C:\projects\smtk\RelWithDebInfo <--- path adjusted for your build environment
../source <--- path adjusted for your build environment

```

## Qt Creator:

Open the Project Build settings (in Project tab) - if CMake parameters are not yet populated, run cmake to do an initial setup.

Add/Edit these `Initial CMake Parameters` to those already present:

```auto
-Dsmtk_DIR:PATH=C:/projects/smtk/5_15_VS19_64RDb <--- path adjusted for your build environment

```

Open the Project Run settings (in Project tab).  
In the `Environment` section, edit the `Path` variable to include:

```auto
C:\projects\cmb-superbuild\5_15_VS19_64RDb\install\Python <--- path adjusted for your build environment

```

Add a value for `PYTHOMHOME` (if it is not yet present) to be:

```auto
C:\projects\cmb-superbuild\5_15_VS19_64RDb\install\Python <--- path adjusted for your build environment

```

Once the paths are adjusted for the specifics of your build environment, these steps should allow you work around the configuration difference you will encounter in a Windows development environment.

---

<div class="post-metadata">

### Author: ![Stan\_Hammon](https://discourse.kitware.com/user_avatar/discourse.kitware.com/stan_hammon/32/487_2.png) [@Stan\_Hammon](https://discourse.kitware.com/u/Stan_Hammon)
#### Post date: [December 27, 2021, 8:19pm UTC](https://discourse.kitware.com/t/building-on-windows/748/2 "2021-12-27T20:19:19Z")

</div>

@Bob_Obara @johnt  
“New users can only mention two users in a post”  
Can one of you @ the rest of the crowd for me?  
ben.boeckel aron.helser Ryan\_Krattiger dcthomp C\_Wetterer-Nelson

---

<div class="post-metadata">

### Author: ![Bob\_Obara](https://discourse.kitware.com/user_avatar/discourse.kitware.com/bob_obara/32/37_2.png) [@Bob\_Obara](https://discourse.kitware.com/u/Bob_Obara)
#### Post date: [December 27, 2021, 9:15pm UTC](https://discourse.kitware.com/t/building-on-windows/748/3 "2021-12-27T21:15:14Z")

</div>

@ben.boeckel @aron.helser @Ryan_Krattiger @dcthomp @C_Wetterer-Nelson FYI
