You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[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
#63286, and should
handle the issues that were observed originally when the
minimum CMake version was bumped, in
#62719 and
#62739.
Differential Revision: https://reviews.llvm.org/D155233
Copy file name to clipboardExpand all lines: llvm/CMakeLists.txt
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -684,7 +684,7 @@ if( WIN32 AND NOT CYGWIN )
684
684
endif()
685
685
set(LLVM_NATIVE_TOOL_DIR ""CACHEPATH"Path to a directory containing prebuilt matching native tools (such as llvm-tblgen)")
686
686
687
-
set(LLVM_INTEGRATED_CRT_ALLOC ""CACHEPATH"Replace the Windows CRT allocator with any of {rpmalloc|mimalloc|snmalloc}. Only works with /MT enabled.")
687
+
set(LLVM_INTEGRATED_CRT_ALLOC ""CACHEPATH"Replace the Windows CRT allocator with any of {rpmalloc|mimalloc|snmalloc}. Only works with CMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded.")
688
688
if(LLVM_INTEGRATED_CRT_ALLOC)
689
689
if(NOTWIN32)
690
690
message(FATAL_ERROR "LLVM_INTEGRATED_CRT_ALLOC is only supported on Windows.")
Copy file name to clipboardExpand all lines: llvm/lib/Support/CMakeLists.txt
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -89,8 +89,8 @@ endif()
89
89
90
90
# Override the C runtime allocator on Windows and embed it into LLVM tools & libraries
91
91
if(LLVM_INTEGRATED_CRT_ALLOC)
92
-
if (CMAKE_BUILD_TYPEANDNOT ${LLVM_USE_CRT_${uppercase_CMAKE_BUILD_TYPE}}MATCHES"^(MT|MTd)$")
93
-
message(FATAL_ERROR "LLVM_INTEGRATED_CRT_ALLOC only works with /MT or /MTd. Use LLVM_USE_CRT_${uppercase_CMAKE_BUILD_TYPE}to set the appropriate option.")
92
+
if (NOT CMAKE_MSVC_RUNTIME_LIBRARY OR CMAKE_MSVC_RUNTIME_LIBRARYMATCHES"DLL$")
93
+
message(FATAL_ERROR "LLVM_INTEGRATED_CRT_ALLOC only works with CMAKE_MSVC_RUNTIME_LIBRARY set to MultiThreaded or MultiThreadedDebug.")
0 commit comments