diff --git a/cmake/install.cmake b/cmake/install.cmake index 9d837ac536c9..8c96981da8b3 100644 --- a/cmake/install.cmake +++ b/cmake/install.cmake @@ -12,6 +12,10 @@ foreach (_target IN LISTS _pc_target_list) string(CONCAT _protobuf_PC_REQUIRES "${_protobuf_PC_REQUIRES}" "${_sep}" "${_target}") set(_sep " ") endforeach () +set(_protobuf_PC_CFLAGS) +if (protobuf_BUILD_SHARED_LIBS) + set(_protobuf_PC_CFLAGS -DPROTOBUF_USE_DLLS) +endif () configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/protobuf.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/protobuf.pc @ONLY) diff --git a/cmake/protobuf-lite.pc.cmake b/cmake/protobuf-lite.pc.cmake index 7f742c0258dc..eb5869e588f1 100644 --- a/cmake/protobuf-lite.pc.cmake +++ b/cmake/protobuf-lite.pc.cmake @@ -8,5 +8,5 @@ Description: Google's Data Interchange Format Version: @protobuf_VERSION@ Requires: @_protobuf_PC_REQUIRES@ Libs: -L${libdir} -lprotobuf-lite @CMAKE_THREAD_LIBS_INIT@ -Cflags: -I${includedir} +Cflags: -I${includedir} @_protobuf_PC_CFLAGS@ Conflicts: protobuf diff --git a/cmake/protobuf.pc.cmake b/cmake/protobuf.pc.cmake index 21bbf47fb1d1..81d87c1f7019 100644 --- a/cmake/protobuf.pc.cmake +++ b/cmake/protobuf.pc.cmake @@ -8,5 +8,5 @@ Description: Google's Data Interchange Format Version: @protobuf_VERSION@ Requires: @_protobuf_PC_REQUIRES@ Libs: -L${libdir} -lprotobuf @CMAKE_THREAD_LIBS_INIT@ -Cflags: -I${includedir} +Cflags: -I${includedir} @_protobuf_PC_CFLAGS@ Conflicts: protobuf-lite