diff --git a/cpp/cmake_modules/BuildUtils.cmake b/cpp/cmake_modules/BuildUtils.cmake index f5f0ad7..3dca82e 100644 --- a/cpp/cmake_modules/BuildUtils.cmake +++ b/cpp/cmake_modules/BuildUtils.cmake @@ -305,7 +305,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/FindLz4.cmake b/cpp/cmake_modules/FindLz4.cmake index 8410916..a196b25 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 f9d6296..82b8d22 100644 --- a/cpp/cmake_modules/FindThrift.cmake +++ b/cpp/cmake_modules/FindThrift.cmake @@ -54,6 +54,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} @@ -74,16 +78,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 8e47086..d7ce559 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} @@ -44,14 +48,14 @@ else() 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 75b33c2..80cac9a 100644 --- a/cpp/cmake_modules/SetupCxxFlags.cmake +++ b/cpp/cmake_modules/SetupCxxFlags.cmake @@ -128,7 +128,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()