Skip to content

Set C++17 standard for WebAssembly target#10

Merged
fedorov merged 2 commits intomasterfrom
copilot/update-cmake-to-cpp17
Feb 3, 2026
Merged

Set C++17 standard for WebAssembly target#10
fedorov merged 2 commits intomasterfrom
copilot/update-cmake-to-cpp17

Conversation

Copy link
Contributor

Copilot AI commented Feb 3, 2026

Emscripten's embind now requires C++17, but the build inherited C++11 from the root CMakeLists.txt, causing compilation failure.

Changes

Added target-specific C++17 requirement in wasm/CMakeLists.txt:

set_target_properties(dicomiccwasm PROPERTIES
    CXX_STANDARD 17
    CXX_STANDARD_REQUIRED ON
)

This overrides the inherited C++11 standard for the WebAssembly target only, leaving other build configurations unchanged.

Original prompt

Problem

The WebAssembly build is failing with the error:

error: "embind requires -std=c++17 or newer"

This occurs when building wasm/CMakeFiles/dicomiccwasm.dir/src/jslib.cpp.o because Emscripten's embind library now requires C++17 or newer, but the current build configuration doesn't specify a C++ standard.

Solution

Update the wasm/CMakeLists.txt file to set the C++ standard to C++17 for the dicomiccwasm target.

Add the following lines after the add_executable(dicomiccwasm src/jslib.cpp) line:

set_target_properties(dicomiccwasm PROPERTIES
    CXX_STANDARD 17
    CXX_STANDARD_REQUIRED ON
)

Or alternatively, you can set it globally for the wasm directory by adding at the top of wasm/CMakeLists.txt:

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

Reference

This pull request was created from Copilot chat.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: fedorov <313942+fedorov@users.noreply.github.com>
Copilot AI changed the title [WIP] Update CMake configuration for C++17 support Set C++17 standard for WebAssembly target Feb 3, 2026
Copilot AI requested a review from fedorov February 3, 2026 15:43
@fedorov fedorov marked this pull request as ready for review February 3, 2026 15:57
@fedorov fedorov merged commit 0ad9867 into master Feb 3, 2026
2 checks passed
@fedorov fedorov deleted the copilot/update-cmake-to-cpp17 branch February 3, 2026 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants