diff --git a/tools/optimizer/CMakeLists.txt b/tools/optimizer/CMakeLists.txt index e9a62ad26..7f01126a2 100644 --- a/tools/optimizer/CMakeLists.txt +++ b/tools/optimizer/CMakeLists.txt @@ -5,6 +5,16 @@ project(asmjs_optimizer) file(GLOB sourceFiles *.cpp) file(GLOB headerFiles *.h) +if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR CMAKE_C_COMPILER MATCHES ".*(gcc|clang|emcc).*" OR CMAKE_C_COMPILER_ID MATCHES ".*(GCC|Clang|emcc).*") + set(IS_GCC_LIKE TRUE) +else() + set(IS_GCC_LIKE FALSE) +endif() + +if (IS_GCC_LIKE) + set(cFlags "-std=c++11 -fno-exceptions -fno-rtti") +endif() + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${cFlags}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${cFlags}")