summaryrefslogtreecommitdiffstats
path: root/Modules/Platform/Windows-MSVC.cmake
Commit message (Collapse)AuthorAgeFilesLines
* MSVC: Restore support for non-incremental linking with v100 toolset and olderRüdiger Ihle2024-09-031-2/+2
| | | | | | | | | | | | Since commit 0b552eb877 (MSVC: Embed manifests directly for non-incremental vs_link_exe links, 2023-02-20, v3.27.0-rc1~438^2) we use `/MANIFEST:EMBED`, but that is not supported by older MSVC linkers. Restore use of the standalone manifest tool. Update `Tests/MSManifest` to recognize `dpiAwareness` in the manifest content as written by MSVC v100 tooling. Fixes: #26179
* WHOLE_ARCHIVE link feature: rely now on linker configurationMarc Chevrier2024-07-221-8/+0
| | | | Fixes: #26019
* Linker configuration: introduce a new architectureMarc Chevrier2024-07-201-2/+0
| | | | | | | | A new set of files are dedicated to linker configuration. This set of files enable a fine-tuned configuration based of the linker type as identified during compiler detection. Fixes: #25360
* MSVC: Remove outdated preprocessor flags for targeting ARM64ECmoyo19972024-07-091-1/+1
| | | | | | Remove `/DAMD64` and `/DARM64EC` flags added by commit 4ea3a88625 (MSVC: Add support for targeting ARM64EC, 2020-12-30, v3.20.0-rc1~121^2) that are not longer expected.
* Link feature attributes: stabilizationMarc Chevrier2024-06-211-1/+1
| | | | | * enhance OVERRIDE handling * Update wording
* Libraries processing: update configuration wordingMarc Chevrier2024-06-211-1/+1
|
* GenEx $<LINK_LIBRARY>: Add the support of properties attached to featuresMarc Chevrier2024-05-151-0/+1
| | | | Fixes: #24504, #25954
* IntelLLVM: Fix link flags with Visual Studio generatorsBrad King2024-04-021-22/+22
| | | | | | | | | | | | The link flag wrapping added by commit 5d5a712303 (IntelLLVM: Pass linker flags to the compiler when used as linker, 2022-05-27, v3.25.0-rc1~344^2~4) is not needed with Visual Studio generators because MSBuild invokes the linker directly. Furthermore, that commit omitted wrapping of the per-config linker flags. Revise the logic to add the link flag wrapping more precisely. Fixes: #25533
* 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
* Add options to specify linker toolMarc Chevrier2023-10-131-0/+6
| | | | | | | | | | | | | | | | | | 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
* Windows: Add experimental WindowsKernelModeDriver platformKyle Edwards2023-07-171-2/+22
|
* MSVC: Add abstraction for debug information formatGlen Chung2022-09-141-2/+19
| | | | | | | | | | | | | | | | 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
* MSVC: Revert "Default to -ZI instead of /Zi for x86 and x64"Brad King2022-06-091-7/+2
| | | | | | | | | | | | | | Revert commit 5fcadc481e (MSVC: Default to -ZI instead of /Zi for x86 and x64, 2022-05-24). The `-ZI` flag is incompatible with the `-GL` flag used for IPO, and so is not an unconditionally better default. Revert the change pending future design of a first-class setting for MSVC debug info format that can be automatically reconciled with IPO settings. That commit introduced policy CMP0138, but we already have later policy numbers used too. Leave placeholder text to avoid policy renumbering. Issue: #23607, #10189
* MSVC: Default to -ZI instead of /Zi for x86 and x64Glen Chung2022-05-261-2/+7
| | | | | | | | | | Add a policy for compatibility. For more information, see [1]. [1] https://docs.microsoft.com/en-us/cpp/build/reference/z7-zi-zi-debug-information-format?view=msvc-170 Fixes: #10189
* genex-LINK_LIBRARY: Add feature WHOLE_ARCHIVEMarc Chevrier2022-03-171-0/+9
|
* Merge topic 'cmcldeps-cross'Brad King2022-01-071-1/+1
|\ | | | | | | | | | | | | | | d49e168e1b Ninja: Do not use cmcldeps for RC on non-Windows hosts Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: Dmitry Mikushin <dmitry@kernelgen.org> Merge-request: !6843
| * Ninja: Do not use cmcldeps for RC on non-Windows hostsMartin Storsjö2022-01-061-1/+1
| | | | | | | | | | | | | | | | The `cmcldeps` executable is only built on Windows. If running MSVC on a different OS (with various compatibility wrapping), don't try to use `cmcldeps`, as the executable doesn't exist. Fixes: #21760
* | MSVC: update arm64ec default flags and libmoyo19972022-01-061-1/+5
|/ | | | | | | | | | | | Update the support added by commit 4ea3a88625 (MSVC: Add support for targeting ARM64EC, 2020-12-30, v3.20.0-rc1~121^2). Add `softintrin.lib` to `CMAKE_C_STANDARD_LIBRARIES_INIT`. Remove `/D_ARM64EC_WORKAROUND` from the flags as it was only ever needed in preview versions of VS. Issue: #21724
* MSVC: Fix MSVC_TOOLSET_VERSION for VS 2022 v143 toolsetBrad King2021-09-021-1/+4
| | | | | | | | This was forgotten in commit 0c7f918fb1 (VS: Update Visual Studio 17 2022 generator for Preview 2, 2021-07-14, v3.21.1~29^2) when the toolset was first renumbered to `v143`. Fixes: #22585
* Per-language Win32/Console flagsRaul Tambre2021-03-171-4/+8
| | | | | | | | 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.
* MSVC: Add support for targeting ARM64ECMoyo Okeremi 😊2021-01-211-3/+15
|
* Ninja Generators: Homogenize configuration with MakefilesMarc Chevrier2020-12-011-2/+1
| | | | | * Use same configuration variables to configure dependencies * Abstract Ninja deps format from compiler one
* Makefiles Generators: use compiler for dependencies generationMarc Chevrier2020-11-291-0/+7
| | | | | | | | | | | 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
* MSVC: Do not add /GR to CMAKE_CXX_FLAGS by defaultBrad King2020-11-131-1/+7
| | | | | | | | | | | | The `/GR` flag has been on by default since MSVC cl 14.0 from VS 2005. Remove it from the default flags to make it easier for projects to pass `/GR-` themselves to turn it off. Projects may be using string processing to replace `/GR` with another flag, so we cannot simply drop it. Add a policy to drop it in a compatible way. Fixes: #21428
* MSVC: Factor out initialization of /GR flagBrad King2020-11-131-4/+8
|
* Clang: Implement CMAKE_${LANG}_COMPILER_TARGET for all variants on windowsThomas Bernard2020-09-111-5/+0
| | | | Fixes: #21097
* clang-cl: Restore rules to create preprocessed and assembly outputBrad King2020-08-191-2/+2
| | | | | | In commit d993ebd4ca (clang-cl: Add '--' before source file, 2020-07-28) we accidentally replaced these rules with those to compile an object file.
* clang-cl: Add '--' before source fileThomas Bernard2020-08-071-0/+8
| | | | | | | 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.
* Detect the correct target architecture for clang compilers.Thomas Bernard2020-07-281-0/+5
| | | | | | During compiler identification, if CMAKE_{C,CXX}_COMPILER_TARGET is defined, the corresponding clang target flag is used to guaranty proper target architecture detection.
* Merge topic 'pch-msvc-pragma'Brad King2020-05-121-7/+5
|\ | | | | | | | | | | | | 6c2514dabe MSVC: Use 'pragma system_header' in PCH only on cl 19.13 and above Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !4736
| * MSVC: Use 'pragma system_header' in PCH only on cl 19.13 and aboveBrad King2020-05-111-7/+5
| | | | | | | | | | | | | | VS 2017 15.6 introduced support for this pragma. Older MSVC versions warn that it is unknown. Fixes: #20692
* | MSVC: Use 'lib' instead of 'link /lib' to create static librariesFrancisco Facioni2020-03-031-1/+1
| | | | | | | | | | | | `link.exe /lib` is an undocumented flag and it just calls `lib.exe`. Also `link.exe` doesn't parse the `/lib` option correctly when in a response file.
* | MSVC: Fixed missing import library for Windows 10 ARM64 (Desktop)shibayan2019-12-101-1/+1
|/ | | | | | Add the same import library as x86/x64 by default for Windows 10 ARM64 (Desktop, not UWP). Fixes: #20077
* Precompile Headers: Add REUSE_FROM signatureCristian Adam2019-09-171-3/+10
| | | | | | | Add the ability to share precompiled headers artifacts between targets. Fixes: #19659
* Precompile headers: Add methods to generate PCH sourcesCristian Adam2019-08-281-0/+9
| | | | Co-Author: Daniel Pfeifer <daniel@pfeifer-mail.de>
* Windows-MSVC.cmake: fix disabling of CMAKE_NINJA_CMCLDEPS_RCMarc-André Moreau2019-05-301-1/+3
|
* Modules: Consistently use 2 space indentationKitware Robot2019-05-141-1/+1
|
* MSVC: Do not add /W3 to CMAKE_<LANG>_FLAGS by defaultBrad King2019-04-191-2/+15
| | | | | | | | | | | | | | We do not add default warning flags on other compilers, and having a warning flag in the default flags makes it hard for projects to customize the warning level. They need to use string processing to remove `/W3` from `CMAKE_{C,CXX}_FLAGS`. Therefore we should drop it. However, projects may be using string processing to replace `/W3` with another flag, so we cannot simply drop it. Add a policy to drop it in a compatible way. Fixes: #18317
* MSVC: Add abstraction for runtime library selectionBrad King2019-04-171-8/+30
| | | | | | | | | | | | | | | | Replace our hard-coded defaults for `/MD` and `/MDd` with a first-class abstraction to select the runtime library from an enumeration of logical names. We've long hesitated to do this because the idea of "runtime library selection" 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 flags 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 CMP0091 to provide compatibility. Fixes: #19108
* Merge topic 'vs2019-redist'Brad King2019-04-041-1/+4
|\ | | | | | | | | | | | | | | 33ee779330 IRSL: Fix discovery of VS 2019 v142 toolset redistributables d8cf8380fb MSVC: Fix MSVC_TOOLSET_VERSION for VS 2019 v142 toolset Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !3186
| * MSVC: Fix MSVC_TOOLSET_VERSION for VS 2019 v142 toolsetBrad King2019-04-031-1/+4
| | | | | | | | | | | | | | | | This was forgotten in commit 626c51f47b (VS: Update for Visual Studio 2019 Preview 2, 2019-01-24, v3.14.0-rc1~74^2) when the toolset was first renumbered to `v142`. Issue: #19125
* | MSVC: Use -D instead of /D in RC_FLAGSZsolt Parragi2019-03-011-2/+4
|/ | | | llvm-rc can't handle definitions given with /D and without a space.
* MSVC: Respect CMAKE_RC_COMPILER and CMAKE_MT in vs_link_{dll,exe}Mateusz Zych2018-10-291-2/+2
| | | | | | | | | | | | CMake commands vs_link_dll and vs_link_exe, performing linking on MSVC, are responsible for calling resource compiler and manifest tool. Before this commit, both of these tools were called directly, with the expectation that they are available in the `PATH`. This has been fixed by respecting CMake variables `CMAKE_RC_COMPILER` and `CMAKE_MT` defining paths to these tools. Fixes: #17804
* MSVC: Factor out enable_language(RC) call into helper macroBrad King2018-10-291-1/+4
| | | | This will be useful to call from elsewhere later.
* MSVC: Add MSVC_TOOLSET_VERSION variableArkady Shapkin2018-04-041-0/+25
| | | | | | Provide the MSVC toolset version number based on the compiler version. Fixes: #16923
* MSVC,Clang,Flang: Add IPO supportxoviat2018-02-231-0/+28
| | | | Fixes: #17692
* MSVC: Fix MSVC_VERSION when mixing MSVC C/C++ with Intel FortranBrad King2017-11-151-1/+5
| | | | | | | | When using a real MSVC compiler for `C` or `CXX`, use the version of that compiler for `MSVC_VERSION`. This is preferred over the MSVC version that a non-MSVC compiler "simulates". Fixes: #17468
* Merge topic 'MsvcArm64'Brad King2017-09-131-3/+9
|\ | | | | | | | | | | | | bc7c94fe MSVC: Add support for ARM64 architecture Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !1215
| * MSVC: Add support for ARM64 architectureMinmin Gong2017-09-121-3/+9
| | | | | | | | | | | | Visual Studio 15.4 adds support for this architecture. Fixes: #17213
* | VS: Update support for LLVM-vs* toolsets from LLVM 5.0Konstantin Ivlev2017-09-111-2/+2
|/ | | | | | | | | Revert commit v3.7.0-rc1~25^2 (VS: Recognize VS/LLVM toolset names as Clang, 2016-09-28). Since at least LLVM 5.0 the VS integration of the LLVM toolchain now mimics cl and accepts MSVC-style command-line arguments (unlike Microsoft Clang/C2). Fixes: #17193, #17235