Skip to content

Commit 13c792e

Browse files
committed
fix: missing -DPROTOBUF_USE_DLLS in pkg-config
When the protobuf libraries have been compiled as shared libraries the users of the library need to add `-DPROTOBUF_USE_DLLS` to their build line. Otherwise some symbols are missing.
1 parent da2c4a6 commit 13c792e

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

cmake/install.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ foreach (_target IN LISTS _pc_target_list)
1212
string(CONCAT _protobuf_PC_REQUIRES "${_protobuf_PC_REQUIRES}" "${_sep}" "${_target}")
1313
set(_sep " ")
1414
endforeach ()
15+
set(_protobuf_PC_CFLAGS)
16+
if (protobuf_BUILD_SHARED_LIBS)
17+
set(_protobuf_PC_CFLAGS -DPROTOBUF_USE_DLLS)
18+
endif ()
1519

1620
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/protobuf.pc.cmake
1721
${CMAKE_CURRENT_BINARY_DIR}/protobuf.pc @ONLY)

cmake/protobuf-lite.pc.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ Description: Google's Data Interchange Format
88
Version: @protobuf_VERSION@
99
Requires: @_protobuf_PC_REQUIRES@
1010
Libs: -L${libdir} -lprotobuf-lite @CMAKE_THREAD_LIBS_INIT@
11-
Cflags: -I${includedir}
11+
Cflags: -I${includedir} @_protobuf_PC_CFLAGS@
1212
Conflicts: protobuf

cmake/protobuf.pc.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ Description: Google's Data Interchange Format
88
Version: @protobuf_VERSION@
99
Requires: @_protobuf_PC_REQUIRES@
1010
Libs: -L${libdir} -lprotobuf @CMAKE_THREAD_LIBS_INIT@
11-
Cflags: -I${includedir}
11+
Cflags: -I${includedir} @_protobuf_PC_CFLAGS@
1212
Conflicts: protobuf-lite

0 commit comments

Comments
 (0)