File: options_win.cmake

package info (click to toggle)
telegram-desktop 2.6.1%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 40,024 kB
  • sloc: cpp: 411,999; xml: 34,087; python: 2,199; sh: 1,103; ansic: 861; objc: 258; javascript: 174; makefile: 46
file content (103 lines) | stat: -rw-r--r-- 2,458 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# This file is part of Desktop App Toolkit,
# a set of libraries for developing nice desktop applications.
#
# For license and copyright information please follow this link:
# https://github.com/desktop-app/legal/blob/master/LEGAL

target_compile_definitions(common_options
INTERFACE
    WIN32
    _WINDOWS
    _SCL_SECURE_NO_WARNINGS
    NOMINMAX
    UNICODE
    _UNICODE
)
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
    target_compile_options(common_options
    INTERFACE
        /permissive-
        # /Qspectre
        /W1
        /WX
        /MP     # Enable multi process build.
        /EHsc   # Catch C++ exceptions only, extern C functions never throw a C++ exception.
        /w14834 # [[nodiscard]]
        /w15038 # wrong initialization order
        /w14265 # class has virtual functions, but destructor is not virtual
        /wd4068 # Disable "warning C4068: unknown pragma"
        /wd4267 # 'initializing': conversion from 'size_t' to 'int', possible loss of data.
        /wd4244 # '=': conversion from 'size_t' to 'int', possible loss of data.
        /Zc:wchar_t- # don't tread wchar_t as builtin type
        /Zi
    )

    target_link_options(common_options
    INTERFACE
        $<IF:$<CONFIG:Debug>,/NODEFAULTLIB:LIBCMT,/DEBUG;/OPT:REF>
    )

    if (build_win64)
        target_compile_options(common_options
        INTERFACE
            /bigobj # scheme.cpp has too many sections.
        )
    endif()
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
    target_compile_definitions(common_options
    INTERFACE
        WINVER=0x0601
        _WIN32_WINNT=0x0601
    )

    target_compile_options(common_options
    INTERFACE
        -fpermissive
    )

    if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
        target_compile_options(common_options
        INTERFACE
            -fms-extensions
            -femulated-tls
        )

        target_link_options(common_options
        INTERFACE
            -fuse-ld=lld
        )
    endif()
endif()

target_link_libraries(common_options
INTERFACE
    winmm
    imm32
    ws2_32
    kernel32
    user32
    gdi32
    winspool
    comdlg32
    advapi32
    shell32
    ole32
    oleaut32
    uuid
    odbc32
    odbccp32
    Shlwapi
    Iphlpapi
    Gdiplus
    Strmiids
    Netapi32
    Userenv
    Version
    Dwmapi
    Wtsapi32
    Crypt32
)

if (build_winstore)
    target_compile_definitions(common_options INTERFACE OS_WIN_STORE)
endif()