mirror of
https://github.com/google/googletest.git
synced 2025-12-06 16:57:00 +08:00
Treat LCC as compiler different from GCC
LCC (eLbrus C/C++ compiler) is an EDG-based compiler that in most cases
is similar in behavior to GNU, but it has different warning options
supported and enabled by default. It seems to have sense to treat LCC
and GNU differently, as CMake supports it from 3.23.
For it to be done, CMake policy CMP0129 should be set to NEW,
and then CMAKE_${LANG}_COMPILER_ID may be checked to be STREQUAL "LCC".
This commit does this, and introduces warning arguments in call
to compiler that are slightly different from GNU to let googletest be
buildable without unexpected warnings.
This commit is contained in:
parent
0953a17a42
commit
5b2ecaa64e
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
cmake_minimum_required(VERSION 3.13)
|
cmake_minimum_required(VERSION 3.13)
|
||||||
|
|
||||||
|
cmake_policy(SET CMP0129 NEW)
|
||||||
project(googletest-distribution)
|
project(googletest-distribution)
|
||||||
set(GOOGLETEST_VERSION 1.15.2)
|
set(GOOGLETEST_VERSION 1.15.2)
|
||||||
|
|
||||||
|
|||||||
@ -37,6 +37,7 @@ endif()
|
|||||||
# ${gmock_BINARY_DIR}.
|
# ${gmock_BINARY_DIR}.
|
||||||
# Language "C" is required for find_package(Threads).
|
# Language "C" is required for find_package(Threads).
|
||||||
cmake_minimum_required(VERSION 3.13)
|
cmake_minimum_required(VERSION 3.13)
|
||||||
|
cmake_policy(SET CMP0129 NEW)
|
||||||
project(gmock VERSION ${GOOGLETEST_VERSION} LANGUAGES CXX C)
|
project(gmock VERSION ${GOOGLETEST_VERSION} LANGUAGES CXX C)
|
||||||
|
|
||||||
if (COMMAND set_up_hermetic_build)
|
if (COMMAND set_up_hermetic_build)
|
||||||
|
|||||||
@ -47,6 +47,7 @@ endif()
|
|||||||
# Project version.
|
# Project version.
|
||||||
|
|
||||||
cmake_minimum_required(VERSION 3.13)
|
cmake_minimum_required(VERSION 3.13)
|
||||||
|
cmake_policy(SET CMP0129 NEW)
|
||||||
project(gtest VERSION ${GOOGLETEST_VERSION} LANGUAGES CXX C)
|
project(gtest VERSION ${GOOGLETEST_VERSION} LANGUAGES CXX C)
|
||||||
|
|
||||||
if (COMMAND set_up_hermetic_build)
|
if (COMMAND set_up_hermetic_build)
|
||||||
|
|||||||
@ -102,9 +102,11 @@ macro(config_compiler_and_linker)
|
|||||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM")
|
if (CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM")
|
||||||
set(cxx_base_flags "${cxx_base_flags} -Wno-implicit-float-size-conversion -ffp-model=precise")
|
set(cxx_base_flags "${cxx_base_flags} -Wno-implicit-float-size-conversion -ffp-model=precise")
|
||||||
endif()
|
endif()
|
||||||
elseif (CMAKE_COMPILER_IS_GNUCXX)
|
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR
|
||||||
set(cxx_base_flags "-Wall -Wshadow -Wundef")
|
CMAKE_CXX_COMPILER_ID STREQUAL "LCC")
|
||||||
if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0.0)
|
set(cxx_base_flags "-Wall -Wundef")
|
||||||
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND
|
||||||
|
NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0.0)
|
||||||
set(cxx_base_flags "${cxx_base_flags} -Wno-error=dangling-else")
|
set(cxx_base_flags "${cxx_base_flags} -Wno-error=dangling-else")
|
||||||
endif()
|
endif()
|
||||||
set(cxx_exception_flags "-fexceptions")
|
set(cxx_exception_flags "-fexceptions")
|
||||||
@ -115,6 +117,11 @@ macro(config_compiler_and_linker)
|
|||||||
set(cxx_no_rtti_flags "-fno-rtti -DGTEST_HAS_RTTI=0")
|
set(cxx_no_rtti_flags "-fno-rtti -DGTEST_HAS_RTTI=0")
|
||||||
set(cxx_strict_flags
|
set(cxx_strict_flags
|
||||||
"-Wextra -Wno-unused-parameter -Wno-missing-field-initializers")
|
"-Wextra -Wno-unused-parameter -Wno-missing-field-initializers")
|
||||||
|
if (CMAKE_CXX_COMPILER_ID STREQUAL "LCC")
|
||||||
|
set(cxx_base_flags "${cxx_base_flags} -Wno-unused-variable -Wno-unused-but-set-variable -Wno-unused-function")
|
||||||
|
else()
|
||||||
|
set(cxx_base_flags "${cxx_base_flags} -Wshadow")
|
||||||
|
endif()
|
||||||
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "SunPro")
|
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "SunPro")
|
||||||
set(cxx_exception_flags "-features=except")
|
set(cxx_exception_flags "-features=except")
|
||||||
# Sun Pro doesn't provide macros to indicate whether exceptions and
|
# Sun Pro doesn't provide macros to indicate whether exceptions and
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user