GauthamBanasandra commented on code in PR #4374:
URL: https://github.com/apache/hadoop/pull/4374#discussion_r885005736


##########
hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/CMakeLists.txt:
##########
@@ -53,30 +53,14 @@ find_package(Threads)
 include(CheckCXXSourceCompiles)
 include(CheckSymbolExists)
 
-# Download and build gtest
-configure_file(CMakeLists-gtest.txt.in googletest-download/CMakeLists.txt)
-execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" .
-  RESULT_VARIABLE result
-  WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/googletest-download)
-if(result)
-  message(FATAL_ERROR "CMake step for googletest failed: ${result}")
-endif()
-execute_process(COMMAND ${CMAKE_COMMAND} --build .
-  RESULT_VARIABLE result
-  WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/googletest-download)
-if(result)
-  message(FATAL_ERROR "Build step for googletest failed: ${result}")
-endif()
-
-# Prevent overriding the parent project's compiler/linker
-# settings on Windows
+include(FetchContent)
+FetchContent_Declare(
+  googletest
+  URL 
https://github.com/google/googletest/archive/703bd9caab50b139428cea1aaff9974ebee5742e.zip

Review Comment:
   Also, the gtest repo suggests has mentioned this approach in their README.md 
- 
https://github.com/google/googletest/tree/f2d71f0be2ff2230789cfaf37d4c4f38db5b1c7c/googletest#incorporating-into-an-existing-cmake-project.



##########
hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/CMakeLists.txt:
##########
@@ -53,30 +53,14 @@ find_package(Threads)
 include(CheckCXXSourceCompiles)
 include(CheckSymbolExists)
 
-# Download and build gtest
-configure_file(CMakeLists-gtest.txt.in googletest-download/CMakeLists.txt)
-execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" .
-  RESULT_VARIABLE result
-  WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/googletest-download)
-if(result)
-  message(FATAL_ERROR "CMake step for googletest failed: ${result}")
-endif()
-execute_process(COMMAND ${CMAKE_COMMAND} --build .
-  RESULT_VARIABLE result
-  WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/googletest-download)
-if(result)
-  message(FATAL_ERROR "Build step for googletest failed: ${result}")
-endif()
-
-# Prevent overriding the parent project's compiler/linker
-# settings on Windows
+include(FetchContent)
+FetchContent_Declare(
+  googletest
+  URL 
https://github.com/google/googletest/archive/703bd9caab50b139428cea1aaff9974ebee5742e.zip

Review Comment:
   Also, the gtest repo has mentioned this approach in their README.md - 
https://github.com/google/googletest/tree/f2d71f0be2ff2230789cfaf37d4c4f38db5b1c7c/googletest#incorporating-into-an-existing-cmake-project.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to