1 2PROJECT(NTOS) 3 4if (CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "Clang") 5 # Enable this again. CORE-17637 6 add_compile_options(-Wunused-result) 7endif() 8 9include(ntos.cmake) 10 11set(NTOSKRNL_SOURCE ${SOURCE}) 12set(NTOSKRNL_ASM_SOURCE ${ASM_SOURCE}) 13 14set(NTKRNLMP_SOURCE ${SOURCE}) 15set(NTKRNLMP_ASM_SOURCE ${ASM_SOURCE}) 16 17spec2def(ntoskrnl.exe ntoskrnl.spec ADD_IMPORTLIB) 18 19# Embed RTC libs 20if (STACK_PROTECTOR) 21 target_sources(libntoskrnl PRIVATE $<TARGET_OBJECTS:gcc_ssp_nt>) 22endif() 23 24add_asm_files(ntoskrnl_asm ${NTOSKRNL_ASM_SOURCE}) 25 26if(CMAKE_C_COMPILER_ID STREQUAL "Clang") 27 # Clang optimises strcmp calls to memcmp. 28 target_sources(libntoskrnl PRIVATE $<TARGET_OBJECTS:memcmp>) 29endif() 30 31list(APPEND PCH_SKIP_SOURCE 32 guid.c) 33 34add_executable(ntoskrnl 35 ${ntoskrnl_asm} 36 ${NTOSKRNL_SOURCE} 37 ${PCH_SKIP_SOURCE} 38 ntoskrnl.rc 39 ${CMAKE_CURRENT_BINARY_DIR}/ntoskrnl.def) 40set_module_type(ntoskrnl kernel) 41 42source_group(TREE ${REACTOS_SOURCE_DIR}/ntoskrnl PREFIX "Source Files" FILES ${NTOSKRNL_SOURCE}) 43 44target_link_libraries(ntoskrnl cportlib csq ${PSEH_LIB} arbiter cmlib ntlsalib rtl ${ROSSYM_LIB} libcntpr wdmguid ioevent) 45 46if(STACK_PROTECTOR) 47 target_sources(ntoskrnl PRIVATE $<TARGET_OBJECTS:gcc_ssp_nt>) 48endif() 49 50add_importlibs(ntoskrnl hal kdcom bootvid) 51add_pch(ntoskrnl ${REACTOS_SOURCE_DIR}/ntoskrnl/include/ntoskrnl.h "${PCH_SKIP_SOURCE}") 52add_dependencies(ntoskrnl psdk asm) 53add_cd_file(TARGET ntoskrnl DESTINATION reactos/system32 NO_CAB FOR all) 54 55if(BUILD_MP) 56 add_subdirectory(ntkrnlmp) 57endif() 58 59add_asm_files(ntdllsys_asm ntdll.S) 60add_library(ntdllsys ${ntdllsys_asm}) 61set_target_properties(ntdllsys PROPERTIES LINKER_LANGUAGE "C") 62add_dependencies(ntdllsys asm) 63