Skip to content

Commit 610a789

Browse files
committed
feat: Add pc file for pkgconfig support
1 parent 5d60bff commit 610a789

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

CMakeLists.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -819,3 +819,19 @@ if(SENTRY_BUILD_SHARED_LIBS)
819819
"$<$<PLATFORM_ID:Android>:-Wl,-z,max-page-size=16384>"
820820
)
821821
endif()
822+
823+
# Generate and install pkg-config file
824+
if(SENTRY_INSTALL_PKGCONFIG)
825+
set(PROJECT_VERSION "${SENTRY_VERSION_FULL}")
826+
set(PREFIX "${CMAKE_INSTALL_PREFIX}")
827+
include(GNUInstallDirs)
828+
configure_file(
829+
"${CMAKE_CURRENT_SOURCE_DIR}/sentry.pc.in"
830+
"${CMAKE_CURRENT_BINARY_DIR}/sentry.pc"
831+
@ONLY
832+
)
833+
install(
834+
FILES "${CMAKE_CURRENT_BINARY_DIR}/sentry.pc"
835+
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig"
836+
)
837+
endif()

sentry.pc.in

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
prefix=@PREFIX@
2+
exec_prefix=${prefix}
3+
libdir=${prefix}/lib
4+
includedir=${prefix}/include
5+
6+
Name: sentry
7+
Description: Sentry SDK for C, C++ and native applications
8+
Version: @PROJECT_VERSION@
9+
URL: https://sentry.io/
10+
Libs: -L${libdir} -lsentry -lstdc++
11+
Cflags: -I${includedir}

0 commit comments

Comments
 (0)