deb1622d39111a1bf9730b617d125daf33b303d4
[reactos.git] / msc.cmake
1
2 if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86")
3 add_definitions(-D__i386__)
4 endif()
5
6 add_definitions(-Dinline=__inline)
7
8 if(NOT CMAKE_CROSSCOMPILING)
9
10
11
12 else()
13
14 add_definitions(/GS- /Zl /Zi)
15 add_definitions(-Dinline=__inline -D__STDC__=1)
16
17 macro(set_entrypoint MODULE ENTRYPOINT)
18 set(NEW_LINKER_FLAGS "/ENTRY:${ENTRYPOINT}")
19 get_target_property(LINKER_FLAGS ${MODULE} LINK_FLAGS)
20 if(LINKER_FLAGS)
21 set(NEW_LINKER_FLAGS "${LINKER_FLAGS} ${NEW_LINKER_FLAGS}")
22 endif()
23 set_target_properties(${MODULE} PROPERTIES LINK_FLAGS ${NEW_LINKER_FLAGS})
24 endmacro()
25
26 macro(set_subsystem MODULE SUBSYSTEM)
27 set(NEW_LINKER_FLAGS "/subsystem:${SUBSYSTEM}")
28 get_target_property(LINKER_FLAGS ${MODULE} LINK_FLAGS)
29 if(LINKER_FLAGS)
30 set(NEW_LINKER_FLAGS "${LINKER_FLAGS} ${NEW_LINKER_FLAGS}")
31 endif()
32 set_target_properties(${MODULE} PROPERTIES LINK_FLAGS ${NEW_LINKER_FLAGS})
33 endmacro()
34
35 macro(add_importlibs MODULE)
36 FOREACH(LIB ${ARGN})
37 target_link_libraries(${MODULE} ${LIB}.LIB)
38 ENDFOREACH()
39 endmacro()
40
41 macro(set_module_type MODULE TYPE)
42 if(${TYPE} MATCHES nativecui)
43 set_subsystem(${MODULE} native)
44 add_importlibs(${MODULE} ntdll)
45 endif()
46 if (${TYPE} MATCHES win32gui)
47 set_subsystem(${MODULE} windows)
48 endif ()
49 if (${TYPE} MATCHES win32cui)
50 set_subsystem(${MODULE} windows)
51 set_entrypoint(${MODULE} mainCRTStartup)
52 endif ()
53 endmacro()
54
55 endif()
56
57 set(CMAKE_C_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od")
58 SET(CMAKE_CXX_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od")
59