diff --git a/cpp/cmake_modules/FindPython3Alt.cmake b/cpp/cmake_modules/FindPython3Alt.cmake
index ab91c7be052..80b69ccfab7 100644
--- a/cpp/cmake_modules/FindPython3Alt.cmake
+++ b/cpp/cmake_modules/FindPython3Alt.cmake
@@ -65,9 +65,24 @@ endif()
set(PYTHON_EXECUTABLE ${Python3_EXECUTABLE})
set(PYTHON_INCLUDE_DIRS ${Python3_INCLUDE_DIRS})
-set(PYTHON_LIBRARIES ${Python3_LIBRARIES})
set(PYTHON_OTHER_LIBS)
+# On Windows, debug builds of Python will have format:
+# "optimized python3x.lib debug python3xd.lib"
+list(LENGTH Python3_LIBRARIES NUM_LIBS)
+if(NUM_LIBS EQUAL 4)
+ if("${CMAKE_BUILD_TYPE}" STREQUAL "DEBUG")
+ list(SUBLIST Python3_LIBRARIES 3 1 PYTHON_LIBRARIES)
+ else()
+ list(SUBLIST Python3_LIBRARIES 1 1 PYTHON_LIBRARIES)
+ endif()
+else()
+ set(PYTHON_LIBRARIES ${Python3_LIBRARIES})
+endif()
+unset(NUM_LIBS)
+
+message("Python libraries: ${PYTHON_LIBRARIES}")
+
get_target_property(NUMPY_INCLUDE_DIRS Python3::NumPy INTERFACE_INCLUDE_DIRECTORIES)
# CMake's python3_add_library() doesn't apply the required extension suffix,
diff --git a/cpp/cmake_modules/FindThrift.cmake b/cpp/cmake_modules/FindThrift.cmake
index 750d8ce8341..dd54fd10f9a 100644
--- a/cpp/cmake_modules/FindThrift.cmake
+++ b/cpp/cmake_modules/FindThrift.cmake
@@ -46,9 +46,17 @@ endfunction(EXTRACT_THRIFT_VERSION)
if(MSVC_TOOLCHAIN AND NOT DEFINED THRIFT_MSVC_LIB_SUFFIX)
if(NOT ARROW_THRIFT_USE_SHARED)
if(ARROW_USE_STATIC_CRT)
- set(THRIFT_MSVC_LIB_SUFFIX "mt")
+ if("${CMAKE_BUILD_TYPE}" STREQUAL "DEBUG")
+ set(THRIFT_MSVC_LIB_SUFFIX "mtd")
+ else()
+ set(THRIFT_MSVC_LIB_SUFFIX "mt")
+ endif()
else()
- set(THRIFT_MSVC_LIB_SUFFIX "md")
+ if("${CMAKE_BUILD_TYPE}" STREQUAL "DEBUG")
+ set(THRIFT_MSVC_LIB_SUFFIX "mdd")
+ else()
+ set(THRIFT_MSVC_LIB_SUFFIX "md")
+ endif()
endif()
endif()
endif()
diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake
index c35b9e3102a..0872ad9cb27 100644
--- a/cpp/cmake_modules/ThirdpartyToolchain.cmake
+++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake
@@ -79,7 +79,7 @@ set(ARROW_THIRDPARTY_DEPENDENCIES
# supported when building with MSVC because of the way that
# conda-forge packages have 4 variants of the libraries packaged
# together
-if(MSVC AND "${GTest_SOURCE}" STREQUAL "")
+if(MSVC AND "${GTest_SOURCE}" STREQUAL "" AND "${ARROW_DEPENDENCY_SOURCE}" STREQUAL "CONDA")
set(GTest_SOURCE "BUNDLED")
endif()
@@ -228,6 +228,7 @@ macro(resolve_dependency DEPENDENCY_NAME)
list(APPEND FIND_PACKAGE_ARGUMENTS CONFIG)
endif()
if(${DEPENDENCY_NAME}_SOURCE STREQUAL "AUTO")
+ message("Finding auto package with args: ${FIND_PACKAGE_ARGUMENTS}")
find_package(${FIND_PACKAGE_ARGUMENTS})
if(${${PACKAGE_NAME}_FOUND})
set(${DEPENDENCY_NAME}_SOURCE "SYSTEM")
@@ -236,8 +237,10 @@ macro(resolve_dependency DEPENDENCY_NAME)
set(${DEPENDENCY_NAME}_SOURCE "BUNDLED")
endif()
elseif(${DEPENDENCY_NAME}_SOURCE STREQUAL "BUNDLED")
+ message("Finding bundled package with args: ${FIND_PACKAGE_ARGUMENTS}")
build_dependency(${DEPENDENCY_NAME})
elseif(${DEPENDENCY_NAME}_SOURCE STREQUAL "SYSTEM")
+ message("Finding package with args: ${FIND_PACKAGE_ARGUMENTS}")
find_package(${FIND_PACKAGE_ARGUMENTS} REQUIRED)
endif()
if(${DEPENDENCY_NAME}_SOURCE STREQUAL "SYSTEM" AND ARG_IS_RUNTIME_DEPENDENCY)
diff --git a/cpp/cmake_modules/Usevcpkg.cmake b/cpp/cmake_modules/Usevcpkg.cmake
index 06ac4dd075d..cef31f16b44 100644
--- a/cpp/cmake_modules/Usevcpkg.cmake
+++ b/cpp/cmake_modules/Usevcpkg.cmake
@@ -235,6 +235,9 @@ set(BROTLI_ROOT
set(LZ4_ROOT
"${ARROW_VCPKG_PREFIX}"
CACHE STRING "")
+set(GTEST_ROOT
+ "${ARROW_VCPKG_PREFIX}"
+ CACHE STRING "")
if(CMAKE_HOST_WIN32)
set(LZ4_MSVC_LIB_PREFIX
diff --git a/docs/source/developers/cpp/windows.rst b/docs/source/developers/cpp/windows.rst
index b2c0c238ff2..6494354e96c 100644
--- a/docs/source/developers/cpp/windows.rst
+++ b/docs/source/developers/cpp/windows.rst
@@ -45,6 +45,12 @@ For Visual Studio 2019, the script is:
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\VsDevCmd.bat" -arch=amd64
+For Visual Studio 2022, the script is:
+
+.. code-block:: shell
+
+ "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools\VsDevCmd.bat" -arch=amd64
+
One can configure a console emulator like `cmder `_ to
automatically launch this when starting a new development console.
@@ -183,7 +189,7 @@ Building with Ninja and clcache
The `Ninja `_ build system offers better build
parallelization, and the optional `clcache
-`_ compiler cache keeps track of
+`_ compiler cache keeps track of
past compilations to avoid running them over and over again (in a way similar
to the Unix-specific ``ccache``).
@@ -196,11 +202,9 @@ If Ninja is not included in your version of Visual Studio, and you are using
conda, activate your conda environment and install Ninja and clcache:
.. code-block:: shell
-
activate arrow-dev
conda install -c conda-forge ninja
- pip install git+https://github.com/frerich/clcache.git
-
+ pip install git+https://github.com/Nuitka/clcache.git
If you are not using conda,
`install Ninja from another source `_
and optionally
@@ -227,7 +231,6 @@ of ``cmake`` is the preferred method of using ``clcache``. Alternatively, you
can set ``CC`` and ``CXX`` environment variables before calling ``cmake``:
.. code-block:: shell
-
...
set CC=clcache
set CXX=clcache
@@ -414,7 +417,6 @@ tests can be made with there individual make targets).
SET JOB=Static_Crt_Build
SET GENERATOR=Ninja
SET APPVEYOR_BUILD_WORKER_IMAGE=Visual Studio 2017
- SET USE_CLCACHE=false
SET ARROW_BUILD_GANDIVA=OFF
SET ARROW_LLVM_VERSION=8.0.*
SET PYTHON=3.9