From 01ea7ed83149fc65bb537ec93e97b346a32c5cb3 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 30 Apr 2019 20:22:10 +0200 Subject: [PATCH] Improve detecton of Protocol Buffers compiler when cross-compiling --- CMakeLists.txt | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b43465dcb..4beca52e6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1871,19 +1871,22 @@ if(Protobuf_FOUND AND CMAKE_VERSION VERSION_LESS 3.9) endif() endif() if(Protobuf_FOUND AND CMAKE_CROSSCOMPILING) - find_program(PROTOC_EXECUTABLE protoc - HINTS - /usr/local/bin/ - /usr/bin/ - NO_SYSTEM_ENVIRONMENT_PATH - ) + find_program(PROTOC_EXECUTABLE protoc) + if(NOT PROTOC_EXECUTABLE) + find_program(PROTOC_EXECUTABLE protoc + HINTS + /usr/bin/ + /usr/local/bin/ + ) + endif() if(PROTOC_EXECUTABLE) set_target_properties(protobuf::protoc PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" IMPORTED_LOCATION ${PROTOC_EXECUTABLE} ) + set(Protobuf_PROTOC_EXECUTABLE ${PROTOC_EXECUTABLE}) else() - message(FATAL ERROR "Please install the Protocol Buffers compiter v${Protobuf_VERSION} in the host machine") + message(FATAL_ERROR "Please install the Protocol Buffers compiler v${Protobuf_VERSION} in the host machine") endif() endif() if((NOT Protobuf_FOUND) OR (NOT Protobuf_PROTOC_EXECUTABLE) OR (${Protobuf_VERSION} VERSION_LESS ${GNSSSDR_PROTOBUF_MIN_VERSION}))