Skip to content

Commit

Permalink
Fix building with system-installed Arrow library (round 2nd)
Browse files Browse the repository at this point in the history
  • Loading branch information
ljishen authored Aug 17, 2022
1 parent e1f4cc3 commit 9aad712
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
5 changes: 3 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ FetchContent_Declare(
_project_options
# Ensure anything that depends on the extracted contents will be rebuilt
# whenever the URL changes
DOWNLOAD_EXTRACT_TIMESTAMP True
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
URL https://github.com/aminya/project_options/archive/refs/tags/v0.24.1.zip)
FetchContent_MakeAvailable(_project_options)
include("${_project_options_SOURCE_DIR}/Index.cmake")
Expand Down Expand Up @@ -131,7 +131,8 @@ project(
HOMEPAGE_URL "https://github.com/ljishen/bitar"
LANGUAGES CXX C)

# Ensure that the PC files installed by vcpkg has the highest priority
set(old_PKG_CONFIG_PATH "$ENV{PKG_CONFIG_PATH}")
# Ensure that the .pc files installed by vcpkg has the highest priority
if(NOT DEFINED CMAKE_BUILD_TYPE OR CMAKE_BUILD_TYPE MATCHES
"^[Dd][Ee][Bb][Uu][Gg]$")
prepend_path_to_env(
Expand Down
13 changes: 12 additions & 1 deletion cmake_modules/FindArrow.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@
# ~~~

if(NOT BITAR_BUILD_ARROW)
# Temporarily remove the path to the .pc files installed by vcpkg to allow
# looking for system-installed libraries only when we do not intend to build
# Arrow.
set(_backup_PKG_CONFIG_PATH "$ENV{PKG_CONFIG_PATH}")
set(ENV{PKG_CONFIG_PATH} "${old_PKG_CONFIG_PATH}")
set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH FALSE)

if(ARROW_PARQUET)
# Since the Parquet library depends on the Arrow library, finding the
# Parquet library will import the Arrow library as well.
Expand Down Expand Up @@ -63,6 +70,10 @@ if(NOT BITAR_BUILD_ARROW)
OFF
CACHE INTERNAL "Build the Parquet libraries")
endif()

set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH TRUE)
set(ENV{PKG_CONFIG_PATH} "${_backup_PKG_CONFIG_PATH}")
unset(_backup_PKG_CONFIG_PATH)
endif()

if(${CMAKE_FIND_PACKAGE_NAME}_FOUND AND (NOT ARROW_PARQUET OR Parquet_FOUND))
Expand Down Expand Up @@ -233,7 +244,7 @@ else()
unset(_backup_CMAKE_INTERPROCEDURAL_OPTIMIZATION)
endif()

set(Arrow_IS_BUILT True) # Arrow is built by this project
set(Arrow_IS_BUILT TRUE) # Arrow is built by this project

set(required_vars ${${_find_package_name_lower}_POPULATED})

Expand Down
4 changes: 2 additions & 2 deletions cmake_modules/Finddpdk.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ set_target_properties(DPDK::dpdk PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
target_compile_options(DPDK::dpdk INTERFACE ${DPDK_STATIC_CFLAGS})
target_link_libraries(DPDK::dpdk INTERFACE ${DPDK_STATIC_LDFLAGS})

set(dpdk_IS_BUILT True) # dpdk is built by this project via vcpkg
set(dpdk_IS_BUILT TRUE) # dpdk is built by this project via vcpkg
if(DEFINED VCPKG_INSTALLED_DIR AND DEFINED VCPKG_TARGET_TRIPLET)
file(REAL_PATH "${DPDK_PREFIX}" dpdk_prefix_abs)
file(REAL_PATH "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}"
Expand All @@ -56,7 +56,7 @@ if(DEFINED VCPKG_INSTALLED_DIR AND DEFINED VCPKG_TARGET_TRIPLET)
unset(vcpkg_triplet_dir_abs)
unset(dpdk_prefix_abs)
else()
set(dpdk_IS_BUILT False)
set(dpdk_IS_BUILT FALSE)
endif()

# Add the OpenSSL dependency for dpdk openssl driver
Expand Down

0 comments on commit 9aad712

Please sign in to comment.