Skip to content

Commit a451047

Browse files
committed
cmake: Make breakpad build conditional (WITH_BREAKPAD)
Add option WITH_BREAKPAD defaulting to TRUE on non-windows platforms. Signed-off-by: Marcel Lauhoff <[email protected]>
1 parent 5729a4b commit a451047

File tree

5 files changed

+51
-23
lines changed

5 files changed

+51
-23
lines changed

CMakeLists.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,18 @@ if(WITH_CATCH2)
539539
message("-- Enabled Catch2 support")
540540
endif()
541541

542+
if(WIN32)
543+
set(WITH_BREAKPAD_DEFAULT OFF)
544+
else()
545+
set(WITH_BREAKPAD_DEFAULT ON)
546+
endif()
547+
548+
option(WITH_BREAKPAD "Build with Google Breakpad crash reporter" ${WITH_BREAKPAD_DEFAULT})
549+
if(WITH_BREAKPAD)
550+
set(HAVE_BREAKPAD ON)
551+
message("-- Enabled Google Breakpad crash reporter")
552+
endif()
553+
542554
#option for RGW
543555
option(WITH_RADOSGW "RADOS Gateway is enabled" ON)
544556
option(WITH_RADOSGW_BEAST_OPENSSL "RADOS Gateway's Beast frontend uses OpenSSL" ON)

src/CMakeLists.txt

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -326,16 +326,17 @@ if (WITH_BLKIN)
326326
endif(WITH_BLKIN)
327327

328328
## breakpad
329-
set(breakpad_SOURCE_DIR ${CMAKE_SOURCE_DIR}/src/breakpad)
330-
set(lss_SOURCE_DIR ${CMAKE_SOURCE_DIR}/src/lss)
329+
if(WITH_BREAKPAD)
330+
set(breakpad_SOURCE_DIR ${CMAKE_SOURCE_DIR}/src/breakpad)
331+
set(lss_SOURCE_DIR ${CMAKE_SOURCE_DIR}/src/lss)
331332

332-
add_custom_target(breakpad_lss_symlink)
333-
add_custom_command(
333+
add_custom_target(breakpad_lss_symlink)
334+
add_custom_command(
334335
TARGET breakpad_lss_symlink
335336
COMMAND ${CMAKE_COMMAND} -E create_symlink ${lss_SOURCE_DIR} ${breakpad_SOURCE_DIR}/src/third_party/lss
336337
COMMENT "Creating symbolic link lss -> breakpad third party"
337-
)
338-
ExternalProject_Add(
338+
)
339+
ExternalProject_Add(
339340
breakpad_project
340341
SOURCE_DIR "${breakpad_SOURCE_DIR}"
341342
CONFIGURE_COMMAND
@@ -347,20 +348,20 @@ ExternalProject_Add(
347348
BUILD_IN_SOURCE ON
348349
DEPENDS breakpad_lss_symlink
349350
BUILD_BYPRODUCTS "${breakpad_SOURCE_DIR}/src/libbreakpad.a;${breakpad_SOURCE_DIR}/src/client/linux/libbreakpad_client.a"
350-
)
351-
352-
add_library(libbreakpad STATIC IMPORTED GLOBAL)
353-
set_property(TARGET libbreakpad PROPERTY IMPORTED_LOCATION ${breakpad_SOURCE_DIR}/src/libbreakpad.a)
354-
add_library(libbreakpad_client STATIC IMPORTED GLOBAL)
355-
set_property(TARGET libbreakpad_client PROPERTY IMPORTED_LOCATION ${breakpad_SOURCE_DIR}/src/client/linux/libbreakpad_client.a)
351+
)
356352

357-
include_directories(SYSTEM "${breakpad_SOURCE_DIR}/src")
358-
add_dependencies(libbreakpad breakpad_project)
359-
add_dependencies(libbreakpad_client breakpad_project)
353+
add_library(libbreakpad STATIC IMPORTED GLOBAL)
354+
set_property(TARGET libbreakpad PROPERTY IMPORTED_LOCATION ${breakpad_SOURCE_DIR}/src/libbreakpad.a)
355+
add_library(libbreakpad_client STATIC IMPORTED GLOBAL)
356+
set_property(TARGET libbreakpad_client PROPERTY IMPORTED_LOCATION ${breakpad_SOURCE_DIR}/src/client/linux/libbreakpad_client.a)
360357

361-
add_library(breakpad INTERFACE)
362-
target_link_libraries(breakpad INTERFACE libbreakpad libbreakpad_client)
358+
include_directories(SYSTEM "${breakpad_SOURCE_DIR}/src")
359+
add_dependencies(libbreakpad breakpad_project)
360+
add_dependencies(libbreakpad_client breakpad_project)
363361

362+
add_library(breakpad INTERFACE)
363+
target_link_libraries(breakpad INTERFACE libbreakpad libbreakpad_client)
364+
endif(WITH_BREAKPAD)
364365

365366
if(WITH_JAEGER)
366367
find_package(thrift 0.13.0 REQUIRED)
@@ -518,8 +519,10 @@ if(WITH_JAEGER)
518519
target_link_libraries(common-objs jaeger_base)
519520
endif()
520521

521-
add_dependencies(common-objs breakpad_project)
522-
target_link_libraries(common-objs breakpad)
522+
if(WITH_BREAKPAD)
523+
add_dependencies(common-objs breakpad_project)
524+
target_link_libraries(common-objs breakpad)
525+
endif()
523526

524527
CHECK_C_COMPILER_FLAG("-fvar-tracking-assignments" HAS_VTA)
525528
add_subdirectory(auth)
@@ -582,7 +585,9 @@ if(WITH_JAEGER)
582585
list(APPEND ceph_common_deps jaeger_base)
583586
endif()
584587

585-
list(APPEND ceph_common_deps breakpad)
588+
if(WITH_BREAKPAD)
589+
list(APPEND ceph_common_deps breakpad)
590+
endif()
586591

587592
if(WIN32)
588593
list(APPEND ceph_common_deps ws2_32 mswsock iphlpapi bcrypt)
@@ -620,7 +625,9 @@ if(WITH_JAEGER)
620625
add_dependencies(common jaeger_base)
621626
endif()
622627

628+
if(WITH_BREAKPAD)
623629
add_dependencies(common breakpad_project)
630+
endif()
624631

625632
if (WIN32)
626633
# Statically building ceph-common on Windows fails. We're temporarily
@@ -641,7 +648,9 @@ if(WITH_JAEGER)
641648
add_dependencies(ceph-common jaeger_base)
642649
endif()
643650

651+
if(WITH_BREAKPAD)
644652
add_dependencies(ceph-common breakpad_project)
653+
endif()
645654

646655
# appease dpkg-shlibdeps
647656
set_target_properties(ceph-common PROPERTIES

src/crimson/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,9 @@ if(WITH_JAEGER)
137137
list(APPEND crimson_common_public_deps jaeger_base)
138138
endif()
139139

140-
list(APPEND crimson_common_public_deps breakpad)
140+
if(WITH_BREAKPAD)
141+
list(APPEND crimson_common_public_deps breakpad)
142+
endif()
141143

142144
if(NOT WITH_SYSTEM_BOOST)
143145
list(APPEND crimson_common_deps ${ZLIB_LIBRARIES})

src/include/config-h.in.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,4 +405,7 @@
405405
/* libexec directory path */
406406
#cmakedefine CMAKE_INSTALL_LIBEXECDIR "@CMAKE_INSTALL_LIBEXECDIR@"
407407

408+
/* Define if breakpad is available */
409+
#cmakedefine HAVE_BREAKPAD
410+
408411
#endif /* CONFIG_H */

src/rgw/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -358,8 +358,10 @@ if(WITH_JAEGER)
358358
target_link_libraries(rgw_common PUBLIC jaeger_base)
359359
endif()
360360

361-
add_dependencies(rgw_common breakpad_project)
362-
target_link_libraries(rgw_common PUBLIC breakpad)
361+
if(WITH_BREAKPAD)
362+
add_dependencies(rgw_common breakpad_project)
363+
target_link_libraries(rgw_common PUBLIC breakpad)
364+
endif()
363365

364366
if(WITH_RADOSGW_DBSTORE)
365367
target_link_libraries(rgw_common PRIVATE global dbstore)

0 commit comments

Comments
 (0)