diff --git a/modules/FindMagnum.cmake b/modules/FindMagnum.cmake index caa6999ee..b65de5a79 100644 --- a/modules/FindMagnum.cmake +++ b/modules/FindMagnum.cmake @@ -1042,6 +1042,10 @@ if(CORRADE_TARGET_EMSCRIPTEN) # IN_LIST as an operator since 3.1 (Emscripten needs at least 3.7), but # it's behind a policy, so enable that one as well. cmake_policy(SET CMP0057 NEW) + # TODO since 1.39.19 it's possible to use `-sUSE_WEBGL2=1`, which can be + # then passed via target_link_libraries() etc. without requiring CMake + # 3.13: https://github.com/emscripten-core/emscripten/blob/main/ChangeLog.md#13919-07072020 + # -- change to that once we drop support for older Emscripten versions if(CMAKE_VERSION VERSION_LESS 3.13 AND GL IN_LIST Magnum_FIND_COMPONENTS AND NOT MAGNUM_TARGET_GLES2 AND NOT CMAKE_EXE_LINKER_FLAGS MATCHES "-s USE_WEBGL2=1") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s USE_WEBGL2=1") endif() diff --git a/modules/FindOpenGLES3.cmake b/modules/FindOpenGLES3.cmake index 4d601ad7a..1c53a617e 100644 --- a/modules/FindOpenGLES3.cmake +++ b/modules/FindOpenGLES3.cmake @@ -82,6 +82,10 @@ if(NOT TARGET OpenGLES3::OpenGLES3) # Emscripten needs a special flag to use WebGL 2. CMake 3.13 allows to set # this via INTERFACE_LINK_OPTIONS, for older versions we modify the global # CMAKE_EXE_LINKER_FLAGS inside FindMagnum.cmake. + # TODO since 1.39.19 it's possible to use `-sUSE_WEBGL2=1`, which can be + # then passed via target_link_libraries() etc. without requiring CMake + # 3.13: https://github.com/emscripten-core/emscripten/blob/main/ChangeLog.md#13919-07072020 + # -- change to that once we drop support for older Emscripten versions if(CORRADE_TARGET_EMSCRIPTEN AND NOT CMAKE_VERSION VERSION_LESS 3.13) # I could probably use target_link_options() here, but let's be # consistent with the rest diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 69e8a8455..584044ee1 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -40,6 +40,10 @@ endif() # `-s USE_WEBGL2=1` linker option is propagated from FindOpenGLES3.cmake # already. If not (and the GL library is used), we need to modify the global # CMAKE_EXE_LINKER_FLAGS. +# TODO since 1.39.19 it's possible to use `-sUSE_WEBGL2=1`, which can be then +# passed via target_link_libraries() etc. without requiring CMake 3.13 +# https://github.com/emscripten-core/emscripten/blob/main/ChangeLog.md#13919-07072020 +# -- change to that once we drop support for older Emscripten versions if(CORRADE_TARGET_EMSCRIPTEN AND CMAKE_VERSION VERSION_LESS 3.13 AND WITH_GL AND NOT TARGET_GLES2) set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s USE_WEBGL2=1") endif()