Skip to content

Commit

Permalink
Switch to protobuf's /CMakeLists.txt instead of /cmake/CMakeLists.txt (
Browse files Browse the repository at this point in the history
…grpc#32678)

Try to react to protocolbuffers/protobuf#12263
and protocolbuffers/protobuf#12295

Protobuf's /cmake/CMakeLists.txt is now deprecated if favor of
/CMakeLists.txt


https://github.com/protocolbuffers/protobuf/blob/58ecf38aa521ba812a0c1a0ae9f108dd311c739c/cmake/CMakeLists.txt#L3

In this PR:
- Adjust `cmake/protobuf.cmake` to use the right CMakeLists.txt
- adjust the C++ distribtests accordingly
  • Loading branch information
jtattermusch authored and XuanWang-Amos committed May 1, 2023
1 parent 5a0a880 commit b10f797
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions cmake/protobuf.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ if(gRPC_PROTOBUF_PROVIDER STREQUAL "module")
set(PROTOBUF_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/third_party/protobuf)
endif()

if(EXISTS "${PROTOBUF_ROOT_DIR}/cmake/CMakeLists.txt")
if(EXISTS "${PROTOBUF_ROOT_DIR}/CMakeLists.txt")
set(protobuf_MSVC_STATIC_RUNTIME OFF CACHE BOOL "Link static runtime libraries")
add_subdirectory(${PROTOBUF_ROOT_DIR}/cmake third_party/protobuf)
add_subdirectory(${PROTOBUF_ROOT_DIR} third_party/protobuf)
if(TARGET ${_gRPC_PROTOBUF_LIBRARY_NAME})
set(_gRPC_PROTOBUF_LIBRARIES ${_gRPC_PROTOBUF_LIBRARY_NAME})
endif()
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion test/distrib/cpp/run_distrib_test_cmake.bat
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ popd
@rem Install protobuf
mkdir third_party\protobuf\cmake\build
pushd third_party\protobuf\cmake\build
cmake -G %VS_GENERATOR% -DCMAKE_INSTALL_PREFIX=%INSTALL_DIR% -DZLIB_ROOT=%INSTALL_DIR% -Dprotobuf_MSVC_STATIC_RUNTIME=OFF -Dprotobuf_BUILD_TESTS=OFF ..
cmake -G %VS_GENERATOR% -DCMAKE_INSTALL_PREFIX=%INSTALL_DIR% -DZLIB_ROOT=%INSTALL_DIR% -Dprotobuf_MSVC_STATIC_RUNTIME=OFF -Dprotobuf_BUILD_TESTS=OFF ..\..
cmake --build . --config Release --target install || goto :error
popd

Expand Down
2 changes: 1 addition & 1 deletion test/distrib/cpp/run_distrib_test_cmake.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ popd
# Install protobuf
mkdir -p "third_party/protobuf/cmake/build"
pushd "third_party/protobuf/cmake/build"
cmake -Dprotobuf_BUILD_TESTS=OFF -DCMAKE_BUILD_TYPE=Release ..
cmake -Dprotobuf_BUILD_TESTS=OFF -DCMAKE_BUILD_TYPE=Release ../..
make "-j${GRPC_CPP_DISTRIBTEST_BUILD_COMPILER_JOBS}" install
popd

Expand Down
2 changes: 1 addition & 1 deletion test/distrib/cpp/run_distrib_test_cmake_pkgconfig.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ popd
# Install protobuf
mkdir -p "third_party/protobuf/cmake/build"
pushd "third_party/protobuf/cmake/build"
cmake -Dprotobuf_BUILD_TESTS=OFF -DCMAKE_BUILD_TYPE=Release ..
cmake -Dprotobuf_BUILD_TESTS=OFF -DCMAKE_BUILD_TYPE=Release ../..
make "-j${GRPC_CPP_DISTRIBTEST_BUILD_COMPILER_JOBS}" install
popd

Expand Down

0 comments on commit b10f797

Please sign in to comment.