Skip to content

Commit

Permalink
fix glog::glog include dirs
Browse files Browse the repository at this point in the history
  • Loading branch information
assignUser committed Nov 21, 2024
1 parent 91389e3 commit 81a8540
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions CMake/resolve_dependency_modules/glog.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,35 @@ FetchContent_Declare(
URL_HASH ${VELOX_GLOG_BUILD_SHA256_CHECKSUM}
PATCH_COMMAND
git apply ${CMAKE_CURRENT_LIST_DIR}/glog/glog-no-export.patch && git apply
${CMAKE_CURRENT_LIST_DIR}/glog/glog-config.patch OVERRIDE_FIND_PACKAGE
${CMAKE_CURRENT_LIST_DIR}/glog/glog-config.patch SYSTEM OVERRIDE_FIND_PACKAGE
EXCLUDE_FROM_ALL)

set(BUILD_SHARED_LIBS ${VELOX_BUILD_SHARED})
set(WITH_UNWIND OFF)
set(gflags_NAMESPACE google)
set(BUILD_TESTING OFF)
FetchContent_MakeAvailable(glog)
unset(BUILD_TESTING)
unset(BUILD_SHARED_LIBS)

# Folly used variables instead of targets
# Folly uses variables instead of targets
set(glog_LIBRARY glog::glog)

unset(BUILD_TESTING)
unset(BUILD_SHARED_LIBS)
add_dependencies(glog gflags::gflags)

# The default target has the glog-src as an include dir but this causes issues
# with folly due to an internal glog 'demangle.h' being mistaken for a system
# header so we remove glog_SOURCE_DIR by overwriting
# INTERFACE_INCLUDE_DIRECTORIES
get_target_property(
_glog_target glog::glog ALIASED_TARGET) # Can't set properties on ALIAS
# targets
set_target_properties(
${_glog_target}
PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${glog_BINARY_DIR})

# These headers are missing from glog_BINARY_DIR
file(COPY ${glog_SOURCE_DIR}/src/glog/platform.h
DESTINATION ${glog_BINARY_DIR}/glog)
file(COPY ${glog_SOURCE_DIR}/src/glog/log_severity.h
DESTINATION ${glog_BINARY_DIR}/glog)

0 comments on commit 81a8540

Please sign in to comment.