Are you using this, by any chance? https://github.com/kripken/emscripten/blob/master/cmake/Platform/Emscripten.cmake Because it defines an `EMSCRIPTEN` variable specifically for tests like these.