Commit Graph

718 Commits

Author SHA1 Message Date
Raul Tambre
9f81591dbf Clang: MSVC-style C flags
Support added in LLVM commit d087d805acb664e885e9c31a916f6cfa5dbc2186, will be
released in Clang 13.
2021-02-25 18:22:32 +02:00
Raul Tambre
72f4984cdc Clang: C23 support
Added in LLVM commit d06f3917913d2558b771ccc48d838f8cd8993c01, released in
Clang 9.0.
2021-02-25 18:22:32 +02:00
Raul Tambre
82239d43f8 Clang: C17 default version
Switched in LLVM commit 91cdbd521a38495c66e30636943563ca70d3c022, released in
Clang 11.

Issue: #17755
2021-02-25 18:22:29 +02:00
Raul Tambre
9024fb632e Clang: C17 support
Added in LLVM commit 5b6c0f75e01571851b767dc63a3229c962f464f1, available since
Clang 6.

Issue: #17755
2021-02-25 18:22:10 +02:00
Raul Tambre
dcd599757f C23 support 2021-02-25 18:22:10 +02:00
Raul Tambre
93b7d3d292 C17 support
Implements #17755.
2021-02-25 18:22:10 +02:00
Raul Tambre
58d9525233 Clang: Correct default C standards for ancient versions
C11 was made default in LLVM commit ab506adf7d3ced6abcaf42f92de3d6cd15fa19e8,
released in 3.5.2.
C99 was made default in LLVM commit 17f76e04d244c80e70f1c81c94d4524b53d9772d,
released in 2.1. It was flipped a few times between C89 and C99 during the 2.1
cycle, but the C89 default never made it into a release.
2021-02-25 18:22:10 +02:00
Raul Tambre
356e83c156 Clang: Correct C standards flags for ancient versions
C89, C99 flags in LLVM commit ff43821d5380ee38aff421701f1d461242b524ee.
C90 flag in LLVM commit 229ce60fc9983df5f7e83e25fa6b5c0ca4d2b135.
C1x flag in LLVM commit a686b5f8bf7b5a2ab636c0c2de5ad4c174aa33e0.
C11 flag in LLVM commit 6784aeb9ef96e5735850fa7226ed0cb45cb82e75.

Mark C90, C99 full support since 2.1. Might've been possibly a little later,
but source spelunking that much back is difficult.

Mark C11 full support since 3.0, which added _Static_assert in LLVM commit
3d9cbdc3e66e274d5d3cb94ce81a65478d9baae0.
2021-02-25 18:22:10 +02:00
Raul Tambre
f112450ea0 Clang: C flags cleanup
Don't need to set the options to empty strings if not supported.
2021-02-25 18:22:10 +02:00
Brad King
4250c5f91b Merge topic 'cuda_clang_implicit'
23753be1cc Clang/CUDA: Restore needed references to implicit link variables

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5855
2021-02-25 09:03:07 -05:00
Brad King
6288974ba5 Merge topic 'nvhpc-minor-fixes'
72efd95add PGI: Explicitly specify CMAKE_CXX98_STANDARD_COMPILE_OPTION
6bfb2c6175 HELP: Update compile-features documentation with missing compilers

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5857
2021-02-25 09:02:02 -05:00
Robert Maynard
72efd95add PGI: Explicitly specify CMAKE_CXX98_STANDARD_COMPILE_OPTION
The PGI ( and NVIDIA HPC ) compilers default C++ standard level
are based on the GCC system headers it is compiling against.

Therefore on newer platforms the default C++ level will be >= 11
and requesting C++98 compilation mode will fail as no explicit
flag will be set.
2021-02-24 13:47:03 -05:00
Raul Tambre
23753be1cc Clang/CUDA: Restore needed references to implicit link variables
In commit 4620cf77f2 (Clang: Remove unused CUDA implicit link variables,
2021-02-14) we removed some references.  It turns out they are non-empty
and necessary if using a non-scattered installation.

Fixes: #21863
2021-02-24 09:58:06 -05:00
Brad King
788f231e4c Merge topic 'nag-fortran-include-moddir'
ec030877a2 NAG: Fix using Fortran modules from their output directory

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5842
2021-02-23 08:06:30 -05:00
Brad King
ec030877a2 NAG: Fix using Fortran modules from their output directory
The NAG Fortran compiler's `-mdir` flag sets the module output
directory but does not add the directory to the search path for using
modules.  This is inconsistent with other compilers like the GNU Fortran
compiler's `-J` flag that does both.  In order to make these consistent,
add the module output directory with a `-I` flag on the NAG Fortran
compiler so that it will be searched when using modules too.

We already do this for the XL Fortran compiler since commit 210b0b99a9
(XL: Fix using Fortran modules from their output directory, 2020-02-28,
v3.18.0-rc1~640^2~1).
2021-02-22 09:38:12 -05:00
Brad King
b3822e6508 Merge topic 'intel-fortran-preprocess'
c9244f369a IntelLLVM: Make explicit Fortran preprocessing under Ninja more robust
056d4bf528 Merge branch 'backport-intel-fortran-preprocess'
af074c266e Intel: Make explicit Fortran preprocessing under Ninja more robust

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5826
2021-02-19 09:35:18 -05:00
Brad King
c9244f369a IntelLLVM: Make explicit Fortran preprocessing under Ninja more robust
Tell the Fortran compiler to write preprocessor output directly to a
file, as we do for the GNU compiler.  The previous "redirect stdout"
approach could break during ABI detection with some `mpif90` wrappers
that add version information to stdout when called with `-v`.

Issue: #21828
2021-02-18 07:36:32 -05:00
Brad King
056d4bf528 Merge branch 'backport-intel-fortran-preprocess' 2021-02-18 07:35:35 -05:00
Brad King
af074c266e Intel: Make explicit Fortran preprocessing under Ninja more robust
Tell the Fortran compiler to write preprocessor output directly to a
file, as we do for the GNU compiler.  The previous "redirect stdout"
approach could break during ABI detection with some `mpif90` wrappers
that add version information to stdout when called with `-v`.

Fixes: #21828
2021-02-18 07:35:12 -05:00
Brad King
ae83d2b5ff Merge topic 'cuda_cleanup'
af38d5a1d4 Platform/Windows-NVIDIA-CUDA: Remove duplicated code
4dc1c9e525 CUDA: Fix spelling __IMPLICT_ -> __IMPLICIT_
4620cf77f2 Clang: Remove unused CUDA implicit link variables

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5812
2021-02-16 10:44:24 -05:00
Brad King
4642c81c72 IntelLLVM: Remove incomplete C17 support
CMake does not yet model support for C17.  Avoid possible confusion by
removing the settings for IntelLLVM pending a full implementation.
2021-02-15 10:43:35 -05:00
Raul Tambre
4620cf77f2 Clang: Remove unused CUDA implicit link variables
We don't use/need implicit links for Clang with CUDA.
2021-02-14 11:38:02 +02:00
Felipe Torrezan
8ee933900e IAR: add support for the STM8 compiler 2021-02-12 06:51:05 -05:00
Brad King
b1e544dd64 Merge topic 'IntelLLVM-no-imsvc' into release-3.20
e5563e592f IntelLLVM: Remove unsupported -imsvc system include flag

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5795
2021-02-11 08:58:40 -05:00
william.r.dieter
e5563e592f IntelLLVM: Remove unsupported -imsvc system include flag
`clang-cl` supports the `-imsvc` flag to tell the compiler an include
directory is intended for system paths.  `icx` does not accept this
flag, even on MSVC platforms, so do not tell CMake that it exists.

Fixes: #21801
Signed-off-by: william.r.dieter <william.r.dieter@intel.com>
2021-02-10 07:55:00 -05:00
Brad King
691e8ac480 Merge topic 'clang-imsvc'
2fc5e5dba9 Clang: Use -imsvc for system include only with MSVC-like front-end

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Thomas Bernard <thomas@famillebernardgouriou.fr>
Merge-request: !5792
2021-02-10 07:46:33 -05:00
Brad King
2fc5e5dba9 Clang: Use -imsvc for system include only with MSVC-like front-end
In commit bb61c2d024 (Clang: use -imsvc for system include dirs when
running on Windows, 2020-09-16, v3.19.0-rc1~162^2) we added `-imsvc`
for all Clang compilers targeting the MSVC ABI.  However, the option
only exists for the MSVC-like front-end.  The GNU-like front-ends
use `-isystem`.

Fixes: #21789
2021-02-09 11:24:41 -05:00
William R. Dieter
a90d2a9eed IntelLLVM: Add support for Intel LLVM-based compilers
Using a single ID 'IntelLLVM' for the suite of Intel compilers based on
the LLVM backend.  The 'IntelLLVM' ID are used for C, C++, and Fortran.
Data Parallel C++ will be handled in a separate commit.

The C and C++ definitions are based on the Clang definitions.  The Intel
LLVM-based C and C++ compilers are based on the Clang front end, so
existing Clang options are more likely to be a good match than options
for the older Intel compilers.

Fortran is based on the older Fortran front end with the LLVM backend.
It has a similar interface to the older versions, though many options
are shared with the C and C++ compilers.

Fixes: #21561
Signed-off-by: William R. Dieter <william.r.dieter@intel.com>
2021-01-28 09:05:35 -05:00
Tin Huynh
83ea49818f NVHPC: Add support for NVIDIA HPC SDK compilers based on PGI
Identify the compilers as `NVHPC` to distinguish it from the older PGI
compilers from which they evolved, and from other `NVIDIA` compilers.

Fixes: #20887
2021-01-27 09:53:02 -05:00
Thomas Bernard
b12aec6c8d BinUtils: prefer bin utils matching the compiler version extension 2021-01-11 11:33:37 -05:00
Brad King
9109475bfb Merge topic 'cpp23'
9f3c70a333 CUDA, CXX, OBJCXX: C++23 support with Clang 12
af7e1545c8 CUDA, CXX: Remove HAS_FULL_SUPPORT for C++17 and 20

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5576
2020-12-10 07:00:17 -05:00
Brad King
9f66eb74a5 Merge topic 'ispc-system-includes' into release-3.19
8da25e4a3c ISPC: Treat system includes as '-I' includes

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5591
2020-12-10 06:57:04 -05:00
Brad King
e966c23be2 Merge topic 'ispc-system-includes'
8da25e4a3c ISPC: Treat system includes as '-I' includes

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5591
2020-12-10 06:57:04 -05:00
Robert Maynard
8da25e4a3c ISPC: Treat system includes as '-I' includes
ISPC doesn't have specific syntax for system includes.
2020-12-09 11:33:44 -05:00
Raul Tambre
9f3c70a333 CUDA, CXX, OBJCXX: C++23 support with Clang 12
Clang 12 landed initial support for C++23 language mode flag -std={c|gnu}++2b
in commit 6627a3c2873fdf7ccba1a1573371079be48b36e8.
2020-12-08 18:43:59 +02:00
Raul Tambre
af7e1545c8 CUDA, CXX: Remove HAS_FULL_SUPPORT for C++17 and 20
CMake has no features for C++ versions past 14 and it seems unlikely we'd want
to add any.
Remove the related code.
2020-12-08 18:42:24 +02:00
Brad King
f200ac1304 Merge topic 'remove-partial-intel-compiler-support'
41b69348a5 Revert "Intel: Add Intel DPC++ compiler identification"
f0babb53b3 Revert "Intel: Add Intel Clang compiler identification"

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Axel Huebl <axel.huebl@plasma.ninja>
Merge-request: !5583
2020-12-08 10:16:21 -05:00
Brad King
41b69348a5 Revert "Intel: Add Intel DPC++ compiler identification"
Revert commit 887f3a88a6 (Intel: Add Intel DPC++ compiler
identification, 2020-09-21, v3.19.0-rc1~124^2).  The compiler has
already been released, and is more usable with CMake by pretending to be
upstream Clang than by identifying it as a compiler for which we have
not implemented support.

Fixes: #21551
2020-12-07 10:46:27 -05:00
Brad King
f0babb53b3 Revert "Intel: Add Intel Clang compiler identification"
Revert commit 5c3a93ab88 (Intel: Add Intel Clang compiler
identification, 2020-09-29, v3.19.0-rc1~68^2).  The compiler has already
been released, and is more usable with CMake by pretending to be
upstream Clang than by identifying it as a compiler for which we have
not implemented support.

Issue: #21551
2020-12-07 10:46:22 -05:00
Brad King
76685b985d Merge topic 'explicit-LANGUAGE-flag'
48aac247e9 Compile with explicit language flag when source LANGUAGE property is set
2e67a75acd Embarcadero: Simplify addition of -P flag for C++

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5522
2020-12-04 08:27:55 -05:00
Brad King
48aac247e9 Compile with explicit language flag when source LANGUAGE property is set
This change was originally made by commit 74b1c9fc8e (Explicitly specify
language flag when source LANGUAGE property is set, 2020-06-01,
v3.19.0-rc1~722^2), but it was reverted by commit 30aa715fac (Revert
"specify language flag when source LANGUAGE property is set",
2020-11-19) to restore compatibility with pre-3.19 behavior.

Implement the change again, but add policy CMP0119 to make this change
while preserving compatibility with existing projects.

Note that the `Compiler/{Clang,Intel,MSVC}-CXX` modules do not need to
specify `-TP` for their MSVC-like variants because we already use the
flag in `CMAKE_CXX_COMPILE_OBJECT`.  Similarly for `Compiler/XL-CXX`
and `Platform/Windows-Embarcadero`.

Note also that this does not seem possible to implement for XL C.
Even with `-qsourcetype=c`, `xlc` complains about an unknown suffix:
`1501-218 (W) file /.../AltExtC.zzz contains an incorrect file suffix`.
It returns non-zero even with `-qsuppress=1501-218`.

Co-Author: Robert Maynard <robert.maynard@kitware.com>
Fixes: #14516, #20716
2020-12-02 11:39:11 -05:00
Marc Chevrier
8981e3e7cc NVIDIA-CUDA: rely on new capabilities for deps generation 2020-12-02 17:31:02 +01:00
Brad King
ed958ba685 Merge topic 'ti-c-only-standard'
8eeddb1f0a Compiler/TI: Fix C standard flags in C-only project

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5558
2020-12-02 09:21:30 -05:00
Adam Weisi
8eeddb1f0a Compiler/TI: Fix C standard flags in C-only project
Use our compiler architecture variable for C rather than CXX.
2020-12-01 12:14:38 -05:00
Brad King
a24a4e18af Merge topic 'makefiles-compiler-deps-optims'
2c71d051fa Makefiles Generators: use compiler for dependencies generation
afd0f6785d Refactoring: Abstract Makefile line continuation format
b6068ce407 Refactoring: enhance include file filtering
3401403f69 Refactoring: Introduce place-holder for dependency target.
a97c41bf8b Refactoring: Makefiles Generators: Add support for various depends scanners

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Brad King <brad.king@kitware.com>
Merge-request: !5528
2020-11-30 13:26:53 -05:00
Marc Chevrier
2c71d051fa Makefiles Generators: use compiler for dependencies generation
Each source compilation generates a dependencies file. These dependencies
files are consolidated in one file per target. This consolidation is done
as part of command 'cmake -E cmake_depends` launched before evaluation of
makefile dependency graph.

The consolidation uses the same approach as `CMake` dependencies management.

Fixes: #21321
2020-11-29 15:25:42 +01:00
Marc Chevrier
3401403f69 Refactoring: Introduce place-holder for dependency target.
These changes are in preparation of compiler generated dependencies support
for Makefiles generators

* compiler output and dependency target can be different for Makefiles generators
* resolve inconsistency naming for dependency file place-holder
2020-11-28 16:02:58 +01:00
Robert Maynard
72f6b4bfbe Modules: Rename Internal/CMake{CheckCompiler => TryCompilerOrLinker}Flag
Rename the `CheckPIESupported` helper functions so that they
don't clobber other internal functions. Also rename them to
document they can't be unified with `CheckCompilerFlag`.

Fixes: #21497
2020-11-25 11:06:15 -05:00
Brad King
30aa715fac Revert "specify language flag when source LANGUAGE property is set"
Revert commit 74b1c9fc8e (Explicitly specify language flag when source
LANGUAGE property is set, 2020-06-01, v3.19.0-rc1~722^2) and the lookup
tables from its two immediate ancestors.  The purpose of that change was
to convert an explicit `LANGUAGE` source file property into an explicit
language specification compiler flag like `-x c`.  This seems reasonable
since the property is documented as meaning "indicate what programming
language the source file is".  It is also needed to help compilers deal
with non-standard source file extensions they don't recognize.

However, some projects have been setting `LANGUAGE C` on `.S` assembler
source files to mean "use the C compiler".  Passing `-x c` for them
breaks the build because the `.S` sources are not written in C.  These
projects should be updated to use `enable_language(ASM)`, for which
CMake often chooses the C compiler as the assembler when using
toolchains that support it (which would have to be the case for projects
using the approach).

Revert the change for now to preserve the old behavior for such projects.
We can re-introduce it with a policy in a future version of CMake.

Fixes: #21469
Issue: #14516, #20716
2020-11-19 17:06:03 -05:00
janbernloehr
bcdd486bf7 CUDA: Enable support on QNX
This fixes the following two issues with the CUDA support on QNX:

* cuda target name is not derived correctly (should be `aarch64-qnx`).
* linking `cudart` must not be linked against `rt`, `dl`, `pthread`.

This enables to use cmake's native cuda support on QNX.

Fixes: #21381
2020-11-02 09:39:36 -05:00