Commit Graph

469 Commits

Author SHA1 Message Date
Brad King
4d337be994 Merge branch 'qcc-asm-detection' into release-3.14
Merge-request: !3016
2019-02-25 09:33:25 -05:00
Maikel van den Hurk
be87ce43f0 Add ASM Compiler detection for QCC 2019-02-25 08:28:47 +01:00
Brad King
113a395ee7 Merge branch 'try_compile-expand-compile-defs' into release-3.14
Merge-request: !2965
2019-02-15 06:47:59 -05:00
Brad King
cde2596a19 try_compile: Restore expansion of ;-list in COMPILE_DEFINITIONS
The quoting added by commit 8c5221fb1f (try_compile: Preserve special
characters in COMPILE_DEFINITIONS, 2019-01-21, v3.14.0-rc1~108^2~3)
broke the case that the `COMPILE_DEFINITIONS` value contains a `;`.
Without the quoting the `;` would be generated literally in an unquoted
argument in the test `CMakeLists.txt` file and would then be expanded.
With quoting the `;` is preserved, which is not the old behavior.

Fix this by expanding the `;`-list ahead of time.  Add test cases for
behavior with both `#` and `;`.

This was noticed with the PGI compiler where we set
`CMAKE_CXX*_STANDARD_COMPILE_OPTION` to values like `--c++17;-A`.  The
symptom had also been observed while preparing commit ef8f237686
(ParseImplicitIncludeInfo: add SunPro Fortran and PGI compiler, Cray
fix, 2019-01-29, v3.14.0-rc1~26^2~2) but was not recognized at the time
as a regression.  Revert the workaround added by that commit.

Fixes: #18919
2019-02-15 06:21:19 -05:00
Brad King
d80ecba5c2 Fortran: Fix submodule file names across compilers
The naming convention for submodule files varies across compilers.  Add
a table to the compiler information modules and thread the information
through to the Fortran module dependency parser.  Fill out the table for
compiler ids known to support Fortran submodules.

Fixes: #18746
2019-02-14 10:23:02 -05:00
Chuck Cranor
eaf53158f4 CrayPrgEnv/ParseImplicitIncludes: simplify for new implict include parser
Remove now redundant implicit parser code from CrayPrgEnv.cmake, as
this function is now supported in the general cmake code
(e.g. Modules/CMakeParseImplicit{Include,Link}Info.cmake).

This simplifies __CrayPrgEnv_setup() to take only one arg (${lang})
and allows us to remove a level of inclusion as
CrayPrgEnv-${lang}.cmake is now compiler independent we
do not need the CrayPrgEnv-${compiler}-${lang} files any more.
2019-01-29 08:17:44 -07:00
Chuck Cranor
ef8f237686 ParseImplicitIncludeInfo: add SunPro Fortran and PGI compiler, Cray fix
Add implicit include parser for PGI compiler ID.  PGI verbose output
for CXX differs from C and Fortran, so CXX is broken out into its own
case.  The C and Fortran compilers take "-YI,path" and "-Mnostdinc" to
change or disable the builtin include path.  The last arg on the command
line appears to override previous args (e.g. "-YI,path1 -YI,path2" will
set the path to "path2" ... the previous "-YI,path1" gets undone).
The CXX compiler verbose output reports with "-I" rather than "-stdinc"
for the built in path.  In addition with CXX "-Mnostdinc" does not
completely zero the include path (e.g. "#include <stdio.h>" still works
with "-Mnostdinc"... "-I/usr/include" still shows up in the verbose output).

Minor adjustments to get the SunPro parser to handle Fortran as well.

Fixes for Cray compiler support (Modules/Compiler/Cray-{C,CXX}.cmake):
The *_COMPILE_OPTION flags contain options like "-h c99,gnu" ...
these options need to be in double quotes (they are currently not).
Otherwise, cmake treats them as lists and tries to run the compiler
with "-h;c99,gnu" and fails when it is "Detecting C compile features"...
Also, the Cray-CXX.cmake contains "__compiler_cray(C)" instead of
"__compiler_cray(CXX)" -- this error prevents the correct VERBOSE
flags for CXX from being defined which prevents the implicit include
parser from running.

Add additional test cases for PGI and SunPro Fortran to the
Tests/RunCMake/ParseImplicitIncludeInfo area.
2019-01-29 07:48:03 -07:00
Brad King
6d57201868 Merge topic 'intel-compile-features'
fc40bca590 Intel: Record support for relaxed constexpr by version 18.0.5

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2862
2019-01-28 07:59:30 -05:00
Brad King
fc40bca590 Intel: Record support for relaxed constexpr by version 18.0.5
Update the special case added by commit f719a13c28 (Features: Add
special case to disable relaxed constexpr for Intel 18, 2018-06-04,
v3.12.0-rc1~11^2) to record that 18.0.5 fixed the regression.
2019-01-25 07:56:37 -05:00
Brad King
c765ae495a CMakeDetermineCompilerABI: pass verbose flag during compilation
Default to the same flag that is used for verbose link information, but
provide another internal platform information variable to use a
compilation-specific variant.  Populate it for CUDA where we use a
different compiler for compilation and linking and therefore need
different flags.

Co-Author: Chuck Cranor <chuck@ece.cmu.edu>
2019-01-21 11:14:08 -05:00
Fred Baksik
72e0c115b7 GHS: Add Compiler ID detection
-- Detect GHS compiler and version
   Detect ARCHITECTURE_ID for PPC / ARM / 86 targets
   Detect PLATFORM_ID for Integrity and Integrity178 platforms
   Using defines specified in the documents for the compilers: 201416 PPC / 201754 ARM / 201714 86
-- Fallback C/CXX compiler ID to GHS if not otherwise detected and using GHS MULTI generator
   Works around issue with some GHS compilers not setting __ghs__ compiler define
-- Tweak Compiler ID checking so major id of 002017 is not replaced with 217
-- Prefer try_compile() library targets when testing for working GHS compilers
-- Avoid CMake errors if reading past end of file for checking if file is PE executable
2019-01-16 10:42:04 -05:00
Fred Baksik
702121c5f3 GHS: Use the correct compiler flags for CMAKE_BUILD_TYPE
-- Do not use CMAKE_C_FLAGS_RELEASE flags when CMAKE_BUILD_TYPE is empty
   if CMAKE_BUILD_TYPE was not set the generator would use Release settings
   this does not match the documented behavior of CMAKE_BUILD_TYPE

-- CMAKE_C_FLAGS_<CONFIG> not used when -kernel is present
   Fixes issue where CMAKE_C_FLAGS_<CONFIG> is ignored when -kernel option is present as a compiler option
   When the -kernel option is added to an executable it uses a different set of language flags
   This does not occur -kernel=<type> is used or if it is added as part of a link flag
   The variables CMAKE_<LANG>_GHS_KERNEL_FLAGS_<CONFIG> are removed
   NOTE: By default this only added the flag -ldebug which links in the debugger library.

-- Separate compiler options by newlines
2019-01-16 10:41:35 -05:00
Fred Baksik
595932c4f0 GHS: Update the link line processing
-- add missing executable linker libs from:
   CMAKE_C_STANDARD_LIBRARIES
-- add missed transitive link libraries
-- add skipped library linker options
-- The linker expects -l../relative/path/to/lib.a to be relative to the top-level project
   Because there can be multiple top-level projects convert the path to an absolute path to target
2019-01-16 10:41:27 -05:00
Fred Baksik
2ed2d6b46f GHS: Place build system outputs per target output directives
-- Set output and object file locations
-- Suffixes are no longer being forced but will now follow the target properties
   By default GHS tools have no suffix for executable files so
   CMAKE_EXECUTABLE_SUFFIX was changed to meet this behavior
-- Remove #if 0 blocked out code; it has been replaced.
   Forcing the -relprog option has been removed from non-kernel executable targets.
   The default value of this option (if it is even available) is determined by the
   tool-chain for the specified target and platform (Some tool-chains default to
   -locatedprogram).  The use of -relprog can have unexpected results as it cannot
   always produce a fully relocated executable.
-- Clarify use of CMAKE_BUILD_TYPE to control build configuration
2019-01-16 10:41:24 -05:00
Ethan Slattery
270965e0c7 IAR: Update compiler modules to support AVR systems
Fixes: #18557
2019-01-15 13:59:01 -05:00
Rob Boehne
74720a298c XL: Move '-bE' flag earlier so it can be overridden
By default, we generate an export list for a shared library and pass
that file on the link line.  The problem was that it could not be
overridden by a target when a specific export file is being used.
Multiple `-bE` flags on the link are overridden by subsequent `-bE`
flags, so only the last one is used.

Fixes: #13282
2019-01-10 14:25:06 -05:00
Marc Chevrier
f255280fd9 PIE link options: Update strategy to fix performance regression
Fixes: #18700
2018-12-19 19:41:27 +11:00
Cristian Adam
243b7c40d4 QNX: Compiler and feature detection fixes
Tested compiler detection with the QNX 7.0 list of compiler targets:
 * gcc_ntoaarch64le
 * gcc_ntoaarch64le_cxx
 * gcc_ntoarmv7le
 * gcc_ntoarmv7le_cxx
 * gcc_ntox86_cxx
 * gcc_ntoaarch64le_gpp
 * gcc_ntox86_64_gpp
 * gcc_ntoarmv7le_gpp
 * gcc_ntox86_64_cxx
 * gcc_ntox86
 * gcc_ntox86_gpp
 * gcc_ntox86_64

This commit fixes some of the problems described in:
https://cristianadam.eu/20181202/a-better-qnx-cmake-toolchain-file/
2018-12-03 23:18:43 +01:00
Marc Chevrier
c4b4d8b3a6 POSITION_INDEPENDENT_CODE: Manage link flags for executables
Fixes: #14983, #16561
2018-11-11 17:34:09 +01:00
Marc Chevrier
724a0346f7 POSITION_INDEPENDENT_CODE: Fix erroneous '-fPIE' flag for Sun Studio
Fixes: #16311
2018-11-08 14:58:57 +01:00
Brad King
157e3e1bd6 Merge topic 'flang-preprocess-source'
8d782adbce Flang: Fix command-line used to preprocess sources

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2545
2018-10-30 11:00:41 -04:00
Brad King
59d57f023f Merge topic 'qccDepfile'
99728fe27c QNX: Update qcc depfile flags to be compliant with ccache

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2540
2018-10-30 10:59:12 -04:00
Brad King
b8e2c42f36 Merge branch 'flang-preprocess-source' into release-3.13
Merge-request: !2545
2018-10-29 14:26:01 -04:00
Brad King
8d782adbce Flang: Fix command-line used to preprocess sources
Running flang with `-E` now ignores any `-o` option and always prints
preprocessed output to stdout.  Use shell redirection to place it in a
file instead.

Fixes: #18497
2018-10-29 14:23:58 -04:00
Brad King
37cf805d3e Merge branch 'qccDepfile' into release-3.13
Merge-request: !2540
2018-10-29 12:51:19 -04:00
Maikel van den Hurk
99728fe27c QNX: Update qcc depfile flags to be compliant with ccache
Pass the flags to the preprocessor phase via `-Wp,`.  This is
accepted both by qcc and ccache.
2018-10-29 12:50:55 -04:00
Brad King
39534c58c5 Autogen: Add clang --target= flag to compiler predefines command
Respect the compiler target value `CMAKE_<LANG>_COMPILER_TARGET` in
`CMAKE_<LANG>_COMPILER_PREDEFINES_COMMAND`.

Issue: #18425
2018-10-05 10:23:52 -04:00
Daniel Schürmann
a26ebb894b IAR: Abort if compiler version or target architecture is not detected
If these are not detected then we cannot support the IAR compiler.
Fail early with an explicit message instead of silently proceeding
and getting strange errors.

Issue: #18333
2018-09-10 09:03:47 -04:00
Brad King
eeb5bb7fe1 Merge topic 'cmake_lang_compiler_predefines'
83f2d48388 Respect CMAKE_<LANG>_COMPILER_ARG1 in CMAKE_<LANG>_COMPILER_PREDEFINES_COMMAND

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2316
2018-08-30 09:21:31 -04:00
Sebastian Holtermann
83f2d48388 Respect CMAKE_<LANG>_COMPILER_ARG1 in CMAKE_<LANG>_COMPILER_PREDEFINES_COMMAND
AUTOMOC used to fail to generate ``moc_predefs.h`` when ``ccache`` was used
as a compiler starter by e.g. configuring a project with the environment
variable CXX="ccache g++".
The reason was that ``CMAKE_<LANG>_COMPILER_ARG1`` wasn't respected in the
definition of ``CMAKE_<LANG>_COMPILER_PREDEFINES_COMMAND`` for various
compilers.  This is fixed by this patch.

Fixes #17275.
2018-08-28 20:07:53 +02:00
Kelly (KT) Thompson
5a655681c3 Cray: Record C++14 compiler mode options
Fixes: #18270
2018-08-24 15:15:53 -04:00
Brad King
d64e41ac48 Merge topic 'nag-fortran-rsp'
10d6c3a635 NAG: Pass response files through front-end to the linker

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2250
2018-08-06 08:24:43 -04:00
Brad King
10d6c3a635 NAG: Pass response files through front-end to the linker
The `nagfor` compiler front-end does not support the `@rspfile` syntax.
Use `-Wl,@rspfile` instead to pass it through to the linker.

Fixes: #18232
2018-08-01 13:28:45 -04:00
Brad King
c2856e0b2b XL: Use -qpic for position independent executables
The XL compiler does not have a dedicated "pie" option so use at least
`-qpic`.  This missing setting was exposed by the `ExportImport` and
`PositionIndependentTargets` tests with XL on an ELF platform.
2018-08-01 11:59:50 -04:00
Brad King
0d72c50d29 Merge topic 'intel-std-fix'
735e69f445 Intel: Fix incorrectly documented extension flags

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2206
2018-07-13 08:54:47 -04:00
Christian Pfeiffer
735e69f445 Intel: Fix incorrectly documented extension flags
Fixes: #18166
2018-07-12 09:35:50 -04:00
Brad King
f7f2b8078e Merge topic 'qnx_fix'
e014df762b QNX: Fix autogen compiler predefines detection

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2205
2018-07-12 09:15:58 -04:00
Cristian Adam
e014df762b QNX: Fix autogen compiler predefines detection
In commit v3.12.0-rc1~20^2 (Move GNU COMPILER_PREDEFINES_COMMAND from
Platform to Compiler, 2018-06-01), `Compiler/GNU.cmake` introduced the
`-dM` flag, which requires `-Wp` prefix for the QNX compiler wrapper.
2018-07-11 09:54:49 -04:00
Marc Chevrier
66ea1a3795 LINK_OPTIONS: Add support of "LINKER:" prefix 2018-06-06 17:22:41 +02:00
Brad King
f719a13c28 Features: Add special case to disable relaxed constexpr for Intel 18
Intel compilers define `__cpp_constexpr` to `200704` even in C++14 mode.
This indicates that the `cxx_relaxed_constexpr` feature is not
available.  However, Intel 17 and above document support for it.  In
commit v3.8.0~9^2 (Features: Update features for Intel C++ 17.0.2 on
UNIX, 2017-03-31) we added a special check for this case.  Intel 17 and
19 work.  However, Intel 18 does not seem to work and fails our test
case.  Add a special case to disable the feature for Intel 18.
2018-06-04 13:52:11 -04:00
Brad King
07bddeae14 Merge topic 'fix-ti-c-standard'
9e27881bb1 TI: Add support for C language standards

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2131
2018-06-04 11:34:35 -04:00
Arnaud Gelas
9e27881bb1 TI: Add support for C language standards
Set C90 and C99 compile options for TI compiler.

Fixes: #18061
2018-06-04 10:48:02 -04:00
Sebastian Holtermann
caa138c1a5 Move GNU COMPILER_PREDEFINES_COMMAND from Platform to Compiler
Moves `CMAKE_${lang}_COMPILER_PREDEFINES_COMMAND` from linux specific
[Modules/Platform/Linux-GNU.cmake](Modules/Platform/Linux-GNU.cmake) to
[Modules/Compiler/GNU.cmake](Modules/Compiler/GNU.cmake).
This enables compiler predefines generation (in AUTOMOC) on all
platforms that run gcc (and clang).
2018-06-01 09:21:06 +02:00
Henry Schreiner
1fb2812d5b CUDA: Add compiler detection for CUDA < 7.5
If the CUDA version macros are not defined, run `nvcc --version` and
extract the version from its output.

Fixes: #17920
2018-04-23 11:26:56 -04:00
Ephi Sinowitz
d67962c55a SunPro,XL: Add depfile flags to support Ninja generator
Add CMAKE_DEPFILE_FLAGS_${lang} to SunPro and XL. These flags are used
by the Ninja generator.
2018-04-17 15:35:49 -04:00
Brad King
77705a2c28 Merge topic 'clang-cl-std'
3f82c5904d Clang: Add standard flags support when simulating MSVC
8381bc12ad Clang: Avoid extra C++ feature detection when simulating MSVC
6cddf7ba32 Clang: Refactor standard flags logic when simulating MSVC

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1906
2018-04-13 10:22:26 -04:00
Brad King
d59cd3b131 Merge topic 'features-msvc-2017'
5f4272cc06 Features: Record for VS 2017 through 15.6

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1903
2018-04-12 11:31:42 -04:00
Ruben Van Boxem
3f82c5904d Clang: Add standard flags support when simulating MSVC
When Clang 3.9 simulates MSVC 19.0 or higher it knows the `-std:` flags
that such versions of MSVC defines.

Fixes: #17866
2018-04-11 14:50:22 -04:00
Brad King
8381bc12ad Clang: Avoid extra C++ feature detection when simulating MSVC
Apply the optimization from commit v3.10.0-rc1~131^2 (MSVC: Avoid
unnecessary C++ feature detection steps, 2017-09-11) to the case of
Clang simulating a version of MSVC that does not define standards.

Issue: #17274
2018-04-11 14:47:28 -04:00
Brad King
6cddf7ba32 Clang: Refactor standard flags logic when simulating MSVC
Consolidate the compile options and standard defaults branches.
Add comments.
2018-04-11 14:45:16 -04:00