[CMAKE:MSVC]
[reactos.git] / reactos / cmake / msvc.cmake
index b92107b..53fe600 100644 (file)
@@ -23,13 +23,21 @@ add_definitions(/Dinline=__inline /D__STDC__=1)
 add_compile_flags("/X /GR- /EHs-c- /GS- /Zl /W3")
 
 # HACK: for VS 11+ we need to explicitly disable SSE, which is off by
-# default for older compilers. See bug #7174
+# default for older compilers. See CORE-6507
 if (MSVC_VERSION GREATER 1699 AND ARCH STREQUAL "i386")
     add_compile_flags("/arch:IA32")
 endif ()
 
-# C4700 is almost always likely to result in broken code, so mark it as an error
-add_compile_flags("/we4700")
+# C++ exception specification ignored... yeah we don't care
+add_compile_flags("/wd4290")
+
+# The following warnings are treated as errors:
+# - C4047: different level of indirection
+# - C4090: different 'modifier' qualifiers (for C programs only;
+#          for C++ programs, the compiler error C2440 is issued)
+# - C4098: void function returning a value
+# - C4700: uninitialized variable usage
+add_compile_flags("/we4047 /we4090 /we4098 /we4700")
 
 # Debugging
 #if(${CMAKE_BUILD_TYPE} STREQUAL "Debug")
@@ -45,6 +53,9 @@ endif()
 
 if(MSVC_IDE)
     add_compile_flags("/MP")
+    if(NOT DEFINED USE_FOLDER_STRUCTURE)
+        set(USE_FOLDER_STRUCTURE FALSE)
+    endif()
 endif()
 
 if(${_MACHINE_ARCH_FLAG} MATCHES X86)
@@ -100,7 +111,11 @@ function(set_entrypoint _module _entrypoint)
 endfunction()
 
 function(set_subsystem MODULE SUBSYSTEM)
-    add_target_link_flags(${MODULE} "/SUBSYSTEM:${SUBSYSTEM}")
+    if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 17)
+        add_target_link_flags(${MODULE} "/SUBSYSTEM:${SUBSYSTEM},5.01")
+    else()
+        add_target_link_flags(${MODULE} "/SUBSYSTEM:${SUBSYSTEM}")
+    endif()
 endfunction()
 
 function(set_image_base MODULE IMAGE_BASE)
@@ -185,7 +200,7 @@ else()
     set(SPEC2DEF_ARCH i386)
 endif()
 function(spec2def _dllname _spec_file)
-    # do we also want to add impotlib targets?
+    # do we also want to add importlib targets?
     if(${ARGC} GREATER 2)
         if(${ARGN} STREQUAL "ADD_IMPORTLIB")
             set(__add_importlib TRUE)