Commit Graph

293 Commits

Author SHA1 Message Date
Brad King
5c1f5357b0 VS: Fix CUDA compiler id with CMAKE_CUDA_ARCHITECTURES={all,all-major}
Skip the architecture verification check for these values on Visual
Studio.  It cannot be implemented correctly until future work delays the
check to the main compiler test step.

Issue: #23164, #23161
2022-03-02 15:49:14 -05:00
Brad King
5cd7a6ac1e Merge topic 'vs-intel-oneapi-toolset' into release-3.22
612c0d49f4 VS: Fix detecting icx.exe with Intel Compiler toolsets newer than 2021

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6806
2021-12-17 08:52:02 -05:00
Brad King
5dfcb318a0 Merge topic 'vs-intel-oneapi-toolset'
612c0d49f4 VS: Fix detecting icx.exe with Intel Compiler toolsets newer than 2021

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6806
2021-12-17 08:52:02 -05:00
William R. Dieter
612c0d49f4 VS: Fix detecting icx.exe with Intel Compiler toolsets newer than 2021
The logic added by commit 7808cbd644 (CMakeDetermineCompilerId: support
Intel DPC++ compiler toolset for VS gen, 2020-12-06, v3.20.0-rc1~330^2)
matches a specific toolset known to be the `icx.exe` compiler, and
assumes all other Intel C++ compilers (that are not DPC++) must be
`icl.exe`.

Since `icx.exe` is officially replacing `icl.exe`, use a regex that
matches the now-fixed set of toolsets known to use `icl.exe`.  Any other
Intel C++ compiler will be assumed to be `icx.exe`.

Signed-off-by: William R. Dieter <william.r.dieter@intel.com>
2021-12-15 15:56:20 -05:00
Fred Baksik
831607889f GHS: Update selection of primaryTarget in MULTI project file
Changes to ``-A`` handling:
* Don't force CMAKE_GENERATOR_PLATFORM into cache when using default
  value (breaks using CMake presets).
* Don't print message when using default value (breaks CMake tests).

Changes to ``GHS_PRIMARY_TARGET`` handling:
* Add as a cache variable so its known to GUI
* Don't always include``GHS_TARGET_PLATFORM``, it's only needed if
  ``GHS_PRIMARY_TARGET`` wasn't set by the user.
* Set ``GHS_PRIMARY_TARGET`` during platform selection instead of when
  a language is enabled.  By performing this sooner
  ``GHS_TARGET_PLATFORM`` is not always required to be set into cache.
2021-11-15 13:15:10 -05:00
Brad King
c0e23058f6 Merge topic 'vs-framework-version'
d51246c662 VS: Default TargetFrameworkVersion to v4.7.2 for VS 2022
f97f8537f3 VS: Model a default target framework
e40cedddc0 cmVisualStudio10TargetGenerator: Refactor target framework selection
78782cc7dc cmGlobalVisualStudio8Generator: Refactor SetGeneratorPlatform

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6699
2021-11-08 12:38:48 -05:00
Brad King
f97f8537f3 VS: Model a default target framework
Add fields to the VS generator to select a target framework.
Migrate the existing default for VS 12 .NET CF for Windows CE.

Report the values in `CMAKE_VS_*` variables and use them for
the CSharp compiler id project too.

Issue: #22849
2021-11-06 06:08:54 -04: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
Brad King
3add62462c Xcode: Fix detection of default language standard when given -std= flags
If one uses `CFLAGS='-std=...'` or `CXXFLAGS='-std=...'` then the given
`-std=` flag(s) will always be used.  That effectively changes the
compiler default standard level and extension settings.  Fix the
Xcode generator's compiler id logic to preserve any `-std=` flag
so that the proper defaults are detected.

This problem was exposed by commit 4a0485be7f (cmStandardLevelResolver:
Avoid unnecessary flags, fix unset level logic, 2021-05-29), which
changed the logic to not pass any `-std=` flag if the standard level
and extension settings requested by the project match the default
(`stdIt <= defaultStdIt` became `stdIt < defaultStdIt`).  The new
logic assumes the detected default standard matches what will actually
happen when the project is generated.
2021-10-06 10:36:39 -04:00
Brad King
5c4424e5b7 CMakeDetermineCompilerId: Tolerate variables named for languages 2021-10-06 10:36:39 -04:00
Raul Tambre
fc3a1cbdd8 CompilerID: Compiler extensions default detection 2021-09-28 21:24:53 +03:00
Raul Tambre
2adfd95d79 CompilerID: Rename language_dialect to language_standard
In Linux C++ terms dialect usually refers to having GNU extensions or not.
Change the name to better reflect that this is about the standard version.
2021-09-28 21:24:53 +03:00
Brad King
36966f63ca Merge topic 'hip-no-hipcc'
cb93f72624 HIP: Simplify detection of HIP runtime CMake package
a71f0fc9c7 HIP: Remove ROMClang compiler id and use Clang directly
b125e9809a HIP: Detect ROCm path earlier
735f41fc2d HIP: Use 'rocm_agent_enumerator' to determine CMAKE_HIP_ARCHITECTURES

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Acked-by: Raul Tambre <raul@tambre.ee>
Acked-by: Axel Huebl <axel.huebl@plasma.ninja>
Merge-request: !6533
2021-09-20 12:38:44 -04:00
Brad King
a71f0fc9c7 HIP: Remove ROMClang compiler id and use Clang directly
Since commit bd844387df (ROCMClang: Add the ROCm toolkit derived clang
compiler to CMake, 2020-08-28, v3.21.0-rc1~66^2~6) and commit ff0d2858e1
(HIP: Extract clang compiler details from hipcc, 2020-10-21,
v3.21.0-rc1~66^2~5), the separate `ROCMClang` compiler id for `hipcc`
has caused a few problems:

* The compiler id changed from behavior of CMake 3.20 and below,
  breaking projects that already built with `hipcc` treated as `Clang`.

* The implementation of `target_compile_features` was incomplete for
  the `ROCMClang` identity.

* Only `hipcc` was identified as `ROCMClang`, so after it is unwrapped
  to the underlying `clang++`, future runs of new CMake versions on
  an existing build tree would not repeat this.

* Clang should be usable as a HIP compiler without the `hipcc` wrapper.

Remove the `ROMClang` compiler identity, and revise HIP language support
to work directly with a Clang compiler.

Reject direct `hipcc` usage as a HIP compiler.  For now it cannot be
supported because it interferes with flags CMake needs to pass to Clang.

Fixes: #22536, #22460, #22593
2021-09-16 15:33:47 -04:00
Brad King
b125e9809a HIP: Detect ROCm path earlier
Fail early if it is not found.

Use the detected location as a hint to find `rocm_agent_enumerator`.

Also remove the leading `_` prefix in case we want to document this
publicly later.
2021-09-16 14:45:07 -04:00
Brad King
d13eabcfd8 Merge topic 'enable_language-CMP0126'
f75610d492 CMakeDetermineCompilerId: Fix CMAKE_EXECUTABLE_FORMAT in CMP0126 NEW behavior

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6364
2021-07-20 11:47:08 -04:00
Brad King
f75610d492 CMakeDetermineCompilerId: Fix CMAKE_EXECUTABLE_FORMAT in CMP0126 NEW behavior
Setting `CMAKE_EXECUTABLE_FORMAT` as a normal variable is unnecessary
because setting it as a cache entry already makes the value visible to
the calling scope.

Fixes: #22433
2021-07-19 15:28:14 -04:00
Michael Hirsch
0602e35858 Intel/Fortran: Avoid recording warning 5117 lines in CMakeError.log 2021-07-06 14:03:14 -04:00
Robert Maynard
ff0d2858e1 HIP: Extract clang compiler details from hipcc 2021-06-07 19:25:33 +00:00
Robert Maynard
bd844387df ROCMClang: Add the ROCm toolkit derived clang compiler to CMake 2021-06-07 19:25:28 +00:00
Josef Angstenberger
dad5b9d845
Modules: Fix typos and spelling in comments 2021-05-07 17:00:15 +02:00
Paul Zehner
ec78e86cc8 FujitsuClang: Use GNU-like command-line 2021-04-14 15:18:24 -04:00
Brad King
f39ea2e292 Merge topic 'flags-with-backslash'
3953dfcb31 Restore support for backslashes in initial language-wide flags

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5995
2021-04-08 07:47:09 -04:00
Brad King
3953dfcb31 Restore support for backslashes in initial language-wide flags
Refactoring in commit bdc40742bd (CMakeDetermineCompilerId: Test without
COMPILER_ID_FLAGS if REQUIRE_SUCCESS, 2021-02-27, v3.20.0-rc3~6^2) added
an extra macro layer through which flag strings are passed.  That caused
an extra level of argument re-parsing, and broke flags with backslashes.
Pass flags to the helper macro through variable names instead.

Fixes: #22041
2021-04-07 13:53:22 -04:00
Chuck Atkins
3c867cff4a Fujitsu: Add support for the Fujitsu compiler in Trad mode
Co-Author: Yuichiro Utsumi <utsumi.yuichiro@jp.fujitsu.com>
2021-03-30 10:32:53 -04:00
Marcel Ritzschke
c73b847b03 VS: switch to new folder structure while keeping the old one working
Fixes: #21170
2021-03-18 15:44:13 +01:00
Raul Tambre
1bd8f19453 CMakeDetermineCompilerId: Fix REQUIRE_SUCCESS with multiple user flags
Need to quote the list expansion otherwise we'll try each argument separately.
2021-03-02 16:20:45 +02:00
Raul Tambre
bdc40742bd CMakeDetermineCompilerId: Test without COMPILER_ID_FLAGS if REQUIRE_SUCCESS
If we REQUIRE_SUCCESS, i.e. TEST_FLAGS_FIRST must work, we need to also try
without user flags.

Fixes #21869.
2021-02-27 14:25:26 +02:00
Brad King
ddaaee907d CMakeDetermineCompilerId: Recognize XCOFF executable format 2021-02-03 12:26:58 -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
Craig Scott
cc8162a981 CMakeDetermineCompilerId: Ensure CMAKE_EXECUTABLE_FORMAT is INTERNAL
Fixes: #21607
2020-12-17 21:09:46 +11:00
Nikita Sirgienko
7808cbd644 CMakeDetermineCompilerId: support Intel DPC++ compiler toolset for VS gen
Before Intel have only one compiler icl (Intel(R) C++ compiler) and
CMakeDetermineCompilerId has considered, that all toolchains with a word
"Intel" in the toolchain name is a icl compiler. But now Intel have also other
compiler - Intel(R) DPC++ compiler, which haven't working with cmake on
Visual Studio Generator because cmake try to use icl compiler, which cmake
can't found and because of this fails the configuration. This commit fix
this problem, and both compilers start to work correctly with
Visual Studio generator.

Fixes: #21546
2020-12-06 14:20:21 +03:00
Brad King
7068189657 Merge topic 'compiler-id-extra-text'
f25ac39dee CMakeDetermineCompilerId: Tolerate stray text around INFO strings
5cb66f17ca CMakeDetermineCompilerId: Add whitespace to clarify logic
1ee99104f7 CMakeDetermineCompilerId: Filter IAR-AVR format INFO strings earlier

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5570
2020-12-04 08:27:02 -05:00
Brad King
f25ac39dee CMakeDetermineCompilerId: Tolerate stray text around INFO strings
When cross-compiling with Xcode our compiler id test binary may be
compiled with multiple architectures.  The INFO strings should be
identical and therefore de-duplicated.  However, this can be broken by
stray text that happens to sit immediately before or after an INFO
string.  Filter out such text so we can match clean INFO strings.

Fixes: #21526
2020-12-03 14:37:21 -05:00
Brad King
5cb66f17ca CMakeDetermineCompilerId: Add whitespace to clarify logic
Also initialize a variable closer to its use.
2020-12-03 14:37:08 -05:00
Brad King
1ee99104f7 CMakeDetermineCompilerId: Filter IAR-AVR format INFO strings earlier
Remove the bytes between characters from the entire list at once.
2020-12-03 14:34:04 -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
Brad King
37add87632 Merge topic 'cuda_detect_vs_codegen' into release-3.19
20807a1882 CUDA: Fix user-set architectures during detection with Visual Studio

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5531
2020-11-25 08:35:08 -05:00
Brad King
0e28b39f41 Merge topic 'cuda_detect_vs_codegen'
20807a1882 CUDA: Fix user-set architectures during detection with Visual Studio

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5531
2020-11-25 08:35:08 -05:00
Raul Tambre
20807a1882 CUDA: Fix user-set architectures during detection with Visual Studio
If the user specifies CMAKE_CUDA_ARCHITECTURES we use those during detection
and error out if they don't work.
For Visual Studio a dummy project file is used instead of invoking the compiler
directly. NVCC would thus use its default and we'd fail if
CMAKE_CUDA_ARCHITECTURES was anything other than NVCC's default.

Use the necessary project file variable in CMakeDetermineCompilerId.cmake to
match other generators.

Fixes #21492.
2020-11-25 08:27:40 -05:00
Brad King
98849039cc Xcode: Default to arm64 arch on Apple Silicon hosts during compiler id
In commit b6c60f14b6 (macOS: Default to arm64 architecture on Apple
Silicon hosts, 2020-09-28, v3.19.0-rc1~63^2) we forgot to update the
compiler id architecture selection added by commit 26673bf480 (Xcode:
Explicitly specify default native architecture on macOS, 2020-07-16,
v3.18.1~20^2).

Issue: #21425
2020-11-12 11:26:19 -05:00
Brad King
2d723e66f1 Merge topic 'cuda_host_compiler_fail'
01428c5560 CUDA: Fail fast if CMAKE_CUDA_ARCHITECTURES doesn't work during detection
9f81aa0f69 CUDA: Fail if compiler detection using the host compiler fails

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5155
2020-09-01 09:20:23 -04:00
Raul Tambre
9f81aa0f69 CUDA: Fail if compiler detection using the host compiler fails
If an user specified a host compiler we should fail if we are unable to perform
compiler detection with it.
Previously we would try without and likely succeed and continue. Then we'd fail
during ABI detection and compiler testing since we'd still try to use it.

This is particularly problematic when crosscompiling since we extract the host
linker from the compiler detection link line. This would result in the wrong
host linker being used and a linking error due to architecture mismatch during
ABI detection where other necessary flags may already be present to make the
host compiler work. See #21076 for an example.

Fix this by adding CMAKE_<LANG>_COMPILER_ID_REQUIRE_SUCCESS to
CMakeDetermineCompilerId, which throws a fatal error if executing the compiler
results in a non-zero exit code.

Fixes #21120.
2020-08-29 13:06:44 +03:00
Robert Maynard
34cc6acc81 Add ISPC compiler support to CMake 2020-08-28 11:21:31 -04:00
Fred Baksik
deec2f587c Toolchain: Take CMAKE_<lang>_FLAGS_INIT into account during compiler detection
Fixes: #20040
2020-07-29 11:51:27 -04:00
Jean-Christophe Fillion-Robin
207373802e Fix typos identified using codespell
See https://github.com/codespell-project/codespell#readme

The following command was used:

```
codespell -q6 --skip="\
.git,\
*.json,\
./Copyright.txt,\
./Help/command/foreach.rst,\
./Help/prop_test/REQUIRED_FILES.rst,\
./Help/variable/CTEST_COVERAGE_COMMAND.rst,\
./Modules/CMakeCheckCompilerFlagCommonPatterns.cmake,\
./Modules/CMakeRCInformation.cmake,\
./Modules/Internal/CPack/NSIS.template.in,\
./Modules/FindMatlab.cmake,\
./Modules/MatlabTestsRedirect.cmake,\
./Modules/Platform/Windows-Clang.cmake,\
./Modules/Platform/Windows-Intel-Fortran.cmake,\
./Modules/Platform/Windows-MSVC.cmake,\
./Source/CMakeVersion.cmake,\
./Source/cmConvertMSBuildXMLToJSON.py,\
./Source/cmCreateTestSourceList.cxx,\
./Source/cmGlobalVisualStudio10Generator.cxx,\
./Source/cmExportBuildFileGenerator.cxx,\
./Source/cmExportInstallAndroidMKGenerator.cxx,\
./Source/cmExportInstallFileGenerator.cxx,\
./Source/cmExportSet.cxx,\
./Source/cmExportTryCompileFileGenerator.cxx,\
./Source/cmFindPackageCommand.cxx,\
./Source/cmInstallCommand.cxx,\
./Source/cmGeneratorExpressionLexer.cxx,\
./Source/cmLocalVisualStudio7Generator.cxx,\
./Source/cmOrderDirectories.cxx,\
./Source/cmTarget.cxx,\
./Source/kwsys/*,\
./Source/QtDialog/CMakeSetupDialog.ui,\
./Source/CPack/WiX/cmWIXRichTextFormatWriter.cxx,\
./Source/CTest/cmParseCoberturaCoverage.h,\
./Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in,\
./Tests/RunCMake/CPack/tests/DMG_SLA/English.license.rtf,\
./Tests/RunCMake/CPack/tests/DMG_SLA/German.license.txt,\
./Tests/RunCMake/CPack/tests/DMG_SLA/German.menu.txt,\
./Tests/RunCMake/GoogleTest/xml_output.cpp,\
./Tests/RunCMake/Make/TargetMessages*,\
./Utilities/*,\
" \
-L "\
dependees,\
endwhile,\
fo,\
filetest,\
helpfull,\
nd,\
objext,\
stoll,\
supercedes,\
superceded,\
vas,\
varn,\
"
```
2020-07-22 12:44:47 -04:00
Craig Scott
8abeec58f3 Merge topic 'xcode-native-arch'
26673bf480 Xcode: Explicitly specify default native architecture on macOS
ce624cfbd4 cmGlobalXCodeGenerator: Save CMAKE_SYSTEM_NAME in member

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5023
2020-07-21 07:19:02 -04:00
Brad King
26673bf480 Xcode: Explicitly specify default native architecture on macOS
When `CMAKE_OSX_ARCHITECTURES` is not specified, we add the Xcode
setting `ONLY_ACTIVE_ARCH = YES` with the intention of targeting the
native architecture of the host.  However, the default `ARCHS` value
chosen by "Xcode 12 Universal Apps" includes multiple architectures.
Add an explicit `ARCHS` setting with value `$(NATIVE_ARCH_ACTUAL)`
to tell Xcode to use the host's native architecture only.

Fixes: #20893
2020-07-20 10:03:15 -04:00
Kyle Edwards
6051a49c78 Visual Studio: Add Android support 2020-06-24 08:41:09 -04:00
Brad King
d8eee80e30 Merge branch 'backport-cuda-default-runtime' into cuda-default-runtime 2020-05-22 06:50:19 -04:00
Robert Maynard
e55b21e24e CUDA: Compute CMAKE_CUDA_RUNTIME_LIBRARY default from toolchain
Since commit 0d0145138f (CUDA: Add abstraction for cuda runtime
selection, 2019-11-29, v3.17.0-rc1~83^2) we add CUDA runtime library
selection flags by default.

To maintain backwards compatibility the default CUDA runtime
library needs to be computed based on what libraries are found
on the initial compiler invocation. For example a toolchain
could establish initial flags that have all CUDA compilations
using the runtime version, and if we don't detect this we will
try to link to both the static and shared runtime.

Co-Author: Brad King <brad.king@kitware.com>
Fixes: #20708
2020-05-21 11:15:03 -04:00
Brad King
efb2a9f093 Merge topic 'vs-clangcl' into release-3.17
f3d7a15010 VS: Fix ClangCL toolset compiler path detection

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4523
2020-03-27 07:45:15 -04:00
Brad King
112cb248ae Merge topic 'vs-clangcl'
f3d7a15010 VS: Fix ClangCL toolset compiler path detection

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4523
2020-03-27 07:45:15 -04:00
Brad King
184dd23d2e Merge topic 'nmc-cl-showincludes'
6c7e6b1e49 Ninja Multi-Config: Fix MSVC showincludes prefix detection

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Kyle Edwards <kyle.edwards@kitware.com>
Merge-request: !4526
2020-03-27 07:41:58 -04:00
Brad King
6c7e6b1e49 Ninja Multi-Config: Fix MSVC showincludes prefix detection
Activate the detection logic for this generator too.

Fixes: #20506
2020-03-26 08:47:36 -04:00
Brad King
f3d7a15010 VS: Fix ClangCL toolset compiler path detection
Prior to commit 3c125c6de0 (VS: Support Visual Studio Clang Toolkit
identification, 2019-12-03, v3.17.0-rc1~341^2) using `-T ClangCL`
would work but `CMAKE_{C,CXX}_COMPILER` would be detected as `cl.exe`
even though `clang-cl.exe` is the actual compiler.  That commit
attempted to fix the detection by using `$(ClangClExecutable)`
as we do for LLVM-distributed toolsets, but that is not actually
defined.  Instead, look for `$(CLToolExe)` in the `PATH`.

Fixes: #20504
2020-03-26 08:18:25 -04:00
Brad King
0d0aa98c84 ASM: Record vendor-specific output matched to identify assembler
For example, with GNU `as`, we match `GNU assembler`, but with GNU `gcc`
as the assembler, we do not match anything.  Distinguishing these cases
may be useful for constructing assembler command lines.
2020-03-12 10:07:30 -04:00
Brad King
ee3ec27465 CMakeDetermineCompilerId: Set locale to C for vendor output match
Apply the change from commit d751d2d2ed (CMakeDetermineCompilerABI: set
locale to C for try_compile(), 2019-01-14, v3.14.0-rc1~108^2~1) to the
`CMAKE_DETERMINE_COMPILER_ID_VENDOR` implementation too.
2020-03-12 10:07:29 -04:00
Robert Maynard
ef4a66d694 CUDA: MSVC generators fill CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES
Fixes #18733
Correct an oversight where the MSVC generators didn't populate
CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES.
2020-01-10 16:14:28 -05:00
Brad King
cffd618230 Merge topic 'backport-3.16-vs-v142-version'
2f853eec3d Merge branch 'backport-3.15-vs-v142-version' into backport-3.16-vs-v142-version
d8d4924d98 VS: Fix support for v142 toolset minor versions in VS 16.5+
07612646fe VS: Fix support for v142 toolset minor versions in VS 16.5+

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4133
2019-12-13 10:31:41 -05:00
Brad King
d8d4924d98 VS: Fix support for v142 toolset minor versions in VS 16.5+
The fix in commit 5117389931 (VS: Fix support for v142 toolset minor
versions, 2019-10-01, v3.16.0-rc1~32^2) worked around a bug in VS's
placement of toolset files.   VS 16.5 will fix that bug and restore the
original pattern for locations of toolset files.  Update our logic to
look for both possibilities.

Issue: #19779
2019-12-12 11:28:34 -05:00
Justin Goshi
3c125c6de0 VS: Support Visual Studio Clang Toolkit identification
Teach CMake that the `ClangCl` toolset uses the `ClangClExecutable`
value as the path to the compiler executable.
2019-12-05 11:48:48 -05:00
Brad King
19f267c75e XL: Add support for Ninja and XL Fortran
The Ninja generator's support for Fortran requires that source files
be preprocessed explicitly first.  However, the `xlf` compiler does
not have a simple `-E` option or equivalent to do preprocessing.
The only documented way to get preprocessed output is to use `-d`
to leave it behind, but only at an inflexible location.

Instead, create our own `cpp` wrapper script and substitute it for the
real preprocessor using `-tF -B ...`.  Teach the wrapper to map the
`cpp` output to the location we need and then invoke the real `cpp`
underneath.

Fixes: #19450
2019-11-21 15:59:12 -05:00
Alexander Boczar
45b4b4b930 VS: Propagate CMAKE_VS_GLOBALS into compiler id projects
Issue: #19708
2019-10-17 10:18:52 -04:00
Alexander Boczar
548e9051a4 VS: Add support to override VCTargetsPath through toolset
Fixes: #19708
2019-10-15 13:28:45 -04:00
Brad King
20e9151e6c Merge topic 'vs-v142-version'
5117389931 VS: Fix support for v142 toolset minor versions

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3874
2019-10-02 07:47:25 -04:00
Brad King
5117389931 VS: Fix support for v142 toolset minor versions
When using `-T v142,version=14.22` the `.props` file location is
different starting with version `14.20` than it was in `14.16` and
below.  Adapt the path based on the version.

Fixes: #19779
2019-10-01 11:39:38 -04:00
Benjamin Wozniak
0ad180d712 cuda: Extend cuda compiler detection to work with custom cuda path 2019-08-30 08:14:00 +02:00
Brad King
fa722a8792 Merge topic 'clang-cl-non-windows'
863f7eb6d7 clang: Restore support for clang-cl on non-Windows hosts

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3634
2019-08-02 10:37:57 -04:00
Brad King
863f7eb6d7 clang: Restore support for clang-cl on non-Windows hosts
The frontend variant detection logic added by commit 53fbe23f3f (clang:
introduce CMAKE_<lang>_COMPILER_FRONTEND_VARIANT, 2019-02-20,
v3.15.0-rc1~41^2~8) assumes that `clang-cl` only runs on a Windows host.
It is also available on non-Windows hosts.  Fix the condition.

Fixes: #19544
2019-07-31 12:52:35 -04:00
Brad King
d1f38ba65d CMakeDetermineCompilerId: Consider UTF-16 encodings of INFO strings
Our compiler identification source encodes `INFO:compiler[...]` and
similar strings in compiled objects or binaries that we then extract to
get information about the compiler.  With most compilers the strings are
encoded in the binaries as a simple byte sequence.  However, some
compilers use other encodings.  For example, the MS CSharp compiler uses
UTF-16LE and a TI compiler uses UTF-16BE.  Try each encoding.

Fixes: #19459
2019-07-11 09:50:30 -04:00
Brad King
067a4f484b Merge topic 'clang-gnulike-support'
74829f01b1 Help: Add notes for topic 'clang-gnulike-support'
19669abe1d Tests: handle string escaping differences with NMake+clang
a2a90f41e3 Tests: require C++14 for the Tutorial
4819ff9647 Tests: fix failures with gnu mode clang on windows
26af0b25e7 cmake: use correct stack size with gnu mode clang on windows
d44c0db0b2 clang: setup correct configuration in gnu mode
b7d5ef23e9 cmGlobalNinjaGenerator: use gnu compatible paths with clang in gnu mode
3d0210d8dc binutils: add the llvm-* variants to the tool lists.
...

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Francesco Bertolaccini <francesco@bertolaccini.dev>
Acked-by: Stanislav Ershov <digital.stream.of.mind@gmail.com>
Acked-by: Saleem Abdulrasool <compnerd@compnerd.org>
Merge-request: !2992
2019-05-29 09:22:12 -04:00
Brad King
f83f29dbaa Merge topic 'vs-ApplicationTypeRevision'
9c07cefee5 VS: Fix ApplicationTypeRevision in builtin check projects
639e14def6 VS: Factor out helper to compute ApplicationTypeRevision

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3350
2019-05-22 10:27:01 -04:00
Brad King
4c0fb923b7 IAR: Do not print compiler architecture id for non-IAR compilers
The compiler identification message was modified in commit ea83d0f8fb
(IAR: Generalize and add support for IAR RX compiler, 2019-04-05) to
include the architecture id since IAR compilers are arch-specific.
Revise the logic to avoid modifying the message for other compilers.
2019-05-21 10:58:18 -04:00
Brad King
9c07cefee5 VS: Fix ApplicationTypeRevision in builtin check projects
Do not use the entire `CMAKE_SYSTEM_VERSION`, but rather the first two
components only.

Fixes: #19275
2019-05-21 08:50:37 -04:00
Zsolt Parragi
53fbe23f3f clang: introduce CMAKE_<lang>_COMPILER_FRONTEND_VARIANT
This variable is set to GNU on Windows when clang.exe ar clang++.exe is
used, and set to MSVC for clang-cl.exe.

CMAKE_<lang>_SIMULATE_ID is set to MSVC in both cases, as clang defaults
to -fms-compatibility for all command lines on windows.
2019-05-17 19:11:34 +02:00
Brad King
0723582208 Swift: Detect compiler version 2019-05-16 14:41:04 -04:00
Brad King
086c51dc04 CMakeDetermineCompilerId: Make CMAKE_${lang}_COMPILER available earlier
If compiler id detection gave us the compiler tool, copy its value to
the `CMAKE_${lang}_COMPILER` variable as early as possible.
2019-05-16 14:31:30 -04:00
Johan Stridkvist
7b0abaac31 ARMClang: Add support for Clang-based ARM compiler
Fixes: #18215
2019-05-14 14:59:55 -04:00
Zufu Liu
c846dbf89e CMakeDetermineCompilerId: Support versioned LLVM for Visual Studio.
Supports versioned LLVM toolsets like LLVM_v142, LLVM_v141,
LLVM_v141_xp, etc. for Visual Studio (2010 and later).

The name for versioned LLVM toolsets has "LLVM_" prefix
plus MSVC toolset name (i.e. v142, v141, v141_xp, etc.).

Fixes: #19203
2019-05-02 10:57:37 +08:00
Stefan Andersson
ea83d0f8fb IAR: Generalize and add support for IAR RX compiler
Moved common ASM setup to the common macros and changed version check.
2019-04-12 09:10:02 +02:00
Naren Manimohan
0404efe786 GHS: Add support for GHS Multi Generator in Linux 2019-03-21 12:57:40 -04:00
Brad King
72a6306454 Merge topic 'vs-llvm-extension'
8375c303e2 VS: Fix detection of clang-cl with -T llvm

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3024
2019-02-27 07:55:13 -05:00
Brad King
8375c303e2 VS: Fix detection of clang-cl with -T llvm
When using a VS generator with `-T llvm`, MSBuild relies on the "LLVM
Compiler Toolchain" VS Extension.  This does not put `clang-cl` in the
`PATH` inside the build, and LLVM no longer provides a `cl` replacement
either.  Therefore we need another way to extract the path to the
`CMAKE_{C,CXX}_COMPILER`.  Fortunately the LLVM VS integration provides
a `$(ClangClExecutable)` macro we can reference to get the path.

Fixes: #18983
2019-02-26 09:58:51 -05:00
Brad King
b186329d3d Use -? instead of /? to test compiler for MSVC-like command-line support
MS-style command-line tools accept either `/` or `-` for command-line
options.  Prefer `-` over `/` so that non-MS tools do not treat it as a
path.

Fixes: #18941
2019-02-19 07:29:27 -05:00
Gregor Jasny
8af334f5ba Xcode: Derive stdlib from CXX flags
Closes: #18396
2019-02-07 06:43:51 -05:00
Brad King
c03072f2f7 Merge topic '17870-iphone-friendly-cmake'
e8ee8cab97 Xcode: Completely disable code signing for compiler id detection
11da882a12 Apple: Introduce separate system name for iOS, tvOS, and watchOS
36cf44a7a3 Tests: Isolate RunCMake.XcodeProject per-device cases from host arch

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2392
2019-02-05 07:33:04 -05:00
Brad King
96dece6dc1 Xcode: Update default Swift language version for Xcode 10.2
Xcode 10.2 no longer supports Swift language versions before 4.0.

Fixes: #18871
2019-02-04 13:26:10 -05:00
Gregor Jasny
e8ee8cab97 Xcode: Completely disable code signing for compiler id detection
Issue: #17870
2019-02-04 09:03:35 -05:00
Gregor Jasny
11da882a12 Apple: Introduce separate system name for iOS, tvOS, and watchOS
- Remove code signing requirements for non-macOS
- Do not set deployment target for non-macOS
- Build static library for compiler feature detection for non-macOS
- Use framework to run CompilerId tests for watchOS
- Port tests to new SDK handling
- Add new Apple cross-compiling section to toolchain documentation

Closes: #17870
2019-02-04 09:03:35 -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
Ethan Slattery
7414d422b2 IAR: Parse INFO strings from the binary format of AVR systems
Teach `CMakeDetermineCompilerId` to recognize and parse the IAR-AVR
binary format so we can recognize this compiler id.

Issue: #18557
2019-01-15 13:58:53 -05:00
Maikel van den Hurk
c86e82c092 Add Mach-O CMAKE_EXECUTABLE_FORMAT detection
Code for this was prototyped when ELF detection was added long ago but
left commented out.  Use either MH_MAGIC or MH_CIGAM for the 32-bit
variant and use either or MH_MAGIC_64 or MH_CIGAM_64 for the 64-bit
variant.
2018-12-10 14:41:42 -05:00
Daniel Schürmann
8fdf08c097 IAR: Fix compiler id, version, and arch detection on 6.50.6
The IAR 6.50.6 compiler places extra/truncated copies of the
compiler id `INFO:` strings into binaries with a prefix like
`?<Constant "`.  Teach CMakeDetermineCompilerId to ignore them.

Fixes: #18333
2018-09-11 10:43:03 -04:00
Rafal Parzych
c68b358ce3 Xcode: Set CODE_SIGN_IDENTITY during compiler identification
If `CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY` is set then propagate
it to the compiler id test project too.

Fixes: #18292
2018-08-24 13:58:51 -04:00
Brad King
bc5bcad45e Xcode: Detect architecture(s) using ARCHS instead of CURRENT_ARCH
Xcode 10 no longer populates `CURRENT_ARCH` with the current
architecture in shell scripts and instead uses `undefined_arch`.
Instead we must use `ARCHS`.  It lists all architectures separated by
spaces.

Fixes: #18085
2018-06-18 13:44:43 -04:00
Basil Fierz
5f13168419 VS: Add option to select the version of the toolset used by VS 2017
Add new `version=` parameter in the toolset setting to select the
version.  Add variable `CMAKE_VS_PLATFORM_TOOLSET_VERSION` to hold the
version, if one is set (blank indicates default).

Fixes: #17549
2018-05-29 10:12:59 -04: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
İsmail Dönmez
f969f1a9ce
Clang: Do not mistake clang-cl 6.0 for GNU-like clang
The check added by commit v3.10.0-rc2~2^2 (Clang: Diagnose unsupported
GNU-like clang targeting MSVC ABI, 2017-10-10) is incorrectly detecting
clang-cl 6.0 as GNU-like.  Currently cmake is testing if the clang
compiler accepts `--version` to see if it accepts GNU style flags.
However, with the latest llvm snapshot this also works for clang-cl:

    > clang-cl --version
    clang version 6.0.0 (trunk)
    Target: x86_64-pc-windows-msvc
    Thread model: posix
    InstalledDir: C:\Program Files\LLVM\bin

So instead we should use the `/?` flag which fails with clang but
works with clang-cl:

    > clang-cl /? &> /dev/null; echo $?
    0
    > clang /? &> /dev/null; echo $?
    1

Fixes: #17518
2017-11-28 17:08:33 +01:00