diff options
| author | Martin Storsjö <martin@martin.st> | 2023-07-12 12:40:37 +0000 |
|---|---|---|
| committer | Martin Storsjö <martin@martin.st> | 2023-07-17 09:59:05 +0300 |
| commit | c6bd873403a8ac6538a3fe3b3c2fe39c16b146a6 (patch) | |
| tree | d640f6e4cbe17b31642488103969b875e21c8783 /cmake | |
| parent | f69a9f3974ea6d6f556783dfbe202a06d6d3398b (diff) | |
[CMake] Switch the CMP0091 policy (MSVC_RUNTIME_LIBRARY) to the new behaviour
With the new behaviour, the /MD or similar options aren't added to
e.g. CMAKE_CXX_FLAGS_RELEASE, but are added separately by CMake.
They can be changed by the cmake variable
CMAKE_MSVC_RUNTIME_LIBRARY or with the target property
MSVC_RUNTIME_LIBRARY.
LLVM has had its own custom CMake flags, e.g. LLVM_USE_CRT_RELEASE,
which affects which CRT is used for release mode builds. Deprecate
these and direct users to use CMAKE_MSVC_RUNTIME_LIBRARY directly
instead (and do a best effort attempt at setting CMAKE_MSVC_RUNTIME_LIBRARY
based on the existing LLVM_USE_CRT_ flags). This only handles the
simple cases, it doesn't handle multi-config generators with
different LLVM_USE_CRT_* variables for different configs though,
but that's probably fine - we should move over to the new upstream
CMake mechanism anyway, and push users towards that.
Change code in compiler-rt, that previously tried to override the
CRT choice to /MT, to set CMAKE_MSVC_RUNTIME_LIBRARY instead of
meddling in the old variables.
This resolves the policy issue in
https://github.com/llvm/llvm-project/issues/63286, and should
handle the issues that were observed originally when the
minimum CMake version was bumped, in
https://github.com/llvm/llvm-project/issues/62719 and
https://github.com/llvm/llvm-project/issues/62739.
Differential Revision: https://reviews.llvm.org/D155233
Diffstat (limited to 'cmake')
| -rw-r--r-- | cmake/Modules/CMakePolicy.cmake | 5 |
1 files changed, 0 insertions, 5 deletions
diff --git a/cmake/Modules/CMakePolicy.cmake b/cmake/Modules/CMakePolicy.cmake index 8a3445c40cb5..0ec32ad8637f 100644 --- a/cmake/Modules/CMakePolicy.cmake +++ b/cmake/Modules/CMakePolicy.cmake @@ -1,10 +1,5 @@ # CMake policy settings shared between LLVM projects -# CMP0091: MSVC runtime library flags are selected by an abstraction. -# New in CMake 3.15. https://cmake.org/cmake/help/latest/policy/CMP0091.html -if(POLICY CMP0091) - cmake_policy(SET CMP0091 OLD) -endif() # CMP0114: ExternalProject step targets fully adopt their steps. # New in CMake 3.19: https://cmake.org/cmake/help/latest/policy/CMP0114.html if(POLICY CMP0114) |
