arrow-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From w...@apache.org
Subject arrow git commit: ARROW-1220: [C++] Cmake script errors out if lib is not found under *…
Date Sun, 16 Jul 2017 18:40:23 GMT
Repository: arrow
Updated Branches:
  refs/heads/master e438e1517 -> f266f17e0


ARROW-1220: [C++] Cmake script errors out if lib is not found under *…

…_HOME directory

Author: Max Risuhin <risuhin.max@gmail.com>

Closes #850 from MaxRis/ARROW-1220 and squashes the following commits:

ef855c9e [Max Risuhin] ARROW-1220: [C++] Cmake script errors out if lib is not found under
*_HOME directory


Project: http://git-wip-us.apache.org/repos/asf/arrow/repo
Commit: http://git-wip-us.apache.org/repos/asf/arrow/commit/f266f17e
Tree: http://git-wip-us.apache.org/repos/asf/arrow/tree/f266f17e
Diff: http://git-wip-us.apache.org/repos/asf/arrow/diff/f266f17e

Branch: refs/heads/master
Commit: f266f17e023c7ea8391a2d33c2a8f9e5593e3a19
Parents: e438e15
Author: Max Risuhin <risuhin.max@gmail.com>
Authored: Sun Jul 16 14:40:19 2017 -0400
Committer: Wes McKinney <wes.mckinney@twosigma.com>
Committed: Sun Jul 16 14:40:19 2017 -0400

----------------------------------------------------------------------
 appveyor.yml                                |  22 +-
 ci/msvc-build.bat                           |  16 +-
 ci/test-cmake-build-script.bat              | 113 ++++++++++
 cpp/CMakeLists.txt                          |   3 -
 cpp/cmake_modules/ThirdpartyToolchain.cmake | 276 ++++++++++++-----------
 5 files changed, 276 insertions(+), 154 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/arrow/blob/f266f17e/appveyor.yml
----------------------------------------------------------------------
diff --git a/appveyor.yml b/appveyor.yml
index f3ce5a5..c58e1da 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -20,22 +20,31 @@ os: Visual Studio 2015
 
 environment:
   matrix:
-    - GENERATOR: NMake Makefiles
+    - JOB: "Cmake_Script_Tests"
+      GENERATOR: NMake Makefiles
       PYTHON: "3.5"
       ARCH: "64"
       CONFIGURATION: "Release"
-    - GENERATOR: Visual Studio 14 2015 Win64
+    - JOB: "Build"
+      GENERATOR: NMake Makefiles
+      PYTHON: "3.5"
+      ARCH: "64"
+      CONFIGURATION: "Release"
+    - JOB: "Build_Debug"
+      GENERATOR: Visual Studio 14 2015 Win64
       PYTHON: "3.5"
       ARCH: "64"
       CONFIGURATION: "Debug"
-    - GENERATOR: Visual Studio 14 2015 Win64
+    - JOB: "Build"
+      GENERATOR: Visual Studio 14 2015 Win64
       PYTHON: "3.5"
       ARCH: "64"
       CONFIGURATION: "Release"
-    - GENERATOR: Visual Studio 14 2015 Win64
+    - JOB: "Toolchain"
+      GENERATOR: Visual Studio 14 2015 Win64
       PYTHON: "3.5"
       ARCH: "64"
-      CONFIGURATION: "Toolchain"
+      CONFIGURATION: "Release"
 
   MSVC_DEFAULT_OPTIONS: ON
   BOOST_ROOT: C:\Libraries\boost_1_63_0
@@ -49,4 +58,5 @@ init:
 build_script:
   - git config core.symlinks true
   - git reset --hard
-  - call ci\msvc-build.bat
+  - if "%JOB%"=="Cmake_Script_Tests" call ci\test-cmake-build-script.bat
+  - if NOT "%JOB%"=="Cmake_Script_Tests" call ci\msvc-build.bat

http://git-wip-us.apache.org/repos/asf/arrow/blob/f266f17e/ci/msvc-build.bat
----------------------------------------------------------------------
diff --git a/ci/msvc-build.bat b/ci/msvc-build.bat
index c84d12d..be5fd7b 100644
--- a/ci/msvc-build.bat
+++ b/ci/msvc-build.bat
@@ -17,13 +17,13 @@
 
 @echo on
 
-if "%CONFIGURATION%" == "Debug" (
+if "%JOB%" == "Build_Debug" (
   mkdir cpp\build-debug
   pushd cpp\build-debug
 
   cmake -G "%GENERATOR%" ^
         -DARROW_BOOST_USE_SHARED=OFF ^
-        -DCMAKE_BUILD_TYPE=Debug ^
+        -DCMAKE_BUILD_TYPE=%CONFIGURATION% ^
         -DARROW_CXXFLAGS="/MP" ^
         ..  || exit /B
 
@@ -39,7 +39,7 @@ conda update --yes --quiet conda
 conda create -n arrow -q -y python=%PYTHON% ^
       six pytest setuptools numpy pandas cython
 
-if "%CONFIGURATION%" == "Toolchain" (
+if "%JOB%" == "Toolchain" (
   conda install -n arrow -q -y -c conda-forge ^
       flatbuffers rapidjson cmake git boost-cpp ^
       thrift-cpp snappy zlib brotli gflags lz4-c zstd
@@ -47,7 +47,7 @@ if "%CONFIGURATION%" == "Toolchain" (
 
 call activate arrow
 
-if "%CONFIGURATION%" == "Toolchain" (
+if "%JOB%" == "Toolchain" (
   set ARROW_BUILD_TOOLCHAIN=%CONDA_PREFIX%\Library
 )
 
@@ -61,11 +61,11 @@ pushd cpp\build
 cmake -G "%GENERATOR%" ^
       -DCMAKE_INSTALL_PREFIX=%CONDA_PREFIX%\Library ^
       -DARROW_BOOST_USE_SHARED=OFF ^
-      -DCMAKE_BUILD_TYPE=Release ^
+      -DCMAKE_BUILD_TYPE=%CONFIGURATION% ^
       -DARROW_CXXFLAGS="/WX /MP" ^
       -DARROW_PYTHON=ON ^
       ..  || exit /B
-cmake --build . --target INSTALL --config Release  || exit /B
+cmake --build . --target INSTALL --config %CONFIGURATION%  || exit /B
 
 @rem Needed so python-test.exe works
 set PYTHONPATH=%CONDA_PREFIX%\Lib;%CONDA_PREFIX%\Lib\site-packages;%CONDA_PREFIX%\python35.zip;%CONDA_PREFIX%\DLLs;%CONDA_PREFIX%;%PYTHONPATH%
@@ -83,11 +83,11 @@ set PARQUET_BUILD_TOOLCHAIN=%CONDA_PREFIX%\Library
 set PARQUET_HOME=%CONDA_PREFIX%\Library
 cmake -G "%GENERATOR%" ^
      -DCMAKE_INSTALL_PREFIX=%PARQUET_HOME% ^
-     -DCMAKE_BUILD_TYPE=Release ^
+     -DCMAKE_BUILD_TYPE=%CONFIGURATION% ^
      -DPARQUET_BOOST_USE_SHARED=OFF ^
      -DPARQUET_ZLIB_VENDORED=off ^
      -DPARQUET_BUILD_TESTS=off .. || exit /B
-cmake --build . --target INSTALL --config Release || exit /B
+cmake --build . --target INSTALL --config %CONFIGURATION% || exit /B
 popd
 
 @rem Build and import pyarrow

http://git-wip-us.apache.org/repos/asf/arrow/blob/f266f17e/ci/test-cmake-build-script.bat
----------------------------------------------------------------------
diff --git a/ci/test-cmake-build-script.bat b/ci/test-cmake-build-script.bat
new file mode 100644
index 0000000..e37a811
--- /dev/null
+++ b/ci/test-cmake-build-script.bat
@@ -0,0 +1,113 @@
+@rem Licensed to the Apache Software Foundation (ASF) under one
+@rem or more contributor license agreements.  See the NOTICE file
+@rem distributed with this work for additional information
+@rem regarding copyright ownership.  The ASF licenses this file
+@rem to you under the Apache License, Version 2.0 (the
+@rem "License"); you may not use this file except in compliance
+@rem with the License.  You may obtain a copy of the License at
+@rem
+@rem   http://www.apache.org/licenses/LICENSE-2.0
+@rem
+@rem Unless required by applicable law or agreed to in writing,
+@rem software distributed under the License is distributed on an
+@rem "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+@rem KIND, either express or implied.  See the License for the
+@rem specific language governing permissions and limitations
+@rem under the License.
+
+@echo on
+
+conda update --yes --quiet conda
+conda create -n arrow-cmake-script-tests -q -y
+conda install -n arrow-cmake-script-tests -q -y -c conda-forge ^
+cmake git boost-cpp
+call activate arrow-cmake-script-tests
+
+mkdir cpp\build-cmake-test
+pushd cpp\build-cmake-test
+
+echo Test cmake script errors out on flatbuffers missed
+set FLATBUFFERS_HOME=WrongPath
+
+cmake -G "%GENERATOR%" ^
+      -DARROW_BOOST_USE_SHARED=OFF ^
+      -DCMAKE_BUILD_TYPE=%CONFIGURATION% ^
+      -DARROW_CXXFLAGS="/MP" ^
+      .. >nul 2>error.txt
+
+FINDSTR /M /C:"Could not find the Flatbuffers library" error.txt || exit /B
+set FLATBUFFERS_HOME=
+
+echo Test cmake script errors out on gflags missed
+set GFLAGS_HOME=WrongPath
+
+cmake -G "%GENERATOR%" ^
+      -DARROW_BOOST_USE_SHARED=OFF ^
+      -DCMAKE_BUILD_TYPE=%CONFIGURATION% ^
+      -DARROW_CXXFLAGS="/MP" ^
+      .. >nul 2>error.txt
+
+FINDSTR /M /C:"No static or shared library provided for gflags" error.txt || exit /B
+set GFLAGS_HOME=
+
+echo Test cmake script errors out on snappy missed
+set SNAPPY_HOME=WrongPath
+
+cmake -G "%GENERATOR%" ^
+      -DARROW_BOOST_USE_SHARED=OFF ^
+      -DCMAKE_BUILD_TYPE=%CONFIGURATION% ^
+      -DARROW_CXXFLAGS="/MP" ^
+      .. >nul 2>error.txt
+
+FINDSTR /M /C:"Could not find the Snappy library" error.txt || exit /B
+set SNAPPY_HOME=
+
+echo Test cmake script errors out on zlib missed
+set ZLIB_HOME=WrongPath
+
+cmake -G "%GENERATOR%" ^
+      -DARROW_BOOST_USE_SHARED=OFF ^
+      -DCMAKE_BUILD_TYPE=%CONFIGURATION% ^
+      -DARROW_CXXFLAGS="/MP" ^
+      .. >nul 2>error.txt
+
+FINDSTR /M /C:"Could not find the ZLIB library" error.txt || exit /B
+set ZLIB_HOME=
+
+echo Test cmake script errors out on brotli missed
+set BROTLI_HOME=WrongPath
+
+cmake -G "%GENERATOR%" ^
+      -DARROW_BOOST_USE_SHARED=OFF ^
+      -DCMAKE_BUILD_TYPE=%CONFIGURATION% ^
+      -DARROW_CXXFLAGS="/MP" ^
+      .. >nul 2>error.txt
+
+FINDSTR /M /C:"Could not find the Brotli library" error.txt || exit /B
+set BROTLI_HOME=
+
+echo Test cmake script errors out on lz4 missed
+set LZ4_HOME=WrongPath
+
+cmake -G "%GENERATOR%" ^
+      -DARROW_BOOST_USE_SHARED=OFF ^
+      -DCMAKE_BUILD_TYPE=%CONFIGURATION% ^
+      -DARROW_CXXFLAGS="/MP" ^
+      .. >nul 2>error.txt
+
+FINDSTR /M /C:"No static or shared library provided for lz4_static" error.txt || exit /B
+set LZ4_HOME=
+
+echo Test cmake script errors out on zstd missed
+set ZSTD_HOME=WrongPath
+
+cmake -G "%GENERATOR%" ^
+      -DARROW_BOOST_USE_SHARED=OFF ^
+      -DCMAKE_BUILD_TYPE=%CONFIGURATION% ^
+      -DARROW_CXXFLAGS="/MP" ^
+      .. >nul 2>error.txt
+
+FINDSTR /M /C:"Could NOT find ZSTD" error.txt || exit /B
+set ZSTD_HOME=
+
+popd

http://git-wip-us.apache.org/repos/asf/arrow/blob/f266f17e/cpp/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt
index c609850..3146b87 100644
--- a/cpp/CMakeLists.txt
+++ b/cpp/CMakeLists.txt
@@ -162,9 +162,6 @@ if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
     "Build with zstd compression"
     ON)
 
-  option(ARROW_ZLIB_VENDORED
-    "Build our own zlib (some libz.a aren't configured for static linking)"
-    ON)
   if (MSVC)
     set(BROTLI_MSVC_STATIC_LIB_SUFFIX "_static" CACHE STRING
       "Brotli static lib suffix used on Windows with MSVC (default _static)")

http://git-wip-us.apache.org/repos/asf/arrow/blob/f266f17e/cpp/cmake_modules/ThirdpartyToolchain.cmake
----------------------------------------------------------------------
diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake
index ab8fc5d..b9d9823 100644
--- a/cpp/cmake_modules/ThirdpartyToolchain.cmake
+++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake
@@ -450,177 +450,178 @@ message(STATUS "Found hdfs.h at: " ${HDFS_H_PATH})
 
 include_directories(SYSTEM "${HADOOP_HOME}/include")
 
+if (ARROW_WITH_ZLIB)
 # ----------------------------------------------------------------------
 # ZLIB
 
-if (NOT ARROW_ZLIB_VENDORED)
-  find_package(ZLIB)
-endif()
-
-if (NOT ZLIB_FOUND)
-  set(ZLIB_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/zlib_ep/src/zlib_ep-install")
-  set(ZLIB_HOME "${ZLIB_PREFIX}")
-  set(ZLIB_INCLUDE_DIR "${ZLIB_PREFIX}/include")
-  if (MSVC)
-    if (${UPPERCASE_BUILD_TYPE} STREQUAL "DEBUG")
-      set(ZLIB_STATIC_LIB_NAME zlibstaticd.lib)
+  if("${ZLIB_HOME}" STREQUAL "")
+    set(ZLIB_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/zlib_ep/src/zlib_ep-install")
+    set(ZLIB_HOME "${ZLIB_PREFIX}")
+    set(ZLIB_INCLUDE_DIR "${ZLIB_PREFIX}/include")
+    if (MSVC)
+      if (${UPPERCASE_BUILD_TYPE} STREQUAL "DEBUG")
+        set(ZLIB_STATIC_LIB_NAME zlibstaticd.lib)
+      else()
+        set(ZLIB_STATIC_LIB_NAME zlibstatic.lib)
+      endif()
     else()
-      set(ZLIB_STATIC_LIB_NAME zlibstatic.lib)
+      set(ZLIB_STATIC_LIB_NAME libz.a)
     endif()
+    set(ZLIB_STATIC_LIB "${ZLIB_PREFIX}/lib/${ZLIB_STATIC_LIB_NAME}")
+    set(ZLIB_CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
+                        -DCMAKE_INSTALL_PREFIX=${ZLIB_PREFIX}
+                        -DCMAKE_C_FLAGS=${EP_C_FLAGS}
+                        -DBUILD_SHARED_LIBS=OFF)
+
+    ExternalProject_Add(zlib_ep
+      URL "http://zlib.net/fossils/zlib-1.2.8.tar.gz"
+      BUILD_BYPRODUCTS "${ZLIB_STATIC_LIB}"
+      CMAKE_ARGS ${ZLIB_CMAKE_ARGS})
+    set(ZLIB_VENDORED 1)
   else()
-    set(ZLIB_STATIC_LIB_NAME libz.a)
+    find_package(ZLIB REQUIRED)
+    set(ZLIB_VENDORED 0)
   endif()
-  set(ZLIB_STATIC_LIB "${ZLIB_PREFIX}/lib/${ZLIB_STATIC_LIB_NAME}")
-  set(ZLIB_CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-                      -DCMAKE_INSTALL_PREFIX=${ZLIB_PREFIX}
-                      -DCMAKE_C_FLAGS=${EP_C_FLAGS}
-                      -DBUILD_SHARED_LIBS=OFF)
-
-  ExternalProject_Add(zlib_ep
-    URL "http://zlib.net/fossils/zlib-1.2.8.tar.gz"
-    BUILD_BYPRODUCTS "${ZLIB_STATIC_LIB}"
-    CMAKE_ARGS ${ZLIB_CMAKE_ARGS})
-  set(ZLIB_VENDORED 1)
-else()
-  set(ZLIB_VENDORED 0)
-endif()
 
-include_directories(SYSTEM ${ZLIB_INCLUDE_DIR})
-ADD_THIRDPARTY_LIB(zlib
-  STATIC_LIB ${ZLIB_STATIC_LIB})
+  include_directories(SYSTEM ${ZLIB_INCLUDE_DIR})
+  ADD_THIRDPARTY_LIB(zlib
+    STATIC_LIB ${ZLIB_STATIC_LIB})
 
-if (ZLIB_VENDORED)
-  add_dependencies(zlib zlib_ep)
+  if (ZLIB_VENDORED)
+    add_dependencies(zlib zlib_ep)
+  endif()
 endif()
 
+if (ARROW_WITH_SNAPPY)
 # ----------------------------------------------------------------------
 # Snappy
 
-## Snappy
-find_package(Snappy)
-if (NOT SNAPPY_FOUND)
-  set(SNAPPY_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/snappy_ep/src/snappy_ep-install")
-  set(SNAPPY_HOME "${SNAPPY_PREFIX}")
-  set(SNAPPY_INCLUDE_DIR "${SNAPPY_PREFIX}/include")
-  if (MSVC)
-    set(SNAPPY_STATIC_LIB_NAME snappystatic)
-  else()
-    set(SNAPPY_STATIC_LIB_NAME snappy)
-  endif()
-  set(SNAPPY_STATIC_LIB "${SNAPPY_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}${SNAPPY_STATIC_LIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}")
-  set(SNAPPY_SRC_URL "https://github.com/google/snappy/releases/download/${SNAPPY_VERSION}/snappy-${SNAPPY_VERSION}.tar.gz")
-
-  if (${UPPERCASE_BUILD_TYPE} EQUAL "RELEASE")
-    if (APPLE)
-      set(SNAPPY_CXXFLAGS "CXXFLAGS='-DNDEBUG -O1'")
+  if("${SNAPPY_HOME}" STREQUAL "")
+    set(SNAPPY_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/snappy_ep/src/snappy_ep-install")
+    set(SNAPPY_HOME "${SNAPPY_PREFIX}")
+    set(SNAPPY_INCLUDE_DIR "${SNAPPY_PREFIX}/include")
+    if (MSVC)
+      set(SNAPPY_STATIC_LIB_NAME snappystatic)
     else()
-      set(SNAPPY_CXXFLAGS "CXXFLAGS='-DNDEBUG -O2'")
+      set(SNAPPY_STATIC_LIB_NAME snappy)
+    endif()
+    set(SNAPPY_STATIC_LIB "${SNAPPY_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}${SNAPPY_STATIC_LIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}")
+    set(SNAPPY_SRC_URL "https://github.com/google/snappy/releases/download/${SNAPPY_VERSION}/snappy-${SNAPPY_VERSION}.tar.gz")
+
+    if (${UPPERCASE_BUILD_TYPE} EQUAL "RELEASE")
+      if (APPLE)
+        set(SNAPPY_CXXFLAGS "CXXFLAGS='-DNDEBUG -O1'")
+      else()
+        set(SNAPPY_CXXFLAGS "CXXFLAGS='-DNDEBUG -O2'")
+      endif()
     endif()
-  endif()
 
-  if (MSVC)
-    set(SNAPPY_CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-                          "-DCMAKE_CXX_FLAGS=${EP_CXX_FLAGS}"
-                          "-DCMAKE_C_FLAGS=${EX_C_FLAGS}"
-                          "-DCMAKE_INSTALL_PREFIX=${SNAPPY_PREFIX}")
-    set(SNAPPY_UPDATE_COMMAND ${CMAKE_COMMAND} -E copy
-                      ${CMAKE_SOURCE_DIR}/cmake_modules/SnappyCMakeLists.txt
-                      ./CMakeLists.txt &&
-                      ${CMAKE_COMMAND} -E copy
-                      ${CMAKE_SOURCE_DIR}/cmake_modules/SnappyConfig.h
-                      ./config.h)
-    ExternalProject_Add(snappy_ep
-      UPDATE_COMMAND ${SNAPPY_UPDATE_COMMAND}
-      BUILD_IN_SOURCE 1
-      BUILD_COMMAND ${MAKE}
-      INSTALL_DIR ${SNAPPY_PREFIX}
-      URL ${SNAPPY_SRC_URL}
-      CMAKE_ARGS ${SNAPPY_CMAKE_ARGS}
-      BUILD_BYPRODUCTS "${SNAPPY_STATIC_LIB}")
+    if (MSVC)
+      set(SNAPPY_CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
+                            "-DCMAKE_CXX_FLAGS=${EP_CXX_FLAGS}"
+                            "-DCMAKE_C_FLAGS=${EX_C_FLAGS}"
+                            "-DCMAKE_INSTALL_PREFIX=${SNAPPY_PREFIX}")
+      set(SNAPPY_UPDATE_COMMAND ${CMAKE_COMMAND} -E copy
+                        ${CMAKE_SOURCE_DIR}/cmake_modules/SnappyCMakeLists.txt
+                        ./CMakeLists.txt &&
+                        ${CMAKE_COMMAND} -E copy
+                        ${CMAKE_SOURCE_DIR}/cmake_modules/SnappyConfig.h
+                        ./config.h)
+      ExternalProject_Add(snappy_ep
+        UPDATE_COMMAND ${SNAPPY_UPDATE_COMMAND}
+        BUILD_IN_SOURCE 1
+        BUILD_COMMAND ${MAKE}
+        INSTALL_DIR ${SNAPPY_PREFIX}
+        URL ${SNAPPY_SRC_URL}
+        CMAKE_ARGS ${SNAPPY_CMAKE_ARGS}
+        BUILD_BYPRODUCTS "${SNAPPY_STATIC_LIB}")
+    else()
+      ExternalProject_Add(snappy_ep
+        CONFIGURE_COMMAND ./configure --with-pic "--prefix=${SNAPPY_PREFIX}" ${SNAPPY_CXXFLAGS}
+        BUILD_IN_SOURCE 1
+        BUILD_COMMAND ${MAKE}
+        INSTALL_DIR ${SNAPPY_PREFIX}
+        URL ${SNAPPY_SRC_URL}
+        BUILD_BYPRODUCTS "${SNAPPY_STATIC_LIB}")
+    endif()
+    set(SNAPPY_VENDORED 1)
   else()
-    ExternalProject_Add(snappy_ep
-      CONFIGURE_COMMAND ./configure --with-pic "--prefix=${SNAPPY_PREFIX}" ${SNAPPY_CXXFLAGS}
-      BUILD_IN_SOURCE 1
-      BUILD_COMMAND ${MAKE}
-      INSTALL_DIR ${SNAPPY_PREFIX}
-      URL ${SNAPPY_SRC_URL}
-      BUILD_BYPRODUCTS "${SNAPPY_STATIC_LIB}")
+    find_package(Snappy REQUIRED)
+    set(SNAPPY_VENDORED 0)
   endif()
-  set(SNAPPY_VENDORED 1)
-else()
-  set(SNAPPY_VENDORED 0)
-endif()
 
-include_directories(SYSTEM ${SNAPPY_INCLUDE_DIR})
-ADD_THIRDPARTY_LIB(snappy
-  STATIC_LIB ${SNAPPY_STATIC_LIB})
+  include_directories(SYSTEM ${SNAPPY_INCLUDE_DIR})
+  ADD_THIRDPARTY_LIB(snappy
+    STATIC_LIB ${SNAPPY_STATIC_LIB})
 
-if (SNAPPY_VENDORED)
-  add_dependencies(snappy snappy_ep)
+  if (SNAPPY_VENDORED)
+    add_dependencies(snappy snappy_ep)
+  endif()
 endif()
 
+if (ARROW_WITH_BROTLI)
 # ----------------------------------------------------------------------
 # Brotli
 
-find_package(Brotli)
-if (NOT BROTLI_FOUND)
-  set(BROTLI_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/brotli_ep/src/brotli_ep-install")
-  set(BROTLI_HOME "${BROTLI_PREFIX}")
-  set(BROTLI_INCLUDE_DIR "${BROTLI_PREFIX}/include")
-  if (MSVC)
-    set(BROTLI_LIB_DIR bin)
+  if("${BROTLI_HOME}" STREQUAL "")
+    set(BROTLI_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/brotli_ep/src/brotli_ep-install")
+    set(BROTLI_HOME "${BROTLI_PREFIX}")
+    set(BROTLI_INCLUDE_DIR "${BROTLI_PREFIX}/include")
+    if (MSVC)
+      set(BROTLI_LIB_DIR bin)
+    else()
+      set(BROTLI_LIB_DIR lib)
+    endif()
+    set(BROTLI_STATIC_LIBRARY_ENC "${BROTLI_PREFIX}/${BROTLI_LIB_DIR}/${CMAKE_LIBRARY_ARCHITECTURE}/${CMAKE_STATIC_LIBRARY_PREFIX}brotlienc${CMAKE_STATIC_LIBRARY_SUFFIX}")
+    set(BROTLI_STATIC_LIBRARY_DEC "${BROTLI_PREFIX}/${BROTLI_LIB_DIR}/${CMAKE_LIBRARY_ARCHITECTURE}/${CMAKE_STATIC_LIBRARY_PREFIX}brotlidec${CMAKE_STATIC_LIBRARY_SUFFIX}")
+    set(BROTLI_STATIC_LIBRARY_COMMON "${BROTLI_PREFIX}/${BROTLI_LIB_DIR}/${CMAKE_LIBRARY_ARCHITECTURE}/${CMAKE_STATIC_LIBRARY_PREFIX}brotlicommon${CMAKE_STATIC_LIBRARY_SUFFIX}")
+    set(BROTLI_CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
+                          "-DCMAKE_CXX_FLAGS=${EP_CXX_FLAGS}"
+                          "-DCMAKE_C_FLAGS=${EX_C_FLAGS}"
+                          -DCMAKE_INSTALL_PREFIX=${BROTLI_PREFIX}
+                          -DCMAKE_INSTALL_LIBDIR=lib/${CMAKE_LIBRARY_ARCHITECTURE}
+                          -DBUILD_SHARED_LIBS=OFF)
+
+    ExternalProject_Add(brotli_ep
+      URL "https://github.com/google/brotli/archive/${BROTLI_VERSION}.tar.gz"
+      BUILD_BYPRODUCTS "${BROTLI_STATIC_LIBRARY_ENC}" "${BROTLI_STATIC_LIBRARY_DEC}" "${BROTLI_STATIC_LIBRARY_COMMON}"
+      ${BROTLI_BUILD_BYPRODUCTS}
+      CMAKE_ARGS ${BROTLI_CMAKE_ARGS}
+      STEP_TARGETS headers_copy)
+    if (MSVC)
+      ExternalProject_Get_Property(brotli_ep SOURCE_DIR)
+
+      ExternalProject_Add_Step(brotli_ep headers_copy
+        COMMAND xcopy /E /I include ..\\..\\..\\brotli_ep\\src\\brotli_ep-install\\include
/Y
+        DEPENDEES build
+        WORKING_DIRECTORY ${SOURCE_DIR})
+    endif()
+    set(BROTLI_VENDORED 1)
   else()
-    set(BROTLI_LIB_DIR lib)
+    find_package(Brotli REQUIRED)
+    set(BROTLI_VENDORED 0)
   endif()
-  set(BROTLI_STATIC_LIBRARY_ENC "${BROTLI_PREFIX}/${BROTLI_LIB_DIR}/${CMAKE_LIBRARY_ARCHITECTURE}/${CMAKE_STATIC_LIBRARY_PREFIX}brotlienc${CMAKE_STATIC_LIBRARY_SUFFIX}")
-  set(BROTLI_STATIC_LIBRARY_DEC "${BROTLI_PREFIX}/${BROTLI_LIB_DIR}/${CMAKE_LIBRARY_ARCHITECTURE}/${CMAKE_STATIC_LIBRARY_PREFIX}brotlidec${CMAKE_STATIC_LIBRARY_SUFFIX}")
-  set(BROTLI_STATIC_LIBRARY_COMMON "${BROTLI_PREFIX}/${BROTLI_LIB_DIR}/${CMAKE_LIBRARY_ARCHITECTURE}/${CMAKE_STATIC_LIBRARY_PREFIX}brotlicommon${CMAKE_STATIC_LIBRARY_SUFFIX}")
-  set(BROTLI_CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-                        "-DCMAKE_CXX_FLAGS=${EP_CXX_FLAGS}"
-                        "-DCMAKE_C_FLAGS=${EX_C_FLAGS}"
-                        -DCMAKE_INSTALL_PREFIX=${BROTLI_PREFIX}
-                        -DCMAKE_INSTALL_LIBDIR=lib/${CMAKE_LIBRARY_ARCHITECTURE}
-                        -DBUILD_SHARED_LIBS=OFF)
 
-  ExternalProject_Add(brotli_ep
-    URL "https://github.com/google/brotli/archive/${BROTLI_VERSION}.tar.gz"
-    BUILD_BYPRODUCTS "${BROTLI_STATIC_LIBRARY_ENC}" "${BROTLI_STATIC_LIBRARY_DEC}" "${BROTLI_STATIC_LIBRARY_COMMON}"
-    ${BROTLI_BUILD_BYPRODUCTS}
-    CMAKE_ARGS ${BROTLI_CMAKE_ARGS}
-    STEP_TARGETS headers_copy)
-  if (MSVC)
-    ExternalProject_Get_Property(brotli_ep SOURCE_DIR)
-
-    ExternalProject_Add_Step(brotli_ep headers_copy
-      COMMAND xcopy /E /I include ..\\..\\..\\brotli_ep\\src\\brotli_ep-install\\include
/Y
-      DEPENDEES build
-      WORKING_DIRECTORY ${SOURCE_DIR})
+  include_directories(SYSTEM ${BROTLI_INCLUDE_DIR})
+  ADD_THIRDPARTY_LIB(brotli_enc
+    STATIC_LIB ${BROTLI_STATIC_LIBRARY_ENC})
+  ADD_THIRDPARTY_LIB(brotli_dec
+    STATIC_LIB ${BROTLI_STATIC_LIBRARY_DEC})
+  ADD_THIRDPARTY_LIB(brotli_common
+    STATIC_LIB ${BROTLI_STATIC_LIBRARY_COMMON})
+
+  if (BROTLI_VENDORED)
+    add_dependencies(brotli_enc brotli_ep)
+    add_dependencies(brotli_dec brotli_ep)
+    add_dependencies(brotli_common brotli_ep)
   endif()
-  set(BROTLI_VENDORED 1)
-else()
-  set(BROTLI_VENDORED 0)
-endif()
-
-include_directories(SYSTEM ${BROTLI_INCLUDE_DIR})
-ADD_THIRDPARTY_LIB(brotli_enc
-  STATIC_LIB ${BROTLI_STATIC_LIBRARY_ENC})
-ADD_THIRDPARTY_LIB(brotli_dec
-  STATIC_LIB ${BROTLI_STATIC_LIBRARY_DEC})
-ADD_THIRDPARTY_LIB(brotli_common
-  STATIC_LIB ${BROTLI_STATIC_LIBRARY_COMMON})
-
-if (BROTLI_VENDORED)
-  add_dependencies(brotli_enc brotli_ep)
-  add_dependencies(brotli_dec brotli_ep)
-  add_dependencies(brotli_common brotli_ep)
 endif()
 
 if (ARROW_WITH_LZ4)
 # ----------------------------------------------------------------------
 # Lz4
 
-  find_package(Lz4)
-  if (NOT LZ4_FOUND)
+  if("${LZ4_HOME}" STREQUAL "")
     set(LZ4_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/lz4_ep-prefix/src/lz4_ep")
     set(LZ4_INCLUDE_DIR "${LZ4_BUILD_DIR}/lib")
   
@@ -645,6 +646,7 @@ if (ARROW_WITH_LZ4)
   
     set(LZ4_VENDORED 1)
   else()
+    find_package(Lz4 REQUIRED)
     set(LZ4_VENDORED 0)
   endif()
   
@@ -661,8 +663,7 @@ if (ARROW_WITH_ZSTD)
 # ----------------------------------------------------------------------
 # ZSTD
 
-  find_package(ZSTD)
-  if (NOT ZSTD_FOUND)
+  if("${ZSTD_HOME}" STREQUAL "")
     set(ZSTD_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/zstd_ep-prefix/src/zstd_ep")
     set(ZSTD_INCLUDE_DIR "${ZSTD_BUILD_DIR}/lib")
 
@@ -687,6 +688,7 @@ if (ARROW_WITH_ZSTD)
 
     set(ZSTD_VENDORED 1)
   else()
+    find_package(ZSTD REQUIRED)
     set(ZSTD_VENDORED 0)
   endif()
 


Mime
View raw message