[CMAKE] The /SUBSYSTEM flag takes uppercase parameters.
[reactos.git] / reactos / cmake / msvc.cmake
index 53e4f07..520b55b 100644 (file)
@@ -33,6 +33,11 @@ if(MSVC_VERSION GREATER 1799 AND NOT MSVC_IDE)
     add_compile_flags("/FS")
 endif ()
 
+# VS14+ tries to use thread-safe initialization
+if(MSVC_VERSION GREATER 1899)
+    add_compile_flags("/Zc:threadSafeInit-")
+endif ()
+
 # Disable overly sensitive warnings as well as those that generally aren't
 # useful to us.
 # - C4244: implicit integer truncation
@@ -54,11 +59,12 @@ add_compile_flags("/wd4244 /wd4290 /wd4800")
 # - C4129: unrecognized escape sequence
 # - TODO: C4133: incompatible types
 # - C4163: 'identifier': not available as an intrinsic function
+# - C4189: local variable initialized but not referenced
 # - C4229: modifiers on data are ignored
 # - C4700: uninitialized variable usage
 # - C4603: macro is not defined or definition is different after precompiled header use
 # - C4716: function must return a value
-add_compile_flags("/we4013 /we4020 /we4022 /we4047 /we4098 /we4113 /we4129 /we4163 /we4229 /we4700 /we4603 /we4716")
+add_compile_flags("/we4013 /we4020 /we4022 /we4047 /we4098 /we4113 /we4129 /we4163 /we4189 /we4229 /we4700 /we4603 /we4716")
 
 # Enable warnings above the default level, but don't treat them as errors:
 # - C4115: named type definition in parentheses
@@ -76,11 +82,8 @@ elseif(CMAKE_BUILD_TYPE STREQUAL "Release")
     add_compile_flags("/Ob2 /D NDEBUG")
 endif()
 
-if(MSVC_IDE)
-    add_compile_flags("/MP")
-    if(NOT DEFINED USE_FOLDER_STRUCTURE)
-        set(USE_FOLDER_STRUCTURE FALSE)
-    endif()
+if(MSVC_IDE AND (NOT DEFINED USE_FOLDER_STRUCTURE))
+    set(USE_FOLDER_STRUCTURE FALSE)
 endif()
 
 if(NOT DEFINED RUNTIME_CHECKS)
@@ -207,10 +210,11 @@ function(set_entrypoint _module _entrypoint)
 endfunction()
 
 function(set_subsystem MODULE SUBSYSTEM)
+    string(TOUPPER ${SUBSYSTEM} _subsystem)
     if(ARCH STREQUAL "amd64")
-        add_target_link_flags(${MODULE} "/SUBSYSTEM:${SUBSYSTEM},5.02")
+        add_target_link_flags(${MODULE} "/SUBSYSTEM:${_subsystem},5.02")
     else()
-        add_target_link_flags(${MODULE} "/SUBSYSTEM:${SUBSYSTEM},5.01")
+        add_target_link_flags(${MODULE} "/SUBSYSTEM:${_subsystem},5.01")
     endif()
 endfunction()