summaryrefslogtreecommitdiffstats
path: root/Modules/Compiler/Clang.cmake
Commit message (Collapse)AuthorAgeFilesLines
* FujitsuClang: Change LTO option from -flto=thin to -fltoYuichiro Utsumi2021-06-291-0/+3
| | | | | Since -flto=thin is not supported officially in FujitsuClang, change to -flto.
* Clang/MSVC: C++20 final flag, C++23 supportRaul Tambre2021-05-291-3/+12
| | | | | Added in LLVM commit a8f75d497daa2684a03909d7c31d5bce11b427e1, will be released in 13.0.
* Android: Do not use gold for ndk >= r22Haibo Huang2021-03-031-1/+1
| | | | Fixes: #21772
* Merge topic 'clang-imsvc'Brad King2021-02-101-1/+0
|\ | | | | | | | | | | | | | | 2fc5e5dba9 Clang: Use -imsvc for system include only with MSVC-like front-end Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: Thomas Bernard <thomas@famillebernardgouriou.fr> Merge-request: !5792
| * Clang: Use -imsvc for system include only with MSVC-like front-endBrad King2021-02-091-1/+0
| | | | | | | | | | | | | | | | | | | | In commit bb61c2d024 (Clang: use -imsvc for system include dirs when running on Windows, 2020-09-16, v3.19.0-rc1~162^2) we added `-imsvc` for all Clang compilers targeting the MSVC ABI. However, the option only exists for the MSVC-like front-end. The GNU-like front-ends use `-isystem`. Fixes: #21789
* | CUDA, CXX, OBJCXX: C++23 support with Clang 12Raul Tambre2020-12-081-0/+8
| | | | | | | | | | Clang 12 landed initial support for C++23 language mode flag -std={c|gnu}++2b in commit 6627a3c2873fdf7ccba1a1573371079be48b36e8.
* | CUDA, CXX: Remove HAS_FULL_SUPPORT for C++17 and 20Raul Tambre2020-12-081-6/+0
|/ | | | | | CMake has no features for C++ versions past 14 and it seems unlikely we'd want to add any. Remove the related code.
* Clang: use -imsvc for system include dirs when running on WindowsAndrew Fuller2020-09-161-0/+1
| | | | Fixes #17808
* Merge topic 'pch-instantiate-templates'Brad King2020-09-101-0/+3
|\ | | | | | | | | | | | | | | | | | | 8c8f03422e PCH: Template instantiation support Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: Raul Tambre <raul@tambre.ee> Acked-by: Cristian Adam <cristian.adam@gmail.com> Tested-by: Raul Tambre <raul@tambre.ee> Merge-request: !5168
| * PCH: Template instantiation supportTobias Hieta2020-09-021-0/+3
| | | | | | | | | | | | | | | | Adds PCH_INSTANTIATE_TEMPLATES target property for enabling template instantiation in precompiled headers. Enabled by default. Currently only supported for Clang 11 and newer. Implements #21133.
* | PCH: Mark CMake PCH source files as -x <lang>-headerCristian Adam2020-09-041-1/+6
|/ | | | Fixes: #21163
* Clang: Fix fallback compile features when simulating old MSVC versionsBrad King2020-07-291-5/+5
| | | | | | | | Refactoring in commit 25439c7d62 (Clang: Refactor CXX standard flags into __compiler_clang_cxx_standards(), 2020-03-16, v3.18.0-rc1~362^2~4) accidentally broke the `cxx_std_*` fallback feature names. Issue: #21033
* Clang: Record Clang 6.0+ as fully supporting C++17Raul Tambre2020-06-131-0/+4
|
* Clang: Add final C++20 flag for Clang 11.0+Raul Tambre2020-06-131-1/+4
| | | | | -std=c++20 superseded -std=c++2a in upstream Clang commit 24ad121582454e625bdad125c90d9ac0dae948c8.
* Clang: Refactor CXX standard flags into __compiler_clang_cxx_standards()Raul Tambre2020-04-071-0/+120
| | | | | | | These standard flags are the same for CXX, OBJCXX and CUDA. Refactor them into a single macro to reduce duplication and so we can easily reuse them. Updated bootstrap script to search in the general Clang module instead of the language-specific.
* PCH: Clang: Update PCH usage flags to include original headerSergey Larin2020-02-241-1/+1
| | | | | | | | | | | | | | | | | | | | | Add an additional include flag to PCH usage command line to fix programs that rely on `compile_commands.json` file. Pass it to the preprocessor directly to avoid compiler driver to change it to '-include-pch'. When preprocessor is requested to preprocess a file, it tries to get the original filename from '.pch' and uses that file for preprocessing. CMake generates a '.pch' file from the '.hxx' file by passing an empty '.cxx' source file to the compiler as a compilation unit and the header file with the '-include' flag. After that, compiler puts compilation unit filename in the '.pch' as the original filename. However, CMake build system uses empty file as the source file and passes the header file using '-include-pch' flag. As a result, Clang uses the wrong file for preprocessing and produces the corrupted preprocessed file. Fixes: #20355 Signed-off-by: Sergey Larin <cerg2010cerg2010@mail.ru>
* PCH: Do not add #pragma system_header for Xcode generatorCristian Adam2019-12-041-1/+3
| | | | Fixes: #20039
* PCH: Use clang's own pch functionality instead of the GCC emulationCristian Adam2019-10-031-0/+3
| | | | Fixes: #19786
* Precompile headers: Add methods to generate PCH sourcesCristian Adam2019-08-281-0/+2
| | | | Co-Author: Daniel Pfeifer <daniel@pfeifer-mail.de>
* PIE link options: Update strategy to fix performance regressionMarc Chevrier2018-12-191-17/+3
| | | | Fixes: #18700
* POSITION_INDEPENDENT_CODE: Manage link flags for executablesMarc Chevrier2018-11-111-0/+20
| | | | Fixes: #14983, #16561
* Autogen: Add clang --target= flag to compiler predefines commandBrad King2018-10-051-0/+8
| | | | | | | Respect the compiler target value `CMAKE_<LANG>_COMPILER_TARGET` in `CMAKE_<LANG>_COMPILER_PREDEFINES_COMMAND`. Issue: #18425
* LINK_OPTIONS: Add support of "LINKER:" prefixMarc Chevrier2018-06-061-0/+2
|
* Flang: Identify as simulating MSVC on WindowsIsuru Fernando2017-10-311-1/+2
| | | | | | In `CMakeFortranCompilerId.F.in`, take the `_MSC_VER` out of the Intel-specific block so it will trigger for other compilers like Flang. In `Compiler/Clang.cmake`, switch off Fortran too.
* IPO: Fix support for spaces in path to archive toolsThomas Stenersen2017-10-061-3/+3
| | | | | | | | In the normal archiving rules the ``<CMAKE_AR>`` placeholder is replaced by the generators with a properly-quoted path to the tool. In the IPO rules we specify the tools directly, so we need to quote them. Fixes: #17326
* IPO: Consider support for each language separatelyBrad King2017-06-141-2/+2
| | | | | | | | | We only define `INTERPROCEDURAL_OPTIMIZATION` behavior for C, CXX, and Fortran languages. Do not try to enable support for other languages. Furthermore, each language builds with a different compiler, so check for support by CMake and the compiler for each language independently. Fixes: #16944
* Clang: Use common compiler macros for language standard defaultChuck Atkins2017-05-021-0/+2
|
* Clang IPO (LTO) supportRuslan Baratov2017-04-281-6/+48
|
* Implement interprocedural optimization for GNU compilersRuslan Baratov2017-03-301-0/+8
| | | | | Honor the `INTERPROCEDURAL_OPTIMIZATION` target property for GNU compilers by activating their link-time-optimization (LTO) flags.
* 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.
* Avoid if() quoted auto-dereference when checking for "MSVC"Fraser Hutchison2014-11-191-2/+2
| | | | | When testing CMAKE_<LANG>_COMPILER_ID values against "MSVC", do not allow the definition of the "MSVC" variable to be expanded.
* Update the Clang pattern to specify compiler options.Stephen Kelly2013-11-251-2/+7
| | | | | | | | | | In Clang 3.4, the preferred (and new) option pattern is --target=. http://thread.gmane.org/gmane.comp.compilers.clang.devel/29975 http://llvm.org/viewvc/llvm-project?view=revision&revision=184408 Clang 3.4 is not yet released, but there is a release candidate, and there is a dashboard test of Clang trunk.
* Allow toolchain files to specify an external toolchain.Stephen Kelly2013-11-191-0/+1
| | | | | | | | | Clang can compile code, but uses the gcc tools for other tasks such as linking. The -gcc-toolchain option can be used for that, but generalize so that other compilers can be treated the same. If such a location is specified, use it as a hint for finding the binutils executables.
* Add compiler target compile options.Stephen Kelly2013-11-191-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Clang: Support Windows variants for GNU and MSVC (#13035, #14458)Brad King2013-10-041-7/+13
| | | | | | | | | | | | | | | | Teach the compiler identification preprocessor tests to report when Clang simulates MSVC, and what version. If not MSVC, assume GNU. Teach compiler information modules Clang-(C|CXX) to recognize when Clang simulates MSVC and skip loading the GNU information. Teach the Windows-MSVC platform information to recognize when it is loaded as the simulated compiler and use that version information instead of the real compiler's (different) version scheme. Add platform modules Windows-Clang-(C|CXX) and support module Windows-Clang to load either Windows-MSVC or Windows-GNU and wrap the corresponding information macros.
* Revert "Add compiler target compile options."Stephen Kelly2013-08-091-1/+0
| | | | This reverts commit 2d9ec1dadfdd10043a98d425abb25d0aef117699.
* Add compiler target compile options.Stephen Kelly2013-06-111-0/+1
| | | | | | | | | | | | | | | | | | | | | 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.
* Introduce target property <LANG>_VISIBILITY_PRESETStephen Kelly2013-06-021-0/+1
| | | | | | This is initialized by CMAKE_<LANG>_VISIBILITY_PRESET. The target property is used as the operand to the -fvisibility= compile option with GNU compilers and clang.
* Clang: Add -isystem flag support everywhereBen Boeckel2013-03-281-0/+1
| | | | | | | | In GNU.cmake, -isystem is not used if APPLE is set. However, Clang has pretty much always supported -isystem, so we should always use it. In the future, GNU.cmake should do a version check to see if -isystem is supported.
* Clang: All versions know about -fPIE (#13550)Brad King2012-09-191-0/+1
| | | | | | The GNU compiler information file tests for GNU >= 3.4 because earlier versions do not have the flag. The version number test is not valid for Clang compiler versions, but we know Clang supports the flag.
* Clang: Split Compiler/Clang* modules out from GNU (#13550)Brad King2012-09-191-0/+25
While Clang presents an almost identical interface to GNU there will be some differences. Split the compiler information modules to allow separate rules for Clang. Start by loading the GNU rules but leave a place to add Clang-specific information.