Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

**Features**:

- Add pkg-config support ([#1411](https://github.com/getsentry/sentry-native/pull/1411))
- Add support for outgoing W3C traceparent header propagation with the `propagate_traceparent` option. ([#1394](https://github.com/getsentry/sentry-native/pull/1394))

**Fixes**:
Expand Down
27 changes: 27 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ if("${CMAKE_SOURCE_DIR}" STREQUAL "${PROJECT_SOURCE_DIR}")
endif()

option(SENTRY_ENABLE_INSTALL "Enable sentry installation" "${SENTRY_MAIN_PROJECT}")
option(SENTRY_INSTALL_PKGCONFIG "Generate and install pkg-config file" ON)

if(MSVC AND CMAKE_GENERATOR_TOOLSET MATCHES "_xp$")
message(WARNING "Crashpad is not supported for MSVC with XP toolset. Default backend was switched to 'breakpad'")
Expand Down Expand Up @@ -819,3 +820,29 @@ if(SENTRY_BUILD_SHARED_LIBS)
"$<$<PLATFORM_ID:Android>:-Wl,-z,max-page-size=16384>"
)
endif()

# Generate and install pkg-config file
if(SENTRY_INSTALL_PKGCONFIG)
set(PREFIX "${CMAKE_INSTALL_PREFIX}")
set(PKGCONFIG_VERSION "${SENTRY_VERSION_FULL}")
# Use absolute paths for libdir and includedir to support non-standard layouts (e.g., lib64)
if(IS_ABSOLUTE "${CMAKE_INSTALL_LIBDIR}")
set(PKGCONFIG_LIBDIR "${CMAKE_INSTALL_LIBDIR}")
else()
set(PKGCONFIG_LIBDIR "\${prefix}/${CMAKE_INSTALL_LIBDIR}")
endif()
if(IS_ABSOLUTE "${CMAKE_INSTALL_INCLUDEDIR}")
set(PKGCONFIG_INCLUDEDIR "${CMAKE_INSTALL_INCLUDEDIR}")
else()
set(PKGCONFIG_INCLUDEDIR "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}")
endif()
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/sentry.pc.in"
"${CMAKE_CURRENT_BINARY_DIR}/sentry.pc"
@ONLY
)
sentry_install(
FILES "${CMAKE_CURRENT_BINARY_DIR}/sentry.pc"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig"
)
endif()
11 changes: 11 additions & 0 deletions sentry.pc.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
prefix=@PREFIX@
exec_prefix=${prefix}
libdir=@PKGCONFIG_LIBDIR@
includedir=@PKGCONFIG_INCLUDEDIR@

Name: sentry
Description: Sentry SDK for C, C++ and native applications
Version: @PKGCONFIG_VERSION@
URL: https://sentry.io/
Libs: -L${libdir} -lsentry
Cflags: -I${includedir}
Loading