Skip to content

Preferred CMake flag to detect if on Emscripten #3191

Closed
@httpdigest

Description

@httpdigest

Hi,

I try to build a cross-platform CMakeLists.txt that allows me to configure and build both under Windows with msvc and on Emscripten. Now, the compilation and linking steps all succeed for both compilers/platforms, but I want to get rid of some warnings emited by emcc, using "-Wno-warn-absolute-paths" to not let it complain about absolute paths that CMake always uses when referencing library and include paths and also to activate C++11 support via "-std=c++11" to not let it complain about some range-based for loops I am using.
I wanted to include an add_definitions instruction in my CMake build file wrapped in an if()endif() but so far, I have yet to find the correct condition that tells me that I am under emcc.
I also do not want to identify a GNU or Clang compiler there, because I still want to be able to compile with the real Clang and x86 LLVM backends, and not with Emscripten/fastcomp.

What is the preferred condition here to detect if on emcc/em++?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions