Commit Graph

18 Commits

Author SHA1 Message Date
Brad King
9fd0ecdedb Tests: Fix RunCMake infrastructure for LCC and CMP0129
Since commit 3958ed878f (LCC: Add policy CMP0129 regarding interpreting
LCC as GNU, 2021-10-19, v3.23.0-rc1~508^2) we intended to enable policy
`CMP0129` in RunCMake tests via `-DCMAKE_POLICY_DEFAULT_CMP0129=NEW`.
Fix the condition activating that to check `CMAKE_C_COMPILER_ID` where
it is always available.

Remove now-unnecessary CMP0129 settings in RunCMake cases.
2023-04-03 09:42:22 -04:00
Brad King
97fcd3bd30 CheckCompilerFlag: Revert 'Match the Clang "argument unused" output ...'
Revert commit 5b45a3d0ce (CheckCompilerFlag: Match the Clang "argument
unused" output for all languages, 2023-01-23, v3.26.0-rc1~38^2).  It
broke existing projects that were silently tolerating unrelated unused
arguments in their checks for C and CXX.  For example, using
`CFLAGS=-nostdinc` or `CXXFLAGS=-nostdinc++` causes those flags to be
used when driving the linker as well, and Clang warns they are unused in
that case.

Add a test case covering the now-restored behavior.

Fixes: #24591
2023-03-13 16:18:50 -04:00
Evan Wilde
2d5403ecaa CheckCompilerFlag: Add Swift Support
Plumb through Swift `check_compiler_flag` support.
Add tests to check that valid flags work and invalid flags don't.
2022-11-04 09:32:06 -07:00
Brad King
90aa0bb305 Tests: Move TryCompile check module cases to RunCMake.Check*
The latter already have similar checks for similar modules.
2022-10-06 10:29:42 -04:00
Brad King
64ac01451d Tests: Clarify RunCMake.Check* case names
Cases for `CheckSource{Compiles,Runs}` and `Check{Compiler,Linker}Flag`
cover the modules with the language as a parameter, not the
language-specific modules.
2022-10-06 10:29:42 -04:00
Brad King
cbf3252975 Tests: Remove stray debugging flag from RunCMake.CheckCompilerFlag case 2022-10-05 09:53:17 -04:00
Craig Scott
a10fc754a6 CheckSourceCompiles: Avoid linker warning with -fembed-bitcode
When the Apple linker sees -headerpad_max_install_names and
bitcode is enabled with a flag like -fembed-bitcode, it issues a warning
and ignores the -headerpad_max_install_names flag. This causes
unrelated compiler and linker flag checks to fail for valid flags.
In f745e0497e (CheckCompilerFlags: Catch linker warning about ignored
flags, 2022-01-03), we started detecting linker warnings, which caused
a regression for projects that were setting -fembed-bitcode in their
CMAKE_CXX_FLAGS or similar. Prevent that regression by removing
the -headerpad_max_install_names linker flag when we know it will
warn and be ignored anyway.

Fixes: #23390
Issue: #23408
2022-04-09 21:51:09 +10:00
Brad King
9dd585d12c CheckCompilerFlag: Fix regression in locale environment preservation
Fix a typo from commit 660e0d80ae (internal/CheckCompilerFlag: rely on
common configuration, 2022-01-12, v3.23.0-rc1~124^2~1) that caused
locale environment variables to not be restored after they are set
during the check.
2022-04-07 15:07:48 -04:00
Marc Chevrier
660e0d80ae internal/CheckCompilerFlag: rely on common configuration
Extract configuration step from the CheckCompilerFlag command
to enable to share it with future CheckLinkerFlag implementation
2022-01-14 23:22:01 +01:00
makise-homura
3958ed878f LCC: Add policy CMP0129 regarding interpreting LCC as GNU
Due to MCST LCC compiler identification is now changed to LCC,
there should be a way for old projects to still identify it as GNU,
as it was before.
This commits adds the policy:
CMP0129: Compiler id for MCST LCC compilers is now LCC, not GNU.
This policy controls such a behavior.
OLD behaivior is to treat LCC as GNU, NEW is to treat is as LCC.
2021-10-21 17:24:22 +03:00
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
Robert Maynard
2e86e50c2f HIP: Add HIP to all the Check* modules 2021-06-07 19:25:33 +00:00
Brad King
f3d4254b3d Check*: Tolerate variables set with names of languages
Fix the language checks added by commit 90dead024c (CheckCompilerFlag:
unified way to check compiler flags per language, 2020-09-25,
v3.19.0-rc1~88^2), commit 10ae907de0 (CheckSoureCompiles: Add a unified
way to check if a source compiles, 2020-09-14, v3.19.0-rc1~118^2~1), and
commit 357e2ef429 (CheckSoureRuns: Add a unified way to check if a
source runs, 2020-09-14, v3.19.0-rc1~118^2) to work when variables of
the language names are set.

Fixes: #21500
2020-11-25 09:11:21 -05:00
Robert Maynard
da2622ff36 CUDA: Add Support to SourceCompiles|Runs and CheckCompilerFlags 2020-10-08 08:30:59 -04:00
Brad King
c61f820a7f Merge topic 'add_ispc_to_check_helpers'
e17e2c6a51 ISPC: CheckCompilerFlags and CheckSourceCompiles support ISPC

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5337
2020-10-07 07:13:21 -04:00
Robert Maynard
e17e2c6a51 ISPC: CheckCompilerFlags and CheckSourceCompiles support ISPC 2020-10-06 10:47:20 -04:00
Luthaf
d66858c8e4 CheckCompilerFlag: Update the regex used to detect invalid options for GCC 10
The warning emmitted by GCC for invalid options have been updated to
read "command-line option XXX is valid ..." instead of "command line
option XXX is valid ...".  Update the regex to make it valid with both
the old and new warning message.

Fixes: #21275
2020-10-06 10:38:18 -04:00
Robert Maynard
8ac9719659 CheckCompilerFlag: Add tests to verify module correctness 2020-10-06 07:07:02 -04:00