diff --git a/cpp/cmake_modules/BuildUtils.cmake b/cpp/cmake_modules/BuildUtils.cmake index e4e13cb70..58ca626da 100644 --- a/cpp/cmake_modules/BuildUtils.cmake +++ b/cpp/cmake_modules/BuildUtils.cmake @@ -335,7 +335,7 @@ function(ADD_ARROW_LIB LIB_NAME) target_include_directories(${LIB_NAME}_static PRIVATE ${ARG_PRIVATE_INCLUDES}) endif() - if(MSVC) + if(MSVC AND 0) set(LIB_NAME_STATIC ${LIB_NAME}_static) else() set(LIB_NAME_STATIC ${LIB_NAME}) diff --git a/cpp/cmake_modules/FindBrotli.cmake b/cpp/cmake_modules/FindBrotli.cmake index bf47915c4..053e605a0 100644 --- a/cpp/cmake_modules/FindBrotli.cmake +++ b/cpp/cmake_modules/FindBrotli.cmake @@ -64,8 +64,7 @@ if(BROTLI_ROOT) PATH_SUFFIXES ${INCLUDE_PATH_SUFFIXES} NO_DEFAULT_PATH) else() - pkg_check_modules(BROTLI_PC libbrotlicommon libbrotlienc libbrotlidec) - if(BROTLI_PC_FOUND) + if(0) # Find via pkg_check_modules disabled as incompatible with vcpkg set(BROTLI_INCLUDE_DIR "${BROTLI_PC_libbrotlicommon_INCLUDEDIR}") # Some systems (e.g. Fedora) don't fill Brotli_LIBRARY_DIRS, so add the other dirs here. diff --git a/cpp/cmake_modules/FindLz4.cmake b/cpp/cmake_modules/FindLz4.cmake index 841091643..a196b251d 100644 --- a/cpp/cmake_modules/FindLz4.cmake +++ b/cpp/cmake_modules/FindLz4.cmake @@ -19,14 +19,16 @@ if(MSVC AND NOT DEFINED LZ4_MSVC_STATIC_LIB_SUFFIX) set(LZ4_MSVC_STATIC_LIB_SUFFIX "_static") endif() -set(LZ4_STATIC_LIB_SUFFIX "${LZ4_MSVC_STATIC_LIB_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}") +if(CMAKE_BUILD_TYPE STREQUAL "DEBUG") + set(LZ4_LIB_NAME_DEBUG_SUFFIX d) +endif() -set(LZ4_STATIC_LIB_NAME ${CMAKE_STATIC_LIBRARY_PREFIX}lz4${LZ4_STATIC_LIB_SUFFIX}) +set(LZ4_STATIC_LIB_NAME ${CMAKE_STATIC_LIBRARY_PREFIX}lz4${LZ4_MSVC_STATIC_LIB_SUFFIX}${LZ4_LIB_NAME_DEBUG_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}) if(LZ4_ROOT) find_library( LZ4_LIB - NAMES lz4 ${LZ4_STATIC_LIB_NAME} lib${LZ4_STATIC_LIB_NAME} + NAMES lz4${LZ4_LIB_NAME_DEBUG_SUFFIX} ${LZ4_STATIC_LIB_NAME} lib${LZ4_STATIC_LIB_NAME} "${CMAKE_SHARED_LIBRARY_PREFIX}lz4_static${CMAKE_SHARED_LIBRARY_SUFFIX}" PATHS ${LZ4_ROOT} PATH_SUFFIXES ${LIB_PATH_SUFFIXES} @@ -43,14 +45,14 @@ else() set(LZ4_INCLUDE_DIR "${LZ4_PC_INCLUDEDIR}") list(APPEND LZ4_PC_LIBRARY_DIRS "${LZ4_PC_LIBDIR}") - find_library(LZ4_LIB lz4 + find_library(LZ4_LIB lz4${LZ4_LIB_NAME_DEBUG_SUFFIX} ${LZ4_STATIC_LIB_NAME} lib${LZ4_STATIC_LIB_NAME} PATHS ${LZ4_PC_LIBRARY_DIRS} NO_DEFAULT_PATH PATH_SUFFIXES ${LIB_PATH_SUFFIXES}) else() find_library( LZ4_LIB - NAMES lz4 ${LZ4_STATIC_LIB_NAME} lib${LZ4_STATIC_LIB_NAME} + NAMES lz4${LZ4_LIB_NAME_DEBUG_SUFFIX} ${LZ4_STATIC_LIB_NAME} lib${LZ4_STATIC_LIB_NAME} "${CMAKE_SHARED_LIBRARY_PREFIX}lz4_static${CMAKE_SHARED_LIBRARY_SUFFIX}" PATH_SUFFIXES ${LIB_PATH_SUFFIXES}) find_path(LZ4_INCLUDE_DIR NAMES lz4.h PATH_SUFFIXES ${INCLUDE_PATH_SUFFIXES}) diff --git a/cpp/cmake_modules/FindThrift.cmake b/cpp/cmake_modules/FindThrift.cmake index bb3eb5608..0b03d37d3 100644 --- a/cpp/cmake_modules/FindThrift.cmake +++ b/cpp/cmake_modules/FindThrift.cmake @@ -43,6 +43,10 @@ if(MSVC AND NOT THRIFT_MSVC_STATIC_LIB_SUFFIX) set(THRIFT_MSVC_STATIC_LIB_SUFFIX md) endif() +if(CMAKE_BUILD_TYPE STREQUAL "DEBUG") + set(THRIFT_LIB_NAME_DEBUG_SUFFIX d) +endif() + if(Thrift_ROOT) find_library(THRIFT_STATIC_LIB thrift${THRIFT_MSVC_STATIC_LIB_SUFFIX} PATHS ${Thrift_ROOT} @@ -61,16 +65,14 @@ else() list(APPEND THRIFT_PC_LIBRARY_DIRS "${THRIFT_PC_LIBDIR}") - find_library(THRIFT_STATIC_LIB thrift${THRIFT_MSVC_STATIC_LIB_SUFFIX} - PATHS ${THRIFT_PC_LIBRARY_DIRS} - NO_DEFAULT_PATH) + find_library(THRIFT_STATIC_LIB thrift${THRIFT_MSVC_STATIC_LIB_SUFFIX}${THRIFT_LIB_NAME_DEBUG_SUFFIX} + PATHS ${THRIFT_PC_LIBRARY_DIRS}) find_program(THRIFT_COMPILER thrift HINTS ${THRIFT_PC_PREFIX} - NO_DEFAULT_PATH PATH_SUFFIXES "bin") set(THRIFT_VERSION ${THRIFT_PC_VERSION}) else() - find_library(THRIFT_STATIC_LIB thrift${THRIFT_MSVC_STATIC_LIB_SUFFIX} + find_library(THRIFT_STATIC_LIB thrift${THRIFT_MSVC_STATIC_LIB_SUFFIX}${THRIFT_LIB_NAME_DEBUG_SUFFIX} PATH_SUFFIXES "lib/${CMAKE_LIBRARY_ARCHITECTURE}" "lib") find_path(THRIFT_INCLUDE_DIR thrift/Thrift.h PATH_SUFFIXES "include") find_program(THRIFT_COMPILER thrift PATH_SUFFIXES "bin") diff --git a/cpp/cmake_modules/FindZSTD.cmake b/cpp/cmake_modules/FindZSTD.cmake index 8e47086e8..d87906a25 100644 --- a/cpp/cmake_modules/FindZSTD.cmake +++ b/cpp/cmake_modules/FindZSTD.cmake @@ -19,14 +19,18 @@ if(MSVC AND NOT DEFINED ZSTD_MSVC_STATIC_LIB_SUFFIX) set(ZSTD_MSVC_STATIC_LIB_SUFFIX "_static") endif() -set(ZSTD_STATIC_LIB_SUFFIX "${ZSTD_MSVC_STATIC_LIB_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}") +if(CMAKE_BUILD_TYPE STREQUAL "DEBUG") + set(ZSTD_LIB_NAME_DEBUG_SUFFIX d) +endif() + +set(ZSTD_STATIC_LIB_SUFFIX "${ZSTD_MSVC_STATIC_LIB_SUFFIX}${ZSTD_LIB_NAME_DEBUG_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}") set(ZSTD_STATIC_LIB_NAME ${CMAKE_STATIC_LIBRARY_PREFIX}zstd${ZSTD_STATIC_LIB_SUFFIX}) # First, find via if specified ZTD_ROOT if(ZSTD_ROOT) message(STATUS "Using ZSTD_ROOT: ${ZSTD_ROOT}") find_library(ZSTD_LIB - NAMES zstd "${ZSTD_STATIC_LIB_NAME}" "lib${ZSTD_STATIC_LIB_NAME}" + NAMES zstd${ZSTD_LIB_NAME_DEBUG_SUFFIX} "${ZSTD_STATIC_LIB_NAME}" "lib${ZSTD_STATIC_LIB_NAME}" "${CMAKE_SHARED_LIBRARY_PREFIX}zstd${CMAKE_SHARED_LIBRARY_SUFFIX}" PATHS ${ZSTD_ROOT} PATH_SUFFIXES ${LIB_PATH_SUFFIXES} @@ -39,19 +43,18 @@ if(ZSTD_ROOT) else() # Second, find via pkg_check_modules - pkg_check_modules(ZSTD_PC libzstd) - if(ZSTD_PC_FOUND) + if(0) # Disabled as incompatible with vcpkg set(ZSTD_INCLUDE_DIR "${ZSTD_PC_INCLUDEDIR}") list(APPEND ZSTD_PC_LIBRARY_DIRS "${ZSTD_PC_LIBDIR}") - find_library(ZSTD_LIB zstd + find_library(ZSTD_LIB zstd${ZSTD_LIB_NAME_DEBUG_SUFFIX} PATHS ${ZSTD_PC_LIBRARY_DIRS} NO_DEFAULT_PATH PATH_SUFFIXES ${LIB_PATH_SUFFIXES}) # Third, check all other CMake paths else() find_library(ZSTD_LIB - NAMES zstd "${ZSTD_STATIC_LIB_NAME}" "lib${ZSTD_STATIC_LIB_NAME}" + NAMES zstd${ZSTD_LIB_NAME_DEBUG_SUFFIX} "${ZSTD_STATIC_LIB_NAME}" "lib${ZSTD_STATIC_LIB_NAME}" "${CMAKE_SHARED_LIBRARY_PREFIX}zstd${CMAKE_SHARED_LIBRARY_SUFFIX}" PATH_SUFFIXES ${LIB_PATH_SUFFIXES}) find_path(ZSTD_INCLUDE_DIR NAMES zstd.h PATH_SUFFIXES ${INCLUDE_PATH_SUFFIXES}) diff --git a/cpp/cmake_modules/SetupCxxFlags.cmake b/cpp/cmake_modules/SetupCxxFlags.cmake index 6110a5aa5..3270d74a9 100644 --- a/cpp/cmake_modules/SetupCxxFlags.cmake +++ b/cpp/cmake_modules/SetupCxxFlags.cmake @@ -163,7 +163,9 @@ macro(arrow_add_werror_if_debug) if("${CMAKE_BUILD_TYPE}" STREQUAL "DEBUG") # Treat all compiler warnings as errors if(MSVC) - set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} /WX") + if(MSVC_VERSION VERSION_LESS 1900) + set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} /WX") + endif() else() set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} -Werror") endif()