https://git.reactos.org/?p=reactos.git;a=commitdiff;h=49000c6471cd79745a36a…
commit 49000c6471cd79745a36a8cadf33eeebc50ed9a4
Author: Jérôme Gardou <jerome.gardou(a)reactos.org>
AuthorDate: Fri Jan 22 12:11:34 2021 +0100
Commit: Jérôme Gardou <zefklop(a)users.noreply.github.com>
CommitDate: Wed Mar 3 08:34:32 2021 +0100
[CMAKE] Disable policy CMP0091 and set /MT flag explicitly for Visual Studio
generator
---
CMakeLists.txt | 13 +++++++++++++
toolchain-msvc.cmake | 1 -
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d090b2f79c0..fcd92b5512a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -7,6 +7,13 @@ endif()
include(CMakeDependentOption)
+# CMAKE_CROSSCOMPILING and MSVC_IDE are not set until project() is called, so let's
test this instead
+if ((DEFINED CMAKE_TOOLCHAIN_FILE) AND (CMAKE_GENERATOR MATCHES "Visual
Studio.*"))
+# Do not use MSVC_RUNTIME_LIBRARY target property. We use our own flags instead
+message(WARNING "Setting policy CMP0091 to OLD behaviour")
+cmake_policy(SET CMP0091 OLD)
+endif()
+
project(REACTOS)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
@@ -120,6 +127,12 @@ else()
# Print build type
message("-- Build Type: ${CMAKE_BUILD_TYPE}")
+ # Always add /MT in VS CMAKE_GENERATOR
+ if (MSVC_IDE)
+ add_compile_options("/MT")
+ endif()
+
+
# adjust the default behaviour of the FIND_XXX() commands:
# search headers and libraries in the target environment, search
# programs in the host environment
diff --git a/toolchain-msvc.cmake b/toolchain-msvc.cmake
index dbb901ae874..2aae2edbdd4 100644
--- a/toolchain-msvc.cmake
+++ b/toolchain-msvc.cmake
@@ -64,7 +64,6 @@ else()
set(CMAKE_ASM_MASM_FLAGS_INIT "/Cp")
endif()
-
set(CMAKE_C_STANDARD_LIBRARIES "" CACHE INTERNAL "")
set(CMAKE_USER_MAKE_RULES_OVERRIDE
"${CMAKE_CURRENT_LIST_DIR}/overrides-msvc.cmake")