xref: /reactos/dll/win32/msvcrt/CMakeLists.txt (revision 8a978a17)
1
2include_directories(${REACTOS_SOURCE_DIR}/sdk/lib/crt/include)
3spec2def(msvcrt.dll msvcrt.spec)
4
5# The msvcrt <-> msvcrtex trick
6generate_import_lib(libmsvcrt_real msvcrt.dll msvcrt.spec)
7add_library(libmsvcrt INTERFACE)
8target_compile_definitions(libmsvcrt INTERFACE _DLL __USE_CRTIMP)
9# if the linked module is one of win32gui;win32cui;win32dll;win32ocx;cpl link it with msvcrtex, which itself is linked to libmsvcrt_real
10# Otherwise, just link to libmsvcrt_real
11target_link_libraries(libmsvcrt INTERFACE "$<IF:$<IN_LIST:$<TARGET_PROPERTY:REACTOS_MODULE_TYPE>,win32gui;win32cui;win32dll;win32ocx;cpl>,msvcrtex,libmsvcrt_real>")
12
13add_definitions(
14    -DUSE_MSVCRT_PREFIX
15    -D_MSVCRT_
16    -D_MSVCRT_LIB_
17    -D_MT
18    -D_CTYPE_DISABLE_MACROS
19    -D_NO_INLINING
20    -DCRTDLL
21    -D__MINGW_IMPORT="")
22
23list(APPEND SOURCE
24    dllmain.c
25    stubs.c
26    msvcrt.rc
27    ${CMAKE_CURRENT_BINARY_DIR}/msvcrt_stubs.c
28    ${CMAKE_CURRENT_BINARY_DIR}/msvcrt.def)
29
30add_library(msvcrt MODULE ${SOURCE})
31set_module_type(msvcrt win32dll ENTRYPOINT DllMain 12)
32add_dependencies(msvcrt psdk)
33target_link_libraries(msvcrt crt wine ${PSEH_LIB})
34
35if(MSVC)
36    # export of deleting destructor "name"
37    target_link_options(msvcrt PRIVATE "/ignore:4102")
38    set_property(TARGET libmsvcrt_real APPEND PROPERTY STATIC_LIBRARY_OPTIONS "/ignore:4102")
39endif()
40
41add_importlibs(msvcrt kernel32 ntdll)
42add_cd_file(TARGET msvcrt DESTINATION reactos/system32 FOR all)
43