[Cmake-commits] CMake branch, master, updated. v3.11.0-420-gd7af8a3

Kitware Robot kwrobot at kitware.com
Thu Apr 5 13:35:05 EDT 2018


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, master has been updated
       via  d7af8a34b67026feaee558433db3a835d6007e06 (commit)
       via  57c2834da056394bed178936fbbe9811a36ae006 (commit)
       via  308d21b225af15c52806b6a2d601cb2f06d42629 (commit)
       via  45bf6f6246a72874c880aa3de13ba957abd50ca6 (commit)
       via  304f493e570a177795575b5297c4b54bf1b3d2ac (commit)
       via  44ad8e48def8d98eaff8fd6deb11731520183daa (commit)
       via  30bbb4f2acdebc50a08ef29a0b79577f8275ed2a (commit)
      from  43e44bcd8e14783ff454f70d097cfa9fa8aef652 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d7af8a34b67026feaee558433db3a835d6007e06
commit d7af8a34b67026feaee558433db3a835d6007e06
Merge: 57c2834 44ad8e4
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu Apr 5 17:28:14 2018 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Thu Apr 5 13:28:19 2018 -0400

    Merge topic 'findwxwidgets-msys-library-dirs'
    
    44ad8e48de FindwxWidgets: Fix wxWidgets_LIBRARY_DIRS on Cygwin/MSYS
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Merge-request: !1930


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=57c2834da056394bed178936fbbe9811a36ae006
commit 57c2834da056394bed178936fbbe9811a36ae006
Merge: 308d21b 30bbb4f
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu Apr 5 17:27:34 2018 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Thu Apr 5 13:27:39 2018 -0400

    Merge topic 'vs10-groups'
    
    30bbb4f2ac cmVisualStudio10TargetGenerator: extend DOM-like generation
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Merge-request: !1905


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=308d21b225af15c52806b6a2d601cb2f06d42629
commit 308d21b225af15c52806b6a2d601cb2f06d42629
Merge: 43e44bc 45bf6f6
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu Apr 5 17:26:33 2018 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Thu Apr 5 13:26:49 2018 -0400

    Merge topic 'msvc-toolset-version-variable'
    
    45bf6f6246 Modules: Use MSVC_TOOLSET_VERSION variable to simplify logic
    304f493e57 MSVC: Add MSVC_TOOLSET_VERSION variable
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Merge-request: !1882


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=45bf6f6246a72874c880aa3de13ba957abd50ca6
commit 45bf6f6246a72874c880aa3de13ba957abd50ca6
Author:     Arkady Shapkin <arkady.shapkin at gmail.com>
AuthorDate: Thu Mar 22 21:50:03 2018 +0300
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Apr 4 13:21:16 2018 -0400

    Modules: Use MSVC_TOOLSET_VERSION variable to simplify logic

diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake
index 8d44aee..5b5002a 100644
--- a/Modules/FindBoost.cmake
+++ b/Modules/FindBoost.cmake
@@ -458,20 +458,10 @@ function(_Boost_GUESS_COMPILER_PREFIX _ret)
   elseif (GHSMULTI)
     set(_boost_COMPILER "-ghs")
   elseif("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC")
-    if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.10)
+    if(MSVC_TOOLSET_VERSION GREATER_EQUAL 141)
       set(_boost_COMPILER "-vc141;-vc140")
-    elseif (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19)
-      set(_boost_COMPILER "-vc140")
-    elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 18)
-      set(_boost_COMPILER "-vc120")
-    elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 17)
-      set(_boost_COMPILER "-vc110")
-    elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 16)
-      set(_boost_COMPILER "-vc100")
-    elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15)
-      set(_boost_COMPILER "-vc90")
-    elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 14)
-      set(_boost_COMPILER "-vc80")
+    elseif(MSVC_TOOLSET_VERSION GREATER_EQUAL 80)
+      set(_boost_COMPILER "-vc${MSVC_TOOLSET_VERSION}")
     elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 13.10)
       set(_boost_COMPILER "-vc71")
     elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 13) # Good luck!
@@ -1009,21 +999,12 @@ function(_Boost_UPDATE_WINDOWS_LIBRARY_SEARCH_DIRS_WITH_PREBUILT_PATHS component
     else()
       set(_arch_suffix 32)
     endif()
-    if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.10)
+    if(MSVC_TOOLSET_VERSION GREATER_EQUAL 141)
       list(APPEND ${componentlibvar} ${basedir}/lib${_arch_suffix}-msvc-14.1)
       list(APPEND ${componentlibvar} ${basedir}/lib${_arch_suffix}-msvc-14.0)
-    elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19)
-      list(APPEND ${componentlibvar} ${basedir}/lib${_arch_suffix}-msvc-14.0)
-    elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 18)
-      list(APPEND ${componentlibvar} ${basedir}/lib${_arch_suffix}-msvc-12.0)
-    elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 17)
-      list(APPEND ${componentlibvar} ${basedir}/lib${_arch_suffix}-msvc-11.0)
-    elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 16)
-      list(APPEND ${componentlibvar} ${basedir}/lib${_arch_suffix}-msvc-10.0)
-    elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15)
-      list(APPEND ${componentlibvar} ${basedir}/lib${_arch_suffix}-msvc-9.0)
-    elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 14)
-      list(APPEND ${componentlibvar} ${basedir}/lib${_arch_suffix}-msvc-8.0)
+    elseif(MSVC_TOOLSET_VERSION GREATER_EQUAL 80)
+      math(EXPR _toolset_major_version "${MSVC_TOOLSET_VERSION} / 10")
+      list(APPEND ${componentlibvar} ${basedir}/lib${_arch_suffix}-msvc-${_toolset_major_version}.0)
     endif()
     set(${componentlibvar} ${${componentlibvar}} PARENT_SCOPE)
   endif()
diff --git a/Modules/FindGTK2.cmake b/Modules/FindGTK2.cmake
index 8d0da51..15d1230 100644
--- a/Modules/FindGTK2.cmake
+++ b/Modules/FindGTK2.cmake
@@ -352,13 +352,9 @@ function(_GTK2_FIND_LIBRARY _var _lib _expand_vc _append_version)
 
     if(_expand_vc AND MSVC)
         # Add vc80/vc90/vc100 midfixes
-        if(MSVC_VERSION EQUAL 1400)
-            set(_library   ${_library}-vc80)
-        elseif(MSVC_VERSION EQUAL 1500)
-            set(_library   ${_library}-vc90)
-        elseif(MSVC_VERSION EQUAL 1600)
-            set(_library ${_library}-vc100)
-        elseif(MSVC_VERSION EQUAL 1700)
+        if(MSVC_TOOLSET_VERSION LESS 110)
+            set(_library   ${_library}-vc${MSVC_TOOLSET_VERSION})
+        else()
             # Up to gtkmm-win 2.22.0-2 there are no vc110 libraries but vc100 can be used
             set(_library ${_library}-vc100)
         endif()
diff --git a/Modules/FindIce.cmake b/Modules/FindIce.cmake
index b37f796..df76e5a 100644
--- a/Modules/FindIce.cmake
+++ b/Modules/FindIce.cmake
@@ -255,21 +255,15 @@ function(_Ice_FIND)
 
   unset(vcvers)
   if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
-    if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.10)
+    if(MSVC_TOOLSET_VERSION GREATER_EQUAL 141)
       set(vcvers "141;140")
-    elseif (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19)
-      set(vcvers "140")
-    elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 18)
-      set(vcvers "120")
-    elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 17)
-      set(vcvers "110")
-    elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 16)
-      set(vcvers "100")
-    elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15)
-      set(vcvers "90")
+    elseif(MSVC_TOOLSET_VERSION GREATER_EQUAL 100)
+      set(vcvers "${MSVC_TOOLSET_VERSION}")
+    elseif(MSVC_TOOLSET_VERSION GREATER_EQUAL 90)
+      set(vcvers "${MSVC_TOOLSET_VERSION}")
       set(vcyear "2008")
-    elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 14)
-      set(vcvers "80")
+    elseif(MSVC_TOOLSET_VERSION GREATER_EQUAL 80)
+      set(vcvers "${MSVC_TOOLSET_VERSION}")
       set(vcyear "2005")
     else() # Unknown version
       set(vcvers Unknown)
diff --git a/Modules/FindwxWidgets.cmake b/Modules/FindwxWidgets.cmake
index 202d481..caff4db 100644
--- a/Modules/FindwxWidgets.cmake
+++ b/Modules/FindwxWidgets.cmake
@@ -498,19 +498,7 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32")
       set(_WX_TOOL gcc)
     elseif(MSVC)
       set(_WX_TOOL vc)
-      if(NOT MSVC_VERSION LESS 1910)
-        set(_WX_TOOLVER 141)
-      elseif(NOT MSVC_VERSION LESS 1900)
-        set(_WX_TOOLVER 140)
-      elseif(NOT MSVC_VERSION LESS 1800)
-        set(_WX_TOOLVER 120)
-      elseif(NOT MSVC_VERSION LESS 1700)
-        set(_WX_TOOLVER 110)
-      elseif(NOT MSVC_VERSION LESS 1600)
-        set(_WX_TOOLVER 100)
-      elseif(NOT MSVC_VERSION LESS 1500)
-        set(_WX_TOOLVER 90)
-      endif()
+      set(_WX_TOOLVER ${MSVC_TOOLSET_VERSION})
       if(CMAKE_SIZEOF_VOID_P EQUAL 8)
         set(_WX_ARCH _x64)
       endif()
diff --git a/Modules/InstallRequiredSystemLibraries.cmake b/Modules/InstallRequiredSystemLibraries.cmake
index 797f9e4..50e9361 100644
--- a/Modules/InstallRequiredSystemLibraries.cmake
+++ b/Modules/InstallRequiredSystemLibraries.cmake
@@ -121,9 +121,7 @@ if(MSVC)
       )
   endif()
 
-  if(MSVC_VERSION EQUAL 1400)
-    set(MSVC_REDIST_NAME VC80)
-
+  if(MSVC_TOOLSET_VERSION EQUAL 80)
     # Find the runtime library redistribution directory.
     get_filename_component(msvc_install_dir
       "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0;InstallDir]" ABSOLUTE)
@@ -163,9 +161,7 @@ if(MSVC)
     endif()
   endif()
 
-  if(MSVC_VERSION EQUAL 1500)
-    set(MSVC_REDIST_NAME VC90)
-
+  if(MSVC_TOOLSET_VERSION EQUAL 90)
     # Find the runtime library redistribution directory.
     get_filename_component(msvc_install_dir
       "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\9.0;InstallDir]" ABSOLUTE)
@@ -209,34 +205,31 @@ if(MSVC)
   endif()
 
   set(MSVC_REDIST_NAME "")
-  set(_MSVCRT_DLL_VERSION "")
-  set(_MSVCRT_IDE_VERSION "")
+  set(_MSVC_DLL_VERSION "")
+  set(_MSVC_IDE_VERSION "")
   if(MSVC_VERSION GREATER_EQUAL 2000)
     message(WARNING "MSVC ${MSVC_VERSION} not yet supported.")
-  elseif(MSVC_VERSION GREATER_EQUAL 1911)
-    set(MSVC_REDIST_NAME VC141)
-    set(_MSVCRT_DLL_VERSION 140)
-    set(_MSVCRT_IDE_VERSION 15)
-  elseif(MSVC_VERSION EQUAL 1910)
-    set(MSVC_REDIST_NAME VC150)
-    set(_MSVCRT_DLL_VERSION 140)
-    set(_MSVCRT_IDE_VERSION 15)
-  elseif(MSVC_VERSION EQUAL 1900)
-    set(MSVC_REDIST_NAME VC140)
-    set(_MSVCRT_DLL_VERSION 140)
-    set(_MSVCRT_IDE_VERSION 14)
-  elseif(MSVC_VERSION EQUAL 1800)
-    set(MSVC_REDIST_NAME VC120)
-    set(_MSVCRT_DLL_VERSION 120)
-    set(_MSVCRT_IDE_VERSION 12)
-  elseif(MSVC_VERSION EQUAL 1700)
-    set(MSVC_REDIST_NAME VC110)
-    set(_MSVCRT_DLL_VERSION 110)
-    set(_MSVCRT_IDE_VERSION 11)
-  elseif(MSVC_VERSION EQUAL 1600)
-    set(MSVC_REDIST_NAME VC100)
-    set(_MSVCRT_DLL_VERSION 100)
-    set(_MSVCRT_IDE_VERSION 10)
+  elseif(MSVC_TOOLSET_VERSION)
+    set(MSVC_REDIST_NAME VC${MSVC_TOOLSET_VERSION})
+    if(MSVC_VERSION EQUAL 1910)
+      # VS2017 named this differently prior to update 3.
+      set(MSVC_REDIST_NAME VC150)
+    endif()
+
+    math(EXPR _MSVC_DLL_VERSION "${MSVC_TOOLSET_VERSION} / 10 * 10")
+
+    if(MSVC_TOOLSET_VERSION EQUAL 141)
+      set(_MSVC_IDE_VERSION 15)
+    else()
+      math(EXPR _MSVC_IDE_VERSION "${MSVC_TOOLSET_VERSION} / 10")
+    endif()
+  endif()
+
+  set(_MSVCRT_DLL_VERSION "")
+  set(_MSVCRT_IDE_VERSION "")
+  if(_MSVC_IDE_VERSION GREATER_EQUAL 10)
+    set(_MSVCRT_DLL_VERSION "${_MSVC_DLL_VERSION}")
+    set(_MSVCRT_IDE_VERSION "${_MSVC_IDE_VERSION}")
   endif()
 
   if(_MSVCRT_DLL_VERSION)
@@ -433,23 +426,9 @@ if(MSVC)
 
     set(_MFC_DLL_VERSION "")
     set(_MFC_IDE_VERSION "")
-    if(MSVC_VERSION GREATER_EQUAL 2000)
-      # Version not yet supported.
-    elseif(MSVC_VERSION GREATER_EQUAL 1910)
-      set(_MFC_DLL_VERSION 140)
-      set(_MFC_IDE_VERSION 15)
-    elseif(MSVC_VERSION EQUAL 1900)
-      set(_MFC_DLL_VERSION 140)
-      set(_MFC_IDE_VERSION 14)
-    elseif(MSVC_VERSION EQUAL 1800)
-      set(_MFC_DLL_VERSION 120)
-      set(_MFC_IDE_VERSION 12)
-    elseif(MSVC_VERSION EQUAL 1700)
-      set(_MFC_DLL_VERSION 110)
-      set(_MFC_IDE_VERSION 11)
-    elseif(MSVC_VERSION EQUAL 1600)
-      set(_MFC_DLL_VERSION 100)
-      set(_MFC_IDE_VERSION 10)
+    if(_MSVC_IDE_VERSION GREATER_EQUAL 10)
+      set(_MFC_DLL_VERSION ${_MSVC_DLL_VERSION})
+      set(_MFC_IDE_VERSION ${_MSVC_IDE_VERSION})
     endif()
 
     if(_MFC_DLL_VERSION)
@@ -520,32 +499,8 @@ if(MSVC)
   # MSVC 8 was the first version with OpenMP
   # Furthermore, there is no debug version of this
   if(CMAKE_INSTALL_OPENMP_LIBRARIES AND _IRSL_HAVE_MSVC)
-    set(_MSOMP_DLL_VERSION "")
-    set(_MSOMP_IDE_VERSION "")
-    if(MSVC_VERSION GREATER_EQUAL 2000)
-      # Version not yet supported.
-    elseif(MSVC_VERSION GREATER_EQUAL 1910)
-      set(_MSOMP_DLL_VERSION 140)
-      set(_MSOMP_IDE_VERSION 15)
-    elseif(MSVC_VERSION EQUAL 1900)
-      set(_MSOMP_DLL_VERSION 140)
-      set(_MSOMP_IDE_VERSION 14)
-    elseif(MSVC_VERSION EQUAL 1800)
-      set(_MSOMP_DLL_VERSION 120)
-      set(_MSOMP_IDE_VERSION 12)
-    elseif(MSVC_VERSION EQUAL 1700)
-      set(_MSOMP_DLL_VERSION 110)
-      set(_MSOMP_IDE_VERSION 11)
-    elseif(MSVC_VERSION EQUAL 1600)
-      set(_MSOMP_DLL_VERSION 100)
-      set(_MSOMP_IDE_VERSION 10)
-    elseif(MSVC_VERSION EQUAL 1500)
-      set(_MSOMP_DLL_VERSION 90)
-      set(_MSOMP_IDE_VERSION 9)
-    elseif(MSVC_VERSION EQUAL 1400)
-      set(_MSOMP_DLL_VERSION 80)
-      set(_MSOMP_IDE_VERSION 8)
-    endif()
+    set(_MSOMP_DLL_VERSION ${_MSVC_DLL_VERSION})
+    set(_MSOMP_IDE_VERSION ${_MSVC_IDE_VERSION})
 
     if(_MSOMP_DLL_VERSION)
       set(v "${_MSOMP_DLL_VERSION}")

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=304f493e570a177795575b5297c4b54bf1b3d2ac
commit 304f493e570a177795575b5297c4b54bf1b3d2ac
Author:     Arkady Shapkin <arkady.shapkin at gmail.com>
AuthorDate: Thu Mar 22 02:01:37 2018 +0300
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Apr 4 13:21:09 2018 -0400

    MSVC: Add MSVC_TOOLSET_VERSION variable
    
    Provide the MSVC toolset version number based on the compiler version.
    
    Fixes: #16923

diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst
index 652dab8..c1b0316 100644
--- a/Help/manual/cmake-variables.7.rst
+++ b/Help/manual/cmake-variables.7.rst
@@ -239,6 +239,7 @@ Variables that Describe the System
    /variable/MSVC80
    /variable/MSVC90
    /variable/MSVC_IDE
+   /variable/MSVC_TOOLSET_VERSION
    /variable/MSVC_VERSION
    /variable/UNIX
    /variable/WIN32
diff --git a/Help/release/dev/msvc-toolset-version-variable.rst b/Help/release/dev/msvc-toolset-version-variable.rst
new file mode 100644
index 0000000..28ba0b9
--- /dev/null
+++ b/Help/release/dev/msvc-toolset-version-variable.rst
@@ -0,0 +1,6 @@
+msvc-toolset-version-variable
+-----------------------------
+
+* A :variable:`MSVC_TOOLSET_VERSION` variable was added to provide the
+  MSVC toolset version associated with the current MSVC compiler version
+  in :variable:`MSVC_VERSION`.
diff --git a/Help/variable/MSVC_TOOLSET_VERSION.rst b/Help/variable/MSVC_TOOLSET_VERSION.rst
new file mode 100644
index 0000000..77e1ea9
--- /dev/null
+++ b/Help/variable/MSVC_TOOLSET_VERSION.rst
@@ -0,0 +1,21 @@
+MSVC_TOOLSET_VERSION
+--------------------
+
+The toolset version of Microsoft Visual C/C++ being used if any.
+If MSVC-like is being used, this variable is set based on the version
+of the compiler as given by the :variable:`MSVC_VERSION` variable.
+
+Known toolset version numbers are::
+
+  80        = VS 2005 (8.0)
+  90        = VS 2008 (9.0)
+  100       = VS 2010 (10.0)
+  110       = VS 2012 (11.0)
+  120       = VS 2013 (12.0)
+  140       = VS 2015 (14.0)
+  141       = VS 2017 (15.0)
+
+Compiler versions newer than those known to CMake will be reported
+as the latest known toolset version.
+
+See also the :variable:`MSVC_VERSION` variable.
diff --git a/Help/variable/MSVC_VERSION.rst b/Help/variable/MSVC_VERSION.rst
index 5f70c02..4ef43d8 100644
--- a/Help/variable/MSVC_VERSION.rst
+++ b/Help/variable/MSVC_VERSION.rst
@@ -19,4 +19,5 @@ Known version numbers are::
   1900      = VS 14.0 (v140 toolset)
   1910-1919 = VS 15.0 (v141 toolset)
 
-See also the  :variable:`CMAKE_<LANG>_COMPILER_VERSION` variable.
+See also the  :variable:`CMAKE_<LANG>_COMPILER_VERSION` and
+:variable:`MSVC_TOOLSET_VERSION` variable.
diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake
index a1f54c0..ae180ed 100644
--- a/Modules/Platform/Windows-MSVC.cmake
+++ b/Modules/Platform/Windows-MSVC.cmake
@@ -71,6 +71,31 @@ if(NOT MSVC_VERSION)
     message(FATAL_ERROR "MSVC compiler version not detected properly: ${_compiler_version}")
   endif()
 
+  if(MSVC_VERSION GREATER_EQUAL 1910)
+    # VS 2017 or greater
+    set(MSVC_TOOLSET_VERSION 141)
+  elseif(MSVC_VERSION EQUAL 1900)
+    # VS 2015
+    set(MSVC_TOOLSET_VERSION 140)
+  elseif(MSVC_VERSION EQUAL 1800)
+    # VS 2013
+    set(MSVC_TOOLSET_VERSION 120)
+  elseif(MSVC_VERSION EQUAL 1700)
+    # VS 2012
+    set(MSVC_TOOLSET_VERSION 110)
+  elseif(MSVC_VERSION EQUAL 1600)
+    # VS 2010
+    set(MSVC_TOOLSET_VERSION 100)
+  elseif(MSVC_VERSION EQUAL 1500)
+    # VS 2008
+    set(MSVC_TOOLSET_VERSION 90)
+  elseif(MSVC_VERSION EQUAL 1400)
+    # VS 2005
+    set(MSVC_TOOLSET_VERSION 80)
+  else()
+    # We don't support MSVC_TOOLSET_VERSION for earlier compiler.
+  endif()
+
   set(MSVC10)
   set(MSVC11)
   set(MSVC12)

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=44ad8e48def8d98eaff8fd6deb11731520183daa
commit 44ad8e48def8d98eaff8fd6deb11731520183daa
Author:     ARATA Mizuki <minorinoki at gmail.com>
AuthorDate: Thu Apr 5 01:01:21 2018 +0900
Commit:     ARATA Mizuki <minorinoki at gmail.com>
CommitDate: Thu Apr 5 01:37:57 2018 +0900

    FindwxWidgets: Fix wxWidgets_LIBRARY_DIRS on Cygwin/MSYS
    
    The check for `wxWidgets_LIBRARIES` variable, introduced by e8b77084, fails
    with the `wx-config` script generated by an MSYS build, because
    `wxWidgets_LIBRARY_DIRS` is in POSIX style.
    
    This commit fixes the problem with `wxWidgets_LIBRARY_DIRS` by converting it to
    Windows style.  The actual code were copied from bf643286, which does the same
    thing for `wxWidgets_INCLUDE_DIRS`.

diff --git a/Modules/FindwxWidgets.cmake b/Modules/FindwxWidgets.cmake
index 202d481..1cfc624 100644
--- a/Modules/FindwxWidgets.cmake
+++ b/Modules/FindwxWidgets.cmake
@@ -875,6 +875,26 @@ else()
         set(wxWidgets_INCLUDE_DIRS ${_tmp_path})
         separate_arguments(wxWidgets_INCLUDE_DIRS)
         list(REMOVE_ITEM wxWidgets_INCLUDE_DIRS "")
+
+        set(_tmp_path "")
+        foreach(_path ${wxWidgets_LIBRARY_DIRS})
+          execute_process(
+            COMMAND cygpath -w ${_path}
+            OUTPUT_VARIABLE _native_path
+            RESULT_VARIABLE _retv
+            OUTPUT_STRIP_TRAILING_WHITESPACE
+            ERROR_QUIET
+            )
+          if(_retv EQUAL 0)
+            file(TO_CMAKE_PATH ${_native_path} _native_path)
+            DBG_MSG_V("Path ${_path} converted to ${_native_path}")
+            string(APPEND _tmp_path " ${_native_path}")
+          endif()
+        endforeach()
+        DBG_MSG("Setting wxWidgets_LIBRARY_DIRS = ${_tmp_path}")
+        set(wxWidgets_LIBRARY_DIRS ${_tmp_path})
+        separate_arguments(wxWidgets_LIBRARY_DIRS)
+        list(REMOVE_ITEM wxWidgets_LIBRARY_DIRS "")
       endif()
       unset(_cygpath_exe CACHE)
     endif()

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=30bbb4f2acdebc50a08ef29a0b79577f8275ed2a
commit 30bbb4f2acdebc50a08ef29a0b79577f8275ed2a
Author:     Vitaly Stakhovsky <vvs31415 at gitlab.org>
AuthorDate: Fri Mar 30 22:55:30 2018 -0400
Commit:     Vitaly Stakhovsky <vvs31415 at gitlab.org>
CommitDate: Fri Mar 30 22:55:30 2018 -0400

    cmVisualStudio10TargetGenerator: extend DOM-like generation
    
    The local Elem class is extended with more XML-generating functions.
    WriteGroups() is rewritten to use these new functions,
    avoiding BuildFileStream.

diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 4bd07ef..1817153 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -33,6 +33,7 @@ struct cmVisualStudio10TargetGenerator::Elem
   cmGeneratedFileStream& S;
   int Indent;
   bool HasElements = false;
+  const char* Tag = nullptr;
 
   Elem(cmGeneratedFileStream& s, int i)
     : S(s)
@@ -46,25 +47,45 @@ struct cmVisualStudio10TargetGenerator::Elem
   {
     par.SetHasElements();
   }
+  Elem(Elem& par, const char* tag)
+    : S(par.S)
+    , Indent(par.Indent + 1)
+  {
+    par.SetHasElements();
+    this->StartElement(tag);
+  }
   void SetHasElements()
   {
     if (!HasElements) {
-      S << ">\n";
+      this->S << ">\n";
       HasElements = true;
     }
   }
+  cmGeneratedFileStream& WriteString(const char* line);
+  void StartElement(const char* tag)
+  {
+    this->Tag = tag;
+    this->WriteString("<") << tag;
+  }
+  template <typename T>
+  void WriteElem(const char* tag, const T& val)
+  {
+    this->WriteString("<") << tag << ">" << val << "</" << tag << ">\n";
+  }
+  template <typename T>
+  void Attr(const char* an, const T& av)
+  {
+    this->S << " " << an << "=\"" << av << "\"";
+  }
   void WriteEndTag(const char* tag)
   {
     if (HasElements) {
-      S.fill(' ');
-      S.width(Indent * 2);
-      // write an empty string to get the fill level indent to print
-      S << "";
-      S << "</" << tag << ">\n";
+      this->WriteString("</") << tag << ">\n";
     } else {
-      S << " />\n";
+      this->S << " />\n";
     }
   }
+  void EndElement() { this->WriteEndTag(this->Tag); }
 };
 
 class cmVS10GeneratorOptions : public cmVisualStudioGeneratorOptions
@@ -102,16 +123,14 @@ inline void cmVisualStudio10TargetGenerator::WriteElem(const char* tag,
                                                        const char* val,
                                                        int indentLevel)
 {
-  this->WriteString("<", indentLevel);
-  (*this->BuildFileStream) << tag << ">" << val << "</" << tag << ">\n";
+  Elem(*this->BuildFileStream, indentLevel).WriteElem(tag, val);
 }
 
 inline void cmVisualStudio10TargetGenerator::WriteElem(const char* tag,
                                                        std::string const& val,
                                                        int indentLevel)
 {
-  this->WriteString("<", indentLevel);
-  (*this->BuildFileStream) << tag << ">" << val << "</" << tag << ">\n";
+  Elem(*this->BuildFileStream, indentLevel).WriteElem(tag, val);
 }
 
 inline void cmVisualStudio10TargetGenerator::WriteElemEscapeXML(
@@ -247,14 +266,21 @@ void cmVisualStudio10TargetGenerator::WritePlatformConfigTag(
   }
 }
 
+cmGeneratedFileStream& cmVisualStudio10TargetGenerator::Elem::WriteString(
+  const char* line)
+{
+  this->S.fill(' ');
+  this->S.width(this->Indent * 2);
+  // write an empty string to get the fill level indent to print
+  this->S << "";
+  this->S << line;
+  return this->S;
+}
+
 void cmVisualStudio10TargetGenerator::WriteString(const char* line,
                                                   int indentLevel)
 {
-  this->BuildFileStream->fill(' ');
-  this->BuildFileStream->width(indentLevel * 2);
-  // write an empty string to get the fill level indent to print
-  (*this->BuildFileStream) << "";
-  (*this->BuildFileStream) << line;
+  Elem(*this->BuildFileStream, indentLevel).WriteString(line);
 }
 
 #define VS10_CXX_DEFAULT_PROPS "$(VCTargetsPath)\\Microsoft.Cpp.Default.props"
@@ -1373,71 +1399,72 @@ void cmVisualStudio10TargetGenerator::WriteGroups()
   fout.SetCopyIfDifferent(true);
   char magic[] = { char(0xEF), char(0xBB), char(0xBF) };
   fout.write(magic, 3);
-  cmGeneratedFileStream* save = this->BuildFileStream;
-  this->BuildFileStream = &fout;
 
   // get the tools version to use
   const std::string toolsVer(this->GlobalGenerator->GetToolsVersion());
-  std::string project_defaults = "<?xml version=\"1.0\" encoding=\"" +
-    this->GlobalGenerator->Encoding() + "\"?>\n";
-  project_defaults.append("<Project ToolsVersion=\"");
-  project_defaults.append(toolsVer + "\" ");
-  project_defaults.append(
-    "xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n");
-  this->WriteString(project_defaults.c_str(), 0);
+  fout << "<?xml version=\"1.0\" encoding=\""
+       << this->GlobalGenerator->Encoding() << "\"?>\n";
+
+  Elem e0(fout, 0);
+  e0.StartElement("Project");
+  e0.Attr("ToolsVersion", toolsVer);
+  e0.Attr("xmlns", "http://schemas.microsoft.com/developer/msbuild/2003");
+  e0.SetHasElements();
 
   for (auto const& ti : this->Tools) {
-    this->WriteGroupSources(ti.first.c_str(), ti.second, sourceGroups);
+    this->WriteGroupSources(e0, ti.first, ti.second, sourceGroups);
   }
 
   // Added files are images and the manifest.
   if (!this->AddedFiles.empty()) {
-    this->WriteString("<ItemGroup>\n", 1);
+    Elem e1(e0, "ItemGroup");
+    e1.SetHasElements();
     for (std::string const& oi : this->AddedFiles) {
       std::string fileName =
         cmSystemTools::LowerCase(cmSystemTools::GetFilenameName(oi));
       if (fileName == "wmappmanifest.xml") {
-        this->WriteString("<XML Include=\"", 2);
-        (*this->BuildFileStream) << oi << "\">\n";
-        this->WriteElem("Filter", "Resource Files", 3);
-        this->WriteString("</XML>\n", 2);
+        Elem e2(e1, "XML");
+        e2.Attr("Include", oi);
+        Elem(e2).WriteElem("Filter", "Resource Files");
+        e2.EndElement();
       } else if (cmSystemTools::GetFilenameExtension(fileName) ==
                  ".appxmanifest") {
-        this->WriteString("<AppxManifest Include=\"", 2);
-        (*this->BuildFileStream) << oi << "\">\n";
-        this->WriteElem("Filter", "Resource Files", 3);
-        this->WriteString("</AppxManifest>\n", 2);
+        Elem e2(e1, "AppxManifest");
+        e2.Attr("Include", oi);
+        Elem(e2).WriteElem("Filter", "Resource Files");
+        e2.EndElement();
       } else if (cmSystemTools::GetFilenameExtension(fileName) == ".pfx") {
-        this->WriteString("<None Include=\"", 2);
-        (*this->BuildFileStream) << oi << "\">\n";
-        this->WriteElem("Filter", "Resource Files", 3);
-        this->WriteString("</None>\n", 2);
+        Elem e2(e1, "None");
+        e2.Attr("Include", oi);
+        Elem(e2).WriteElem("Filter", "Resource Files");
+        e2.EndElement();
       } else {
-        this->WriteString("<Image Include=\"", 2);
-        (*this->BuildFileStream) << oi << "\">\n";
-        this->WriteElem("Filter", "Resource Files", 3);
-        this->WriteString("</Image>\n", 2);
+        Elem e2(e1, "Image");
+        e2.Attr("Include", oi);
+        Elem(e2).WriteElem("Filter", "Resource Files");
+        e2.EndElement();
       }
     }
-    this->WriteString("</ItemGroup>\n", 1);
+    e1.EndElement();
   }
 
   std::vector<cmSourceFile const*> resxObjs;
   this->GeneratorTarget->GetResxSources(resxObjs, "");
   if (!resxObjs.empty()) {
-    this->WriteString("<ItemGroup>\n", 1);
+    Elem e1(e0, "ItemGroup");
     for (cmSourceFile const* oi : resxObjs) {
       std::string obj = oi->GetFullPath();
-      this->WriteString("<EmbeddedResource Include=\"", 2);
       ConvertToWindowsSlash(obj);
-      (*this->BuildFileStream) << cmVS10EscapeXML(obj) << "\">\n";
-      this->WriteElem("Filter", "Resource Files", 3);
-      this->WriteString("</EmbeddedResource>\n", 2);
+      Elem e2(e1, "EmbeddedResource");
+      e2.Attr("Include", cmVS10EscapeXML(obj));
+      Elem(e2).WriteElem("Filter", "Resource Files");
+      e2.EndElement();
     }
-    this->WriteString("</ItemGroup>\n", 1);
+    e1.EndElement();
   }
 
-  this->WriteString("<ItemGroup>\n", 1);
+  Elem e1(e0, "ItemGroup");
+  e1.SetHasElements();
   std::vector<cmSourceGroup*> groupsVec(groupsUsed.begin(), groupsUsed.end());
   std::sort(groupsVec.begin(), groupsVec.end(),
             [](cmSourceGroup* l, cmSourceGroup* r) {
@@ -1446,31 +1473,29 @@ void cmVisualStudio10TargetGenerator::WriteGroups()
   for (cmSourceGroup* sg : groupsVec) {
     std::string const& name = sg->GetFullName();
     if (!name.empty()) {
-      this->WriteString("<Filter Include=\"", 2);
-      (*this->BuildFileStream) << name << "\">\n";
-      std::string guidName = "SG_Filter_";
-      guidName += name;
+      std::string guidName = "SG_Filter_" + name;
       std::string guid = this->GlobalGenerator->GetGUID(guidName);
-      this->WriteElem("UniqueIdentifier", "{" + guid + "}", 3);
-      this->WriteString("</Filter>\n", 2);
+      Elem e2(e1, "Filter");
+      e2.Attr("Include", name);
+      Elem(e2).WriteElem("UniqueIdentifier", "{" + guid + "}");
+      e2.EndElement();
     }
   }
 
   if (!resxObjs.empty() || !this->AddedFiles.empty()) {
-    this->WriteString("<Filter Include=\"Resource Files\">\n", 2);
     std::string guidName = "SG_Filter_Resource Files";
     std::string guid = this->GlobalGenerator->GetGUID(guidName);
-    this->WriteElem("UniqueIdentifier", "{" + guid + "}", 3);
-    this->WriteString("<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;", 3);
-    (*this->BuildFileStream) << "gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;";
-    (*this->BuildFileStream) << "mfcribbon-ms</Extensions>\n";
-    this->WriteString("</Filter>\n", 2);
+    Elem e2(e1, "Filter");
+    e2.Attr("Include", "Resource Files");
+    Elem(e2).WriteElem("UniqueIdentifier", "{" + guid + "}");
+    Elem(e2).WriteElem("Extensions",
+                       "rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;"
+                       "gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms");
+    e2.EndElement();
   }
 
-  this->WriteString("</ItemGroup>\n", 1);
-  this->WriteString("</Project>\n", 0);
-  // restore stream pointer
-  this->BuildFileStream = save;
+  e1.EndElement();
+  e0.EndElement();
 
   if (fout.Close()) {
     this->GlobalGenerator->FileReplacedDuringGenerate(path);
@@ -1515,30 +1540,27 @@ void cmVisualStudio10TargetGenerator::AddMissingSourceGroups(
 }
 
 void cmVisualStudio10TargetGenerator::WriteGroupSources(
-  std::string const& name, ToolSources const& sources,
+  Elem& e0, std::string const& name, ToolSources const& sources,
   std::vector<cmSourceGroup>& sourceGroups)
 {
-  this->WriteString("<ItemGroup>\n", 1);
+  Elem e1(e0, "ItemGroup");
+  e1.SetHasElements();
   for (ToolSource const& s : sources) {
     cmSourceFile const* sf = s.SourceFile;
     std::string const& source = sf->GetFullPath();
     cmSourceGroup* sourceGroup =
       this->Makefile->FindSourceGroup(source, sourceGroups);
     std::string const& filter = sourceGroup->GetFullName();
-    this->WriteString("<", 2);
     std::string path = this->ConvertPath(source, s.RelativePath);
     ConvertToWindowsSlash(path);
-    (*this->BuildFileStream) << name << " Include=\"" << cmVS10EscapeXML(path);
+    Elem e2(e1, name.c_str());
+    e2.Attr("Include", cmVS10EscapeXML(path));
     if (!filter.empty()) {
-      (*this->BuildFileStream) << "\">\n";
-      this->WriteElem("Filter", filter, 3);
-      this->WriteString("</", 2);
-      (*this->BuildFileStream) << name << ">\n";
-    } else {
-      (*this->BuildFileStream) << "\" />\n";
+      Elem(e2).WriteElem("Filter", filter);
     }
+    e2.EndElement();
   }
-  this->WriteString("</ItemGroup>\n", 1);
+  e1.EndElement();
 }
 
 void cmVisualStudio10TargetGenerator::WriteHeaderSource(cmSourceFile const* sf)
diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h
index 7106737..4df03b6 100644
--- a/Source/cmVisualStudio10TargetGenerator.h
+++ b/Source/cmVisualStudio10TargetGenerator.h
@@ -158,7 +158,8 @@ private:
   void WriteEvent(const char* name,
                   std::vector<cmCustomCommand> const& commands,
                   std::string const& configName);
-  void WriteGroupSources(std::string const& name, ToolSources const& sources,
+  void WriteGroupSources(Elem& e0, std::string const& name,
+                         ToolSources const& sources,
                          std::vector<cmSourceGroup>&);
   void AddMissingSourceGroups(std::set<cmSourceGroup*>& groupsUsed,
                               const std::vector<cmSourceGroup>& allGroups);

-----------------------------------------------------------------------

Summary of changes:
 Help/manual/cmake-variables.7.rst                  |    1 +
 Help/release/dev/msvc-toolset-version-variable.rst |    6 +
 Help/variable/MSVC_TOOLSET_VERSION.rst             |   21 +++
 Help/variable/MSVC_VERSION.rst                     |    3 +-
 Modules/FindBoost.cmake                            |   33 +---
 Modules/FindGTK2.cmake                             |   10 +-
 Modules/FindIce.cmake                              |   20 +--
 Modules/FindwxWidgets.cmake                        |   34 ++--
 Modules/InstallRequiredSystemLibraries.cmake       |  105 ++++--------
 Modules/Platform/Windows-MSVC.cmake                |   25 +++
 Source/cmVisualStudio10TargetGenerator.cxx         |  178 +++++++++++---------
 Source/cmVisualStudio10TargetGenerator.h           |    3 +-
 12 files changed, 225 insertions(+), 214 deletions(-)
 create mode 100644 Help/release/dev/msvc-toolset-version-variable.rst
 create mode 100644 Help/variable/MSVC_TOOLSET_VERSION.rst


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list