diff --git a/cmake/libprotobuf.cmake b/cmake/libprotobuf.cmake index 2638bd07e147..b820479e600a 100644 --- a/cmake/libprotobuf.cmake +++ b/cmake/libprotobuf.cmake @@ -24,7 +24,7 @@ endif() if(${CMAKE_SYSTEM_NAME} STREQUAL "Android") target_link_libraries(libprotobuf PRIVATE log) endif() -target_include_directories(libprotobuf PUBLIC ${protobuf_SOURCE_DIR}/src) +target_include_directories(libprotobuf SYSTEM PUBLIC ${protobuf_SOURCE_DIR}/src) target_link_libraries(libprotobuf PUBLIC ${protobuf_ABSL_USED_TARGETS}) protobuf_configure_target(libprotobuf) if(protobuf_BUILD_SHARED_LIBS) diff --git a/cmake/protoc.cmake b/cmake/protoc.cmake index 385a7a3f3989..f1b44e9cd8d7 100644 --- a/cmake/protoc.cmake +++ b/cmake/protoc.cmake @@ -10,5 +10,17 @@ target_link_libraries(protoc ) add_executable(protobuf::protoc ALIAS protoc) +if (CMAKE_OSX_ARCHITECTURES) + set_target_properties(protoc PROPERTIES OSX_ARCHITECTURES "x86_64;arm64") +endif() +if(UNIX AND NOT APPLE) + target_link_libraries(protoc atomic) +endif() +target_link_libraries(protoc ${CMAKE_THREAD_LIBS_INIT}) +target_include_directories(protoc PRIVATE src ${CMAKE_CURRENT_BINARY_DIR}) +if (CMAKE_USE_PTHREADS_INIT) + target_compile_definitions(protoc PUBLIC HAVE_PTHREAD) +endif (CMAKE_USE_PTHREADS_INIT) + set_target_properties(protoc PROPERTIES VERSION ${protobuf_VERSION})