xref: /reactos/sdk/tools/wpp/CMakeLists.txt (revision 84344399)
1
2add_definitions(
3    -D_CRT_DECLARE_NONSTDC_NAMES=1
4    -D_CRT_NONSTDC_NO_DEPRECATE
5)
6
7if(MSVC)
8    if(MSVC_VERSION LESS 1900)
9        add_definitions(
10            -Dsnprintf=_snprintf
11            -Dstrtoull=_strtoui64
12            -Dstrtoll=_strtoi64)
13
14        # Add this definition for WDK only, VS 9 doesn't like that
15        if(DEFINED ENV{DDKBUILDENV})
16            add_definitions(-Dvsnprintf=_vsnprintf)
17        endif()
18    endif()
19
20    # Disable warnings
21    add_compile_options(
22        /wd4146  # "unary minus operator applied to unsigned type, result still unsigned"
23        /wd4244) # "'=': conversion from 'a' to 'b', possible loss of data"
24
25endif()
26
27if(CMAKE_CROSSCOMPILING)
28    add_definitions(
29        -D_DLL -D__USE_CRTIMP
30        -D__NO_ISOCEXT
31        -Dstrtoull=_strtoui64
32        -Dstrtoll=_strtoi64
33        -Dopen=_open
34        -Dclose=_close)
35    include_directories(${REACTOS_SOURCE_DIR}/sdk/include/reactos/wine)
36endif()
37
38FLEX_TARGET(pp_scanner ppl.l ${CMAKE_CURRENT_BINARY_DIR}/ppl.yy.c)
39BISON_TARGET(pp_parser ppy.y ${CMAKE_CURRENT_BINARY_DIR}/ppy.tab.c COMPILE_FLAGS "-p ppy_")
40ADD_FLEX_BISON_DEPENDENCY(pp_scanner pp_parser)
41
42list(APPEND SOURCE
43    preproc.c
44    wpp.c)
45
46if(CMAKE_CROSSCOMPILING)
47    add_library(wpp ${SOURCE} ${FLEX_pp_scanner_OUTPUT_SOURCE} ${BISON_pp_parser_OUTPUT_SOURCE})
48else()
49    add_library(wpphost ${SOURCE} ${FLEX_pp_scanner_OUTPUTS} ${BISON_pp_parser_OUTPUTS})
50    target_link_libraries(wpphost PRIVATE host_includes)
51endif()
52