Find Correct OpenGL Headers For Emscripten Toolchain
Fixes Issue #18263 (closed)
Emscripten provides a Modules/FindOpenGL.cmake
that sets OPENGL_INCLUDE_DIR
= ${EMSCRIPTEN_ROOT_PATH}/system/include
. But this is unfortunately overriden by VTK's own FindOpenGL.cmake that finds the OpenGL headers under ${EMSCRIPTEN_SYSROOT}
${EMSCRIPTEN_SYSROOT}
also has other c/c++ API headers like 'alltypes.h', 'fstream', 'cmath', 'iterator', 'deque' etc. All those headers conflict with the ones inherently added by clang (emsdk/upstream/lib/clang/14.0.0/include/*) leading to multiple redefinition errors as reported in #18263 (closed)
I added a temporary fix that gets it going for the moment. This could be better handled if Emscripten was an officially supported CMake platform rather than using the independent Modules/Platform/Emscripten.cmake they provide.
There appears to be some motivation to do this in cmake/cmake#18423 3 years back. I guess it stalled somewhere down the road..
Backport: release