Sync with trunk.
[reactos.git] / ntoskrnl / CMakeLists.txt
1
2 PROJECT(NTOS)
3
4 include(ntos.cmake)
5
6 set(NTOSKRNL_SOURCE ${SOURCE})
7 set(NTOSKRNL_ASM_SOURCE ${ASM_SOURCE})
8
9 set(NTKRNLMP_SOURCE ${SOURCE})
10 set(NTKRNLMP_ASM_SOURCE ${ASM_SOURCE})
11
12 spec2def(ntoskrnl.exe ntoskrnl.spec ADD_IMPORTLIB)
13
14 add_asm_files(ntoskrnl_asm ${NTOSKRNL_ASM_SOURCE})
15
16 add_executable(ntoskrnl
17 ${ntoskrnl_asm}
18 ${NTOSKRNL_SOURCE}
19 guid.c
20 ntoskrnl.rc
21 ${CMAKE_CURRENT_BINARY_DIR}/ntoskrnl.def)
22
23 if(ARCH STREQUAL "i386")
24 set_entrypoint(ntoskrnl KiSystemStartup 4)
25 else()
26 set_entrypoint(ntoskrnl KiSystemStartup)
27 endif()
28 set_subsystem(ntoskrnl native)
29
30 if(MSVC)
31 set_image_base(ntoskrnl 0x00400000)
32 else()
33 set_image_base(ntoskrnl 0x80800000)
34 endif()
35
36 # Linker bug
37 if(NOT MSVC AND LTCG)
38 add_target_link_flags(ntoskrnl "-shared")
39 endif()
40
41 target_link_libraries(ntoskrnl
42 cportlib
43 csq
44 ${PSEH_LIB}
45 cmlib
46 rtl
47 ${ROSSYM_LIB}
48 libcntpr
49 wdmguid
50 ioevent)
51
52 add_importlibs(ntoskrnl hal kdcom bootvid)
53 add_pch(ntoskrnl ${REACTOS_SOURCE_DIR}/ntoskrnl/include/ntoskrnl.h NTOSKRNL_SOURCE)
54 add_dependencies(ntoskrnl psdk bugcodes asm)
55 add_cd_file(TARGET ntoskrnl DESTINATION reactos/system32 NO_CAB FOR all)
56
57 if(BUILD_MP)
58 add_subdirectory(ntkrnlmp)
59 endif()
60
61 add_asm_files(ntdllsys_asm ntdll.S)
62 add_library(ntdllsys ${ntdllsys_asm})
63 set_target_properties(ntdllsys PROPERTIES LINKER_LANGUAGE "C")