diff options
author | Niranjan Nilakantan <niranjan.nilakantan@hotmail.com> | 2023-05-24 19:48:51 (GMT) |
---|---|---|
committer | Niranjan Nilakantan <niranjan.nilakantan@hotmail.com> | 2023-05-24 19:48:51 (GMT) |
commit | e032d57642d2a042b9445b2199277bb24fee2eb5 (patch) | |
tree | c219869b0b35b3a7252f7bc6ef793e145950a286 /googletest/cmake | |
parent | 45804691223635953f311cf31a10c632553bbfc3 (diff) | |
download | googletest-e032d57642d2a042b9445b2199277bb24fee2eb5.zip googletest-e032d57642d2a042b9445b2199277bb24fee2eb5.tar.gz googletest-e032d57642d2a042b9445b2199277bb24fee2eb5.tar.bz2 |
Build googletest with IntelLLVM compilers.
Use the same flags as Clang if the compiler id is IntelLLVM.
IntelLLVM warns if a double constant is assigned to a float.
```
[build] .../googletest/googletest/include/gtest/gtest-printers.h:516:17: warning: implicit conversion between floating point types of different sizes [-Wimplicit-float-size-conversion]
[build] mulfor6 = 1e1;
```
IntelLLVM uses fp-model=fast by default, breaking IsNan and IsInf tests.
Use -ffp-model=precise to fix this.
IntelLLVM does not support -Wchar-subscripts
Fixes #4255
Diffstat (limited to 'googletest/cmake')
-rw-r--r-- | googletest/cmake/internal_utils.cmake | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/googletest/cmake/internal_utils.cmake b/googletest/cmake/internal_utils.cmake index fa7da4e..f45a3be 100644 --- a/googletest/cmake/internal_utils.cmake +++ b/googletest/cmake/internal_utils.cmake @@ -94,12 +94,18 @@ macro(config_compiler_and_linker) if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") set(cxx_base_flags "${cxx_base_flags} -utf-8") endif() - elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR + CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM") set(cxx_base_flags "-Wall -Wshadow -Wconversion -Wundef") set(cxx_exception_flags "-fexceptions") set(cxx_no_exception_flags "-fno-exceptions") - set(cxx_strict_flags "-W -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wunused-parameter -Wcast-align -Wchar-subscripts -Winline -Wredundant-decls") + set(cxx_strict_flags "-W -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wunused-parameter -Wcast-align -Winline -Wredundant-decls") set(cxx_no_rtti_flags "-fno-rtti") + if (CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM") + set(cxx_base_flags "${cxx_base_flags} -Wno-implicit-float-size-conversion -ffp-model=precise") + else() + set(cxx_strict_flags "${cxx_strict_flags} -Wchar-subscripts") + endif() elseif (CMAKE_COMPILER_IS_GNUCXX) set(cxx_base_flags "-Wall -Wshadow -Wundef") if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0.0) |