Commit 54be9223 authored by Ghislain MARY's avatar Ghislain MARY

Correctly handle Microsoft redistributable libraries when building with Visual Studio 2015.

parent 8a81102d
......@@ -253,12 +253,19 @@ if(MSVC)
)
string(REGEX REPLACE "Visual Studio ([0-9]+).*" "\\1" MSVC_VERSION "${CMAKE_GENERATOR}")
find_file(MSVCP_LIB "msvcp${MSVC_VERSION}0.dll" PATHS "C:/Windows/System32")
find_file(MSVCR_LIB "msvcr${MSVC_VERSION}0.dll" PATHS "C:/Windows/System32")
install(FILES ${MSVCP_LIB} ${MSVCR_LIB} DESTINATION "bin")
# Starting with Visual Studio 2015 (MSVC_VERSION==14) the msvcr dll has been renamed to vcruntime
find_file(VCRUNTIME_LIB "vcruntime${MSVC_VERSION}0.dll" PATHS "C:/Windows/System32")
if(NOT VCRUNTIME_LIB)
find_file(VCRUNTIME_LIB "msvcr${MSVC_VERSION}0.dll" PATHS "C:/Windows/System32")
endif()
install(FILES ${MSVCP_LIB} ${VCRUNTIME_LIB} DESTINATION "bin")
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
find_file(MSVCPD_LIB "msvcp${MSVC_VERSION}0d.dll" PATHS "C:/Windows/System32")
find_file(MSVCRD_LIB "msvcr${MSVC_VERSION}0d.dll" PATHS "C:/Windows/System32")
install(FILES ${MSVCPD_LIB} ${MSVCRD_LIB} DESTINATION "bin")
find_file(VCRUNTIMED_LIB "vcruntime${MSVC_VERSION}0d.dll" PATHS "C:/Windows/System32")
if(NOT VCRUNTIMED_LIB)
find_file(VCRUNTIMED_LIB "msvcr${MSVC_VERSION}0d.dll" PATHS "C:/Windows/System32")
endif()
install(FILES ${MSVCPD_LIB} ${VCRUNTIMED_LIB} DESTINATION "bin")
endif()
endif()
......
......@@ -76,11 +76,15 @@ if(WIN32)
set(MSVC_DEBUG_SYSTEM_LIBRARIES "d")
endif()
find_file(MSVCP_LIB msvcp${MSVC_VERSION}0${MSVC_DEBUG_SYSTEM_LIBRARIES}.dll PATHS "C:/Windows/System32")
find_file(MSVCR_LIB msvcr${MSVC_VERSION}0${MSVC_DEBUG_SYSTEM_LIBRARIES}.dll PATHS "C:/Windows/System32")
if(NOT MSVCP_LIB OR NOT MSVCR_LIB)
# Starting with Visual Studio 2015 (MSVC_VERSION==14) the msvcr dll has been renamed to vcruntime
find_file(VCRUNTIME_LIB vcruntime${MSVC_VERSION}0${MSVC_DEBUG_SYSTEM_LIBRARIES}.dll PATHS "C:/Windows/System32")
if(NOT VCRUNTIME_LIB)
find_file(VCRUNTIME_LIB msvcr${MSVC_VERSION}0${MSVC_DEBUG_SYSTEM_LIBRARIES}.dll PATHS "C:/Windows/System32")
endif()
if(NOT MSVCP_LIB OR NOT VCRUNTIME_LIB)
message(FATAL_ERROR "You need to install the Visual Studio C++ Redistributable libraries!")
endif()
file(COPY ${MSVCP_LIB} ${MSVCR_LIB} DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")
file(COPY ${MSVCP_LIB} ${VCRUNTIME_LIB} DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")
file(GLOB LINPHONE_DYNAMIC_LIBRARIES_TO_INSTALL "${CMAKE_INSTALL_PREFIX}/bin/*.dll")
else()
set(PACKAGES_TO_BUILD "zip" "wheel")
......
......@@ -24,9 +24,12 @@
if(MSVC)
string(REGEX REPLACE "Visual Studio ([0-9]+).*" "\\1" MSVC_VERSION "${CMAKE_GENERATOR}")
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
find_file(MSVCR_LIB msvcr${MSVC_VERSION}0d.dll PATHS "C:/Windows/System32")
else()
find_file(MSVCR_LIB msvcr${MSVC_VERSION}0.dll PATHS "C:/Windows/System32")
set(MSVC_DEBUG_SYSTEM_LIBRARIES "d")
endif()
# Starting with Visual Studio 2015 (MSVC_VERSION==14) the msvcr dll has been renamed to vcruntime
find_file(VCRUNTIME_LIB vcruntime${MSVC_VERSION}0${MSVC_DEBUG_SYSTEM_LIBRARIES}.dll PATHS "C:/Windows/System32")
if(NOT VCRUNTIME_LIB)
find_file(VCRUNTIME_LIB msvcr${MSVC_VERSION}0${MSVC_DEBUG_SYSTEM_LIBRARIES}.dll PATHS "C:/Windows/System32")
endif()
endif()
......@@ -46,7 +49,7 @@ else()
file(COPY ${LINPHONE_DYNAMIC_LIBRARIES_TO_INSTALL} DESTINATION "${OUTPUT_DIR}/linphone")
endif()
if(MSVC AND NOT MSVC_VERSION STREQUAL "9")
file(COPY ${MSVCR_LIB} DESTINATION "${OUTPUT_DIR}/linphone")
file(COPY ${VCRUNTIME_LIB} DESTINATION "${OUTPUT_DIR}/linphone")
endif()
get_filename_component(LINPHONE_PYTHON_MODULE_PATH "${LINPHONE_PYTHON_MODULE}" DIRECTORY)
find_file(PDB_FILENAME "linphone.pdb" "${LINPHONE_PYTHON_MODULE_PATH}")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment