• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1if (OPENMP_STANDALONE_BUILD)
2  # From HandleLLVMOptions.cmake
3  function(append_if condition value)
4    if (${condition})
5      foreach(variable ${ARGN})
6        set(${variable} "${${variable}} ${value}" PARENT_SCOPE)
7      endforeach(variable)
8    endif()
9  endfunction()
10endif()
11
12# MSVC and clang-cl in compatibility mode map -Wall to -Weverything.
13# TODO: LLVM adds /W4 instead, check if that works for the OpenMP runtimes.
14if (NOT MSVC)
15  append_if(OPENMP_HAVE_WALL_FLAG "-Wall" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
16endif()
17if (OPENMP_ENABLE_WERROR)
18  append_if(OPENMP_HAVE_WERROR_FLAG "-Werror" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
19endif()
20
21# Additional warnings that are not enabled by -Wall.
22append_if(OPENMP_HAVE_WCAST_QUAL_FLAG "-Wcast-qual" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
23append_if(OPENMP_HAVE_WFORMAT_PEDANTIC_FLAG "-Wformat-pedantic" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
24append_if(OPENMP_HAVE_WIMPLICIT_FALLTHROUGH_FLAG "-Wimplicit-fallthrough" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
25append_if(OPENMP_HAVE_WSIGN_COMPARE_FLAG "-Wsign-compare" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
26
27# Warnings that we want to disable because they are too verbose or fragile.
28append_if(OPENMP_HAVE_WNO_EXTRA_FLAG "-Wno-extra" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
29append_if(OPENMP_HAVE_WNO_PEDANTIC_FLAG "-Wno-pedantic" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
30append_if(OPENMP_HAVE_WNO_MAYBE_UNINITIALIZED_FLAG "-Wno-maybe-uninitialized" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
31
32append_if(OPENMP_HAVE_STD_GNUPP14_FLAG "-std=gnu++14" CMAKE_CXX_FLAGS)
33if (NOT OPENMP_HAVE_STD_GNUPP14_FLAG)
34  append_if(OPENMP_HAVE_STD_CPP14_FLAG "-std=c++14" CMAKE_CXX_FLAGS)
35endif()
36