summaryrefslogtreecommitdiffstats
path: root/Modules/Platform/Windows-Clang.cmake
Commit message (Collapse)AuthorAgeFilesLines
* CUDA/Clang: Fail early when mixing clang++ with cl on WindowsBrad King2024-01-311-13/+8
| | | | | | | | | In commit 88c740462c (CUDA/Clang: Add support for MSVC ABI on Windows using GNU-like frontend, 2024-01-17) we updated the message for the existing check to mention CUDA, but neglected to update the check itself. Issue: #25648
* CUDA/Clang: Add support for MSVC ABI on Windows using GNU-like frontendBrad King2024-01-221-2/+5
| | | | Fixes: #20776
* Link step: Enable to configure deduplication of librariesMarc Chevrier2023-11-091-0/+2
| | | | | | | | | Some platforms, Apple or Windows for instance, do not require to duplicate static libraries to resolve mutual dependencies. Moreover, Xcode version 15 emits a warning if a library is duplicated. On Windows, enable a better control of libraries order. Fixes: #20722, #25297
* Link Step: compute effective linker used by the compilerMarc Chevrier2023-10-241-0/+1
| | | | | | | | | | | | | | | Extract the effective linker during the computation of implicit artifacts delivered by the compiler to the linker. Define various variables describing the linker: * CMAKE_<LANG>_COMPILER_LINKER * CMAKE_<LANG>_COMPILER_LINKER_VERSION * CMAKE_<LANG>_COMPILER_LINKER_ID * CMAKE_<LANG>_COMPILER_LINKER_FRONTEND_VARIANT This is complementary to feature introduced by commit 96a953b1ed (Add options to specify linker tool, 2023-09-27). Fixes: #17596, #18209, #25344
* Add options to specify linker toolMarc Chevrier2023-10-131-2/+8
| | | | | | | | | | | | | | | | | | Offer the capability, through variable `CMAKE_LINKER_TYPE`, as well as the target property `LINKER_TYPE` to specify which linker must be used. The implementation of this capability is specified by variables specific to the language and linker type: `CMAKE_<LANG>_USING_LINKER_<TYPE>`. Some definitions are provided as part of `CMake`. For example, to select the `LLVM` linker rather than the standard one, the type `LLD` should be specified through the variable `CMAKE_LINKER_TYPE`. And, on `Apple`, `Linux` and some environments on `Windows`, the variable `CMAKE_<LANG>_USING_LINKER_LLD` has value `-fuse-ld=lld`. And for `Windows` environments based on `MSVC`, where the linker is used directly, the tool `lld-link.exe` will be used rather than `link.exe`. Fixes: #19174, #24254, #24990
* HIP, Windows: Add Windows-Clang-HIP platform moduleGergely Meszaros2022-10-091-15/+30
| | | | | | | | | | | | | Add a platform module for using clang for HIP on windows, based on the CXX module. HIP language on windows works without this, but mixing with MSVC produces catastrofical results. Add the same restriction with HIP as C and C++ had prior: Either none are compiled with MSVC or all are. clang-cl support for HIP does not work yet: it needs more work in both hip-lang-config.cmake and cmake itself.
* MSVC: Add abstraction for debug information formatGlen Chung2022-09-141-2/+22
| | | | | | | | | | | | | | | | Replace our hard-coded default for `/Zi` with a first-class abstraction to select the debug information format an enumeration of logical names. We've long hesitated to do this because the idea of "debug information format" touches on related concepts on several platforms. Avoid that scope creep by simply defining an abstraction that applies only when targeting the MSVC ABI on Windows. Removing the old default flag requires a policy because existing projects may rely on string processing to edit them and choose a runtime library under the old behavior. Add policy CMP0141 to provide compatibility. Fixes: #10189
* Clang/Windows: Clarify name of internal runtime library flags variablesBrad King2022-09-131-10/+10
| | | | Also avoid extra spaces in resulting flag strings.
* Merge branch 'backport-3.23-clang-imsvc' into clang-imsvcBrad King2022-05-171-1/+1
|\
| * Clang: Use -imsvc flag without space to support Clang toolsBrad King2022-05-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Since commit bb61c2d024 (Clang: use -imsvc for system include dirs when running on Windows, 2020-09-16, v3.19.0-rc1~162^2) we use the `-imsvc` flag followed by the include directory as a separate argument. Some versions of `clang-tidy` do not support the flag unless the include directory is attached to it, so use that form instead. A similar fix was made by commit 3a8b6653dc (MSVC: Use -external:I flag without space to support Clang tools, 2022-01-11, v3.22.2~8^2). Fixes: #23517
* | COMPILE_WARNING_AS_ERROR: Add options to treat warnings as errorsMartin Duffy2022-05-061-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | Add `COMPILE_WARNING_AS_ERROR` target property and supporting `CMAKE_COMPILE_WARNING_AS_ERROR` variable. `COMPILE_WARNING_AS_ERROR` is initialized by `CMAKE_COMPILE_WARNING_AS_ERROR`. It is a boolean variable. If it is true, it expands to a different flag depending on the compiler such that any warnings at compile will be treated as errors. Supports compiler ids that I could find a relevant flag for.
* | genex-LINK_LIBRARY: Add feature WHOLE_ARCHIVEMarc Chevrier2022-03-171-0/+7
|/
* Windows/Clang: Support PDB when cross-compilingDeniz Bahadir2022-02-081-0/+1
|
* Clang/Windows: Use ThinLTO if possible to match other platformsRaul Tambre2021-11-141-1/+6
| | | | Fixes #22905.
* Clang: embed windows manifests with GNU interfaceThomas Bernard2021-09-161-2/+4
| | | | Solves: #22611
* Windows-Clang: Support duplicate object names in LTO archivesBrad King2021-05-031-2/+2
| | | | | | | | | Update the archive rules added by commit 6e3655db2c (Clang: add LTO support for GNU-command line clang on windows, 2019-07-08, v3.16.0-rc1~161^2~3) to match the `ar` convention we use for normal archives. Issue: #21988
* Per-language Win32/Console flagsRaul Tambre2021-03-171-2/+2
| | | | | | | | Allows using different compilers with different flags for different languages. For example Clang with GNU-like commandline for CXX and MSVC as host compiler for CUDA. Should help with #21914.
* Merge topic 'clang-imsvc'Brad King2021-02-101-0/+1
|\ | | | | | | | | | | | | | | 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-0/+1
| | | | | | | | | | | | | | | | | | | | 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
* | Clang: Support WIN32_EXECUTABLERaul Tambre2020-12-231-0/+3
| | | | | | | | Fixes #21613.
* | Merge branch 'master' into llvm-rc-preprocess-as-cBrad King2020-12-021-3/+5
|\ \ | |/ |/|
| * Merge topic 'windows-clang-LINKER-prefix'Brad King2020-12-011-0/+3
| |\ | | | | | | | | | | | | | | | | | | 9ac9876757 Clang on Windows: 'LINKER:' prefix must be honored Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !5551
| * | Refactoring: Introduce place-holder for dependency target.Marc Chevrier2020-11-281-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | These changes are in preparation of compiler generated dependencies support for Makefiles generators * compiler output and dependency target can be different for Makefiles generators * resolve inconsistency naming for dependency file place-holder
| * | llvm_rc: add llvm_rc option filter to correctly pick up all optionsThomas Bernard2020-10-281-1/+3
| | | | | | | | | | | | Fixes: #21315
* | | llvm-rc: Force C language for the clang gnu frontendThomas Bernard2020-12-021-5/+5
| |/ |/| | | | | | | | | | | | | When preprocessing the rc file using the clang gnu front end we need to force the source file type to a c file for the preprocessing to take place. Fixes: #21472
* | Clang on Windows: 'LINKER:' prefix must be honoredMarc Chevrier2020-11-301-0/+3
|/ | | | Fixes: #21094
* Clang: Implement CMAKE_${LANG}_COMPILER_TARGET for all variants on windowsThomas Bernard2020-09-111-3/+12
| | | | Fixes: #21097
* Merge topic 'ios-pch-x-lang-header'Brad King2020-09-091-1/+6
|\ | | | | | | | | | | | | 8d61294c3e PCH: Mark CMake PCH source files as -x <lang>-header Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !5188
| * PCH: Mark CMake PCH source files as -x <lang>-headerCristian Adam2020-09-041-1/+6
| | | | | | | | Fixes: #21163
* | llvm-rc: Enable preprocessing for all Windows usage variantsThomas Bernard2020-08-271-0/+2
| | | | | | | | Fixes: #21096
* | llvm-rc: Refactor the preprocessing logicThomas Bernard2020-08-271-20/+27
| |
* | Merge branch 'backport-3.18-llvm-rc-quote-cmake' into llvm-rc-quote-cmakeBrad King2020-08-181-1/+1
|\ \ | |/
| * llvm-rc: Fix quoting of path to cmake in CMAKE_RC_COMPILE_OBJECTThomas Bernard2020-08-181-1/+1
| | | | | | | | | | | | | | | | When the installation path to cmake includes spaces, the `<CMAKE_COMMAND>` is required to have proper quotation of the cmake call. Fixes: #21095
* | clang-cl: Add '--' before source fileThomas Bernard2020-08-071-1/+1
| | | | | | | | | | | | | | On Linux and macOS, absolute paths start with `/` which may be interpreted by clang-cl as an option. To avoid this, we separate the source file path from preceding options with `--` to tell `clang-cl` it is not an option.
* | cmake: Change cmake_llvm_rc separator from -- to ++ to avoid conflictThomas Bernard2020-08-071-1/+1
|/
* Merge topic 'llvm-rc-include-path'Brad King2020-04-071-1/+1
|\ | | | | | | | | | | | | 35a29ec827 llvm-rc: Restore include path for data after explicit preprocessing Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !4570
| * llvm-rc: Restore include path for data after explicit preprocessingThomas Bernard2020-04-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since commit 1c2d031cbd (Add -E cmake_llvm_rc to preprocess files for llvm-rc, 2020-01-14, v3.17.0-rc1~24^2) with llvm-rc we explicitly preprocess RC source files and then compile separately without -I flags. This broke cases where the RC source references data files adjacent to itself or in the include path. This change adds the expansion of the include paths when calling the llvm-rc in order for the resource files to be picked up correctly by llvm-rc. Since the RC compiled file is first preprocessed, the file being compiled by llvm-rc resides in the build directory. In order for llvm-rc to find the resource data specified relative to the .rc file being compiled, the source file path is preppended in the include list so that the original source path takes priority over all the other includes paths specified. A space was added in the CMAKE_INCLUDE_FLAG_RC to make the include directive work properly for llvm-rc. Checks on the rc.exe showed that the syntax change doesn't affect it's proper operation. Fixes: #20529
* | Merge topic 'llvm_rc_pp'Brad King2020-03-301-1/+1
|\ \ | |/ | | | | | | | | | | 4bef0e6450 llvm-rc: Enable preprocessing if CMAKE_RC_COMPILER_INIT is an absolute path Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !4535
| * llvm-rc: Enable preprocessing if CMAKE_RC_COMPILER_INIT is an absolute pathLucas Wang2020-03-271-1/+1
| | | | | | | | | | `CMAKE_RC_COMPILER_INIT` and `CMAKE_RC_COMPILER` can be set by user, for example `llvm-rc-10` and `D:\LLVM\bin\llvm-rc.exe`.
* | Merge topic 'llvm-rc-depfile'Brad King2020-03-271-3/+4
|\ \ | |/ | | | | | | | | | | | | 2c724c3aea llvm-rc: Write depfile to location specified by the generator 4cc876540e llvm-rc: Select preprocessor from active languages Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !4524
| * llvm-rc: Write depfile to location specified by the generatorThomas Bernard2020-03-261-1/+2
| | | | | | | | | | | | | | | | | | Move the depfile flags to `CMAKE_DEPFILE_FLAGS_RC` so that they are only usedwith generators that use depfiles. Also switch to using the `<DEPFILE>` placeholder for the location of the depfile so that it goes where the generator expects. Fixes: #20493
| * llvm-rc: Select preprocessor from active languagesThomas Bernard2020-03-261-2/+2
| | | | | | | | | | | | The llvm-rc preprocessor is selected according to the CMAKE_C_COMPILER_ID / CMAKE_CXX_COMPILER_ID which are only defined when the C or CXX language is active.
* | Modules: Collapse consecutive whitespace in stringsDaan De Meyer2020-03-231-2/+2
|/
* llvm-rc: Forward DEFINES instead of FLAGSThomas Bernard2020-03-031-1/+1
| | | | | | | | Since commit 1c2d031cbd (Add -E cmake_llvm_rc to preprocess files for llvm-rc, 2020-01-14, v3.17.0-rc1~24^2) we pass the full target `<FLAGS>` to the llvm-rc resource compiler, but we should pass only `<DEFINES>`. Fixes: #20414
* 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>
* Add -E cmake_llvm_rc to preprocess files for llvm-rcThomas Bernard2020-02-041-0/+17
| | | | | | | | | llvm-rc requires preprocessed rc files. The CMake command line tool cmake_llvm_rc enables channing the preprocessor call and the resource compiler and make this appear as single compilation step. When llvm-rc is detected as resource compiler, the RC compilation step is set to use this command.
* ASM: Hook up Windows-specific GNU/Clang compiler information modulesMartin Storsjö2020-01-311-16/+20
| | | | | | This allows building .s/.S assembly code, and makes sure that the `-fPIC` option isn't passed to the compiler (as it errors out on Clang and causes a loud warning on GCC).
* MinGW: Update find_library to not find plain .dll filesBrad King2020-01-201-1/+1
| | | | | | | | Modern distributions of packages built with MinGW tools provide `.dll.a` import libraries. Prefer those instead of finding plain `.dll` files. This avoids accidentally finding unrelated Windows `.dll` files. Fixes: #20019
* PCH: Add support for OBJC/OBJCXX languagesCristian Adam2019-11-031-3/+0
|
* PCH: Use clang's own pch functionality instead of the GCC emulationCristian Adam2019-10-031-3/+4
| | | | Fixes: #19786