From 0475c6dfd8ebf213a58fe59513d8658ce1ec7eff Mon Sep 17 00:00:00 2001 From: Ilya Kulakov Date: Fri, 18 Dec 2015 20:50:41 +0600 Subject: [PATCH] CMAKE_VS_PLATFORM_TOOLSET may not be set. E.g. for nmake. --- CMakeLists.txt | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ee72c7af..4612f5c4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -180,6 +180,12 @@ endmacro() if(MSVC) zmq_check_cxx_flag_prepend("/W3") + + if(MSVC_IDE) + set(MSVC_TOOLSET "-${CMAKE_VS_PLATFORM_TOOLSET}") + else() + set(MSVC_TOOLSET "") + endif() else() zmq_check_cxx_flag_prepend("-Wall") endif() @@ -303,8 +309,8 @@ if(MSVC) set(OPENPGM_INCLUDE_DIRS ${OPENPGM_ROOT}/include) set(OPENPGM_LIBRARY_DIRS ${OPENPGM_ROOT}/lib) set(OPENPGM_LIBRARIES - optimized libpgm-${CMAKE_VS_PLATFORM_TOOLSET}-mt-${OPENPGM_VERSION_MAJOR}_${OPENPGM_VERSION_MINOR}_${OPENPGM_VERSION_MICRO}.lib - debug libpgm-${CMAKE_VS_PLATFORM_TOOLSET}-mt-gd-${OPENPGM_VERSION_MAJOR}_${OPENPGM_VERSION_MINOR}_${OPENPGM_VERSION_MICRO}.lib) + optimized libpgm${MSVC_TOOLSET}-mt-${OPENPGM_VERSION_MAJOR}_${OPENPGM_VERSION_MINOR}_${OPENPGM_VERSION_MICRO}.lib + debug libpgm${MSVC_TOOLSET}-mt-gd-${OPENPGM_VERSION_MAJOR}_${OPENPGM_VERSION_MINOR}_${OPENPGM_VERSION_MICRO}.lib) endif() else() if(WITH_OPENPGM) @@ -601,15 +607,15 @@ if(MSVC) target_link_libraries(libzmq ${OPTIONAL_LIBRARIES}) set_target_properties(libzmq PROPERTIES PUBLIC_HEADER "${public_headers}" - RELEASE_POSTFIX "-${CMAKE_VS_PLATFORM_TOOLSET}-mt-${ZMQ_VERSION_MAJOR}_${ZMQ_VERSION_MINOR}_${ZMQ_VERSION_PATCH}" - DEBUG_POSTFIX "-${CMAKE_VS_PLATFORM_TOOLSET}-mt-gd-${ZMQ_VERSION_MAJOR}_${ZMQ_VERSION_MINOR}_${ZMQ_VERSION_PATCH}" + RELEASE_POSTFIX "${MSVC_TOOLSET}-mt-${ZMQ_VERSION_MAJOR}_${ZMQ_VERSION_MINOR}_${ZMQ_VERSION_PATCH}" + DEBUG_POSTFIX "${MSVC_TOOLSET}-mt-gd-${ZMQ_VERSION_MAJOR}_${ZMQ_VERSION_MINOR}_${ZMQ_VERSION_PATCH}" RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin" COMPILE_DEFINITIONS "DLL_EXPORT") add_library(libzmq-static STATIC ${sources}) set_target_properties(libzmq-static PROPERTIES PUBLIC_HEADER "${public_headers}" - RELEASE_POSTFIX "-${CMAKE_VS_PLATFORM_TOOLSET}-mt-s-${ZMQ_VERSION_MAJOR}_${ZMQ_VERSION_MINOR}_${ZMQ_VERSION_PATCH}" - DEBUG_POSTFIX "-${CMAKE_VS_PLATFORM_TOOLSET}-mt-sgd-${ZMQ_VERSION_MAJOR}_${ZMQ_VERSION_MINOR}_${ZMQ_VERSION_PATCH}" + RELEASE_POSTFIX "${MSVC_TOOLSET}-mt-s-${ZMQ_VERSION_MAJOR}_${ZMQ_VERSION_MINOR}_${ZMQ_VERSION_PATCH}" + DEBUG_POSTFIX "${MSVC_TOOLSET}-mt-sgd-${ZMQ_VERSION_MAJOR}_${ZMQ_VERSION_MINOR}_${ZMQ_VERSION_PATCH}" COMPILE_FLAGS "/D ZMQ_STATIC" OUTPUT_NAME "libzmq-static") else() @@ -730,7 +736,7 @@ if(MSVC) PUBLIC_HEADER DESTINATION include COMPONENT SDK) if(NOT CMAKE_PDB_OUTPUT_DIRECTORY) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/bin/libzmq-${CMAKE_VS_PLATFORM_TOOLSET}-mt-gd-${ZMQ_VERSION_MAJOR}_${ZMQ_VERSION_MINOR}_${ZMQ_VERSION_PATCH}.pdb DESTINATION lib + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/bin/libzmq${MSVC_TOOLSET}-mt-gd-${ZMQ_VERSION_MAJOR}_${ZMQ_VERSION_MINOR}_${ZMQ_VERSION_PATCH}.pdb DESTINATION lib COMPONENT SDK) endif() else()