CMake updates for VS2015/cmake 3.12 onwards

cmake 3.12 adds MSVC_TOOLSET_VERSION to define the version of MSVC toolchain in use
Use that if present instead of if-elseif chain
pull/2417/head
RichardTea 2019-04-17 09:32:24 +01:00
parent 4507f7cf46
commit 836801d37e
2 changed files with 24 additions and 12 deletions

View File

@ -106,7 +106,7 @@ OPTION ( BUILD_DOCS
OFF
)
OPTION( INJECT_DEBUG_POSTFIX
"Inject debug postfix in .a/.so lib names"
"Inject debug postfix in .a/.so/.dll lib names"
ON
)
@ -127,14 +127,15 @@ if (WIN32)
ADD_DEFINITIONS( -DWIN32_LEAN_AND_MEAN )
endif()
IF(MSVC)
OPTION( ASSIMP_INSTALL_PDB
"Install MSVC debug files."
ON
)
# Multibyte character set is deprecated, but default
ADD_DEFINITIONS( -DUNICODE -D_UNICODE )
IF(NOT (MSVC_VERSION LESS 1900))
# Multibyte character set is deprecated since at least MSVC2015 (possibly earlier)
ADD_DEFINITIONS( -DUNICODE -D_UNICODE )
ENDIF()
ENDIF(MSVC)
IF (BUILD_FRAMEWORK)
@ -545,18 +546,22 @@ if(WIN32)
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
SET(BIN_DIR "${PROJECT_SOURCE_DIR}/bin64/")
SET(LIB_DIR "${PROJECT_SOURCE_DIR}/lib64/")
elseif()
else()
SET(BIN_DIR "${PROJECT_SOURCE_DIR}/bin32/")
SET(LIB_DIR "${PROJECT_SOURCE_DIR}/lib32/")
ENDIF()
IF(MSVC12)
SET(ASSIMP_MSVC_VERSION "vc120")
ELSEIF(MSVC14)
SET(ASSIMP_MSVC_VERSION "vc140")
ELSEIF(MSVC15)
SET(ASSIMP_MSVC_VERSION "vc141")
ENDIF(MSVC12)
IF(MSVC_TOOLSET_VERSION)
set(MSVC_PREFIX "vc${MSVC_TOOLSET_VERSION}")
ELSE()
IF(MSVC12)
SET(ASSIMP_MSVC_VERSION "vc120")
ELSEIF(MSVC14)
SET(ASSIMP_MSVC_VERSION "vc140")
ELSEIF(MSVC15)
SET(ASSIMP_MSVC_VERSION "vc141")
ENDIF(MSVC12)
ENDIF()
IF(MSVC12 OR MSVC14 OR MSVC15 )
ADD_CUSTOM_TARGET(UpdateAssimpLibsDebugSymbolsAndDLLs COMMENT "Copying Assimp Libraries ..." VERBATIM)

View File

@ -1037,6 +1037,10 @@ ENDIF (ASSIMP_BUILD_NONFREE_C4D_IMPORTER)
if( MSVC )
# in order to prevent DLL hell, each of the DLLs have to be suffixed with the major version and msvc prefix
# CMake 3.12 added a variable for this
if(MSVC_TOOLSET_VERSION)
set(MSVC_PREFIX "vc${MSVC_TOOLSET_VERSION}")
else()
if( MSVC70 OR MSVC71 )
set(MSVC_PREFIX "vc70")
elseif( MSVC80 )
@ -1051,9 +1055,12 @@ if( MSVC )
set(MSVC_PREFIX "vc120")
elseif( MSVC14 )
set(MSVC_PREFIX "vc140")
elseif( MSVC15 )
set(MSVC_PREFIX "vc141")
else()
set(MSVC_PREFIX "vc150")
endif()
endif()
set(LIBRARY_SUFFIX "${ASSIMP_LIBRARY_SUFFIX}-${MSVC_PREFIX}-mt" CACHE STRING "the suffix for the assimp windows library")
endif()