diff --git a/appveyor.yml b/appveyor.yml
index 91e9ee26490..55c58d0bf66 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -60,7 +60,7 @@ environment:
init:
- set MINICONDA=C:\Miniconda35-x64
- set PATH=%MINICONDA%;%MINICONDA%/Scripts;%MINICONDA%/Library/bin;%PATH%
- - if "%GENERATOR%"=="NMake Makefiles" call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86_amd64
+ - if "%GENERATOR%"=="NMake Makefiles" call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
build_script:
- git config core.symlinks true
diff --git a/cpp/build-support/lz4_msbuild_wholeprogramoptimization_param.patch b/cpp/build-support/lz4_msbuild_wholeprogramoptimization_param.patch
new file mode 100644
index 00000000000..ee0f8a12054
--- /dev/null
+++ b/cpp/build-support/lz4_msbuild_wholeprogramoptimization_param.patch
@@ -0,0 +1,225 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+diff --git a/visual/VS2010/datagen/datagen.vcxproj b/visual/VS2010/datagen/datagen.vcxproj
+index aaf81ad..67b716f 100644
+--- a/visual/VS2010/datagen/datagen.vcxproj
++++ b/visual/VS2010/datagen/datagen.vcxproj
+@@ -39,15 +39,19 @@
+
+ Application
+ false
+- true
+ Unicode
+
+
+ Application
+ false
+- true
+ Unicode
+
++
++ true
++
++
++ true
++
+
+
+
+diff --git a/visual/VS2010/frametest/frametest.vcxproj b/visual/VS2010/frametest/frametest.vcxproj
+index 76d12c9..723571d 100644
+--- a/visual/VS2010/frametest/frametest.vcxproj
++++ b/visual/VS2010/frametest/frametest.vcxproj
+@@ -39,15 +39,19 @@
+
+ Application
+ false
+- true
+ Unicode
+
+
+ Application
+ false
+- true
+ Unicode
+
++
++ true
++
++
++ true
++
+
+
+
+diff --git a/visual/VS2010/fullbench-dll/fullbench-dll.vcxproj b/visual/VS2010/fullbench-dll/fullbench-dll.vcxproj
+index c10552a..0c8f293 100644
+--- a/visual/VS2010/fullbench-dll/fullbench-dll.vcxproj
++++ b/visual/VS2010/fullbench-dll/fullbench-dll.vcxproj
+@@ -39,15 +39,19 @@
+
+ Application
+ false
+- true
+ Unicode
+
+
+ Application
+ false
+- true
+ Unicode
+
++
++ true
++
++
++ true
++
+
+
+
+diff --git a/visual/VS2010/fullbench/fullbench.vcxproj b/visual/VS2010/fullbench/fullbench.vcxproj
+index e2d95c9..4cd88d0 100644
+--- a/visual/VS2010/fullbench/fullbench.vcxproj
++++ b/visual/VS2010/fullbench/fullbench.vcxproj
+@@ -39,15 +39,19 @@
+
+ Application
+ false
+- true
+ Unicode
+
+
+ Application
+ false
+- true
+ Unicode
+
++
++ true
++
++
++ true
++
+
+
+
+diff --git a/visual/VS2010/fuzzer/fuzzer.vcxproj b/visual/VS2010/fuzzer/fuzzer.vcxproj
+index 85d6c9b..3ddc77d 100644
+--- a/visual/VS2010/fuzzer/fuzzer.vcxproj
++++ b/visual/VS2010/fuzzer/fuzzer.vcxproj
+@@ -39,15 +39,19 @@
+
+ Application
+ false
+- true
+ Unicode
+
+
+ Application
+ false
+- true
+ Unicode
+
++
++ true
++
++
++ true
++
+
+
+
+diff --git a/visual/VS2010/liblz4-dll/liblz4-dll.vcxproj b/visual/VS2010/liblz4-dll/liblz4-dll.vcxproj
+index 389f13c..038a4d2 100644
+--- a/visual/VS2010/liblz4-dll/liblz4-dll.vcxproj
++++ b/visual/VS2010/liblz4-dll/liblz4-dll.vcxproj
+@@ -40,15 +40,19 @@
+
+ DynamicLibrary
+ false
+- true
+ Unicode
+
+
+ DynamicLibrary
+ false
+- true
+ Unicode
+
++
++ true
++
++
++ true
++
+
+
+
+diff --git a/visual/VS2010/liblz4/liblz4.vcxproj b/visual/VS2010/liblz4/liblz4.vcxproj
+index a0b8000..9aad8c2 100644
+--- a/visual/VS2010/liblz4/liblz4.vcxproj
++++ b/visual/VS2010/liblz4/liblz4.vcxproj
+@@ -39,15 +39,19 @@
+
+ StaticLibrary
+ false
+- true
+ Unicode
+
+
+ StaticLibrary
+ false
+- true
+ Unicode
+
++
++ true
++
++
++ true
++
+
+
+
+diff --git a/visual/VS2010/lz4/lz4.vcxproj b/visual/VS2010/lz4/lz4.vcxproj
+index 693e121..7e63f1e 100644
+--- a/visual/VS2010/lz4/lz4.vcxproj
++++ b/visual/VS2010/lz4/lz4.vcxproj
+@@ -39,15 +39,19 @@
+
+ Application
+ false
+- true
+ Unicode
+
+
+ Application
+ false
+- true
+ Unicode
+
++
++ true
++
++
++ true
++
+
+
+
diff --git a/cpp/build-support/zstd_msbuild_wholeprogramoptimization_param.patch b/cpp/build-support/zstd_msbuild_wholeprogramoptimization_param.patch
new file mode 100644
index 00000000000..8bfb928947e
--- /dev/null
+++ b/cpp/build-support/zstd_msbuild_wholeprogramoptimization_param.patch
@@ -0,0 +1,199 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+diff --git a/build/VS2010/datagen/datagen.vcxproj b/build/VS2010/datagen/datagen.vcxproj
+index bd8a213..8e4dc89 100644
+--- a/build/VS2010/datagen/datagen.vcxproj
++++ b/build/VS2010/datagen/datagen.vcxproj
+@@ -39,15 +39,19 @@
+
+ Application
+ false
+- true
+ MultiByte
+
+
+ Application
+ false
+- true
+ MultiByte
+
++
++ true
++
++
++ true
++
+
+
+
+diff --git a/build/VS2010/fullbench-dll/fullbench-dll.vcxproj b/build/VS2010/fullbench-dll/fullbench-dll.vcxproj
+index e697318..82cd4ab 100644
+--- a/build/VS2010/fullbench-dll/fullbench-dll.vcxproj
++++ b/build/VS2010/fullbench-dll/fullbench-dll.vcxproj
+@@ -39,15 +39,19 @@
+
+ Application
+ false
+- true
+ MultiByte
+
+
+ Application
+ false
+- true
+ MultiByte
+
++
++ true
++
++
++ true
++
+
+
+
+diff --git a/build/VS2010/fullbench/fullbench.vcxproj b/build/VS2010/fullbench/fullbench.vcxproj
+index 2bff4ca..ced4047 100644
+--- a/build/VS2010/fullbench/fullbench.vcxproj
++++ b/build/VS2010/fullbench/fullbench.vcxproj
+@@ -39,15 +39,19 @@
+
+ Application
+ false
+- true
+ MultiByte
+
+
+ Application
+ false
+- true
+ MultiByte
+
++
++ true
++
++
++ true
++
+
+
+
+diff --git a/build/VS2010/fuzzer/fuzzer.vcxproj b/build/VS2010/fuzzer/fuzzer.vcxproj
+index 12a4b93..227efd1 100644
+--- a/build/VS2010/fuzzer/fuzzer.vcxproj
++++ b/build/VS2010/fuzzer/fuzzer.vcxproj
+@@ -39,15 +39,19 @@
+
+ Application
+ false
+- true
+ MultiByte
+
+
+ Application
+ false
+- true
+ MultiByte
+
++
++ true
++
++
++ true
++
+
+
+
+diff --git a/build/VS2010/libzstd-dll/libzstd-dll.vcxproj b/build/VS2010/libzstd-dll/libzstd-dll.vcxproj
+index 364b3be..b227320 100644
+--- a/build/VS2010/libzstd-dll/libzstd-dll.vcxproj
++++ b/build/VS2010/libzstd-dll/libzstd-dll.vcxproj
+@@ -94,15 +94,19 @@
+
+ DynamicLibrary
+ false
+- true
+ MultiByte
+
+
+ DynamicLibrary
+ false
+- true
+ MultiByte
+
++
++ true
++
++
++ true
++
+
+
+
+diff --git a/build/VS2010/libzstd/libzstd.vcxproj b/build/VS2010/libzstd/libzstd.vcxproj
+index 6087d73..51a0572 100644
+--- a/build/VS2010/libzstd/libzstd.vcxproj
++++ b/build/VS2010/libzstd/libzstd.vcxproj
+@@ -91,15 +91,19 @@
+
+ StaticLibrary
+ false
+- true
+ MultiByte
+
+
+ StaticLibrary
+ false
+- true
+ MultiByte
+
++
++ true
++
++
++ true
++
+
+
+
+diff --git a/build/VS2010/zstd/zstd.vcxproj b/build/VS2010/zstd/zstd.vcxproj
+index 438dc61..834ae01 100644
+--- a/build/VS2010/zstd/zstd.vcxproj
++++ b/build/VS2010/zstd/zstd.vcxproj
+@@ -100,15 +100,19 @@
+
+ Application
+ false
+- true
+ MultiByte
+
+
+ Application
+ false
+- true
+ MultiByte
+
++
++ true
++
++
++ true
++
+
+
+
diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake
index 721e866e1d6..a5bbe019cb3 100644
--- a/cpp/cmake_modules/ThirdpartyToolchain.cmake
+++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake
@@ -628,15 +628,16 @@ if (ARROW_WITH_LZ4)
if (MSVC)
set(LZ4_STATIC_LIB "${LZ4_BUILD_DIR}/visual/VS2010/bin/x64_${CMAKE_BUILD_TYPE}/liblz4_static.lib")
set(LZ4_BUILD_COMMAND BUILD_COMMAND msbuild.exe /m /p:Configuration=${CMAKE_BUILD_TYPE} /p:Platform=x64 /p:PlatformToolset=v140 /t:Build ${LZ4_BUILD_DIR}/visual/VS2010/lz4.sln)
+ set(LZ4_PATCH_COMMAND PATCH_COMMAND git --git-dir=. apply --verbose ${CMAKE_SOURCE_DIR}/build-support/lz4_msbuild_wholeprogramoptimization_param.patch)
else()
set(LZ4_STATIC_LIB "${LZ4_BUILD_DIR}/lib/liblz4.a")
set(LZ4_BUILD_COMMAND BUILD_COMMAND ${CMAKE_SOURCE_DIR}/build-support/build-lz4-lib.sh)
endif()
-
+
ExternalProject_Add(lz4_ep
URL "https://github.com/lz4/lz4/archive/v${LZ4_VERSION}.tar.gz"
UPDATE_COMMAND ""
- PATCH_COMMAND ""
+ ${LZ4_PATCH_COMMAND}
CONFIGURE_COMMAND ""
INSTALL_COMMAND ""
BINARY_DIR ${LZ4_BUILD_DIR}
@@ -670,6 +671,7 @@ if (ARROW_WITH_ZSTD)
if (MSVC)
set(ZSTD_STATIC_LIB "${ZSTD_BUILD_DIR}/build/VS2010/bin/x64_${CMAKE_BUILD_TYPE}/libzstd_static.lib")
set(ZSTD_BUILD_COMMAND BUILD_COMMAND msbuild ${ZSTD_BUILD_DIR}/build/VS2010/zstd.sln /t:Build /v:minimal /p:Configuration=${CMAKE_BUILD_TYPE} /p:Platform=x64 /p:PlatformToolset=v140 /p:OutDir=${ZSTD_BUILD_DIR}/build/VS2010/bin/x64_${CMAKE_BUILD_TYPE}/ /p:SolutionDir=${ZSTD_BUILD_DIR}/build/VS2010/ )
+ set(ZSTD_PATCH_COMMAND PATCH_COMMAND git --git-dir=. apply --verbose ${CMAKE_SOURCE_DIR}/build-support/zstd_msbuild_wholeprogramoptimization_param.patch)
else()
set(ZSTD_STATIC_LIB "${ZSTD_BUILD_DIR}/lib/libzstd.a")
set(ZSTD_BUILD_COMMAND BUILD_COMMAND ${CMAKE_SOURCE_DIR}/build-support/build-zstd-lib.sh)
@@ -678,7 +680,7 @@ if (ARROW_WITH_ZSTD)
ExternalProject_Add(zstd_ep
URL "https://github.com/facebook/zstd/archive/v${ZSTD_VERSION}.tar.gz"
UPDATE_COMMAND ""
- PATCH_COMMAND ""
+ ${ZSTD_PATCH_COMMAND}
CONFIGURE_COMMAND ""
INSTALL_COMMAND ""
BINARY_DIR ${ZSTD_BUILD_DIR}