diff --git a/CMakeLists.txt b/CMakeLists.txt index 3d8b9b54d..f171d5872 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -300,6 +300,14 @@ else() set(SHARED_OR_STATIC STATIC) endif() +# If we're in a CMake subproject, find_package(Magnum) will be looking for +# these when targeting Emscripten, so supply their in-source location +if(CORRADE_TARGET_EMSCRIPTEN AND NOT PROJECT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR) + set(MAGNUM_EMSCRIPTENAPPLICATION_JS ${PROJECT_SOURCE_DIR}/src/Magnum/Platform/EmscriptenApplication.js CACHE INTERNAL "" FORCE) + set(MAGNUM_WINDOWLESSEMSCRIPTENAPPLICATION_JS ${PROJECT_SOURCE_DIR}/src/Magnum/Platform/WindowlessEmscriptenApplication.js CACHE INTERNAL "" FORCE) + set(MAGNUM_WEBAPPLICATION_CSS ${PROJECT_SOURCE_DIR}/src/Magnum/Platform/WebApplication.css CACHE INTERNAL "" FORCE) +endif() + # Installation paths include(${CORRADE_LIB_SUFFIX_MODULE}) set(MAGNUM_BINARY_INSTALL_DIR bin) diff --git a/doc/changelog.dox b/doc/changelog.dox index f21020ae0..980f49b8d 100644 --- a/doc/changelog.dox +++ b/doc/changelog.dox @@ -181,6 +181,8 @@ See also: flag in particular) is now handled by the `FindOpenGLES3.cmake` module and the new `INTERFACE_LINK_OPTIONS` property instead of `FindMagnum.cmake`. On older versions this is handled in `FindMagnum.cmake` by modifying the global `CMAKE_EXE_LINKER_FLAGS` variable. +- It's now possible to use Magnum as a CMake subproject also when building + for Emscripten (see [mosra/magnum#219](https://github.com/mosra/magnum/issues/219)) @subsection changelog-latest-bugfixes Bug fixes diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 537182a0c..a8e959863 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -58,4 +58,4 @@ add_subdirectory(Magnum) add_subdirectory(MagnumPlugins) # Magnum include dir for superprojects -set(MAGNUM_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE INTERNAL "") +set(MAGNUM_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE INTERNAL "" FORCE)