I know that in CMake I can check for the compiler version like this
if(MSVC_VERSION LESS 1700)
... // MSVC is lower than MSVC2012
but how do I express this in CMake syntax?
if(MSVC_VERSION GREATER_OR_EQUAL_TO 1700)
... // MSVC greater or equal to MSVC2012
Update for CMake 3.7 and later:
CMake 3.7 introduced a couple of new comparisons for if
, among them GREATER_EQUAL
:
if(MSVC_VERSION GREATER_EQUAL 1700)
[...]
Original answer for older CMake versions:
if((MSVC_VERSION GREATER 1700) OR (MSVC_VERSION EQUAL 1700))
[...]
Or probably better, as it avoids repeating the condition:
if(NOT (MSVC_VERSION LESS 1700))
[...]