# CMake Error Generator Visual Studio 16 2019 does not support variabl CMAKE\_DEFAULT\_BUILD\_TYPE but it has been specified

**URL:** <https://discourse.slicer.org/t/cmake-error-generator-visual-studio-16-2019-does-not-support-variabl-cmake-default-build-type-but-it-has-been-specified/18873>\
**Category:** Development\
**Tags:** build\
**Created:** [July 22, 2021, 1:22pm UTC](https://discourse.slicer.org/t/cmake-error-generator-visual-studio-16-2019-does-not-support-variabl-cmake-default-build-type-but-it-has-been-specified/18873 "2021-07-22T13:22:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ciparnieks](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ciparnieks/32/11740_2.png) [@Ciparnieks](https://discourse.slicer.org/u/Ciparnieks)\
**Post date:** [July 22, 2021, 1:22pm UTC](https://discourse.slicer.org/t/cmake-error-generator-visual-studio-16-2019-does-not-support-variabl-cmake-default-build-type-but-it-has-been-specified/18873/1 "2021-07-22T13:22:13Z")

</div>

Hello,

When i in Cmake GUI pushing the Generate i have the error  
CMake Error Generator Visual Studio 16 2019 does not support variabl CMAKE\_DEFAULT\_BUILD\_TYPE but it has been specified.

How to solve this problem?

 ![Screenshot_1](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/0/b/0b69fae0e21579e7bd2968672de1da1157e55539.jpeg)

---

<div class="post-metadata">

**Author:** ![Ciparnieks](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ciparnieks/32/11740_2.png) [@Ciparnieks](https://discourse.slicer.org/u/Ciparnieks)\
**Post date:** [July 22, 2021, 1:22pm UTC](https://discourse.slicer.org/t/cmake-error-generator-visual-studio-16-2019-does-not-support-variabl-cmake-default-build-type-but-it-has-been-specified/18873/2 "2021-07-22T13:22:09Z")

</div>

Hello, Fallowed instruction in [Windows — 3D Slicer documentation]

After Configure - When i Push the Button in CMAKE GUI - \> Generate i got the ERROR mesage

CMake Error:  
Generator

```
Visual Studio 16 2019

```

does not support variable

```
CMAKE_DEFAULT_BUILD_TYPE

```

but it has been specified.

What i must to doo to avoid the this error? How to solve the this problem?

 ![Screenshot_1](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/0/b/0b69fae0e21579e7bd2968672de1da1157e55539.jpeg)

Program Versions:  
CMAKE 3.20.5  
QT 5.15.2 D:/QT/5.15.2/msvc2019\_64/lib/cmake/Qt5

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [July 22, 2021, 1:27pm UTC](https://discourse.slicer.org/t/cmake-error-generator-visual-studio-16-2019-does-not-support-variabl-cmake-default-build-type-but-it-has-been-specified/18873/3 "2021-07-22T13:27:22Z")

</div>

The solution is not to specify this variable. Visual Studio is a multi-configuration generator. You can have all your configurations in one build tree.

Due to complexity of Slicer’s build system, we recommend to create a separate build tree for each configuration (we do not test if building with different configurations in the same build tree works or not, so probably it does not work). This means that after you build Slicer in Debug mode, you need to create a new build tree if you want to build in release mode as well.
