Skip to content

Commit 1475046

Browse files
committed
GH-40181: [C++] Support glog 0.7 build
1 parent b8fff04 commit 1475046

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

cpp/cmake_modules/FindGLOG.cmake

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@
1717
#
1818
# find_package(GLOG)
1919

20+
find_package(glog CONFIG)
21+
if(glog_FOUND)
22+
return()
23+
endif()
24+
2025
if(GLOG_FOUND)
2126
return()
2227
endif()
@@ -56,5 +61,6 @@ if(GLOG_FOUND)
5661
add_library(glog::glog UNKNOWN IMPORTED)
5762
set_target_properties(glog::glog
5863
PROPERTIES IMPORTED_LOCATION "${GLOG_LIB}"
59-
INTERFACE_INCLUDE_DIRECTORIES "${GLOG_INCLUDE_DIR}")
64+
INTERFACE_INCLUDE_DIRECTORIES "${GLOG_INCLUDE_DIR}"
65+
INTERFACE_COMPILE_DEFINITIONS "GLOG_USE_GLOG_EXPORT")
6066
endif()

cpp/src/arrow/util/logging.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ static std::unique_ptr<std::string> log_dir_;
116116
#ifdef ARROW_USE_GLOG
117117

118118
// Glog's severity map.
119-
static int GetMappedSeverity(ArrowLogLevel severity) {
119+
static google::LogSeverity GetMappedSeverity(ArrowLogLevel severity) {
120120
switch (severity) {
121121
case ArrowLogLevel::ARROW_DEBUG:
122122
return google::GLOG_INFO;
@@ -148,7 +148,7 @@ void ArrowLog::StartArrowLog(const std::string& app_name,
148148
app_name_.reset(new std::string(app_name));
149149
log_dir_.reset(new std::string(log_dir));
150150
#ifdef ARROW_USE_GLOG
151-
int mapped_severity_threshold = GetMappedSeverity(severity_threshold_);
151+
google::LogSeverity mapped_severity_threshold = GetMappedSeverity(severity_threshold_);
152152
google::SetStderrLogging(mapped_severity_threshold);
153153
// Enable log file if log_dir is not empty.
154154
if (!log_dir.empty()) {
@@ -173,7 +173,7 @@ void ArrowLog::StartArrowLog(const std::string& app_name,
173173
google::SetLogFilenameExtension(app_name_without_path.c_str());
174174
for (int i = static_cast<int>(severity_threshold_);
175175
i <= static_cast<int>(ArrowLogLevel::ARROW_FATAL); ++i) {
176-
int level = GetMappedSeverity(static_cast<ArrowLogLevel>(i));
176+
google::LogSeverity level = GetMappedSeverity(static_cast<ArrowLogLevel>(i));
177177
google::SetLogDestination(level, dir_ends_with_slash.c_str());
178178
}
179179
}

0 commit comments

Comments
 (0)