diff --git a/aksetup_helper.py b/aksetup_helper.py
index e86f4cd8e8e193d014462b57b4b0a79357558698..f90d085284f00e6a6cd2a44e6b9bd63a857485f3 100644
--- a/aksetup_helper.py
+++ b/aksetup_helper.py
@@ -917,7 +917,9 @@ def cpp_flag(compiler):
 
     The c++14 is prefered over c++11 (when it is available).
     """
-    if has_flag(compiler, '-std=c++14'):
+    if has_flag(compiler, '-std=gnu++14'):
+        return '-std=gnu++14'
+    elif has_flag(compiler, '-std=c++14'):
         return '-std=c++14'
     elif has_flag(compiler, '-std=c++11'):
         return '-std=c++11'