cc7565cbf7f0bd8525d0af75ddbec0d9f8d65563
[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} console)
51 endif ()
52 endmacro()
53
54 macro(set_unicode MODULE STATE)
55 if(${STATE} MATCHES yes)
56 add_definitions(-DUNICODE -D_UNICODE)
57 endif()
58 endmacro()
59
60 endif()
61
62 set(CMAKE_C_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od")
63 SET(CMAKE_CXX_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od")
64