aboutsummaryrefslogtreecommitdiff
path: root/openmp
diff options
context:
space:
mode:
authorMichal Gorny <mgorny@gentoo.org>2018-12-11 15:39:22 +0000
committerMichal Gorny <mgorny@gentoo.org>2018-12-11 15:39:22 +0000
commite9d4267277068ad46a20cf6001a7077d89244401 (patch)
tree119a7aaa7d0d16693a79d5042a0109797ba9927c /openmp
parentb51283bfd7636c4dd1a894d59f38122571661c64 (diff)
[cmake] Use -std=gnu++11 to fix alloca() on NetBSD
Prefer using '-std=gnu++11' over '-std=c++11' when available, as NetBSD exposes the correct alloca() implementation only with gnu* C/C++ standards. Differential Revision: https://reviews.llvm.org/D55477 llvm-svn: 348854
Diffstat (limited to 'openmp')
-rw-r--r--openmp/cmake/HandleOpenMPOptions.cmake5
-rw-r--r--openmp/cmake/config-ix.cmake3
2 files changed, 6 insertions, 2 deletions
diff --git a/openmp/cmake/HandleOpenMPOptions.cmake b/openmp/cmake/HandleOpenMPOptions.cmake
index 5e5215d3b17b..97b616ef2f17 100644
--- a/openmp/cmake/HandleOpenMPOptions.cmake
+++ b/openmp/cmake/HandleOpenMPOptions.cmake
@@ -13,4 +13,7 @@ if (${OPENMP_ENABLE_WERROR})
append_if(OPENMP_HAVE_WERROR_FLAG "-Werror" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
endif()
-append_if(OPENMP_HAVE_STD_CPP11_FLAG "-std=c++11" CMAKE_CXX_FLAGS) \ No newline at end of file
+append_if(OPENMP_HAVE_STD_GNUPP11_FLAG "-std=gnu++11" CMAKE_CXX_FLAGS)
+if (NOT OPENMP_HAVE_STD_GNUPP11_FLAG)
+ append_if(OPENMP_HAVE_STD_CPP11_FLAG "-std=c++11" CMAKE_CXX_FLAGS)
+endif()
diff --git a/openmp/cmake/config-ix.cmake b/openmp/cmake/config-ix.cmake
index 912cbd07ba25..13eace9831b6 100644
--- a/openmp/cmake/config-ix.cmake
+++ b/openmp/cmake/config-ix.cmake
@@ -3,4 +3,5 @@ include(CheckCXXCompilerFlag)
check_c_compiler_flag(-Werror OPENMP_HAVE_WERROR_FLAG)
-check_cxx_compiler_flag(-std=c++11 OPENMP_HAVE_STD_CPP11_FLAG) \ No newline at end of file
+check_cxx_compiler_flag(-std=gnu++11 OPENMP_HAVE_STD_GNUPP11_FLAG)
+check_cxx_compiler_flag(-std=c++11 OPENMP_HAVE_STD_CPP11_FLAG)