This is an automated email from the ASF dual-hosted git repository.

uwe pushed a commit to branch ARROW-40181-glog07
in repository https://gitbox.apache.org/repos/asf/arrow.git

commit 147504673e409fc5267f0422a58f170f442b5455
Author: Uwe L. Korn <uwe.k...@quantco.com>
AuthorDate: Mon Feb 26 09:21:31 2024 +0100

    GH-40181: [C++] Support glog 0.7 build
---
 cpp/cmake_modules/FindGLOG.cmake | 8 +++++++-
 cpp/src/arrow/util/logging.cc    | 6 +++---
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/cpp/cmake_modules/FindGLOG.cmake b/cpp/cmake_modules/FindGLOG.cmake
index 61b7d0694e..62b235ee91 100644
--- a/cpp/cmake_modules/FindGLOG.cmake
+++ b/cpp/cmake_modules/FindGLOG.cmake
@@ -17,6 +17,11 @@
 #
 #  find_package(GLOG)
 
+find_package(glog CONFIG)
+if(glog_FOUND)
+  return()
+endif()
+
 if(GLOG_FOUND)
   return()
 endif()
@@ -56,5 +61,6 @@ if(GLOG_FOUND)
   add_library(glog::glog UNKNOWN IMPORTED)
   set_target_properties(glog::glog
                         PROPERTIES IMPORTED_LOCATION "${GLOG_LIB}"
-                                   INTERFACE_INCLUDE_DIRECTORIES 
"${GLOG_INCLUDE_DIR}")
+                                   INTERFACE_INCLUDE_DIRECTORIES 
"${GLOG_INCLUDE_DIR}"
+                                   INTERFACE_COMPILE_DEFINITIONS 
"GLOG_USE_GLOG_EXPORT")
 endif()
diff --git a/cpp/src/arrow/util/logging.cc b/cpp/src/arrow/util/logging.cc
index d293113237..25c336a6d2 100644
--- a/cpp/src/arrow/util/logging.cc
+++ b/cpp/src/arrow/util/logging.cc
@@ -116,7 +116,7 @@ static std::unique_ptr<std::string> log_dir_;
 #ifdef ARROW_USE_GLOG
 
 // Glog's severity map.
-static int GetMappedSeverity(ArrowLogLevel severity) {
+static google::LogSeverity GetMappedSeverity(ArrowLogLevel severity) {
   switch (severity) {
     case ArrowLogLevel::ARROW_DEBUG:
       return google::GLOG_INFO;
@@ -148,7 +148,7 @@ void ArrowLog::StartArrowLog(const std::string& app_name,
   app_name_.reset(new std::string(app_name));
   log_dir_.reset(new std::string(log_dir));
 #ifdef ARROW_USE_GLOG
-  int mapped_severity_threshold = GetMappedSeverity(severity_threshold_);
+  google::LogSeverity mapped_severity_threshold = 
GetMappedSeverity(severity_threshold_);
   google::SetStderrLogging(mapped_severity_threshold);
   // Enable log file if log_dir is not empty.
   if (!log_dir.empty()) {
@@ -173,7 +173,7 @@ void ArrowLog::StartArrowLog(const std::string& app_name,
     google::SetLogFilenameExtension(app_name_without_path.c_str());
     for (int i = static_cast<int>(severity_threshold_);
          i <= static_cast<int>(ArrowLogLevel::ARROW_FATAL); ++i) {
-      int level = GetMappedSeverity(static_cast<ArrowLogLevel>(i));
+      google::LogSeverity level = 
GetMappedSeverity(static_cast<ArrowLogLevel>(i));
       google::SetLogDestination(level, dir_ends_with_slash.c_str());
     }
   }

Reply via email to