MSVC_VERSION is used instead of MSVC10, MSVC11, MSVC12, etc.
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /fp:precise")
endif()
-# set compiler short name and choose SSE2 option for appropriate MSVC compilers
-# ONLY for 32-bit
+# add SSE2 option for old MSVC compilers (VS 2005 - 2010, 32 bit only)
if (NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
- if (MSVC80 OR MSVC90 OR MSVC10)
+ if (MSVC AND ((MSVC_VERSION EQUAL 1400) OR (MSVC_VERSION EQUAL 1500) OR (MSVC_VERSION EQUAL 1600)))
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:SSE2")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /arch:SSE2")
endif()
string (REGEX REPLACE "-DDEBUG" "" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")
endif()
# enable parallel compilation on MSVC 9 and above
-if (MSVC AND NOT MSVC70 AND NOT MSVC80)
+if (MSVC AND (MSVC_VERSION GREATER 1400))
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
endif()
# COMPILER variable
macro (OCCT_MAKE_COMPILER_SHORT_NAME)
if (MSVC)
- if (MSVC70)
+ if ((MSVC_VERSION EQUAL 1300) OR (MSVC_VERSION EQUAL 1310))
set (COMPILER vc7)
- elseif (MSVC80)
+ elseif (MSVC_VERSION EQUAL 1400)
set (COMPILER vc8)
- elseif (MSVC90)
+ elseif (MSVC_VERSION EQUAL 1500)
set (COMPILER vc9)
- elseif (MSVC10)
+ elseif (MSVC_VERSION EQUAL 1600)
set (COMPILER vc10)
- elseif (MSVC11)
+ elseif (MSVC_VERSION EQUAL 1700)
set (COMPILER vc11)
- elseif (MSVC12)
+ elseif (MSVC_VERSION EQUAL 1800)
set (COMPILER vc12)
- elseif (MSVC14)
+ elseif (MSVC_VERSION EQUAL 1900)
set (COMPILER vc14)
- elseif (MSVC15)
+ elseif ((MSVC_VERSION GREATER 1900) AND (MSVC_VERSION LESS 2000))
# Since Visual Studio 15 (2017), its version diverged from version of
# compiler which is 14.1; as that compiler uses the same run-time as 14.0,
# we keep its id as "vc14" to be compatibille
set (COMPILER vc14)
+ else()
+ message (FATAL_ERROR "Unrecognized MSVC_VERSION")
endif()
elseif (DEFINED CMAKE_COMPILER_IS_GNUCC)
set (COMPILER gcc)
set( OCCTDEMO_DIR ${OCC_CASROOT}/samples/mfc/occtdemo)
-if (DEFINED MSVC70)
+if ((MSVC_VERSION EQUAL 1300) OR (MSVC_VERSION EQUAL 1310))
SET(COMPILER vc7)
-elseif (DEFINED MSVC80)
+elseif (MSVC_VERSION EQUAL 1400)
SET(COMPILER vc8)
-elseif (DEFINED MSVC90)
+elseif (MSVC_VERSION EQUAL 1500)
SET(COMPILER vc9)
-elseif (DEFINED MSVC10)
+elseif (MSVC_VERSION EQUAL 1600)
SET(COMPILER vc10)
-elseif (DEFINED MSVC11)
+elseif (MSVC_VERSION EQUAL 1700)
SET(COMPILER vc11)
+elseif (MSVC_VERSION EQUAL 1800)
+ SET(COMPILER vc12)
+elseif (MSVC_VERSION EQUAL 1900)
+ SET(COMPILER vc14)
+elseif ((MSVC_VERSION GREATER 1900) AND (MSVC_VERSION LESS 2000))
+ # Since Visual Studio 15 (2017), its version diverged from version of
+ # compiler which is 14.1; as that compiler uses the same run-time as 14.0,
+ # we keep its id as "vc14" to be compatibille
+ SET(COMPILER vc14)
else()
SET(COMPILER ${CMAKE_GENERATOR})
endif()