itk-wasm icon indicating copy to clipboard operation
itk-wasm copied to clipboard

CMAKE_CXX_STANDARD BOOL?

Open N-Dekker opened this issue 5 months ago • 1 comments

.github/workflows/cxx-python.yml overrules the C++ Standard version used to compile the project, by saying -DCMAKE_CXX_STANDARD:BOOL=20:

https://github.com/InsightSoftwareConsortium/ITK-Wasm/blob/3818ff25dd1eec8ea87a148ba1b30aef0a48b47a/.github/workflows/cxx-python.yml#L20

Three questions:

  • Why is the C++ Standard version specified as a Boolean value? That looks like a bug.
  • Is it useful to specify its type anyway? Wouldn't -DCMAKE_CXX_STANDARD=20 work just fine?
  • Wouldn't it be preferable to "hard-code" the C++ Standard version in the CMakeLists.txt, instead of specifying this "on the fly", at the yml/cmake command-line?

N-Dekker avatar Jul 21 '25 13:07 N-Dekker

That looks like a bug.

Yes 🐛 👀

Is it useful to specify its type anyway? Wouldn't -DCMAKE_CXX_STANDARD=20 work just fine?

It keeps the correct type in CMakeCache.txt, which is considered a best practice.

Wouldn't it be preferable to "hard-code" the C++ Standard version in the CMakeLists.txt, instead of specifying this "on the fly", at the yml/cmake command-line?

Yes, we are effectively doing this: https://github.com/InsightSoftwareConsortium/ITK-Wasm/blob/a473cb9ef995a73b21239fe7a8355a71c4d3e85f/CMakeLists.txt#L4

And it can be removed: https://github.com/InsightSoftwareConsortium/ITK-Wasm/pull/1430

thewtex avatar Jul 22 '25 19:07 thewtex