1 if (CMAKE_COMPILER_IS_GNUCXX)
3 include(CheckCXXCompilerFlag)
5 # Additional warnings for GCC 6 set(paraview_extra_warning_flags
20 # This flag is useful as not returning from a non-
void function is an error
21 # with MSVC, but it is not supported on all GCC compiler versions
22 check_cxx_compiler_flag(-Werror=
return-type HAVE_GCC_ERROR_RETURN_TYPE)
23 if (HAVE_GCC_ERROR_RETURN_TYPE)
24 list(APPEND paraview_extra_warning_flags
28 # If we are compiling on Linux then set some extra linker flags too 29 if (CMAKE_SYSTEM_NAME MATCHES
"Linux")
30 option(PARAVIEW_LINKER_FATAL_WARNINGS
"Specify if linker warnings must be considered as errors." OFF)
31 mark_as_advanced(PARAVIEW_LINKER_FATAL_WARNINGS)
32 target_link_options(paraviewbuild
34 "$<$<BOOL:${PARAVIEW_LINKER_FATAL_WARNINGS}>:LINKER:--fatal-warnings>")
37 # Set up the CXX_FLAGS for extra warnings 38 option(PARAVIEW_EXTRA_COMPILER_WARNINGS
39 "Add compiler flags to do stricter checking" OFF)
40 if (PARAVIEW_EXTRA_COMPILER_WARNINGS)
41 if (TARGET paraviewbuild)
42 target_compile_options(paraviewbuild
44 "$<$<COMPILE_LANGUAGE:CXX>:${paraview_extra_warning_flags}>")
49 # Intel OneAPI compilers >= 2021.2.0 turn on "fast math" at any non-zero 50 # optimization level. Suppress this non-standard behavior using the 51 # `-fp-model=precise` flag. 52 set(intel_oneapi_compiler_detections)
53 set(intel_oneapi_compiler_version_min
"2021.2.0")
54 foreach (lang IN ITEMS C CXX Fortran)
55 if (CMAKE_VERSION VERSION_LESS
"3.14" AND lang STREQUAL
"Fortran") # XXX(cmake-3.14): `Fortran_COMPILER_ID` genex
58 # Detect the IntelLLVM compiler
for the given
language.
59 set(is_lang
"$<COMPILE_LANGUAGE:${lang}>")
60 set(is_intelllvm
"$<${lang}_COMPILER_ID:IntelLLVM>")
61 set(is_intelllvm_fastmath_assuming_version
"$<VERSION_GREATER_EQUAL:$<${lang}_COMPILER_VERSION>,${intel_oneapi_compiler_version_min}>")
62 list(APPEND intel_oneapi_compiler_detections
63 "$<AND:${is_lang},${is_intelllvm},${is_intelllvm_fastmath_assuming_version}>")
65 string(REPLACE
";" "," intel_oneapi_compiler_detections
"${intel_oneapi_compiler_detections}")
66 if (TARGET paraviewbuild)
67 target_compile_options(paraviewbuild
69 "$<BUILD_INTERFACE:$<$<OR:${intel_oneapi_compiler_detections}>:-fp-model=precise>>")