Re: [CMake] MSVC15 variable available for Visual Studio 2017

2017-01-11 Thread Brad King
On 01/11/2017 08:33 AM, Gregor Jasny via CMake wrote:
> I wonder if there is a reason why no MSVC15 variable is available for 
> Visual Studio 2017?

The values correspond to the toolset versions:

* https://cmake.org/cmake/help/v3.7/variable/MSVC14.html

and VS 2017 uses toolset version v141 which is still "14".

At the time the VS 2017 generator was first written we were using a
VS 15 preview and its toolset was still called v140.  Please submit
a MR to update the above-linked docs to mention that MSVC14 is for
v140 or v141.

> I wonder how I could detect the v141(_xp) toolset?

Use CMAKE_C_COMPILER_VERSION instead.  The `MSVC##` variables are legacy,
though not deprecated because they can still be handy due to the
"or another compiler that simulates it" part of the documentation.

-Brad

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake


[CMake] MSVC15 variable available for Visual Studio 2017

2017-01-11 Thread Gregor Jasny via CMake

Hello,

I wonder if there is a reason why no MSVC15 variable is available for 
Visual Studio 2017? I'm using those MSVCxx variables and 
CMAKE_GENERATOR_TOOLSET to detect the active toolset:



  # Visual Studio 2008
  if((MSVC90 AND "${CMAKE_GENERATOR_TOOLSET}" STREQUAL "") OR (CMAKE_GENERATOR_TOOLSET 
MATCHES "v90"))
set(COL_BUILD_TOOLCHAIN)
  elseif((MSVC11 AND "${CMAKE_GENERATOR_TOOLSET}" STREQUAL "") OR 
(CMAKE_GENERATOR_TOOLSET MATCHES "^v110.*"))
set(COL_BUILD_TOOLCHAIN _v110)
  elseif((MSVC12 AND "${CMAKE_GENERATOR_TOOLSET}" STREQUAL "") OR 
(CMAKE_GENERATOR_TOOLSET MATCHES "^v120.*"))
set(COL_BUILD_TOOLCHAIN _v120)
  elseif((MSVC14 AND "${CMAKE_GENERATOR_TOOLSET}" STREQUAL "") OR 
(CMAKE_GENERATOR_TOOLSET MATCHES "^v140.*"))
set(COL_BUILD_TOOLCHAIN _v140)
  else()
message(FATAL_ERROR "Unknown Visual Studio version (${MSVC_VERSION}) or 
generator toolset (${CMAKE_GENERATOR_TOOLSET})")
  endif()


If I now select the Visual Studio 2017 compiler but omit the toolset on 
the command line, the CMAKE_GENERATOR_TOOLSET is empty and MSVC15 is not 
set. I wonder how I could detect the v141(_xp) toolset?




Thanks,
Gregor
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake