[CMAKE]
[reactos.git] / msc.cmake
index a6abdf6..864eea0 100644 (file)
--- a/msc.cmake
+++ b/msc.cmake
@@ -13,7 +13,7 @@ elseif(OPTIMIZE STREQUAL "5")
 endif()\r
 endif()\r
 \r
-add_definitions(/GS- /Zl /Zi)\r
+add_definitions(/X /GS- /Zl /Zi)\r
 add_definitions(-Dinline=__inline -D__STDC__=1)\r
 \r
 if(${_MACHINE_ARCH_FLAG} MATCHES X86)\r
@@ -120,6 +120,7 @@ macro(set_module_type MODULE TYPE)
         set_image_base(${MODULE} 0x00010000)\r
         add_linkerflag(${MODULE} "/DRIVER")\r
         add_dependencies(${MODULE} bugcodes)\r
+        target_link_libraries(${MODULE} msvcsup)\r
     endif()\r
 endmacro()\r
 \r
@@ -138,17 +139,26 @@ endmacro()
 # Thanks MS for creating a stupid linker\r
 macro(add_importlib_target _exports_file)\r
     get_filename_component(_name ${_exports_file} NAME_WE)\r
+    get_target_property(_suffix ${_name} SUFFIX)\r
+    if(${_suffix} STREQUAL "_suffix-NOTFOUND")\r
+        get_target_property(_type ${_name} TYPE)\r
+        if(${_type} MATCHES EXECUTABLE)\r
+            set(_suffix ".exe")\r
+        else()\r
+            set(_suffix ".dll")\r
+        endif()\r
+    endif()\r
 \r
     # Generate the asm stub file and the export def file\r
     add_custom_command(\r
         OUTPUT ${CMAKE_BINARY_DIR}/importlibs/lib${_name}_stubs.asm ${CMAKE_BINARY_DIR}/importlibs/lib${_name}_exp.def\r
-        COMMAND native-spec2def --ms --kill-at -r -d=${CMAKE_BINARY_DIR}/importlibs/lib${_name}_exp.def -l=${CMAKE_BINARY_DIR}/importlibs/lib${_name}_stubs.asm ${CMAKE_CURRENT_SOURCE_DIR}/${_exports_file}\r
+        COMMAND native-spec2def --ms --kill-at -r -n=${_name}${_suffix} -d=${CMAKE_BINARY_DIR}/importlibs/lib${_name}_exp.def -l=${CMAKE_BINARY_DIR}/importlibs/lib${_name}_stubs.asm ${CMAKE_CURRENT_SOURCE_DIR}/${_exports_file}\r
         DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_exports_file})\r
 \r
     # Assemble the stub file\r
     add_custom_command(\r
         OUTPUT ${CMAKE_BINARY_DIR}/importlibs/lib${_name}_stubs.obj\r
-        COMMAND ${CMAKE_ASM_COMPILER} /nologo /Fo${CMAKE_BINARY_DIR}/importlibs/lib${_name}_stubs.obj /c /Ta ${CMAKE_BINARY_DIR}/importlibs/lib${_name}_stubs.asm\r
+        COMMAND ${CMAKE_ASM_COMPILER} /nologo /Cp /Fo${CMAKE_BINARY_DIR}/importlibs/lib${_name}_stubs.obj /c /Ta ${CMAKE_BINARY_DIR}/importlibs/lib${_name}_stubs.asm\r
         DEPENDS "${CMAKE_BINARY_DIR}/importlibs/lib${_name}_stubs.asm")\r
 \r
     # Add neccessary importlibs for redirections\r
@@ -187,7 +197,6 @@ macro(spec2def _dllname _spec_file)
         DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file})\r
     set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${_file}.def ${CMAKE_CURRENT_BINARY_DIR}/${_file}_stubs.c\r
         PROPERTIES GENERATED TRUE)\r
-    list(APPEND SOURCE ${CMAKE_CURRENT_BINARY_DIR}/${_file}_stubs.c)\r
 endmacro()\r
 \r
 macro(macro_mc FILE)\r