4

I have a CMake Project that I want to compile to Web assembly. To do so I used the following commands from the base folder of the project:

mkdir build
cd build
cmake .. -DCMAKE_TOOLCHAIN_FILE=/home/ubuntu/emsdk/emscripten/1.38.6/cmake/Modules/Platform/Emscripten.cmake -G "Unix Makefiles"

This successfully (or at least I think) generates a .wasm file and a .js file as well as the various cmake and make files .

I also want it to generate an html file, like you can with emcc (ie. emcc example.c -s WASM=1 -o output.html).

Is it possible to do this?

Robbie
  • 1,733
  • 2
  • 13
  • 20

1 Answers1

12

You could try and set the CMAKE_EXECUTABLE_SUFFIX to .html on the command line or the CMakeLists.txt

Gray
  • 2,333
  • 1
  • 19
  • 24
  • 1
    This seems to be used by emscripten tests: https://github.com/kripken/emscripten/blob/master/tests/cmake/target_html/CMakeLists.txt –  Jan 03 '19 at 12:44