Files
CMake/Tests/RunCMake/PrecompileHeaders/PchWarnInvalid-check.cmake
T
makise-homura e5d9fce03f LCC: Add dedicated support for MCST LCC compiler
Divert LCC compiler as a new one, instead of treating it as GNU.

Since old times, Elbrus C/C++/Fortran Compiler (LCC) by MCST has been
passing checks for GNU compilers, so it has been identified as GNU.
Now, with intent of seriously upstreaming its support, it has been
added as a separate LCC compiler, and its version displays not a
supported GCC version, but LCC version itself (e.g. LCC 1.25.19 instead
of GNU 7.3.0).

This commit adds its support for detection, and also converts basically
every check like 'is this compiler GNU?' to 'is this compiler GNU or
LCC?'. The only places where this check is untouched, is where it
regards other platforms where LCC is unavailable (primarily non-Linux),
and where it REALLY differs from GNU compiler.

Note: this transition may break software that are already ported to
Elbrus, but hardly relies that LCC will be detected as GNU; still such
software is not known.
2021-10-15 05:05:19 +03:00

23 lines
828 B
CMake

if (NOT CMAKE_C_COMPILER_ID MATCHES "GNU|LCC|Intel" OR
(CMAKE_C_COMPILER_ID STREQUAL "Intel" AND CMAKE_HOST_WIN32))
return()
endif()
file(STRINGS ${RunCMake_TEST_BINARY_DIR}/compile_commands.json empty_dir_commands
REGEX "command.*-Winvalid-pch.*empty.dir/cmake_pch.h")
file(STRINGS ${RunCMake_TEST_BINARY_DIR}/compile_commands.json foo_dir_commands
REGEX "command.*-Winvalid-pch.*foo.dir/cmake_pch.h")
list(LENGTH empty_dir_commands empty_dir_commands_size)
list(LENGTH foo_dir_commands foo_dir_commands_size)
if (empty_dir_commands_size EQUAL 0)
set(RunCMake_TEST_FAILED "empty target should have -Winvalid-pch compile option present")
return()
endif()
if (foo_dir_commands_size GREATER 0)
set(RunCMake_TEST_FAILED "foo target should not have -Winvalid-pch compile option present")
return()
endif()