llvm-capstone/cmake/Modules
Martin Storsjö c6bd873403 [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
2023-07-17 09:59:05 +03:00
..
CMakePolicy.cmake [CMake] Switch the CMP0091 policy (MSVC_RUNTIME_LIBRARY) to the new behaviour 2023-07-17 09:59:05 +03:00
EnableLanguageNolink.cmake [libunwind] Try to add --unwindlib=none while configuring and building libunwind 2021-11-05 10:10:19 +02:00
ExtendPath.cmake [cmake] Tweak warning in extend_path helper function 2021-12-30 07:00:50 +00:00
FindGRPC.cmake Revert "build: with -DCLANGD_ENABLE_REMOTE=ON, search for grpc++ dependencies too" 2023-01-12 18:14:41 +01:00
FindPrefixFromConfig.cmake [cmake] Fix missing paren in FindPrefixFromConfig 2022-07-26 07:35:12 +00:00
GetClangResourceDir.cmake GetClangResourceDir: Fix downstream projects that bundle llvm source 2023-07-05 20:10:28 -07:00
GNUInstallPackageDir.cmake Revert "[cmake] Use CMAKE_INSTALL_LIBDIR too" 2022-08-18 22:46:32 -04:00
HandleCompilerRT.cmake [cmake] Demote fatal error to a warning when we don't know the Apple SDK in use 2022-03-22 15:36:47 -04:00
HandleOutOfTreeLLVM.cmake [cmake] Move HandleOutOfTreeLLVM to common cmake utils 2022-01-19 22:05:23 +00:00
LLVMCheckCompilerLinkerFlag.cmake Revert "[CMake] Unify llvm_check_linker_flag and llvm_check_compiler_linker_flag" 2023-03-28 08:28:17 +00:00
SetPlatformToolchainTools.cmake [CMake] Move the AIX archiver settings to a module 2022-01-05 11:46:30 -08:00
SortSubset.cmake [runtimes] Generalize how we reorder projects 2022-05-16 08:55:32 -04:00