Skip to content

Commit 56e35a3

Browse files
Vogtinatorsergiomb2
authored andcommitted
Avoid intermediate proto-object library
The use of proto-object breaks building shared libs and it doesn't make sense to install it. Instead of TARGET, use generate_protobuf with OUT_VAR.
1 parent 5393f1c commit 56e35a3

1 file changed

Lines changed: 4 additions & 17 deletions

File tree

cpp/CMakeLists.txt

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -250,13 +250,10 @@ if (${Protobuf_VERSION} VERSION_LESS "3.21.0.0")
250250
DEPENDS ${PROTO_FILES}
251251
)
252252
else ()
253-
set (PROTOBUF_OUTPUT "")
254-
add_library (proto-objects OBJECT ${PROTO_FILES})
255-
target_link_libraries (proto-objects PUBLIC protobuf::libprotobuf)
256253
set (PROTO_BINARY_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src")
257-
target_include_directories (proto-objects PUBLIC "$<BUILD_INTERFACE:${PROTO_BINARY_DIR}>")
258254
protobuf_generate (
259-
TARGET proto-objects
255+
PROTOS ${PROTO_FILES}
256+
OUT_VAR PROTOBUF_OUTPUT
260257
IMPORT_DIRS "${RESOURCES_DIR}"
261258
PROTOC_OUT_DIR "${PROTO_BINARY_DIR}/phonenumbers"
262259
)
@@ -303,9 +300,7 @@ set (
303300
"src/phonenumbers/utf/unilib.cc"
304301
)
305302

306-
if (${Protobuf_VERSION} VERSION_LESS "3.21.0.0")
307-
list (APPEND SOURCES ${PROTOBUF_OUTPUT})
308-
endif ()
303+
list (APPEND SOURCES ${PROTOBUF_OUTPUT})
309304

310305
if (BUILD_GEOCODER)
311306
set (
@@ -474,10 +469,6 @@ if (APPLE)
474469
list (APPEND LIBRARY_DEPS ${COREFOUNDATION_LIB} ${FOUNDATION_LIB})
475470
endif ()
476471

477-
if (${Protobuf_VERSION} VERSION_GREATER_EQUAL "3.21.0.0")
478-
list (APPEND LIBRARY_DEPS proto-objects)
479-
endif ()
480-
481472
#----------------------------------------------------------------
482473
# Build libraries
483474
#----------------------------------------------------------------
@@ -629,11 +620,7 @@ endif()
629620
# Install built libraries
630621
#----------------------------------------------------------------
631622

632-
if (${Protobuf_VERSION} VERSION_GREATER_EQUAL "3.21.0.0")
633-
set (BUILT_LIBS proto-objects)
634-
else ()
635-
set (BUILT_LIBS)
636-
endif ()
623+
set (BUILT_LIBS)
637624
set(targets_export_name "${PROJECT_NAME}-targets")
638625

639626
if (BUILD_STATIC_LIB)

0 commit comments

Comments
 (0)