[CMAKE]
[reactos.git] / msc.cmake
index eb0fdc7..6669204 100644 (file)
--- a/msc.cmake
+++ b/msc.cmake
@@ -14,6 +14,8 @@ else()
 add_definitions(/GS- /Zl /Zi)\r
 add_definitions(-Dinline=__inline -D__STDC__=1)\r
 \r
+link_directories("${REACTOS_BINARY_DIR}/importlibs" ${REACTOS_BINARY_DIR}/lib/3rdparty/mingw)\r
+\r
 set(CMAKE_RC_CREATE_SHARED_LIBRARY "<CMAKE_C_COMPILER> <CMAKE_SHARED_LIBRARY_C_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>")\r
 \r
 \r
@@ -59,7 +61,18 @@ macro(set_module_type MODULE TYPE)
     endif ()\r
     if (${TYPE} MATCHES win32cui)\r
         set_subsystem(${MODULE} console)\r
+        set_entrypoint(${MODULE} mainCRTStartup)\r
     endif ()\r
+    if(${TYPE} MATCHES win32dll)\r
+        set_entrypoint(${MODULE} __DllMainCRTStartup)\r
+               if(DEFINED baseaddress_${MODULE})\r
+                       set_image_base(${MODULE} ${baseaddress_${MODULE}})\r
+               else()\r
+                       message(STATUS "${MODULE} has no base address")\r
+               endif()\r
+               target_link_libraries(${MODULE} mingw_common mingw_dllmain)\r
+    endif()\r
+\r
 endmacro()\r
 \r
 macro(set_unicode)\r
@@ -82,7 +95,7 @@ set(IDL_SERVER_ARG /sstub) #.c for stub server library
 set(IDL_CLIENT_ARG /cstub) #.c for stub client library\r
 \r
 \r
-macro(add_importlib_def _def_file)\r
+macro(add_importlib_target _def_file)\r
     get_filename_component(_name ${_def_file} NAME_WE)\r
     add_custom_target(\r
         lib${_name}\r