[
https://issues.apache.org/jira/browse/HDFS-16604?focusedWorklogId=776006&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-776006
]
ASF GitHub Bot logged work on HDFS-16604:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 30/May/22 17:34
Start Date: 30/May/22 17:34
Worklog Time Spent: 10m
Work Description: 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.
Issue Time Tracking
-------------------
Worklog Id: (was: 776006)
Time Spent: 1h 40m (was: 1.5h)
> Install gtest via FetchContent_Declare in CMake
> -----------------------------------------------
>
> Key: HDFS-16604
> URL: https://issues.apache.org/jira/browse/HDFS-16604
> Project: Hadoop HDFS
> Issue Type: Bug
> Components: libhdfs++
> Affects Versions: 3.4.0
> Reporter: Gautham Banasandra
> Assignee: Gautham Banasandra
> Priority: Blocker
> Labels: pull-request-available
> Time Spent: 1h 40m
> Remaining Estimate: 0h
>
> CMake is unable to checkout *release-1.10.0* version of GoogleTest -
> {code}
> [WARNING] -- Build files have been written to:
> /home/jenkins/jenkins-home/workspace/hadoop-multibranch_PR-4370/centos-7/src/hadoop-hdfs-project/hadoop-hdfs-native-client/target/main/native/libhdfspp/googletest-download
> [WARNING] Scanning dependencies of target googletest
> [WARNING] [ 11%] Creating directories for 'googletest'
> [WARNING] [ 22%] Performing download step (git clone) for 'googletest'
> [WARNING] Cloning into 'googletest-src'...
> [WARNING] fatal: invalid reference: release-1.10.0
> [WARNING] CMake Error at
> googletest-download/googletest-prefix/tmp/googletest-gitclone.cmake:40
> (message):
> [WARNING] Failed to checkout tag: 'release-1.10.0'
> [WARNING]
> [WARNING]
> [WARNING] gmake[2]: *** [CMakeFiles/googletest.dir/build.make:111:
> googletest-prefix/src/googletest-stamp/googletest-download] Error 1
> [WARNING] gmake[1]: *** [CMakeFiles/Makefile2:95:
> CMakeFiles/googletest.dir/all] Error 2
> [WARNING] gmake: *** [Makefile:103: all] Error 2
> [WARNING] CMake Error at main/native/libhdfspp/CMakeLists.txt:68 (message):
> [WARNING] Build step for googletest failed: 2
> {code}
> Jenkins run -
> https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-4370/6/artifact/out/branch-compile-hadoop-hdfs-project_hadoop-hdfs-native-client.txt
> We need to use *FetchContent_Declare* since we're getting the source code
> exactly at the given commit SHA. This avoids the checkout step altogether and
> solves the above issue.
--
This message was sent by Atlassian Jira
(v8.20.7#820007)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]