1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-18 08:51:52 +08:00
Commit Graph

66 Commits

Author SHA1 Message Date
Gregor Jasny
8c789bee83 AppleClang: Fix ASM compiler identification
Recent AppleClang compilers identify themselves as
`Apple clang version 14.0.3 (clang-1403.0.22.14.1)`.
2023-06-05 17:31:35 -04:00
Felipe Torrezan
f9ff6ab2d1 IAR: Fix ASM compiler architecture detection
Narrow the regex to match the actual supported architectures,
avoiding mismatched detection.

Fixes: #24145
2022-11-11 09:08:03 -05:00
Jukka Jalkanen
c2777ed008 ASM: Fix identification of armasm 6.17+
Spelling of "ARM Compiler" changed to "Arm Compiler".
2022-01-06 11:55:38 -05:00
Thomas Bernard
c9c79dde41 Clang: Add MSVC frontend detection for the ASM compiler
Fixes: #22495
2021-09-09 14:26:44 -04: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
Fred Baksik
6f1af899db Toolchain: Capture all arguments from CMAKE_<LANG>_COMPILER
Capture CMAKE_<LANG>_COMPILER_ARG1 from CMAKE_<LANG>_COMPILER in the
same fashion that it is from $ENV{<LANG>}.

Since get_filename_component() returns a single string of all the
arguments from $ENV{<LANG>}, a single string of arguments will be
constructed from the items contained in CMAKE_<LANG>_COMPILER.

Fixes #20089
2020-07-23 14:52:48 -04:00
Robert Maynard
8cc384f629 Compilers: Add paths from -print-sysroot to system prefix path 2020-04-14 13:48:28 -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
Stefan Andersson
c242187875 IAR: Add support for the RISC-V compiler 2019-07-08 13:11:45 -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
Johan Stridkvist
7b0abaac31 ARMClang: Add support for Clang-based ARM compiler
Fixes: #18215
2019-05-14 14:59:55 -04: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
Brad King
30fc5ecf23 Merge topic 'qcc-asm-detection'
be87ce43f0 Add ASM Compiler detection for QCC

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Bartosz <gang65@poczta.onet.pl>
Merge-request: !3016
2019-02-26 10:42:31 -05:00
Maikel van den Hurk
be87ce43f0 Add ASM Compiler detection for QCC 2019-02-25 08:28:47 +01: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
Brad King
c84fb4812d ASM: Detect compiler id for Clang used as Assembler
Add missing vendor table entries for Clang and AppleClang to identify
them.  Previously this worked only if Clang was also enabled as a C or
CXX compiler first because we used to copy the C compiler id.  However,
that was removed by commit v3.13.0-rc1~44^2 (ASM: Search for full path
even when using C or C++ compiler, 2018-09-26).

Fixes: #18575
2018-11-09 11:34:34 -05:00
Raul Laasner
7ab5843c26 ASM: Search for full path even when using C or C++ compiler
When `CMAKE_{C,CXX}_COMPILER` is set but `CMAKE_ASM*_COMPILER` is
not, we copy the C or C++ compiler to use as the ASM compiler.
In this case we still need to search for the ASM compiler in case
the C or C++ compiler is not known as an absolute path.

Also do not copy the compiler id setting and let the normal detection
take place.  The C compiler id may not exist if the language has not
been enabled.

Fixes: #18406
2018-09-26 14:01:39 -04:00
Anton Danielsson
f83330ed6c ASM: ADSP assembler identification
Add support to identify the ADSP (Analog Devices) assembler
in CMakeDetermineASMCompiler.

Fixes: #17695
2018-01-30 10:06:01 +01:00
Brad King
acb4cb9500 CMakeFindBinUtils: Improve switch between MSVC- and GNU-like tools
The switch was not considering some languages, such as `ASM`.
Instead of memorizing the list of languages in the condition,
use a language specified by the includer.

Fixes: #17510
2017-11-28 07:57:58 -05:00
Ben Boeckel
336c4fc6fa CMakeDetermineASMCompiler: fix a CMP0054 warning
This was introduced in commit d8e6cd9e (IAR: Improve support for IAR ARM
Compiler, 2017-06-15) from !991.

Fixes #17062.
2017-07-13 14:01:38 -04:00
Norbert Lange
d8e6cd9ed8 IAR: Improve support for IAR ARM Compiler
Make the implementation for this compiler more complete.

IAR has multiple C++ modes, historically they were reduced c++ versions
for embedded that gradually improved to the full standard (which can be
reduced again by e.g. disabling rtti and exceptions).  The new
implementation picks the best available, but the c++ mode can also be
overridden by defining `CMAKE_IAR_CXX_FLAG`.

Add C/C++ standard flags so that all modes up to and including the last
supported standard are defined.

Fixes: #16826
2017-06-29 13:25:58 -04:00
Norbert Lange
0b1a2876c8 Add a CMAKE_<LANG>_COMPILER_ARCHITECTURE_ID variable
Compilers such as MSVC and IAR may have variants that target different
architectures.  We have been using a `MSVC_<LANG>_ARCHITECTURE_ID`
variable to hold this information for MSVC.  Add an alternative with a
more general name (later we can port MSVC to it too).

This additional information may be needed to generate proper invocations
of the compiler based on its architecture variant.
2017-06-29 13:25:57 -04:00
Norbert Lange
fea7d69dde Store CMAKE_ASM_COMPILER_VERSION persistently
We already do this for other languages like C and CXX.
2017-06-29 13:25:57 -04:00
Norbert Lange
d2a8b5cea6 CMakeDetermineASMCompiler: Fix small copy-paste mistake
GNU is not a vendor of IAR.
2017-06-29 13:25:57 -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
ee3295e917 Merge topic 'vs-nasm'
5ba2c9e5 VS: Add support for ASM_NASM language
2017-02-10 13:36:18 -05:00
Evgeny Fimochkin
5ba2c9e5e0 VS: Add support for ASM_NASM language
Fixes: #16469
2017-02-07 13:20:52 -05:00
Michael Maltese
72ed051b12 CMakeDetermineCompilerId: check with and without user-specified flags
Clang may raise an error when passed a `-march=` option that doesn't
correspond to the current target triple.  CMake cannot pass the target
triple when determining the compiler id because it doesn't know how yet,
but it does pass along user-specified flags.  This breaks when those
user-specified flags include `-march=`.  Fix this use case by also
trying to find the compiler id without the user-specified flags.

Fixes: #16587
2017-02-06 13:12:06 -05:00
Michał Górny
dd153de4f0 CMakeDetermineASMCompiler: arg-split ASM* env var like CC
Split the arguments off of the `ASM${ASM_DIALECT}` environment variable
as is done for `CC` and other compiler variables. This fixes using CMake
when `ASM*` is used to pass additional target flags, e.g. when one uses
`ASM=${CC}`.
2016-12-02 10:00:34 -05:00
Brad King
86578eccf2 Simplify CMake per-source license notices
Per-source copyright/license notice headers that spell out copyright holder
names and years are hard to maintain and often out-of-date or plain wrong.
Precise contributor information is already maintained automatically by the
version control tool.  Ultimately it is the receiver of a file who is
responsible for determining its licensing status, and per-source notices are
merely a convenience.  Therefore it is simpler and more accurate for
each source to have a generic notice of the license name and references to
more detailed information on copyright holders and full license terms.

Our `Copyright.txt` file now contains a list of Contributors whose names
appeared source-level copyright notices.  It also references version control
history for more precise information.  Therefore we no longer need to spell
out the list of Contributors in each source file notice.

Replace CMake per-source copyright/license notice headers with a short
description of the license and links to `Copyright.txt` and online information
available from "https://cmake.org/licensing".  The online URL also handles
cases of modules being copied out of our source into other projects, so we
can drop our notices about replacing links with full license text.

Run the `Utilities/Scripts/filter-notices.bash` script to perform the majority
of the replacements mechanically.  Manually fix up shebang lines and trailing
newlines in a few files.  Manually update the notices in a few files that the
script does not handle.
2016-09-27 15:14:44 -04:00
Joakim Andersson
035a658f4f Add support for the ARM Compiler (arm.com)
Create an `ARMCC` compiler id corresponding to compilers identified and
versioned by the `__ARMCC_VERSION` predefined macro.  See documentation
for the compilers at

 http://infocenter.arm.com/help/topic/com.arm.doc.set.swdev/index.html
2015-11-02 13:45:24 -05:00
Rolf Eike Beer
7eacbaed4d Replace MATCHES ".+" tests with NOT STREQUAL "" 2014-04-14 18:17:23 +02:00
Brad King
6852fb8034 CMakeDetermine*Compiler: Factor out search for compiler in PATH
Factor out a _cmake_find_compiler_path helper macro to avoid duplication
of the search for a full path to the compiler.
2014-03-10 17:12:00 -04:00
Stephen Kelly
d2dea79b36 CMakeDetermine*Compiler: Fix typo 'lile' => 'like' 2014-01-22 08:43:58 -05:00
Daniele E. Domenichelli
15610bb5b1 Drop use of configure_file IMMEDIATE option
Since commit 7d47c693 (Drop compatibility with CMake < 2.4, 2013-10-08)
we no longer need to use the configure_file IMMEDIATE option to support
compatibility modes less than 2.0.
2013-11-13 10:12:17 -05:00
Brad King
332771c942 CMakeDetermine*Compiler: Remove temporary cache entry
When the user or toolchain file sets CMAKE_<LANG>_COMPILER to a name
without a path we use find_program with CMAKE_<LANG>_COMPILER_WITH_PATH
to search for the tool.  Remove the temporary cache entry afterward to
avoid exposing it to projects.  It is not set by other logic paths so no
one should be using it.
2013-10-24 11:34:07 -04:00
Brad King
2acbd419e2 Merge topic 'FixAsmSupport'
bc460ea asm support: adapt to changes in CMakeDetectCompiler in 2.8.10
2013-06-14 09:00:48 -04:00
Alex Neundorf
bc460ea2fc asm support: adapt to changes in CMakeDetectCompiler in 2.8.10
This fixes #14210. In 2.8.10 CMakeDetermineCompiler.cmake was
modified (or added), and now the _INIT variable must not
be set to a list anymore, before it worked.

Alex
2013-06-14 08:54:34 -04:00
Alex Neundorf
d33f40638d Add regexps for the IAR toolchain to the vendor list.
The IAR compilers produce object files where the plain strings at least
sometimes can't be found, see:

  http://www.cmake.org/Bug/view.php?id=10176#c19598

Alex
2013-04-15 09:13:10 -04:00
Alex Neundorf
b3015862e5 rename TI_DSP toolchain to TI, since it works also for the ARM compiler
Additionally, look for a special ar and strip

Alex
2013-03-14 21:47:59 +01:00
Brad King
7195aca54f Make platform information files specific to the CMake version
At the top of a build tree we configure inside the CMakeFiles directory
files such as "CMakeSystem.cmake" and "CMake<lang>Compiler.cmake" to
save information detected about the system and compilers in use.  The
method of detection and the exact results store varies across CMake
versions as things improve.  This leads to problems when loading files
configured by a different version of CMake.  Previously we ignored such
existing files only if the major.minor part of the CMake version
component changed, and depended on the CMakeCache.txt to tell us the
last version of CMake that wrote the files.  This led to problems if the
user deletes the CMakeCache.txt or we add required information to the
files in a patch-level release of CMake (still a "feature point" release
by modern CMake versioning convention).

Ensure that we always have version-consistent platform information files
by storing them in a subdirectory named with the CMake version.  Every
version of CMake will do its own system and compiler identification
checks even when a build tree has already been configured by another
version of CMake.  Stored results will not clobber those from other
versions of CMake which may be run again on the same tree in the future.
Loaded results will match what the system and language modules expect.

Rename the undocumented variable CMAKE_PLATFORM_ROOT_BIN to
CMAKE_PLATFORM_INFO_DIR to clarify its purpose.  The new variable points
at the version-specific directory while the old variable did not.
2012-08-24 10:52:23 -04:00
Kitware Robot
9db3116226 Remove CMake-language block-end command arguments
Ancient versions of CMake required else(), endif(), and similar block
termination commands to have arguments matching the command starting the
block.  This is no longer the preferred style.

Run the following shell code:

for c in else endif endforeach endfunction endmacro endwhile; do
    echo 's/\b'"$c"'\(\s*\)(.\+)/'"$c"'\1()/'
done >convert.sed &&
git ls-files -z -- bootstrap '*.cmake' '*.cmake.in' '*CMakeLists.txt' |
egrep -z -v '^(Utilities/cm|Source/kwsys/)' |
egrep -z -v 'Tests/CMakeTests/While-Endwhile-' |
xargs -0 sed -i -f convert.sed &&
rm convert.sed
2012-08-13 14:19:16 -04:00
Kitware Robot
77543bde41 Convert CMake-language commands to lower case
Ancient CMake versions required upper-case commands.  Later command
names became case-insensitive.  Now the preferred style is lower-case.

Run the following shell code:

cmake --help-command-list |
grep -v "cmake version" |
while read c; do
    echo 's/\b'"$(echo $c | tr '[:lower:]' '[:upper:]')"'\(\s*\)(/'"$c"'\1(/g'
done >convert.sed &&
git ls-files -z -- bootstrap '*.cmake' '*.cmake.in' '*CMakeLists.txt' |
egrep -z -v '^(Utilities/cm|Source/kwsys/)' |
xargs -0 sed -i -f convert.sed &&
rm convert.sed
2012-08-13 14:19:16 -04:00
Brad King
7e58e5bb68 Prefer generic system compilers by default for C, C++, and Fortran
Teach CMake to prefer the system default compiler automatically when no
compiler is specified.  By default use "cc" for C, "CC" for C++, and
"f95" for Fortran.  Load a new Platform/<os>-<lang>.cmake module to
allow each platform to specify for each language its system compiler
name(s) and/or exclude certain names.

Create Platform/(CYGWIN|Darwin|Linux|Windows)-CXX.cmake modules to
specify "c++" as the system C++ compiler name for these platforms.  On
systems that use case-insensitive filesystems exclude C++ compiler names
that are distinguished from C compiler names only by case.

This will change the default compiler selection for existing build
scripts that do not specify a compiler when run on machines with
separate system and GNU compilers both installed in the PATH.  We do not
make this change in default behavior lightly.  However:

(1) If a given build really needs specific compilers one should specify
    them explicitly e.g. by setting CC, CXX, and FC in the environment.

(2) The motivating case is to prefer the system Clang on newer OS X
    systems over the older GNU compilers typically also installed.  On
    such systems the names "cc" and "c++" link to Clang.  This is the
    first platform known to CMake on which "c++" is not a GNU compiler.
    The old behavior selected "gcc" for C and "c++" C++ and therefore
    chooses GNU for C and Clang for C++ by default.  The new behavior
    selects GNU or Clang consistently for both languages on older or
    newer OS X systems, respectively.

(3) Other than the motivating OS X case the conditions under which the
    behavior changes do not tend to exist in default OS installations.
    They typically occur only on non-GNU systems with manually-installed
    GNU compilers.

(4) The consequences of the new behavior are not dire.  At worst the
    project fails to compile with the system compiler when it previously
    worked with the non-system GNU compiler.  Such failure is easy to
    work around (see #1).

In short this change creates a more sensible default behavior everywhere
and fixes poor default behavior on a widely-used platform at the cost of
a modest change in behavior in less-common conditions.
2012-08-02 13:26:01 -04:00
Brad King
796e33734d Factor common code out of CMakeDetermine(ASM|C|CXX|Fortran)Compiler
The compiler candidate list selection and search code for C, C++, ASM,
and Fortran languages was duplicated across four modules.  To look for
compilers adjacent to already-enabled languages the C and CXX modules
each used _CMAKE_USER_(C|CXX)_COMPILER_PATH and the ASM module used
_CMAKE_TOOLCHAIN_LOCATION.  Since commit 4debb7ac (Bias Fortran compiler
search with C/C++ compilers, 2009-09-09) CMake prefers Fortran compilers
matching the vendor and directory of an enabled C or C++ compiler.

Factor out the common functionality among the four languages into a new
CMakeDetermineCompiler module.  Generalize the Fortran implementation so
that all languages may each use the vendor and directory of the other
languages that have already been enabled.  For now do not list any
vendor-specific names for C, C++, or ASM so that only the directory
preference is used for these languages (existing behavior).
2012-08-02 11:33:18 -04:00
Alex Neundorf
cf93d63c0a fix #12465: detect the masm compiler ID ("MSVC")
Alex
2011-10-06 17:57:32 +02:00
Alex Neundorf
4258b24134 Add more regex for gcc, always print the ASM compiler ID
Now gcc is also recognized via "Free Software Foundation"

Alex
2011-03-01 22:58:26 +01:00
Alex Neundorf
48f7199df0 It's ELSEIF(), not ELSIF()
Alex
2011-03-01 21:39:19 +01:00
Alex Neundorf
d103c751fa Fix bad comparison in the detect assembler-code
(there was a if("${CMAKE_C_COMPILER}") instead of if(CMAKE_C_COMPILER) )

Alex
2011-03-01 21:28:54 +01:00
Alex Neundorf
f745220a32 Add support for ASm for the HP compiler.
Alex
2011-02-23 21:16:44 +01:00