Skip to content

Commit

Permalink
Merge pull request #112 from open-telemetry/main
Browse files Browse the repository at this point in the history
[BUILD] Fix cross-compilation with protoc (open-telemetry#3186)
  • Loading branch information
malkia authored Dec 6, 2024
2 parents 1980f39 + 23562e6 commit 5ed05ad
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -428,12 +428,16 @@ if(WITH_OTLP_GRPC
endif()
# Latest Protobuf imported targets and without legacy module support
if(TARGET protobuf::protoc)
project_build_tools_get_imported_location(PROTOBUF_PROTOC_EXECUTABLE
protobuf::protoc)
# If protobuf::protoc is not a imported target, then we use the target
# directly for fallback
if(NOT PROTOBUF_PROTOC_EXECUTABLE)
set(PROTOBUF_PROTOC_EXECUTABLE protobuf::protoc)
if(CMAKE_CROSSCOMPILING AND Protobuf_PROTOC_EXECUTABLE)
set(PROTOBUF_PROTOC_EXECUTABLE ${Protobuf_PROTOC_EXECUTABLE})
else()
project_build_tools_get_imported_location(PROTOBUF_PROTOC_EXECUTABLE
protobuf::protoc)
# If protobuf::protoc is not a imported target, then we use the target
# directly for fallback
if(NOT PROTOBUF_PROTOC_EXECUTABLE)
set(PROTOBUF_PROTOC_EXECUTABLE protobuf::protoc)
endif()
endif()
elseif(Protobuf_PROTOC_EXECUTABLE)
# Some versions of FindProtobuf.cmake uses mixed case instead of uppercase
Expand Down

0 comments on commit 5ed05ad

Please sign in to comment.