diff --git a/cdk/cmake/DepFindProtobuf.cmake b/cdk/cmake/DepFindProtobuf.cmake index e3726831f..0dd5b4d53 100644 --- a/cdk/cmake/DepFindProtobuf.cmake +++ b/cdk/cmake/DepFindProtobuf.cmake @@ -95,6 +95,17 @@ if(CMAKE_GENERATOR_TOOLSET) set(set_toolset -T ${CMAKE_GENERATOR_TOOLSET}) endif() +# CMAKE_HOST_SYSTEM_NAME +set(set_system_name) +if(CMAKE_SYSTEM_NAME) + set(set_system_name -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}) +endif() + +set(set_system_processor) +if(CMAKE_SYSTEM_PROCESSOR) + set(set_system_processor -DCMAKE_SYSTEM_PROCESSOR=${CMAKE_SYSTEM_PROCESSOR}) +endif() + if(NOT EXISTS "${PB_BINARY_DIR}/exports.cmake") message("==== Configuring Protobuf build using cmake generator: ${CMAKE_GENERATOR} ${set_arch} ${set_toolset}") @@ -114,6 +125,8 @@ if(NOT EXISTS "${PB_BINARY_DIR}/exports.cmake") ${set_arch} ${set_toolset} ${set_build_type} + ${set_system_name} + ${set_system_processor} -DSTATIC_MSVCRT=${STATIC_MSVCRT} -DCMAKE_POSITION_INDEPENDENT_CODE=${CMAKE_POSITION_INDEPENDENT_CODE} -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} @@ -322,7 +335,8 @@ function(mysqlx_protobuf_generate_cpp SRCS HDRS) set_source_files_properties(${srcs} APPEND_STRING PROPERTY COMPILE_FLAGS "-w" ) - ELSE(WIN32) + ENDIF() + IF(MSVC) set_source_files_properties(${srcs} APPEND_STRING PROPERTY COMPILE_FLAGS "/W1 /wd4018 /wd4996 /wd4244 /wd4267" diff --git a/cdk/extra/zlib/CMakeLists.txt b/cdk/extra/zlib/CMakeLists.txt index b80a084af..f6fb4bdca 100644 --- a/cdk/extra/zlib/CMakeLists.txt +++ b/cdk/extra/zlib/CMakeLists.txt @@ -141,7 +141,7 @@ string(REGEX REPLACE ".*#define[ \t]+ZLIB_VERSION[ \t]+\"([-0-9A-Za-z.]+)\".*" # ------------------------------------------------------------------------- # Disable compile warnings -if(WIN32) +if(MSVC) add_compile_options( /wd4996 diff --git a/cdk/foundation/CMakeLists.txt b/cdk/foundation/CMakeLists.txt index 0a34c7d7e..f9b7c00e3 100644 --- a/cdk/foundation/CMakeLists.txt +++ b/cdk/foundation/CMakeLists.txt @@ -94,7 +94,11 @@ target_link_libraries(cdk_foundation ) IF(WIN32) - target_link_libraries(cdk_foundation PRIVATE Dnsapi) + if(MSVC) + target_link_libraries(cdk_foundation PRIVATE Dnsapi) + else() + target_link_libraries(cdk_foundation PRIVATE dnsapi) + endif() ELSEIF(NOT FREEBSD) target_link_libraries(cdk_foundation PRIVATE resolv) ENDIF() diff --git a/cdk/foundation/connection_openssl.cc b/cdk/foundation/connection_openssl.cc index 2f00503f1..95aa4de52 100644 --- a/cdk/foundation/connection_openssl.cc +++ b/cdk/foundation/connection_openssl.cc @@ -49,7 +49,7 @@ POP_SYS_WARNINGS_CDK #pragma comment directive. */ -#ifdef _WIN32 +#ifdef _MSC_VER #pragma comment(lib,"ws2_32") #if defined(WITH_SSL) #if OPENSSL_VERSION_NUMBER < 0x10100000L diff --git a/cdk/foundation/socket_detail.cc b/cdk/foundation/socket_detail.cc index 1bb2b7b49..9ba45aa33 100644 --- a/cdk/foundation/socket_detail.cc +++ b/cdk/foundation/socket_detail.cc @@ -74,6 +74,8 @@ namespace detail { Used for handling Winsock errors. */ +const error_category& winsock_error_category(); + class error_category_winsock : public error_category_base { error_category_winsock() {} @@ -844,7 +846,7 @@ int poll_one(Socket socket, Poll_mode mode, bool wait, DIAGNOSTIC_PUSH_CDK -#ifdef _WIN32 +#ifdef _MSC_VER // 4548 = expression has no effect // This warning is generated by FD_SET DISABLE_WARNING_CDK(4548) diff --git a/cdk/mysqlx/CMakeLists.txt b/cdk/mysqlx/CMakeLists.txt index c92d8004d..afacde65f 100644 --- a/cdk/mysqlx/CMakeLists.txt +++ b/cdk/mysqlx/CMakeLists.txt @@ -33,7 +33,7 @@ ADD_DEFINITIONS(-DSIZEOF_LONG=${SIZEOF_LONG} -DSIZEOF_LONG_LONG=${SIZEOF_LONG_LO # TODO: Fix compile warnings in auth_mysql41.cc -if(WIN32) +if(MSVC) set_property(SOURCE auth_hash.cc PROPERTY COMPILE_FLAGS "/W3" ) diff --git a/cdk/parser/parser.h b/cdk/parser/parser.h index 84dc3189d..e1e31cc92 100644 --- a/cdk/parser/parser.h +++ b/cdk/parser/parser.h @@ -35,7 +35,7 @@ #include "tokenizer.h" -#ifdef _WIN32 +#ifdef _MSC_VER /* 4061 = enum constant not explicitly handled by switch() case. diff --git a/cdk/protobuf/CMakeLists.txt b/cdk/protobuf/CMakeLists.txt index c5fb588a3..11727b401 100644 --- a/cdk/protobuf/CMakeLists.txt +++ b/cdk/protobuf/CMakeLists.txt @@ -163,7 +163,7 @@ if(APPLE) endif() -if(WIN32) +if(MSVC) add_compile_options( /wd4018 diff --git a/common/session.cc b/common/session.cc index d76d307e7..d3985c37e 100644 --- a/common/session.cc +++ b/common/session.cc @@ -118,7 +118,9 @@ std::string get_os_version_info(std::string &platform) else { PUSH_SYS_WARNINGS +#ifdef _MSC_VER DISABLE_WARNING(4996) +#endif if (GetVersionEx(&ver) == 0) ver_info << ""; POP_SYS_WARNINGS