From 38c15f09fe156965ca4f28a0960b73526ae9d2d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jukka=20Jyl=C3=A4nki?= Date: Thu, 18 Dec 2014 17:19:24 -0500 Subject: [PATCH] Pass proper C++11 build flags to native optimizer CMake script. --- tools/optimizer/CMakeLists.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) 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}")