0
0
mirror of https://github.com/zeromq/libzmq.git synced 2025-01-15 10:18:01 +08:00

Merge pull request #104 from snikulov/cmake_fixes_msvc2012

fixed compilation - added detection for _WIN32_WINNT
This commit is contained in:
Pieter Hintjens 2013-08-23 10:25:46 -07:00
commit ba597c6e47
2 changed files with 27 additions and 24 deletions

View File

@ -210,16 +210,22 @@ foreach (source ${rc-sources})
configure_file(${CMAKE_SOURCE_DIR}/src/${source}.in ${CMAKE_BINARY_DIR}/${source})
endforeach()
if(WIN32)
set(_platform_sp "builds/msvc")
if(MINGW)
set(_platform_sp "builds/mingw32")
endif()
add_custom_command(
OUTPUT ${CMAKE_BINARY_DIR}/platform.hpp
OUTPUT ${CMAKE_SOURCE_DIR}/src/platform.hpp
COMMAND ${CMAKE_COMMAND}
ARGS -E
copy
${CMAKE_SOURCE_DIR}/builds/msvc/platform.hpp
${CMAKE_BINARY_DIR}/platform.hpp
DEPENDS ${CMAKE_SOURCE_DIR}/builds/msvc/platform.hpp
${CMAKE_SOURCE_DIR}/${_platform_sp}/platform.hpp
${CMAKE_SOURCE_DIR}/src/platform.hpp
DEPENDS ${CMAKE_SOURCE_DIR}/${_platform_sp}/platform.hpp
)
list(APPEND sources ${CMAKE_BINARY_DIR}/platform.hpp)
list(APPEND sources ${CMAKE_SOURCE_DIR}/src/platform.hpp)
endif()
if (CMAKE_CL_64)
set (nsis-template ${CMAKE_SOURCE_DIR}/cmake/NSIS.template64.in)

View File

@ -1,3 +1,11 @@
macro(get_WIN32_WINNT version)
if (WIN32 AND CMAKE_SYSTEM_VERSION)
set(ver ${CMAKE_SYSTEM_VERSION})
string(REPLACE "." "" ver ${ver})
string(REGEX REPLACE "([0-9])" "0\\1" ver ${ver})
set(${version} "0x${ver}")
endif()
endmacro()
MESSAGE(STATUS "Detecting ZMQ")
SET(TRY_RUN_DIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/zmq_run.dir)
@ -24,36 +32,25 @@
MESSAGE(STATUS "Detecting ZMQ - failed")
ENDIF()
get_WIN32_WINNT(_zmq_WIN32_WINNT)
if(CMAKE_GENERATOR_TOOLSET MATCHES "v120")
set(_zmq_TOOLSET "-v120")
set(_zmq_COMPILER "vc120")
set(_zmq_WIN32_WINNT "0x0601")
elseif(CMAKE_GENERATOR_TOOLSET MATCHES "v110_xp")
set(_zmq_TOOLSET "-v110_xp")
set(_zmq_COMPILER "vc110")
set(_zmq_WIN32_WINNT "0x0501")
elseif(CMAKE_GENERATOR_TOOLSET MATCHES "v110")
set(_zmq_TOOLSET "-v110")
set(_zmq_COMPILER "vc110")
set(_zmq_WIN32_WINNT "0x0601")
elseif(CMAKE_GENERATOR_TOOLSET MATCHES "v100")
set(_zmq_TOOLSET "-v100")
set(_zmq_COMPILER "vc100")
if(CMAKE_CL_64)
set(_zmq_WIN32_WINNT "0x0600")
else()
set(_zmq_WIN32_WINNT "0x0501")
endif()
elseif(CMAKE_GENERATOR_TOOLSET MATCHES "v90")
set(_zmq_TOOLSET "-v90")
set(_zmq_COMPILER "vc90")
if(CMAKE_CL_64)
set(_zmq_WIN32_WINNT "0x0600")
else()
set(_zmq_WIN32_WINNT "0x0501")
endif()
else()
set(_zmq_TOOLSET "")
set(_zmq_COMPILER "")
set(_zmq_WIN32_WINNT "")
endif()