# Slicer 5.8.1 C++20 support

**URL:** <https://discourse.slicer.org/t/slicer-5-8-1-c-20-support/43097>\
**Category:** Support\
**Created:** [May 25, 2025, 10:49pm UTC](https://discourse.slicer.org/t/slicer-5-8-1-c-20-support/43097 "2025-05-25T22:49:34Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![sogo](https://avatars.discourse-cdn.com/v4/letter/s/779978/32.png) [@sogo](https://discourse.slicer.org/u/sogo)\
**Post date:** [May 25, 2025, 10:49pm UTC](https://discourse.slicer.org/t/slicer-5-8-1-c-20-support/43097/1 "2025-05-25T22:49:34Z")

</div>

**Build config**  
Slicer Tag 5.8.1  
OS = Windows 11 pro 24H2  
Visual studio = 2019 v16.11.31, toolset v142  
CMake 3.28.0-rc2  
QT5 5.15.17

Hi, I am trying to build Slicer with variable “CMAKE\_CXX\_STANDARD” set to ‘20’ but running into errors for dependencies. While attaching some parts of build logs showing errors, complete logs can be shared. I wanted to confirm if above build configuration is okay and if Slicer can support building with C++20 version, please do let me know if any further information required.

> 20\>No install step for ‘RapidJSON’  
> 20\>Completed ‘RapidJSON’  
> 6\> lz\_encoder\_mf.c  
> 21\> qRestResult.cpp  
> 6\> fastpos\_table.c  
> 26\>-- Performing Test HAVE\_DIRENT\_H - Failed  
> 26\>-- Performing Test HAVE\_SYS\_NDIR\_H  
> 6\> lzma2\_decoder.c  
> 3\>-- Looking for sys/stat.h - found  
> 3\>-- Looking for unistd.h  
> 6\> lzma2\_encoder.c  
> 25\>-- Detecting C compiler ABI info - done  
> 25\>-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe - skipped  
> 25\>-- Detecting C compile features  
> 25\>-- Detecting C compile features - done  
> 25\>-- Detecting CXX compiler ABI info  
> 25\>CMake Error in C:/D/bb/Slicer/DCMTK-build/CMakeFiles/CMakeScratch/TryCompile-dvyhe4/CMakeLists.txt:  
> 25\> The target named “cmTC\_c2835” has C++ sources that may use modules, but  
> 25\> modules are not supported by this generator. See the cmake-cxxmodules(7)  
> 25\> manual and the CMAKE\_CXX\_SCAN\_FOR\_MODULES variable.  
> 25\>  
> 25\>  
> 25\>CMake Error in C:/D/bb/Slicer/DCMTK-build/CMakeFiles/CMakeScratch/TryCompile-dvyhe4/CMakeLists.txt:  
> 25\> The target named “cmTC\_c2835” has C++ sources that may use modules, but  
> 25\> modules are not supported by this generator. See the cmake-cxxmodules(7)  
> 25\> manual and the CMAKE\_CXX\_SCAN\_FOR\_MODULES variable.  
> 25\>  
> 25\>  
> 25\>CMake Error in C:/D/bb/Slicer/DCMTK-build/CMakeFiles/CMakeScratch/TryCompile-dvyhe4/CMakeLists.txt:  
> 25\> The target named “cmTC\_c2835” has C++ sources that may use modules, but  
> 25\> modules are not supported by this generator. See the cmake-cxxmodules(7)  
> 25\> manual and the CMAKE\_CXX\_SCAN\_FOR\_MODULES variable.  
> 25\>  
> 25\>  
> 25\>CMake Error in C:/D/bb/Slicer/DCMTK-build/CMakeFiles/CMakeScratch/TryCompile-dvyhe4/CMakeLists.txt:  
> 25\> The target named “cmTC\_c2835” has C++ sources that may use modules, but  
> 25\> modules are not supported by this generator. See the cmake-cxxmodules(7)  
> 25\> manual and the CMAKE\_CXX\_SCAN\_FOR\_MODULES variable.  
> 25\>  
> 25\>  
> 25\>CMake Error in C:/D/bb/Slicer/DCMTK-build/CMakeFiles/CMakeScratch/TryCompile-dvyhe4/CMakeLists.txt:  
> 25\> The target named “cmTC\_c2835” has C++ sources that may use modules, but  
> 25\> modules are not supported by this generator. See the cmake-cxxmodules(7)  
> 25\> manual and the CMAKE\_CXX\_SCAN\_FOR\_MODULES variable.  
> 25\>  
> 25\>  
> 25\>CMake Error in C:/D/bb/Slicer/DCMTK-build/CMakeFiles/CMakeScratch/TryCompile-dvyhe4/CMakeLists.txt:  
> 25\> The target named “cmTC\_c2835” has C++ sources that may use modules, but  
> 25\> modules are not supported by this generator. See the cmake-cxxmodules(7)  
> 25\> manual and the CMAKE\_CXX\_SCAN\_FOR\_MODULES variable.  
> 25\>  
> 25\>  
> 25\>CMake Error in C:/D/bb/Slicer/DCMTK-build/CMakeFiles/CMakeScratch/TryCompile-dvyhe4/CMakeLists.txt:  
> 25\> The target named “cmTC\_c2835” has C++ sources that may use modules, but  
> 25\> modules are not supported by this generator. See the cmake-cxxmodules(7)  
> 25\> manual and the CMAKE\_CXX\_SCAN\_FOR\_MODULES variable.  
> 25\>  
> 25\>  
> 25\>CMake Error in C:/D/bb/Slicer/DCMTK-build/CMakeFiles/CMakeScratch/TryCompile-dvyhe4/CMakeLists.txt:  
> 25\> The target named “cmTC\_c2835” has C++ sources that may use modules, but  
> 25\> modules are not supported by this generator. See the cmake-cxxmodules(7)  
> 25\> manual and the CMAKE\_CXX\_SCAN\_FOR\_MODULES variable.  
> 25\>  
> 25\>  
> 25\>CMake Error at C:/Program Files/CMake/share/cmake-3.28/Modules/CMakeDetermineCompilerABI.cmake:57 (try\_compile):  
> 25\> Failed to generate test project build system.  
> 25\>Call Stack (most recent call first):  
> 25\> C:/Program Files/CMake/share/cmake-3.28/Modules/CMakeTestCXXCompiler.cmake:26 (CMAKE\_DETERMINE\_COMPILER\_ABI)  
> 25\> CMakeLists.txt:5 (project)  
> 25\>  
> 25\>  
> 25\>-- Configuring incomplete, errors occurred!  
> 6\> lzma\_decoder.c  
> 25\>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(241,5): error MSB8066: Custom build for ‘C:\D\bb\Slicer\CMakeFiles\a74a0b095844deb4c181312ab40b5ea4\DCMTK-mkdir.rule;C:\D\bb\Slicer\CMakeFiles\a74a0b095844deb4c181312ab40b5ea4\DCMTK-download.rule;C:\D\bb\Slicer\CMakeFiles\a74a0b095844deb4c181312ab40b5ea4\DCMTK-update.rule;C:\D\bb\Slicer\CMakeFiles\a74a0b095844deb4c181312ab40b5ea4\DCMTK-patch.rule;C:\D\bb\Slicer\CMakeFiles\a74a0b095844deb4c181312ab40b5ea4\DCMTK-configure.rule;C:\D\bb\Slicer\CMakeFiles\a74a0b095844deb4c181312ab40b5ea4\DCMTK-build.rule;C:\D\bb\Slicer\CMakeFiles\a74a0b095844deb4c181312ab40b5ea4\DCMTK-generate\_project\_description.rule;C:\D\bb\Slicer\CMakeFiles\a74a0b095844deb4c181312ab40b5ea4\DCMTK-install.rule;C:\D\bb\Slicer\CMakeFiles\a77f4a0adba767bf958116c8b11e7004\DCMTK-complete.rule;C:\D\bb\Slicer\CMakeFiles\c326b9adf37e782152a9db02077a0894\DCMTK.rule;C:\D\Slicer\CMakeLists.txt’ exited with code 1.  
> 25\>Done building project “DCMTK.vcxproj” – FAILED.  
> 6\> lzma\_encoder.c  
> 26\>-- Performing Test HAVE\_SYS\_NDIR\_H - Failed  
> 6\> Generating Code…

> 45\> encodingRaw.c  
> 45\> encodingZRL.c  
> 44\>-- The C compiler identification is MSVC 19.29.30152.0  
> 45\> endianNrrd.c  
> 45\> Generating Code…  
> 44\>-- Detecting CXX compiler ABI info  
> 44\>CMake Error in C:/D/bb/Slicer/ITK-build/CMakeFiles/CMakeScratch/TryCompile-xpji6u/CMakeLists.txt:  
> 44\> The target named “cmTC\_cebee” has C++ sources that may use modules, but  
> 44\> modules are not supported by this generator. See the cmake-cxxmodules(7)  
> 44\> manual and the CMAKE\_CXX\_SCAN\_FOR\_MODULES variable.  
> 44\>  
> 44\>  
> 44\>CMake Error in C:/D/bb/Slicer/ITK-build/CMakeFiles/CMakeScratch/TryCompile-xpji6u/CMakeLists.txt:  
> 44\> The target named “cmTC\_cebee” has C++ sources that may use modules, but  
> 44\> modules are not supported by this generator. See the cmake-cxxmodules(7)  
> 44\> manual and the CMAKE\_CXX\_SCAN\_FOR\_MODULES variable.  
> 44\>  
> 44\>  
> 44\>CMake Error in C:/D/bb/Slicer/ITK-build/CMakeFiles/CMakeScratch/TryCompile-xpji6u/CMakeLists.txt:  
> 44\> The target named “cmTC\_cebee” has C++ sources that may use modules, but  
> 44\> modules are not supported by this generator. See the cmake-cxxmodules(7)  
> 44\> manual and the CMAKE\_CXX\_SCAN\_FOR\_MODULES variable.  
> 44\>  
> 44\>  
> 44\>CMake Error in C:/D/bb/Slicer/ITK-build/CMakeFiles/CMakeScratch/TryCompile-xpji6u/CMakeLists.txt:  
> 44\> The target named “cmTC\_cebee” has C++ sources that may use modules, but  
> 44\> modules are not supported by this generator. See the cmake-cxxmodules(7)  
> 44\> manual and the CMAKE\_CXX\_SCAN\_FOR\_MODULES variable.  
> 44\>  
> 44\>  
> 44\>CMake Error in C:/D/bb/Slicer/ITK-build/CMakeFiles/CMakeScratch/TryCompile-xpji6u/CMakeLists.txt:  
> 44\> The target named “cmTC\_cebee” has C++ sources that may use modules, but  
> 44\> modules are not supported by this generator. See the cmake-cxxmodules(7)  
> 44\> manual and the CMAKE\_CXX\_SCAN\_FOR\_MODULES variable.  
> 44\>  
> 44\>  
> 44\>CMake Error in C:/D/bb/Slicer/ITK-build/CMakeFiles/CMakeScratch/TryCompile-xpji6u/CMakeLists.txt:  
> 44\> The target named “cmTC\_cebee” has C++ sources that may use modules, but  
> 44\> modules are not supported by this generator. See the cmake-cxxmodules(7)  
> 44\> manual and the CMAKE\_CXX\_SCAN\_FOR\_MODULES variable.  
> 44\>  
> 44\>  
> 44\>CMake Error in C:/D/bb/Slicer/ITK-build/CMakeFiles/CMakeScratch/TryCompile-xpji6u/CMakeLists.txt:  
> 44\> The target named “cmTC\_cebee” has C++ sources that may use modules, but  
> 44\> modules are not supported by this generator. See the cmake-cxxmodules(7)  
> 44\> manual and the CMAKE\_CXX\_SCAN\_FOR\_MODULES variable.  
> 44\>  
> 44\>  
> 44\>CMake Error in C:/D/bb/Slicer/ITK-build/CMakeFiles/CMakeScratch/TryCompile-xpji6u/CMakeLists.txt:  
> 44\> The target named “cmTC\_cebee” has C++ sources that may use modules, but  
> 44\> modules are not supported by this generator. See the cmake-cxxmodules(7)  
> 44\> manual and the CMAKE\_CXX\_SCAN\_FOR\_MODULES variable.  
> 44\>  
> 44\>  
> 44\>CMake Error at C:/Program Files/CMake/share/cmake-3.28/Modules/CMakeDetermineCompilerABI.cmake:57 (try\_compile):  
> 44\> Failed to generate test project build system.  
> 44\>Call Stack (most recent call first):  
> 44\> C:/Program Files/CMake/share/cmake-3.28/Modules/CMakeTestCXXCompiler.cmake:26 (CMAKE\_DETERMINE\_COMPILER\_ABI)  
> 44\> CMakeLists.txt:46 (project)  
> 44\>  
> 44\>  
> 44\>-- Configuring incomplete, errors occurred!  
> 44\>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(241,5): error MSB8066: Custom build for ‘C:\D\bb\Slicer\CMakeFiles\d47da4aa6ea3985cbad0d74a0ec5e847\ITK-mkdir.rule;C:\D\bb\Slicer\CMakeFiles\d47da4aa6ea3985cbad0d74a0ec5e847\ITK-download.rule;C:\D\bb\Slicer\CMakeFiles\d47da4aa6ea3985cbad0d74a0ec5e847\ITK-update.rule;C:\D\bb\Slicer\CMakeFiles\d47da4aa6ea3985cbad0d74a0ec5e847\ITK-patch.rule;C:\D\bb\Slicer\CMakeFiles\d47da4aa6ea3985cbad0d74a0ec5e847\ITK-configure.rule;C:\D\bb\Slicer\CMakeFiles\d47da4aa6ea3985cbad0d74a0ec5e847\ITK-build.rule;C:\D\bb\Slicer\CMakeFiles\d47da4aa6ea3985cbad0d74a0ec5e847\ITK-generate\_project\_description.rule;C:\D\bb\Slicer\CMakeFiles\d47da4aa6ea3985cbad0d74a0ec5e847\ITK-install.rule;C:\D\bb\Slicer\CMakeFiles\a77f4a0adba767bf958116c8b11e7004\ITK-complete.rule;C:\D\bb\Slicer\CMakeFiles\c326b9adf37e782152a9db02077a0894\ITK.rule;C:\D\Slicer\CMakeLists.txt’ exited with code 1.  
> 44\>Done building project “ITK.vcxproj” – FAILED.  
> 46\>------ Build started: Project: SimpleITK, Configuration: Release x64 ------  
> 47\>------ Build started: Project: SlicerExecutionModel, Configuration: Release x64 ------  
> 48\>------ Build started: Project: CTK, Configuration: Release x64 ------  
> 47\>Creating directories for ‘SlicerExecutionModel’  
> 46\>Creating directories for ‘SimpleITK’  
> 48\>Creating directories for ‘CTK’  
> 47\>Building Custom Rule C:/D/Slicer/CMakeLists.txt

> 45\> vecEll.c  
> 45\> fft.c  
> 45\> Generating Code…  
> 47\>Generate version-SlicerExecutionModel.txt and license-SlicerExecutionModel.txt  
> 47\>No patch step for ‘SlicerExecutionModel’  
> 47\>Performing configure step for ‘SlicerExecutionModel’  
> 47\>loading initial cache file C:/D/bb/Slicer/SlicerExecutionModel-prefix/tmp/SlicerExecutionModel-cache-Release.cmake  
> 47\>CMake Error at CMakeLists.txt:21 (message):  
> 47\>-- Configuring incomplete, errors occurred!  
> 47\> CMAKE\_CXX\_STANDARD:STRING=20 not in know standards list  
> 47\>  
> 47\> 11;14;17.  
> 47\>  
> 47\>  
> 47\>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(241,5): error MSB8066: Custom build for ‘C:\D\bb\Slicer\CMakeFiles\fd0726319a778a589086e30dc392beda\SlicerExecutionModel-mkdir.rule;C:\D\bb\Slicer\CMakeFiles\fd0726319a778a589086e30dc392beda\SlicerExecutionModel-download.rule;C:\D\bb\Slicer\CMakeFiles\fd0726319a778a589086e30dc392beda\SlicerExecutionModel-update.rule;C:\D\bb\Slicer\CMakeFiles\fd0726319a778a589086e30dc392beda\SlicerExecutionModel-patch.rule;C:\D\bb\Slicer\CMakeFiles\fd0726319a778a589086e30dc392beda\SlicerExecutionModel-configure.rule;C:\D\bb\Slicer\CMakeFiles\fd0726319a778a589086e30dc392beda\SlicerExecutionModel-build.rule;C:\D\bb\Slicer\CMakeFiles\fd0726319a778a589086e30dc392beda\SlicerExecutionModel-generate\_project\_description.rule;C:\D\bb\Slicer\CMakeFiles\fd0726319a778a589086e30dc392beda\SlicerExecutionModel-install.rule;C:\D\bb\Slicer\CMakeFiles\a77f4a0adba767bf958116c8b11e7004\SlicerExecutionModel-complete.rule;C:\D\bb\Slicer\CMakeFiles\c326b9adf37e782152a9db02077a0894\SlicerExecutionModel.rule;C:\D\Slicer\CMakeLists.txt’ exited with code 1.  
> 47\>Done building project “SlicerExecutionModel.vcxproj” – FAILED.  
> 46\>-- Detecting C compiler ABI info - done  
> 46\>-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe - skipped  
> 46\>-- Detecting C compile features  
> 46\>-- Detecting C compile features - done  
> 46\>-- Detecting CXX compiler ABI info

> 8\> are removed. Run “cmake --help-policy CMP0148” for policy details. Use  
> 48\> the cmake\_policy command to set the policy and suppress this warning.  
> 48\>  
> 48\> This warning is for project developers. Use -Wno-dev to suppress it.  
> 48\>  
> 48\> – Found PythonInterp: C:/D/bb/Slicer/python-install/bin/PythonSlicer.exe (found version “3.9.10”)  
> 48\> CMake Warning (dev) at CMakeLists.txt:890 (find\_package):  
> 48\> Policy CMP0148 is not set: The FindPythonInterp and FindPythonLibs modules  
> 48\> are removed. Run “cmake --help-policy CMP0148” for policy details. Use  
> 48\> the cmake\_policy command to set the policy and suppress this warning.  
> 48\>  
> 48\> This warning is for project developers. Use -Wno-dev to suppress it.  
> 48\>  
> 48\> – Found PythonLibs: C:/D/bb/Slicer/python-install/libs/python39.lib (found version “3.9.10”)  
> 48\> – Generated: C:/D/bb/Slicer/CTK-build/CTK-build/DGraphInput.txt  
> 48\> – Configuring CTK with Qt 5.15.17 (using modules: Core, Svg, Xml, XmlPatterns, Sql, Multimedia, Widgets, OpenGL, UiTools, Designer)  
> 48\> – SuperBuild - First pass  
> 48\> – SuperBuild - First pass - done  
> 48\> – Trying to find DCMTK expecting DCMTKConfig.cmake  
> 48\> – Trying to find DCMTK expecting DCMTKConfig.cmake - failed  
> 48\> – Trying to find DCMTK relying on FindDCMTK.cmake  
> 48\> CMake Error at C:/Program Files/CMake/share/cmake-3.28/Modules/FindPackageHandleStandardArgs.cmake:230 (message):  
> 48\> Please set DCMTK\_DIR and re-run configure (missing:  
> 48\> DCMTK\_config\_INCLUDE\_DIR)  
> 48\> Call Stack (most recent call first):  
> 48\> C:/Program Files/CMake/share/cmake-3.28/Modules/FindPackageHandleStandardArgs.cmake:600 (\_FPHSA\_FAILURE\_MESSAGE)  
> 48\> Utilities/CMake/FindDCMTK.cmake:327 (find\_package\_handle\_standard\_args)  
> 48\> CMakeLists.txt:997 (find\_package)  
> 48\>  
> 48\>  
> 48\> – Configuring incomplete, errors occurred!  
> 48\>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(241,5): error MSB8066: Custom build for ‘C:\D\bb\Slicer\CTK-build\CMakeFiles\03e53808ebed25d16564696bcaaf3841\CTK-mkdir.rule;C:\D\bb\Slicer\CTK-build\CMakeFiles\03e53808ebed25d16564696bcaaf3841\CTK-download.rule;C:\D\bb\Slicer\CTK-build\CMakeFiles\03e53808ebed25d16564696bcaaf3841\CTK-update.rule;C:\D\bb\Slicer\CTK-build\CMakeFiles\03e53808ebed25d16564696bcaaf3841\CTK-patch.rule;C:\D\bb\Slicer\CTK-build\CMakeFiles\03e53808ebed25d16564696bcaaf3841\CTK-configure.rule;C:\D\bb\Slicer\CTK-build\CMakeFiles\03e53808ebed25d16564696bcaaf3841\CTK-build.rule;C:\D\bb\Slicer\CTK-build\CMakeFiles\03e53808ebed25d16564696bcaaf3841\CTK-forceconfigure.rule;C:\D\bb\Slicer\CTK-build\CMakeFiles\03e53808ebed25d16564696bcaaf3841\CTK-install.rule;C:\D\bb\Slicer\CTK-build\CMakeFiles\dcfcaf82782c59c3458cd46f49d9817d\CTK-complete.rule;C:\D\bb\Slicer\CTK-build\CMakeFiles\b883b48fd579185efc6926a2e2aae55c\CTK.rule;C:\D\bb\Slicer\CTK\CMakeLists.txt’ exited with code 1. [C:\D\bb\Slicer\CTK-build\CTK.vcxproj]  
> 48\>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(241,5): error MSB8066: Custom build for ‘C:\D\bb\Slicer\CMakeFiles\523543b2c77f51bbe247b526aec70c27\CTK-mkdir.rule;C:\D\bb\Slicer\CMakeFiles\523543b2c77f51bbe247b526aec70c27\CTK-download.rule;C:\D\bb\Slicer\CMakeFiles\523543b2c77f51bbe247b526aec70c27\CTK-update.rule;C:\D\bb\Slicer\CMakeFiles\523543b2c77f51bbe247b526aec70c27\CTK-patch.rule;C:\D\bb\Slicer\CMakeFiles\523543b2c77f51bbe247b526aec70c27\CTK-configure.rule;C:\D\bb\Slicer\CMakeFiles\523543b2c77f51bbe247b526aec70c27\CTK-build.rule;C:\D\bb\Slicer\CMakeFiles\523543b2c77f51bbe247b526aec70c27\CTK-generate\_project\_description.rule;C:\D\bb\Slicer\CMakeFiles\523543b2c77f51bbe247b526aec70c27\CTK-install.rule;C:\D\bb\Slicer\CMakeFiles\a77f4a0adba767bf958116c8b11e7004\CTK-complete.rule;C:\D\bb\Slicer\CMakeFiles\c326b9adf37e782152a9db02077a0894\CTK.rule;C:\D\Slicer\CMakeLists.txt’ exited with code 1.  
> 48\>Done building project “CTK.vcxproj” – FAILED.  
> 49\>------ Build started: Project: Slicer, Configuration: Release x64 ------  
> 49\>Creating directories for ‘Slicer’  
> 49\>Building Custom Rule C:/D/Slicer/CMakeLists.txt  
> 49\>No download step for ‘Slicer’  
> 49\>No update step for ‘Slicer’  
> 49\>No patch step for ‘Slicer’  
> 49\>Performing configure step for ‘Slicer’  
> 49\>loading initial cache file C:/D/bb/Slicer/Slicer-prefix/tmp/Slicer-cache-Release.cmake  
> 49\>-- Setting C++ standard  
> 49\>-- Setting C++ standard - C++20  
> 49\>-- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.26100.

> 49\>-- Configuring Slicer with Qt 5.15.17 (using modules: Core, Widgets, Network, OpenGL, PrintSupport, UiTools, Xml, XmlPatterns, Svg, Sql, Multimedia, MultimediaWidgets, WebEngine, WebEngineWidgets, WebChannel, Qml, LinguistTools, Test, )  
> 49\>-- Setting QT\_PLUGINS\_DIR: C:/Qt/5.15.17/msvc2019\_64/plugins  
> 49\>-- Setting QT\_BINARY\_DIR: C:/Qt/5.15.17/msvc2019\_64/bin  
> 49\>-- Setting QT\_LIBRARY\_DIR: C:/Qt/5.15.17/msvc2019\_64/lib  
> 49\>-- Setting ExternalData\_OBJECT\_STORES to ‘C:/D/bb/Slicer/ExternalData/Objects’  
> 49\>-- Configuring Slicer for [win-amd64]  
> 49\>-- Found Python3: C:/D/bb/Slicer/python-install/bin/PythonSlicer.exe (found suitable version “3.9.10”, minimum required is “3.9”) found components: Interpreter Development.Module Development.Embed  
> 49\>-- Performing Test CMAKE\_HAVE\_LIBC\_PTHREAD  
> 49\>-- Performing Test CMAKE\_HAVE\_LIBC\_PTHREAD - Failed  
> 49\>-- Looking for pthread\_create in pthreads  
> 49\>-- Looking for pthread\_create in pthreads - not found  
> 49\>-- Looking for pthread\_create in pthread  
> 49\>-- Looking for pthread\_create in pthread - not found  
> 49\>-- Found Threads: TRUE  
> 49\>-- Found OpenGL: opengl32 found components: OpenGL  
> 49\>CMake Error at CMakeLists.txt:904 (find\_package):  
> 49\> By not providing “FindCTK.cmake” in CMAKE\_MODULE\_PATH this project has  
> 49\> asked CMake to find a package configuration file provided by “CTK”, but  
> 49\> CMake did not find one.  
> 49\>  
> 49\> Could not find a package configuration file provided by “CTK” with any of  
> 49\> the following names:  
> 49\>  
> 49\> CTKConfig.cmake  
> 49\> ctk-config.cmake  
> 49\>  
> 49\> Add the installation prefix of “CTK” to CMAKE\_PREFIX\_PATH or set “CTK\_DIR”  
> 49\> to a directory containing one of the above files. If “CTK” provides a  
> 49\> separate development package or SDK, be sure it has been installed.  
> 49\>  
> 49\>  
> 49\>-- Configuring incomplete, errors occurred!  
> 49\>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(241,5): error MSB8066: Custom build for ‘C:\D\bb\Slicer\CMakeFiles\16e2979522ca4937c1f557f267b66239\Slicer-mkdir.rule;C:\D\bb\Slicer\CMakeFiles\16e2979522ca4937c1f557f267b66239\Slicer-download.rule;C:\D\bb\Slicer\CMakeFiles\16e2979522ca4937c1f557f267b66239\Slicer-update.rule;C:\D\bb\Slicer\CMakeFiles\16e2979522ca4937c1f557f267b66239\Slicer-patch.rule;C:\D\bb\Slicer\CMakeFiles\16e2979522ca4937c1f557f267b66239\Slicer-configure.rule;C:\D\bb\Slicer\CMakeFiles\16e2979522ca4937c1f557f267b66239\Slicer-build.rule;C:\D\bb\Slicer\CMakeFiles\16e2979522ca4937c1f557f267b66239\Slicer-forceconfigure.rule;C:\D\bb\Slicer\CMakeFiles\16e2979522ca4937c1f557f267b66239\Slicer-install.rule;C:\D\bb\Slicer\CMakeFiles\a77f4a0adba767bf958116c8b11e7004\Slicer-complete.rule;C:\D\bb\Slicer\CMakeFiles\c326b9adf37e782152a9db02077a0894\Slicer.rule;C:\D\Slicer\CMakeLists.txt’ exited with code 1.  
> 49\>Done building project “Slicer.vcxproj” – FAILED.  
> 50\>------ Skipped Build: Project: ALL\_BUILD, Configuration: Release x64 ------  
> 50\>Project not selected to build for this solution configuration  
> ========== Build: 41 succeeded, 6 failed, 0 up-to-date, 3 skipped ==========

---

<div class="post-metadata">

**Author:** ![jamesobutler](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jamesobutler/32/7511_2.png) [@jamesobutler](https://discourse.slicer.org/u/jamesobutler)\
**Post date:** [May 25, 2025, 11:16pm UTC](https://discourse.slicer.org/t/slicer-5-8-1-c-20-support/43097/2 "2025-05-25T23:16:07Z")

</div>

Slicer is generally tested only for C++17. Newer standards are experimental to try and building. You can try building latest Slicer from the `main` branch as there has been dependency updates since 5.8.1 that may have C++20 fixes.

Feel free to issue PRs to support building as C++20. As you posted, there are some dependencies that simply don’t even attempt building as C++20 yet which you can change locally to see if it will work. For example your results included SlicerExecutionModel which doesn’t allow it.

> <https://github.com/Slicer/SlicerExecutionModel/blob/91b921bd5977c3384916ba4b03705d87b26067f7/CMakeLists.txt#L19>

---

<div class="post-metadata">

**Author:** ![sogo](https://avatars.discourse-cdn.com/v4/letter/s/779978/32.png) [@sogo](https://discourse.slicer.org/u/sogo)\
**Post date:** [May 27, 2025, 3:08am UTC](https://discourse.slicer.org/t/slicer-5-8-1-c-20-support/43097/3 "2025-05-27T03:08:22Z")

</div>

Hi James, thank you for quick response. I do am working on top of stable release so probably would like to stick to 5.8.1. Would look into main branch for any C++20 fixes. Before I close this thread, I can try adding “20” as “VALID\_CXX\_STANDARDS” and build for slicer execution model. But for the following error, I am not sure how to begin finding modules not supported by the generator in ITK and DCMTK.

> 44\>CMake Error in C:/D/bb/Slicer/ITK-build/CMakeFiles/CMakeScratch/TryCompile-xpji6u/CMakeLists.txt:  
> 44\> The target named “cmTC\_cebee” has C++ sources that may use modules, but  
> 44\> modules are not supported by this generator. See the cmake-cxxmodules(7)  
> 44\> manual and the CMAKE\_CXX\_SCAN\_FOR\_MODULES variable.

---

<div class="post-metadata">

**Author:** ![jamesobutler](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jamesobutler/32/7511_2.png) [@jamesobutler](https://discourse.slicer.org/u/jamesobutler)\
**Post date:** [May 27, 2025, 11:37am UTC](https://discourse.slicer.org/t/slicer-5-8-1-c-20-support/43097/4 "2025-05-27T11:37:59Z")

</div>

Most of the dependencies for Slicer do not support C++20 explicitly. You will be in an area of experimentation which is why I suggested using latest Slicer `main` which is not anymore unstable and will likely have C++20 compatibility fixes in various recent dependency updates such as DCMTK and VTK.

> [@sogo](#):
>
> Visual studio = 2019 v16.11.31, toolset v142

Slicer is primarily tested with Visual Studio 2022 and the v143 toolset. It was used to actually build Slicer 5.8.1 stable.

> [@sogo](#):
>
> CMake 3.28.0-rc2

Is there a reason you are also not using a stable release of CMake? It appears you are using a preview release candidate build. I generally use an official stable release of CMake. Version 3.31.7 could be a good choice.

---

<div class="post-metadata">

**Author:** ![sogo](https://avatars.discourse-cdn.com/v4/letter/s/779978/32.png) [@sogo](https://discourse.slicer.org/u/sogo)\
**Post date:** [May 30, 2025, 3:25am UTC](https://discourse.slicer.org/t/slicer-5-8-1-c-20-support/43097/5 "2025-05-30T03:25:10Z")

</div>

Hi James,  
Thank you for the test configuration for Slicer 5.8.1, but we have our own external dependencies which are not ready for this upgrade yet. CMake I do am planning to update to newer version, thanks for suggesting 3.31.7, I’ll opt for that one. Closing this thread as I got what I needed. Really appreciate your help. On the side, will continue on C++20 and see if can fix some of these issues.
