Fix regression in Protobuf find_package logic. (#1491)

The introduced changes are not compatible with CMake < 3.6 if the
FindProtobuf.cmake bundled with CMake is used.
Since our minimum required version is 3.2, I consider this to be a bug.

- camel-case variables names weren't used before 3.6
  (upper-case is lowered in CMake > 3.6 for backwards compatibility)
- the `CONFIG` search for the Windows build logs a warning even if the
`REQUIRED` search succeeds, should be quiet
master
Michael Grupp 2019-01-03 09:19:00 +01:00 committed by Andre Gaschler
parent b038e07fff
commit 2d698e70e8
1 changed files with 4 additions and 4 deletions

View File

@ -41,8 +41,8 @@ find_package(Eigen3 REQUIRED)
find_package(LuaGoogle REQUIRED) find_package(LuaGoogle REQUIRED)
# On Windows, Protobuf is incorrectly found by the bundled CMake module. Prefer native CMake config, if possible. # On Windows, Protobuf is incorrectly found by the bundled CMake module. Prefer native CMake config, if possible.
set(protobuf_MODULE_COMPATIBLE TRUE CACHE INTERNAL "") set(protobuf_MODULE_COMPATIBLE TRUE CACHE INTERNAL "")
find_package(Protobuf 3.0.0 CONFIG) find_package(Protobuf 3.0.0 CONFIG QUIET)
if (NOT Protobuf_FOUND) if (NOT PROTOBUF_FOUND)
find_package(Protobuf 3.0.0 REQUIRED) find_package(Protobuf 3.0.0 REQUIRED)
endif() endif()
@ -142,7 +142,7 @@ foreach(ABS_FIL ${ALL_PROTOS})
add_custom_command( add_custom_command(
OUTPUT "${PROJECT_BINARY_DIR}/${DIR}/${FIL_WE}.pb.cc" OUTPUT "${PROJECT_BINARY_DIR}/${DIR}/${FIL_WE}.pb.cc"
"${PROJECT_BINARY_DIR}/${DIR}/${FIL_WE}.pb.h" "${PROJECT_BINARY_DIR}/${DIR}/${FIL_WE}.pb.h"
COMMAND ${Protobuf_PROTOC_EXECUTABLE} COMMAND ${PROTOBUF_PROTOC_EXECUTABLE}
ARGS --cpp_out ${PROJECT_BINARY_DIR} -I ARGS --cpp_out ${PROJECT_BINARY_DIR} -I
${PROJECT_SOURCE_DIR} ${ABS_FIL} ${PROJECT_SOURCE_DIR} ${ABS_FIL}
DEPENDS ${ABS_FIL} DEPENDS ${ABS_FIL}
@ -168,7 +168,7 @@ if(${BUILD_GRPC})
add_custom_command( add_custom_command(
OUTPUT "${PROJECT_BINARY_DIR}/${DIR}/${FIL_WE}.pb.cc" OUTPUT "${PROJECT_BINARY_DIR}/${DIR}/${FIL_WE}.pb.cc"
"${PROJECT_BINARY_DIR}/${DIR}/${FIL_WE}.pb.h" "${PROJECT_BINARY_DIR}/${DIR}/${FIL_WE}.pb.h"
COMMAND ${Protobuf_PROTOC_EXECUTABLE} COMMAND ${PROTOBUF_PROTOC_EXECUTABLE}
ARGS --cpp_out ${PROJECT_BINARY_DIR} ARGS --cpp_out ${PROJECT_BINARY_DIR}
-I ${PROJECT_SOURCE_DIR} -I ${PROJECT_SOURCE_DIR}
${ABS_FIL} ${ABS_FIL}