1
- cmake_minimum_required (VERSION 3.0 )
1
+ cmake_minimum_required (VERSION 3.13 )
2
2
project (crashpad LANGUAGES C CXX)
3
3
4
+ set (CRASHPAD_MAIN_PROJECT OFF )
5
+ if (CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR )
6
+ set (CRASHPAD_MAIN_PROJECT ON )
7
+ endif ()
8
+
9
+ option (CRASHPAD_ENABLE_INSTALL "Enable crashpad installation" "${CRASHPAD_MAIN_PROJECT} " )
10
+ option (CRASHPAD_ENABLE_INSTALL_DEV "Enable crashpad development installation" "${CRASHPAD_MAIN_PROJECT} " )
11
+
12
+ if (MSVC )
13
+ set (CRASHPAD_ZLIB_SYSTEM_DEFAULT OFF )
14
+ else ()
15
+ set (CRASHPAD_ZLIB_SYSTEM_DEFAULT ON )
16
+ endif ()
17
+ option (CRASHPAD_ZLIB_SYSTEM "Use system zlib library" "${CRASHPAD_ZLIB_SYSTEM_DEFAULT} " )
18
+
19
+ if (CRASHPAD_ZLIB_SYSTEM)
20
+ find_package (ZLIB REQUIRED)
21
+ endif ()
22
+
23
+ include (GNUInstallDirs)
24
+ set (CMAKE_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR} /cmake/crashpad" )
25
+
26
+ function (crashpad_install_target)
27
+ if (CRASHPAD_ENABLE_INSTALL)
28
+ install (TARGETS ${ARGN} EXPORT crashpad_export
29
+ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR} "
30
+ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR} "
31
+ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR} "
32
+ )
33
+ endif ()
34
+ endfunction ()
35
+ function (crashpad_install_includes)
36
+ cmake_parse_arguments (CII "" "SUBDIR" "" ${ARGN} )
37
+ if (CRASHPAD_ENABLE_INSTALL_DEV)
38
+ install (FILES ${CII_UNPARSED_ARGUMENTS}
39
+ DESTINATION "${CMAKE_INSTALL_INCLUDEDIR} /${CII_SUBDIR} "
40
+ )
41
+ endif ()
42
+ endfunction ()
43
+
44
+ if (CMAKE_SYSTEM_NAME STREQUAL "Linux" )
45
+ set (LINUX TRUE )
46
+ endif ()
47
+
4
48
if (WIN32 )
5
49
enable_language (ASM_MASM)
6
50
IF (MINGW)
@@ -9,86 +53,74 @@ if(WIN32)
9
53
SET (CMAKE_ASM_MASM_COMPILER "uasm" )
10
54
SET (CMAKE_ASM_MASM_FLAGS "-win64 -10" )
11
55
else ()
12
- message (FATAL_ERROR "UASM is required for MinGW builds ! Make sure you have it installed" )
56
+ message (FATAL_ERROR "UASM is required for MinGW builds! Make sure you have it installed" )
13
57
endif ()
14
58
endif ()
15
59
else ()
16
60
enable_language (ASM)
17
61
endif ()
18
62
19
63
set (CMAKE_CXX_STANDARD 14)
20
- set (CMAKE_CXX_STANDARD_REQUIRED True )
21
-
22
- if (CMAKE_SYSTEM_NAME STREQUAL "Linux" )
23
- set (LINUX TRUE )
24
- endif ()
25
-
26
- include_directories ("${CMAKE_CURRENT_SOURCE_DIR} " )
27
- include_directories ("${CMAKE_CURRENT_SOURCE_DIR} /third_party/mini_chromium/mini_chromium" )
28
-
29
- # These should really be in `compat`, but we want them for the whole project
30
- if (APPLE )
31
- include_directories (SYSTEM "compat/mac" )
32
- else ()
33
- include_directories (PUBLIC "compat/non_mac" )
34
- endif ()
35
-
36
- if (LINUX OR ANDROID)
37
- include_directories (SYSTEM "compat/linux" )
38
- endif ()
39
- if (ANDROID)
40
- include_directories (SYSTEM "compat/android" )
41
- endif ()
42
-
43
- if (MSVC )
44
- include_directories (SYSTEM "compat/win" )
45
- elseif (MINGW)
46
- include_directories (PUBLIC "compat/mingw" )
47
- else ()
48
- include_directories (PUBLIC "compat/non_win" )
49
- endif ()
64
+ set (CMAKE_CXX_STANDARD_REQUIRED ON )
50
65
51
- if (NOT LINUX AND NOT ANDROID)
52
- include_directories (SYSTEM "compat/non_elf" )
53
- endif ()
66
+ add_library (crashpad_interface INTERFACE )
67
+ target_include_directories (crashpad_interface INTERFACE
68
+ $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR} >
69
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR} /third_party/mini_chromium/mini_chromium>
70
+ )
71
+ target_compile_definitions (crashpad_interface INTERFACE
72
+ CRASHPAD_LSS_SOURCE_EMBEDDED
73
+ )
54
74
55
75
if (MSVC )
56
- add_definitions (
57
- /DNOMINMAX
58
- /DUNICODE
59
- /DWIN32_LEAN_AND_MEAN
60
- /D_CRT_SECURE_NO_WARNINGS
61
- /D_HAS_EXCEPTIONS=0
62
- /D_UNICODE
63
- /FS
64
- /W4
65
- /WX
66
- /Zi
67
- /bigobj # Support larger number of sections in obj file.
68
- /wd4100 # Unreferenced formal parameter.
69
- /wd4127 # Conditional expression is constant.
70
- /wd4324 # Structure was padded due to alignment specifier.
71
- /wd4351 # New behavior: elements of array will be default initialized.
72
- /wd4577 # 'noexcept' used with no exception handling mode specified.
73
- /wd4996 # 'X' was declared deprecated.
76
+ target_compile_definitions (crashpad_interface INTERFACE
77
+ NOMINMAX
78
+ UNICODE
79
+ WIN32_LEAN_AND_MEAN
80
+ _CRT_SECURE_NO_WARNINGS
81
+ _HAS_EXCEPTIONS=0
82
+ _UNICODE
83
+ )
84
+ target_compile_options (crashpad_interface INTERFACE
85
+ $<$<COMPILE_LANGUAGE:C,CXX>:/FS>
86
+ $<$<COMPILE_LANGUAGE:C,CXX>:/W4>
87
+ $<$<COMPILE_LANGUAGE:C,CXX>:/WX>
88
+ $<$<COMPILE_LANGUAGE:C,CXX>:/Zi>
89
+ $<$<COMPILE_LANGUAGE:C,CXX>:/bigobj> # Support larger number of sections in obj file.
90
+ $<$<COMPILE_LANGUAGE:C,CXX>:/wd4100> # Unreferenced formal parameter.
91
+ $<$<COMPILE_LANGUAGE:C,CXX>:/wd4127> # Conditional expression is constant.
92
+ $<$<COMPILE_LANGUAGE:C,CXX>:/wd4324> # Structure was padded due to alignment specifier.
93
+ $<$<COMPILE_LANGUAGE:C,CXX>:/wd4351> # New behavior: elements of array will be default initialized.
94
+ $<$<COMPILE_LANGUAGE:C,CXX>:/wd4577> # 'noexcept' used with no exception handling mode specified.
95
+ $<$<COMPILE_LANGUAGE:C,CXX>:/wd4996> # 'X' was declared deprecated.
74
96
)
75
97
elseif (MINGW)
76
98
#redirect to wmain
77
- add_link_options (
99
+ target_link_options (crashpad_interface INTERFACE
78
100
-municode
79
101
)
80
102
endif ()
103
+ add_library (crashpad::interface ALIAS crashpad_interface)
81
104
82
- add_subdirectory (client)
83
105
add_subdirectory (compat)
84
- add_subdirectory (handler)
85
106
add_subdirectory (minidump)
86
107
add_subdirectory (snapshot)
87
- add_subdirectory (tools)
88
108
add_subdirectory (util)
89
109
add_subdirectory (third_party/mini_chromium)
110
+ add_subdirectory (client)
90
111
91
- if (MSVC )
92
- add_subdirectory (third_party/getopt)
93
- add_subdirectory (third_party/zlib)
94
- endif ()
112
+ add_subdirectory (third_party/zlib)
113
+ add_subdirectory (third_party/getopt)
114
+
115
+ add_subdirectory (tools)
116
+ add_subdirectory (handler)
117
+
118
+ if (CRASHPAD_ENABLE_INSTALL)
119
+ install (EXPORT crashpad_export NAMESPACE crashpad:: FILE crashpad-targets.cmake
120
+ DESTINATION "${CMAKE_INSTALL_CMAKEDIR} " )
121
+ include (CMakePackageConfigHelpers)
122
+ configure_package_config_file(crashpad-config.cmake.in crashpad-config.cmake
123
+ INSTALL_DESTINATION "${CMAKE_INSTALL_CMAKEDIR} "
124
+ )
125
+ install (FILES "${CMAKE_CURRENT_BINARY_DIR} /crashpad-config.cmake" DESTINATION "${CMAKE_INSTALL_CMAKEDIR} " )
126
+ endif ()
0 commit comments