Commit Graph

321 Commits

Author SHA1 Message Date
Brad King
820af5f797 Merge topic 'lang-specific-binutils'
73934188 Rename CMAKE_GCC_{AR,RANLIB} to CMAKE_LANG_COMPILER_{AR,RANLIB}

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !656
2017-04-05 10:15:40 -04:00
Ruslan Baratov
7393418844 Rename CMAKE_GCC_{AR,RANLIB} to CMAKE_LANG_COMPILER_{AR,RANLIB}
The variables recently added by commit b9d36826 (Add 'CMAKE_GCC_AR' and
'CMAKE_GCC_RANLIB' variables, 2017-03-08) are more appropriately managed
with language-specific names rather than toolchain-specific names.
2017-04-03 14:10:50 -04:00
Brad King
7c93f6f21d Merge topic 'intel-compile-features'
4af0c9da Features: Update features for Intel C++ 17.0.2 on UNIX

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !652
2017-04-03 09:25:04 -04:00
Brad King
4af0c9daf4 Features: Update features for Intel C++ 17.0.2 on UNIX
Intel 17.0.2 on UNIX introduced a regression from 17.0.1 in its
definition of `__cpp_constexpr` in `-std=c++14` mode.  It incorrectly
defines it as `200704` instead of the expected `201304`.  Fix our
feature detection table to account for this.
2017-03-31 14:29:18 -04:00
Brad King
8772fc81c4 Merge topic 'ipo-policy-CMP0069'
dfa8263f Implement interprocedural optimization for GNU compilers
1588a577 Add policy CMP0069 to enforce INTERPROCEDURAL_OPTIMIZATION
a7575700 Refactoring: s,GetFeatureAsBool,IsIPOEnabled,
e05835c3 CheckIPOSupported: Visual Studio and Xcode generators do not support IPO

Acked-by: Kitware Robot <kwrobot@kitware.com>
Reviewed-by: Brad King <brad.king@kitware.com>
Reviewed-by: Nils Gladitz <nilsgladitz@gmail.com>
Merge-request: !568
2017-03-31 10:38:08 -04:00
Ruslan Baratov
dfa8263f4b Implement interprocedural optimization for GNU compilers
Honor the `INTERPROCEDURAL_OPTIMIZATION` target property for GNU
compilers by activating their link-time-optimization (LTO) flags.
2017-03-30 14:56:52 -04:00
Brad King
a820327d1a Merge topic 'sdcc-compiler-id'
5695558f SDCC: Fix identification of current sdcc compiler

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !644
2017-03-30 08:59:05 -04:00
Brad King
5695558f4a SDCC: Fix identification of current sdcc compiler
The sdcc compiler no longer defines the `SDCC` preprocessor macro.
Instead `__SDCC_VERSION_MAJOR` and similar component-wise macros are
defined.  Use them instead if defined.

Issue: #16746
2017-03-29 13:21:49 -04:00
Brad King
8fc934de0e GNU-FindBinUtils: Avoid setting policy CMP0054
The `cmake_policy(SET)` call triggers `CMP0011` warnings when this
module is used in a project that does not set `CMP0011` to NEW.  We
could avoid these with a `cmake_policy` PUSH/POP pair, but it is simpler
to adjust our code to not trigger `CMP0054` in the first place.
2017-03-10 10:46:11 -05:00
Ruslan Baratov
b9d36826c5 Add 'CMAKE_GCC_AR' and 'CMAKE_GCC_RANLIB' variables 2017-03-09 04:28:01 +08:00
Brad King
d1530cc9a5 Merge topic 'cuda-msvc-flags'
55fb46d2 CUDA: Fix default compiler flags on Windows
d7c80f60 CUDA: Fix test cases to not override CUDA flags
2017-02-16 13:15:35 -05:00
Brad King
55fb46d273 CUDA: Fix default compiler flags on Windows
Fix the default values of `CMAKE_CUDA_FLAGS[_<CONFIG>]` on Windows to
make the host compiler flags match those produced for C++ by the
`Platform/Windows-MSVC` module.  This makes the flags consistent with
those used for C++.
2017-02-15 11:12:12 -05:00
Brad King
8ba5c21db7 Merge topic 'cuda-no-Os'
59ed323d CUDA: Do not use non-existent -Os flag for nvcc
2017-02-15 08:24:02 -05:00
Brad King
59ed323d46 CUDA: Do not use non-existent -Os flag for nvcc
Fix the CUDA MinSizeRel configuration flags to avoid using the `-Os`
flag that nvcc does not support.
2017-02-14 14:49:53 -05:00
Rolf Eike Beer
e2ee097147 g++ knows about C++98 selection flags since at least 3.4
https://gcc.gnu.org/onlinedocs/gcc-3.4.0/gcc/C-Dialect-Options.html#C-Dialect-Options
2017-02-08 21:04:31 +01:00
Rolf Eike Beer
37ed860ad1 GNU C++: record that -fvisibility-inlines-hidden is available since 4.0
See https://gcc.gnu.org/onlinedocs/gcc-4.0.0/gcc/Option-Summary.html
2017-02-02 18:28:56 +01:00
Rolf Eike Beer
94a8ee6fd0 GNU C: record that C99 is available since at least 3.4 2017-02-02 18:28:56 +01:00
Brad King
5d70894d40 Features: Update version of Intel Compiler on Windows supporting C 11
The Intel Compiler 15.0.0 on Windows does not support `-Qstd=c11`.
Bump our version requirement to 16 to use that flag.
2017-02-01 08:55:50 -05:00
Rolf Eike Beer
24d73fa0eb GNUC: also check __GNUG__ define when checking for g++
At least the scratchbox compiler for the N900, which basically is a gcc 4.2,
sets only __GNUG__ in C++ mode, but not __GNUC__. It does indeed set
__GNUC_MINOR__ and __GNUC_PATCHLEVEL__. Extend the compiler detection code for
GNU compilers in C++ mode to look at __GNUG__ in case __GNUC__ is absent.
2017-01-25 21:53:40 +01:00
Giel van Schijndel
9fe399e389 Features: activate C++11 support for Clang 3.1+ 2017-01-12 17:16:34 +01:00
Brad King
1155170230 CUDA: Populate NVIDIA compiler information on Windows
Port Windows-specific compilation and linking rules over from the
`Platform/Windows-MSVC` module and adapt it for NVIDIA CUDA.  On Windows
nvcc and its host compiler (MSVC) do not understand or use options like
`-fPIC` or `-std=`, so condition those out.
2017-01-12 10:39:04 -05:00
Brad King
65c1e012ff CUDA: Detect use of MSVC host compiler
Report it in `CMAKE_CUDA_SIMULATE_{ID,VERSION}`.
2017-01-12 10:39:02 -05:00
Daniel Carrera
4087d0ae85 PGI: Add support for Fortran with the Ninja generator
The PGI documentation says that `-Mpreprocess` "instructs the compiler
to perform cpp-like preprocessing on assembly and Fortran input source
files".  The `-E` flag causes the compiler to spit the result to stdout
instead of saving it to a file.
2016-12-16 08:33:21 -05:00
Brad King
7552d16d1a CUDA: Fix default compiler flag initialization
Since commit v3.7.0-rc1~392^2 (Honor CMAKE_<LANG>_FLAGS[_<CONFIG>]_INIT
set in toolchain files, 2016-07-05) our convention is to initialize
compiler flag variables via `string(APPEND)` rather than `set()`.
Fix the convention for `CMAKE_CUDA_FLAGS[_<CONFIG>]_INIT`.
2016-12-09 14:19:22 -05:00
Brad King
85c8e652b1 Features: Activate C++ 17 support for AppleClang 6.1+ 2016-12-02 11:22:47 -05:00
Brad King
8084f7a6c9 Features: Activate C++ 17 support for Clang 3.5+ 2016-12-02 11:22:46 -05:00
Brad King
24e29d4190 Features: Activate C++ 17 support for GNU 5.1+ 2016-12-02 11:22:46 -05:00
Brad King
ae1a6815b6 Features: Add infrastructure for C++ 17 language standard
Issue: #16468
2016-12-02 11:22:46 -05:00
Brad King
684e4d205d Features: Make feature recording conditions more consistent
Condition all calls to `_record_compiler_features_{c,cxx}` on
`_result EQUAL 0` so that adding new language standards later does
not need to update them.  Avoid some duplicate compiler version
checks by conditioning C11 and CXX14 feature recording on the
existence of `CMAKE_{C11,CXX14}_STANDARD_COMPILE_OPTION` (whose
setting already used the version check).
2016-12-02 11:22:43 -05:00
Brad King
4838ca14df Merge topic 'initial_cuda_language_support'
4cc601f2 Help: Add release note for CUDA support
7b9131da CUDA: Add tests to verify CUDA compiler works properly.
9cf5b98d CUDA: Prefer environment variables CUDACXX and CUDAHOSTCXX.
a5e806b3 CUDA: Add support for CMAKE_CUDA_COMPILE_OPTIONS_VISIBILITY
d038559e CUDA: Add separable compilation support to the makefile generator.
43ce4414 CUDA: Add separable compilation support to the ninja generator.
4b316097 CUDA: Add support for the CUDA_SEPARABLE_COMPILATION target property
ae05fcc6 CUDA: Add LinkLineComputer that computes cuda dlink lines.
115269a8 CUDA: Refactor cmLinkLineComputer to allow for better derived children.
5dec4031 CUDA: Refactor CMakeCUDAInformation to prepare for separable compilation.
5b20d0ab CUDA: C++ compile features now enable cuda c++11 support.
489c52ce CUDA: Use the host compiler for linking CUDA executables and shared libs.
bbaf2434 CUDA: add support for specifying an explicit host compiler.
a92f8d96 CUDA: Enable header dependency scanning.
ec6ce623 CUDA: State that cuda has preprocessor output and can generate assembly.
4f5155f6 CUDA: We now properly perform CUDA compiler identification.
...
2016-11-29 08:59:03 -05:00
Brad King
b6da714af7 Merge topic 'armcc-response-file-flag'
d608e85c ARMCC: Fix flag used for response files
2016-11-16 07:45:54 -05:00
Ben Boeckel
d608e85cfe ARMCC: Fix flag used for response files
ARMCC does not use the `@` sigil to indicate response files, but instead
the `--via=` flag. See the documentation here:

    http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0491h/CHDCIEGC.html

Fixes: #16425
2016-11-15 09:31:33 -05:00
Robert Maynard
5dec403103 CUDA: Refactor CMakeCUDAInformation to prepare for separable compilation. 2016-11-14 11:36:45 -05:00
Robert Maynard
489c52ce68 CUDA: Use the host compiler for linking CUDA executables and shared libs. 2016-11-14 11:36:44 -05:00
Robert Maynard
4f5155f6ab CUDA: We now properly perform CUDA compiler identification. 2016-11-14 11:36:43 -05:00
Robert Maynard
ce4ec876ce CUDA: Add support language levels (98/11) 2016-11-14 11:36:43 -05:00
Robert Maynard
f8aac21947 CUDA: Add basic CUDA language support for *NIX systems. 2016-11-14 11:36:42 -05:00
Brad King
68a9fc1bca Merge topic 'intel-compile-features'
5e428389 Features: Detect Intel C++14 mode more reliably
1f848031 Features: Suppress c_static_assert test coverage on Intel <= 15
2016-11-11 10:44:07 -05:00
Brad King
5e42838961 Features: Detect Intel C++14 mode more reliably
The `__cplusplus` macro is not defined to the language level reliably.
When simulating MSVC it is always set to `1`.  When simulating GCC it is
set to the lower value of the current language level and the maximum
level supported by the simulated version of GCC (from observation).

For MSVC we already used a combination of `__INTEL_CXX11_MODE__` and
`__cpp_aggregate_nsdmi` to detect C++14 mode.  Extend this for general
use by removing the condition on `_MSC_VER`.
2016-11-10 15:37:05 -05:00
Brad King
be73273952 Features: Fix standards and features for Intel 15 on Windows
The Intel 15 compiler for Windows does not support the same set of
standards and features as the same version for other platforms.
2016-11-10 12:54:06 -05:00
Brad King
e106a6eafb Merge topic 'compile-features-for-language-standards'
9a8d758c Help: Document language standard meta-features
df252db1 Features: Test cycle diagnostic with language standard meta-feature
6d5fb0e0 Features: Test feature propagation with language standard meta-feature
a34b98a8 WCDH: Ignore language standard meta-features
b0996a3f Features: Add meta-features requesting awareness of a particular standard
8b6cc251 Features: Centralize per-compiler recording macros
2d23f7b2 Features: Do not record features on MSVC < 2010
2016-11-03 08:54:33 -04:00
Brad King
b902f2a98a Features: Fix Intel cxx_attributes existence condition
This condition needs to follow the same pattern added in note `[1]` by
commit a5a3642f (Features: Port Intel CXX features to test macros where
possible, 2016-10-26).  It was accidentally left out of that commit.
2016-11-03 08:38:23 -04:00
Brad King
b0996a3fa2 Features: Add meta-features requesting awareness of a particular standard
A common use case of `target_compile_features` is simply to specify that
the compiler should be run in a mode that is aware of e.g. C++11.  Some
projects simply specify a particular C++11-only feature to request this.
Provide a first-class way to do this by naming features after the
corresponding language standard.  Record them as always available in the
corresponding standard level so that requesting them always ensures that
standard (or higher) is used.
2016-11-02 10:00:28 -04:00
Brad King
8b6cc2518a Features: Centralize per-compiler recording macros
Simplify and de-duplicate per-compiler feature recording macros and
convert to a centralized per-language macro.
2016-11-02 09:51:48 -04:00
Brad King
2d23f7b206 Features: Do not record features on MSVC < 2010
We have no feature tests for versions of VS older than 2010, so do
not even call `record_compiler_features` for such versions.  This
is consistent with other compilers where we call this macro only
for versions for which we have recorded features.
2016-11-02 09:42:18 -04:00
Brad King
369d580937 Features: Record features for Intel Compiler on Windows
Since this compiler always defines `__cplusplus` to `1` we need to use
`_MSC_VER`, `__INTEL_CXX11_MODE__`, and the feature test macro named
`__cpp_aggregate_nsdmi` to detect C++11 and C++14 modes.

With no `-Qstd=` flag this compiler defaults to C++98 plus a subset of
C++11/C++14 features needed to be compatible with MSVC.  We pretend it
is plain C++98 and add a `-Qstd=` flag whenever needed for C++11 or
above features even if they would happen to be available in MSVC-mode.

Closes: #16384
2016-10-27 13:33:10 -04:00
Brad King
a5a3642f92 Features: Port Intel CXX features to test macros where possible
The Intel 16 and 17 compilers define feature test macros of the form
`__cpp_<feature>`.  Use them where possible to detect corresponding
features.
2016-10-27 13:28:34 -04:00
Brad King
d34ac22fec Features: Unset Intel CXX feature temporaries 2016-10-27 13:28:34 -04:00
Brad King
967dcf36d0 Intel: Remove incorrect C++98 standard compiler flag on Windows
The change in commit 05e05cd2 (Intel: Fix compiler C++98 standard flag
on Windows, 2016-10-26) was wrong.  The Intel C++ Compiler for Windows
does not support either `-Qstd=c++98` or `-Qstd=gnu++98`.  Simply remove
both flags for this compiler and use no options at all to achieve this
mode.

Issue: #16384
2016-10-27 13:28:34 -04:00
Brad King
05e05cd2aa Intel: Fix compiler C++98 standard flag on Windows
The Intel C++ Compiler for Windows does not support the `-Qstd=c++98`
flag but does support `-Qstd=gnu++98`.

Issue: #16384
2016-10-26 15:03:53 -04:00