summaryrefslogtreecommitdiffstats
path: root/Modules/CMakeDetermineCXXCompiler.cmake
Commit message (Collapse)AuthorAgeFilesLines
* Merge topic 'xcode-compiler-id-path'Brad King2020-11-131-1/+1
|\ | | | | | | | | | | | | bcbae3f71e Xcode: Extract CMAKE_<LANG>_COMPILER from compiler id with multiple archs Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !5506
| * Xcode: Extract CMAKE_<LANG>_COMPILER from compiler id with multiple archsBrad King2020-11-121-1/+1
| | | | | | | | | | | | | | | | | | When targeting a platform that supports multiple architectures, Xcode may choose to build all of them in our small compiler id project. Update the regex we use to extract the path to the compiler from the Xcode output to account for this. Fixes: #21425
* | Clang: Implement CMAKE_${LANG}_COMPILER_TARGET for all variants on windowsThomas Bernard2020-09-111-1/+1
| | | | | | | | Fixes: #21097
* | clang: Fix the typo for CMAKE_CXX_COMPILER_ID_TEST_FLAGSThomas Bernard2020-08-181-1/+1
| | | | | | | | | | | | | | Fix typo from commit 270e0d9c4d (Detect the correct target architecture for clang compilers., 2020-07-28). Issue: #21097
* | Merge topic 'compiler_flags'Brad King2020-08-061-1/+1
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | f76c20da63 Toolchain: Test compiler initial settings db486da265 Toolchain: Update documentation for initial compiler flags deec2f587c Toolchain: Take CMAKE_<lang>_FLAGS_INIT into account during compiler detection ca899af3e2 Toolchain: Handle repeated invocations of CMake with -DCMAKE_C_COMPILER 12ba89e142 Toolchain: Make `/path/comp;-argn' behave the same as 'comp;-argn' 6f1af899db Toolchain: Capture all arguments from CMAKE_<LANG>_COMPILER ec1d3bc0b6 cmake: avoid exception when printing "changed variables" message Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !4136
| * | Toolchain: Capture all arguments from CMAKE_<LANG>_COMPILERFred Baksik2020-07-231-1/+1
| |/ | | | | | | | | | | | | | | | | | | | | 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
* | Detect the correct target architecture for clang compilers.Thomas Bernard2020-07-281-0/+4
|/ | | | | | During compiler identification, if CMAKE_{C,CXX}_COMPILER_TARGET is defined, the corresponding clang target flag is used to guaranty proper target architecture detection.
* Update links to gitlab.kitware.com repos to add `-/`Brad King2020-05-261-1/+1
| | | | | | GitLab now uses a `/-/` component between the `group/project` part of the URL and the `{issues,merge_requests,tree}` part so that it can support `group/subgroup/project` with arbitrary depth.
* Compilers: Add paths from -print-sysroot to system prefix pathRobert Maynard2020-04-141-0/+10
|
* DetermineCompiler: Relax _CMAKE_TOOLCHAIN_PREFIX detectionRobert Maynard2020-03-301-1/+1
| | | | | | Now detect _CMAKE_TOOLCHAIN_PREFIX whenever a compilers name matches the heuristics, instead of only doing it when cross compiling
* clang: Work around toolchain file use of internal CMake variablesBrad King2019-08-051-0/+16
| | | | | | | | | | | | Since commit d44c0db0b2 (clang: setup correct configuration in gnu mode, 2019-02-20, v3.15.0-rc1~41^2~5) our Clang compiler information modules need the `CMAKE_<LANG>_COMPILER_FRONTEND_VARIANT` variable that we compute during compiler detection. However, some existing toolchain files set our internal `CMAKE_<LANG>_COMPILER_ID_RUN` variables and block that detection, but do not set the new frontend variant variable. Help them out by setting `CMAKE_<LANG>_COMPILER_FRONTEND_VARIANT` anyway. Fixes: #19515, #19539
* Merge topic 'clang-gnulike-support'Brad King2019-05-291-1/+0
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * clang: introduce CMAKE_<lang>_COMPILER_FRONTEND_VARIANTZsolt Parragi2019-05-171-1/+0
| | | | | | | | | | | | | | | | 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.
* | ARMClang: Add support for Clang-based ARM compilerJohan Stridkvist2019-05-141-0/+3
|/ | | | Fixes: #18215
* MinGW: Fix locating BinUtils when compiler has a suffixRegina Pfeifer2019-02-061-1/+2
| | | | | | | | While all executables from a mingw toolchain share a common prefix, only the ones provided with the compiler have a suffix, the binutils do not. Fixes: #18879
* Apple: Introduce separate system name for iOS, tvOS, and watchOSGregor Jasny2019-02-041-1/+1
| | | | | | | | | | | - 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
* GHS: Add Compiler ID detectionFred Baksik2019-01-161-0/+1
| | | | | | | | | | | | -- 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
* QNX: Compiler and feature detection fixesCristian Adam2018-12-031-2/+2
| | | | | | | | | | | | | | | | | | | 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/
* Xcode: Detect architecture(s) using ARCHS instead of CURRENT_ARCHBrad King2018-06-181-3/+3
| | | | | | | | | 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
* CMakeFindBinUtils: Improve switch between MSVC- and GNU-like toolsBrad King2017-11-281-1/+1
| | | | | | | | 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
* Clang: Diagnose unsupported GNU-like clang targeting MSVC ABIBrad King2017-10-101-0/+1
| | | | | | | | | | The LLVM/Clang installer on Windows provides a `LLVM/bin` directory containing `clang.exe` and `clang++.exe` command-line tools that have a GNU-like command-line but target the MSVC ABI (instead of MinGW). We do not support this combination, so diagnose and reject it explicitly. Tell users what to do to use the `clang-cl.exe` tool instead. Issue: #16439
* IAR: Improve support for IAR ARM CompilerNorbert Lange2017-06-291-0/+3
| | | | | | | | | | | | | | | 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
* Add a CMAKE_<LANG>_COMPILER_ARCHITECTURE_ID variableNorbert Lange2017-06-291-0/+7
| | | | | | | | | | 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.
* Xcode: Detect CURRENT_ARCH for use by generatorBrad King2017-03-311-0/+5
| | | | | | | During compiler identification, extract the Xcode `CURRENT_ARCH` value and save it for later use by the Xcode generator in an internal compiler information variable. This will be useful to know the locations of object files when only one architecture is built.
* Add 'CMAKE_GCC_AR' and 'CMAKE_GCC_RANLIB' variablesRuslan Baratov2017-03-081-0/+4
|
* Simplify CMake per-source license noticesBrad King2016-09-271-12/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* issues: update references to the CMake issue trackerBen Boeckel2016-08-151-1/+1
| | | | | References to specific comments are left as-is since comments were not migrated.
* Modules: Rename internal platform-specific compiler determination modulesBrad King2016-06-021-0/+1
| | | | | | | Rename Modules/Platform/<os>-<lang>.cmake files to Modules/Platform/<os>-Determine-<lang>.cmake to clarify their role. For compatibility with user-provided modules, load the old names if they exist.
* Replace http://www.cmake.org URLs with https://cmake.orgBrad King2015-09-251-1/+1
| | | | | | | The latter is now the preferred URL for visiting cmake.org with a browser. Convert using the shell code: git ls-files -z | xargs -0 sed -i 's|http://www\.cmake|https://cmake|g'
* Ninja: Detect MSVC /showIncludes prefix with compiler flags (#15596)Brad King2015-09-181-1/+0
| | | | | | | | Move detection over to the compiler id logic where we have already constructed the list of compiler flags from ARG1 and CMAKE_<LANG>_FLAGS. Pass the flags when we execute "cl" with "/showIncludes". Also pass "/c" because we only need to compile, not link. Check the compiler process exit code before trusting its output.
* Merge topic 'determine-compiler-CMP0054'Brad King2015-08-211-3/+4
|\ | | | | | | | | dc8822f0 CMakeDetermine{C,CXX}Compiler: Avoid if() auto-dereferene in quoted arguments
| * CMakeDetermine{C,CXX}Compiler: Avoid if() auto-dereferene in quoted argumentsMatt McCormick2015-08-201-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | Exposed by a CMP0054 warning with code like: cmake_minimum_required(VERSION 2.8.9 FATAL_ERROR) project(MyProj NONE) enable_language(C) enable_language(CXX) While at it, use STREQUAL for testing the compiler id against "GNU". Suggested-by: Rolf Eike Beer <eike@sf-mail.de>
* | CMakeDetermineCompilerId: Use per-language regex to match Xcode compiler toolBrad King2015-06-301-0/+8
| | | | | | | | | | | | Move the Ld invocation match expression from CMakeDetermineCompilerId into CMakeDetermine{C,CXX,Fortran}Compiler so that it can be specified on a per-language basis.
* | CMakeDetermineCompilerId: Optionally try some flags before no flagsBrad King2015-06-181-0/+1
|/ | | | | | | | Teach CMAKE_DETERMINE_COMPILER_ID to optionally try detecting the compiler id using some given flags before trying to detect it with no special flags. This will be useful for Fortran detection to distinguish some compilers that use the preprocessors of others but have no macro of their own by getting verbose output.
* Merge topic 'fix-clang-cross-compile-find-binutils'Brad King2014-09-081-1/+3
|\ | | | | | | | | 72d66818 Fix finding binutils when cross-compiling with Clang
| * Fix finding binutils when cross-compiling with ClangBrad King2014-09-051-1/+3
| | | | | | | | | | | | | | | | | | Since commit v3.0.0-rc1~342^2~2 (Add compiler target compile options, 2013-05-19) we use CMAKE_<LANG>_COMPILER_TARGET as the binutils prefix when cross-compiling with Clang. Fix the implementation to use the compiler target as the prefix only when it is set. Otherwise toolchain files not using CMAKE_<LANG>_COMPILER_TARGET cause the logic to use a prefix of just "-" and of course cannot find "-ar" or "-ld".
* | Replace MATCHES ".+" tests with NOT STREQUAL ""Rolf Eike Beer2014-04-141-1/+1
| |
* | Remove .* expressions from beginning and end of MATCHES regexsRolf Eike Beer2014-04-141-1/+1
|/ | | | | | | | | All these expressions work the same: "foo" ".*foo.*" "^.*foo.*$" This assumes that the "Intel*" expressions were meant to be "Intel.*".
* Xcode: Convert forced CMAKE_<LANG>_COMPILER to full path if possibleBrad King2014-03-101-0/+1
| | | | | | | During cross-compiling the toolchain file may use CMakeForceCompiler to force a compiler setting. When using the Xcode generator try to convert it to a full path by searching the PATH as is done for the Makefile generators.
* CMakeDetermine*Compiler: Factor out search for compiler in PATHBrad King2014-03-101-26/+1
| | | | | Factor out a _cmake_find_compiler_path helper macro to avoid duplication of the search for a full path to the compiler.
* CMakeDetermine*Compiler: Fix typo 'lile' => 'like'Stephen Kelly2014-01-221-1/+1
|
* Add compiler target compile options.Stephen Kelly2013-11-191-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | For clang, this allows passing -target <triple> to the compiler, and for qcc, -V<arch> using toolchain files containing something like set(triple arm-linux-gnueabihf) set(CMAKE_C_COMPILER "/usr/bin/clang") set(CMAKE_C_COMPILER_TARGET ${triple}) set(CMAKE_CXX_COMPILER "/usr/bin/clang++") set(CMAKE_CXX_COMPILER_TARGET ${triple}) or set(arch gcc_ntoarmv7le) set(CMAKE_C_COMPILER /opt/qnx650/host/linux/x86/usr/bin/qcc) set(CMAKE_C_COMPILER_TARGET ${arch}) set(CMAKE_CXX_COMPILER /opt/qnx650/host/linux/x86/usr/bin/QCC) set(CMAKE_CXX_COMPILER_TARGET ${arch}) Both clang and qcc are inherently cross compiler( driver)s. When cross-compiling with clang, use the CMAKE_${lang}_COMPILER_TARGET as the _CMAKE_TOOLCHAIN_PREFIX to find the appropriate binutils. When cross-compiling with QNX qcc, use the CMAKE_${lang}_COMPILER_TARGET to set the appropriate _CMAKE_TOOLCHAIN_PREFIX.
* Drop use of configure_file IMMEDIATE optionDaniele E. Domenichelli2013-11-131-1/+1
| | | | | | 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.
* Merge topic 'enable-language-require-compiler'Brad King2013-10-281-1/+1
|\ | | | | | | | | | | | | 3e04946 Require CMAKE_<LANG>_COMPILER to be found as a full path 6007f7c CMakeDetermineCompilerId: Always use compiler detected from IDE 332771c CMakeDetermine*Compiler: Remove temporary cache entry
| * CMakeDetermine*Compiler: Remove temporary cache entryBrad King2013-10-241-1/+1
| | | | | | | | | | | | | | | | 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.
* | Merge topic 'ninja-use-deps'Brad King2013-10-281-1/+2
|\ \ | | | | | | | | | | | | eeb4aec Ninja: use deps = gcc/msvc feature
| * | Ninja: use deps = gcc/msvc featurePeter Kümmel2013-10-241-1/+2
| |/ | | | | | | cmcldeps is now only used for .rc file processing
* | Find appropriate binutils when cross-compiling with clangStephen Kelly2013-10-251-2/+2
|/ | | | | | | | | | One way to use clang as a cross-compiler is to create a symlink named <target>-clang, which is equivalent to running clang -target <target> Extract the toolchain prefix to find the binutils executables.
* Add regexps for the IAR toolchain to the vendor list.Alex Neundorf2013-04-151-0/+7
| | | | | | | | | 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
* TI compiler: add automatic detection of prefix and suffixesAlex Neundorf2013-03-141-0/+8
| | | | | | | The TI cross compilers are named e.g. cl6x or armcl, the accompanying strip and ar have the same prefixes/suffixes. Alex