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  8ed6efbbd377c0941ba018200282fc961aa7d20e (commit)
       via  fc4cbbc2a5f9f7d38e77c991a88400b29c39f182 (commit)
       via  c024e44abea66e37fefe358659d70d8811dd73c8 (commit)
       via  aefd424b6b2f5b630f9a511cfadd6b07228656c1 (commit)
       via  f83f29dbaa254053ac7fe2cc0e6403908fc04ac9 (commit)
       via  9e07ea190bcbd83ffb054cff525fc1a0336a1a7d (commit)
       via  021c61408cc042b1467fbee5cfac4a1ea509118f (commit)
       via  d0f0ba0f7a39e70fbed197e717292b74150cf84f (commit)
       via  a48ce8f4bf0677e9e8d054892836e8a980ffa435 (commit)
       via  81b4d10d8f421242f9989ff0c2d37a12be66f405 (commit)
       via  4c0fb923b7747f1eed0bfa73b8d1653997e1bda9 (commit)
       via  26a99da206526efb203d0e448d7e095a07bec2fd (commit)
       via  9c07cefee541d47be9c378a9285711e07be7a16f (commit)
       via  639e14def6ada307c25a422a4b51f1fceaebeead (commit)
       via  c365243a3a282523062b5378898aa4fe6436f8fb (commit)
       via  62381effba418cdccff0b18f234e3a307446d635 (commit)
       via  3205c7c950d5b90d47ce1c5c58073e511339b78c (commit)
       via  13c92b4a300934e9f8573dee01ab4ec5e06fa7a1 (commit)
       via  083cf7e8a2515d9f838f3edbb2724fd3b17d83cd (commit)
      from  01b6a2c4ee8930e60459b46b4d751148ce28d5a9 (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=8ed6efbbd377c0941ba018200282fc961aa7d20e
commit 8ed6efbbd377c0941ba018200282fc961aa7d20e
Merge: fc4cbbc d0f0ba0
Author:     Brad King <brad.k...@kitware.com>
AuthorDate: Wed May 22 14:30:43 2019 +0000
Commit:     Kitware Robot <kwro...@kitware.com>
CommitDate: Wed May 22 10:32:43 2019 -0400

    Merge topic 'default-generator-env'
    
    d0f0ba0f7a Tests: Add environment generator tests
    a48ce8f4bf Help: Add documentation for default generator environment 
variables
    083cf7e8a2 cmake: Allow default generator to be set by environment variables
    
    Acked-by: Kitware Robot <kwro...@kitware.com>
    Merge-request: !3218

diff --cc Source/cmake.cxx
index 031123a,c861f3b..0762ae1
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@@ -812,8 -840,18 +848,18 @@@ void cmake::SetArgs(const std::vector<s
      }
      // no option assume it is the path to the source or an existing build
      else {
 -      this->SetDirectoriesFromFile(arg.c_str());
 +      this->SetDirectoriesFromFile(arg);
      }
+     // Empty instance, platform and toolset if only a generator is specified
+     if (this->GlobalGenerator) {
+       this->GeneratorInstance = "";
+       if (!this->GeneratorPlatformSet) {
+         this->GeneratorPlatform = "";
+       }
+       if (!this->GeneratorToolsetSet) {
+         this->GeneratorToolset = "";
+       }
+     }
    }
  
    const bool haveSourceDir = !this->GetHomeDirectory().empty();

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fc4cbbc2a5f9f7d38e77c991a88400b29c39f182
commit fc4cbbc2a5f9f7d38e77c991a88400b29c39f182
Merge: c024e44 81b4d10
Author:     Brad King <brad.k...@kitware.com>
AuthorDate: Wed May 22 14:29:49 2019 +0000
Commit:     Kitware Robot <kwro...@kitware.com>
CommitDate: Wed May 22 10:30:00 2019 -0400

    Merge topic 'remove_unneeded_device_link_calls'
    
    81b4d10d8f CUDA: More exhaustive checks to determine when to do device 
linking
    3205c7c950 cmNinjaLinkLineDeviceComputer now lives in the correct source 
file
    
    Acked-by: Kitware Robot <kwro...@kitware.com>
    Merge-request: !3320


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c024e44abea66e37fefe358659d70d8811dd73c8
commit c024e44abea66e37fefe358659d70d8811dd73c8
Merge: aefd424 26a99da
Author:     Brad King <brad.k...@kitware.com>
AuthorDate: Wed May 22 14:28:42 2019 +0000
Commit:     Kitware Robot <kwro...@kitware.com>
CommitDate: Wed May 22 10:28:59 2019 -0400

    Merge topic 'find-package-prefer-config'
    
    26a99da206 find_package: Add option to prefer Config mode
    c365243a3a find_package: Factor out module and config find_package methods
    
    Acked-by: Kitware Robot <kwro...@kitware.com>
    Acked-by: Ruslan Baratov <ruslan_bara...@yahoo.com>
    Merge-request: !3339


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=aefd424b6b2f5b630f9a511cfadd6b07228656c1
commit aefd424b6b2f5b630f9a511cfadd6b07228656c1
Merge: f83f29d 62381ef
Author:     Brad King <brad.k...@kitware.com>
AuthorDate: Wed May 22 14:27:19 2019 +0000
Commit:     Kitware Robot <kwro...@kitware.com>
CommitDate: Wed May 22 10:28:00 2019 -0400

    Merge topic 'swift-debug-variant'
    
    62381effba Ninja,Swift: reuse `SWIFT_MODULE_NAME` for `SWIFT_MODULE`
    
    Acked-by: Kitware Robot <kwro...@kitware.com>
    Merge-request: !3343


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f83f29dbaa254053ac7fe2cc0e6403908fc04ac9
commit f83f29dbaa254053ac7fe2cc0e6403908fc04ac9
Merge: 9e07ea1 9c07cef
Author:     Brad King <brad.k...@kitware.com>
AuthorDate: Wed May 22 14:25:50 2019 +0000
Commit:     Kitware Robot <kwro...@kitware.com>
CommitDate: Wed May 22 10:27:01 2019 -0400

    Merge topic 'vs-ApplicationTypeRevision'
    
    9c07cefee5 VS: Fix ApplicationTypeRevision in builtin check projects
    639e14def6 VS: Factor out helper to compute ApplicationTypeRevision
    
    Acked-by: Kitware Robot <kwro...@kitware.com>
    Merge-request: !3350


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9e07ea190bcbd83ffb054cff525fc1a0336a1a7d
commit 9e07ea190bcbd83ffb054cff525fc1a0336a1a7d
Merge: 021c614 4c0fb92
Author:     Brad King <brad.k...@kitware.com>
AuthorDate: Wed May 22 14:25:09 2019 +0000
Commit:     Kitware Robot <kwro...@kitware.com>
CommitDate: Wed May 22 10:25:50 2019 -0400

    Merge topic 'compiler-id-arch-only-iar'
    
    4c0fb923b7 IAR: Do not print compiler architecture id for non-IAR compilers
    
    Acked-by: Kitware Robot <kwro...@kitware.com>
    Merge-request: !3352


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=021c61408cc042b1467fbee5cfac4a1ea509118f
commit 021c61408cc042b1467fbee5cfac4a1ea509118f
Merge: 01b6a2c 13c92b4
Author:     Brad King <brad.k...@kitware.com>
AuthorDate: Wed May 22 14:24:38 2019 +0000
Commit:     Kitware Robot <kwro...@kitware.com>
CommitDate: Wed May 22 10:24:46 2019 -0400

    Merge topic 'ninja-lib-symlink-space'
    
    13c92b4a30 Ninja: Fix creation of library symlinks in folders with spaces
    
    Acked-by: Kitware Robot <kwro...@kitware.com>
    Merge-request: !3341


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d0f0ba0f7a39e70fbed197e717292b74150cf84f
commit d0f0ba0f7a39e70fbed197e717292b74150cf84f
Author:     Eicke Herbertz <woll...@posteo.de>
AuthorDate: Sat May 4 23:54:58 2019 +0200
Commit:     Brad King <brad.k...@kitware.com>
CommitDate: Wed May 22 07:40:51 2019 -0400

    Tests: Add environment generator tests

diff --git a/Tests/EnforceConfig.cmake.in b/Tests/EnforceConfig.cmake.in
index 8c0817c..f84d180 100644
--- a/Tests/EnforceConfig.cmake.in
+++ b/Tests/EnforceConfig.cmake.in
@@ -23,4 +23,10 @@ if(NOT CTEST_CONFIGURATION_TYPE)
   message("Guessing configuration ${CTEST_CONFIGURATION_TYPE}")
 endif()
 
+# Isolate tests from user configuration in the environment.
+unset(ENV{CMAKE_GENERATOR})
+unset(ENV{CMAKE_GENERATOR_INSTANCE})
+unset(ENV{CMAKE_GENERATOR_PLATFORM})
+unset(ENV{CMAKE_GENERATOR_TOOLSET})
+
 @TEST_HOME_ENV_CODE@
diff --git a/Tests/RunCMake/CommandLine/EnvGenerator/CMakeLists.txt 
b/Tests/RunCMake/CommandLine/EnvGenerator/CMakeLists.txt
new file mode 100644
index 0000000..2b8c65c
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/EnvGenerator/CMakeLists.txt
@@ -0,0 +1,10 @@
+cmake_minimum_required(VERSION 3.14)
+project(EnvGenerator C)
+if(CMAKE_GENERATOR MATCHES "Visual Studio")
+  message(STATUS "CMAKE_VS_PLATFORM_NAME='${CMAKE_VS_PLATFORM_NAME}'")
+endif()
+add_custom_command(
+  OUTPUT output.txt
+  COMMAND ${CMAKE_COMMAND} -E echo CustomCommand > output.txt
+  )
+add_custom_target(CustomTarget ALL DEPENDS output.txt)
diff --git a/Tests/RunCMake/CommandLine/Envgen-A-platform-result.txt 
b/Tests/RunCMake/CommandLine/Envgen-A-platform-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/Envgen-A-platform-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CommandLine/Envgen-A-platform-stderr-vs9.txt 
b/Tests/RunCMake/CommandLine/Envgen-A-platform-stderr-vs9.txt
new file mode 100644
index 0000000..4eae6aa
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/Envgen-A-platform-stderr-vs9.txt
@@ -0,0 +1,2 @@
+^CMake Error at CMakeLists.+
+  No CMAKE_C_COMPILER could be found.
diff --git a/Tests/RunCMake/CommandLine/Envgen-A-platform-stderr.txt 
b/Tests/RunCMake/CommandLine/Envgen-A-platform-stderr.txt
new file mode 100644
index 0000000..09c2d2b
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/Envgen-A-platform-stderr.txt
@@ -0,0 +1,2 @@
+^CMake Error at CMakeLists.+
+.+Platform='fromcli'.+
diff --git a/Tests/RunCMake/CommandLine/Envgen-G-implicit-platform-stdout.txt 
b/Tests/RunCMake/CommandLine/Envgen-G-implicit-platform-stdout.txt
new file mode 100644
index 0000000..4dd6be1
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/Envgen-G-implicit-platform-stdout.txt
@@ -0,0 +1 @@
+-- CMAKE_VS_PLATFORM_NAME='(x64|Win32)'
diff --git a/Tests/RunCMake/CommandLine/Envgen-T-toolset-result.txt 
b/Tests/RunCMake/CommandLine/Envgen-T-toolset-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/Envgen-T-toolset-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CommandLine/Envgen-T-toolset-stderr.txt 
b/Tests/RunCMake/CommandLine/Envgen-T-toolset-stderr.txt
new file mode 100644
index 0000000..b432c19
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/Envgen-T-toolset-stderr.txt
@@ -0,0 +1,2 @@
+^CMake Error at CMakeLists.+
+.+(Platform Toolset = 'fromcli'|Specified platform toolset \(fromcli\) is not 
installed or invalid).+
diff --git a/Tests/RunCMake/CommandLine/Envgen-bad-result.txt 
b/Tests/RunCMake/CommandLine/Envgen-bad-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/Envgen-bad-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CommandLine/Envgen-bad-stderr.txt 
b/Tests/RunCMake/CommandLine/Envgen-bad-stderr.txt
new file mode 100644
index 0000000..4a1215e
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/Envgen-bad-stderr.txt
@@ -0,0 +1,5 @@
+^CMake Error: No generator specified for -G
+CMake Error: CMAKE_GENERATOR was set but the specified generator doesn't 
exist. Using CMake default.
+
+Generators.*
+\* (Unix Makefiles|Visual Studio).*
diff --git a/Tests/RunCMake/CommandLine/Envgen-instance-invalid-result.txt 
b/Tests/RunCMake/CommandLine/Envgen-instance-invalid-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/Envgen-instance-invalid-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CommandLine/Envgen-instance-invalid-stderr.txt 
b/Tests/RunCMake/CommandLine/Envgen-instance-invalid-stderr.txt
new file mode 100644
index 0000000..d53daa5
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/Envgen-instance-invalid-stderr.txt
@@ -0,0 +1,2 @@
+^CMake Error at CMakeLists.+
+  could not find specified instance of Visual Studio.+
diff --git a/Tests/RunCMake/CommandLine/Envgen-ninja-result.txt 
b/Tests/RunCMake/CommandLine/Envgen-ninja-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/Envgen-ninja-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CommandLine/Envgen-ninja-stderr.txt 
b/Tests/RunCMake/CommandLine/Envgen-ninja-stderr.txt
new file mode 100644
index 0000000..0d455db
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/Envgen-ninja-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Error: No generator specified for -G
+
+Generators.*
+\* Ninja.*
diff --git a/Tests/RunCMake/CommandLine/Envgen-platform-invalid-result.txt 
b/Tests/RunCMake/CommandLine/Envgen-platform-invalid-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/Envgen-platform-invalid-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CommandLine/Envgen-platform-invalid-stderr-vs9.txt 
b/Tests/RunCMake/CommandLine/Envgen-platform-invalid-stderr-vs9.txt
new file mode 100644
index 0000000..4eae6aa
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/Envgen-platform-invalid-stderr-vs9.txt
@@ -0,0 +1,2 @@
+^CMake Error at CMakeLists.+
+  No CMAKE_C_COMPILER could be found.
diff --git a/Tests/RunCMake/CommandLine/Envgen-platform-invalid-stderr.txt 
b/Tests/RunCMake/CommandLine/Envgen-platform-invalid-stderr.txt
new file mode 100644
index 0000000..76a8f1c
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/Envgen-platform-invalid-stderr.txt
@@ -0,0 +1,2 @@
+^CMake Error at CMakeLists.+
+.+Platform='invalid'.+
diff --git a/Tests/RunCMake/CommandLine/Envgen-toolset-invalid-result.txt 
b/Tests/RunCMake/CommandLine/Envgen-toolset-invalid-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/Envgen-toolset-invalid-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CommandLine/Envgen-toolset-invalid-stderr.txt 
b/Tests/RunCMake/CommandLine/Envgen-toolset-invalid-stderr.txt
new file mode 100644
index 0000000..51fce60
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/Envgen-toolset-invalid-stderr.txt
@@ -0,0 +1,2 @@
+^CMake Error at CMakeLists.+
+.+(Platform Toolset = 'invalid'|Specified platform toolset \(invalid\) is not 
installed or invalid).+
diff --git a/Tests/RunCMake/CommandLine/Envgen-unset-result.txt 
b/Tests/RunCMake/CommandLine/Envgen-unset-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/Envgen-unset-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CommandLine/Envgen-unset-stderr.txt 
b/Tests/RunCMake/CommandLine/Envgen-unset-stderr.txt
new file mode 100644
index 0000000..ec6ec92
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/Envgen-unset-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Error: No generator specified for -G
+
+Generators.*
+\* (Unix Makefiles|Visual Studio).*
diff --git a/Tests/RunCMake/CommandLine/Envgen-warnings-result.txt 
b/Tests/RunCMake/CommandLine/Envgen-warnings-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/Envgen-warnings-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CommandLine/Envgen-warnings-stderr.txt 
b/Tests/RunCMake/CommandLine/Envgen-warnings-stderr.txt
new file mode 100644
index 0000000..47f9c9e
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/Envgen-warnings-stderr.txt
@@ -0,0 +1,7 @@
+^Warning: Environment variable CMAKE_GENERATOR_INSTANCE will be ignored, 
because CMAKE_GENERATOR is not set.
+Warning: Environment variable CMAKE_GENERATOR_PLATFORM will be ignored, 
because CMAKE_GENERATOR is not set.
+Warning: Environment variable CMAKE_GENERATOR_TOOLSET will be ignored, because 
CMAKE_GENERATOR is not set.
+CMake Error: No generator specified for -G
+
+Generators.*
+\* (Unix Makefiles|Visual Studio).*
diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake 
b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
index ea749ea..dd1180b 100644
--- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
@@ -164,6 +164,74 @@ function(run_BuildDir)
 endfunction()
 run_BuildDir()
 
+function(run_EnvironmentGenerator)
+  set(source_dir ${RunCMake_SOURCE_DIR}/EnvGenerator)
+
+  set(ENV{CMAKE_GENERATOR_INSTANCE} "instance")
+  set(ENV{CMAKE_GENERATOR_PLATFORM} "platform")
+  set(ENV{CMAKE_GENERATOR_TOOLSET} "toolset")
+  run_cmake_command(Envgen-warnings ${CMAKE_COMMAND} -G)
+  unset(ENV{CMAKE_GENERATOR_INSTANCE})
+  unset(ENV{CMAKE_GENERATOR_PLATFORM})
+  unset(ENV{CMAKE_GENERATOR_TOOLSET})
+
+  # Test CMAKE_GENERATOR without actual configuring
+  run_cmake_command(Envgen-unset ${CMAKE_COMMAND} -G)
+  set(ENV{CMAKE_GENERATOR} "Ninja")
+  run_cmake_command(Envgen-ninja ${CMAKE_COMMAND} -G)
+  set(ENV{CMAKE_GENERATOR} "NoSuchGenerator")
+  run_cmake_command(Envgen-bad ${CMAKE_COMMAND} -G)
+  unset(ENV{CMAKE_GENERATOR})
+
+  if(RunCMake_GENERATOR MATCHES "Visual Studio.*")
+    set(ENV{CMAKE_GENERATOR} "${RunCMake_GENERATOR}")
+    run_cmake_command(Envgen ${CMAKE_COMMAND} ${source_dir})
+    # Toolset is available since VS 2010.
+    if(RunCMake_GENERATOR MATCHES "Visual Studio [1-9][0-9]")
+      set(ENV{CMAKE_GENERATOR_TOOLSET} "invalid")
+      # Envvar shouldn't affect existing build tree
+      run_cmake_command(Envgen-toolset-existing ${CMAKE_COMMAND} -E chdir ..
+        ${CMAKE_COMMAND} --build Envgen-build)
+      run_cmake_command(Envgen-toolset-invalid ${CMAKE_COMMAND} ${source_dir})
+      # Command line -G implies -T""
+      run_cmake_command(Envgen-G-implicit-toolset ${CMAKE_COMMAND} -G 
"${RunCMake_GENERATOR}" ${source_dir})
+      run_cmake_command(Envgen-T-toolset ${CMAKE_COMMAND} -T "fromcli" 
${source_dir})
+      unset(ENV{CMAKE_GENERATOR_TOOLSET})
+    endif()
+    # Platform can be set only if not in generator name.
+    if(RunCMake_GENERATOR MATCHES "^Visual Studio [0-9]+ [0-9]+$")
+      set(ENV{CMAKE_GENERATOR_PLATFORM} "invalid")
+      # Envvar shouldn't affect existing build tree
+      run_cmake_command(Envgen-platform-existing ${CMAKE_COMMAND} -E chdir ..
+        ${CMAKE_COMMAND} --build Envgen-build)
+      if(RunCMake_GENERATOR MATCHES "^Visual Studio 9 ")
+        set(RunCMake-stderr-file "Envgen-platform-invalid-stderr-vs9.txt")
+      endif()
+      run_cmake_command(Envgen-platform-invalid ${CMAKE_COMMAND} ${source_dir})
+      unset(RunCMake-stderr-file)
+      # Command line -G implies -A""
+      run_cmake_command(Envgen-G-implicit-platform ${CMAKE_COMMAND} -G 
"${RunCMake_GENERATOR}" ${source_dir})
+      if(RunCMake_GENERATOR MATCHES "^Visual Studio 9 ")
+        set(RunCMake-stderr-file "Envgen-A-platform-stderr-vs9.txt")
+      endif()
+      run_cmake_command(Envgen-A-platform ${CMAKE_COMMAND} -A "fromcli" 
${source_dir})
+      unset(RunCMake-stderr-file)
+      unset(ENV{CMAKE_GENERATOR_PLATFORM})
+    endif()
+    # Instance is available since VS 2017.
+    if(RunCMake_GENERATOR MATCHES "Visual Studio (15|16).*")
+      set(ENV{CMAKE_GENERATOR_INSTANCE} "invalid")
+      # Envvar shouldn't affect existing build tree
+      run_cmake_command(Envgen-instance-existing ${CMAKE_COMMAND} -E chdir ..
+              ${CMAKE_COMMAND} --build Envgen-build)
+      run_cmake_command(Envgen-instance-invalid ${CMAKE_COMMAND} ${source_dir})
+      unset(ENV{CMAKE_GENERATOR_INSTANCE})
+    endif()
+    unset(ENV{CMAKE_GENERATOR})
+  endif()
+endfunction()
+run_EnvironmentGenerator()
+
 if(RunCMake_GENERATOR STREQUAL "Ninja")
   # Use a single build tree for a few tests without cleaning.
   set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Build-build)

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a48ce8f4bf0677e9e8d054892836e8a980ffa435
commit a48ce8f4bf0677e9e8d054892836e8a980ffa435
Author:     Eicke Herbertz <woll...@posteo.de>
AuthorDate: Fri Apr 12 00:50:33 2019 +0200
Commit:     Brad King <brad.k...@kitware.com>
CommitDate: Wed May 22 07:40:49 2019 -0400

    Help: Add documentation for default generator environment variables
    
    Documentation for environment variables that control the default
    generator selection:
    
    * CMAKE_GENERATOR
    * CMAKE_GENERATOR_INSTANCE
    * CMAKE_GENERATOR_PLATFORM
    * CMAKE_GENERATOR_TOOLSET

diff --git a/Help/envvar/CMAKE_GENERATOR.rst b/Help/envvar/CMAKE_GENERATOR.rst
new file mode 100644
index 0000000..f2d055f
--- /dev/null
+++ b/Help/envvar/CMAKE_GENERATOR.rst
@@ -0,0 +1,16 @@
+CMAKE_GENERATOR
+---------------
+
+.. include:: ENV_VAR.txt
+
+Specifies the CMake default generator to use when no generator is supplied
+with ``-G``. If the provided value doesn't name a generator known by CMake,
+the internal default is used.  Either way the resulting generator selection
+is stored in the :variable:`CMAKE_GENERATOR` variable.
+
+Some generators may be additionally configured using the environment
+variables:
+
+* :envvar:`CMAKE_GENERATOR_PLATFORM`
+* :envvar:`CMAKE_GENERATOR_TOOLSET`
+* :envvar:`CMAKE_GENERATOR_INSTANCE`
diff --git a/Help/envvar/CMAKE_GENERATOR_INSTANCE.rst 
b/Help/envvar/CMAKE_GENERATOR_INSTANCE.rst
new file mode 100644
index 0000000..1654fa1
--- /dev/null
+++ b/Help/envvar/CMAKE_GENERATOR_INSTANCE.rst
@@ -0,0 +1,7 @@
+CMAKE_GENERATOR_INSTANCE
+------------------------
+
+.. include:: ENV_VAR.txt
+
+Default value for :variable:`CMAKE_GENERATOR_INSTANCE` if no Cache entry is
+present. This value is only applied if :envvar:`CMAKE_GENERATOR` is set.
diff --git a/Help/envvar/CMAKE_GENERATOR_PLATFORM.rst 
b/Help/envvar/CMAKE_GENERATOR_PLATFORM.rst
new file mode 100644
index 0000000..917b30b
--- /dev/null
+++ b/Help/envvar/CMAKE_GENERATOR_PLATFORM.rst
@@ -0,0 +1,8 @@
+CMAKE_GENERATOR_PLATFORM
+------------------------
+
+.. include:: ENV_VAR.txt
+
+Default value for :variable:`CMAKE_GENERATOR_PLATFORM` if no Cache entry
+is present and no value is specified by :manual:`cmake(1)` ``-A`` option.
+This value is only applied if :envvar:`CMAKE_GENERATOR` is set.
diff --git a/Help/envvar/CMAKE_GENERATOR_TOOLSET.rst 
b/Help/envvar/CMAKE_GENERATOR_TOOLSET.rst
new file mode 100644
index 0000000..7ac3856
--- /dev/null
+++ b/Help/envvar/CMAKE_GENERATOR_TOOLSET.rst
@@ -0,0 +1,8 @@
+CMAKE_GENERATOR_TOOLSET
+-----------------------
+
+.. include:: ENV_VAR.txt
+
+Default value for :variable:`CMAKE_GENERATOR_TOOLSET` if no Cache entry
+is present and no value is specified by :manual:`cmake(1)` ``-T`` option.
+This value is only applied if :envvar:`CMAKE_GENERATOR` is set.
diff --git a/Help/manual/OPTIONS_BUILD.txt b/Help/manual/OPTIONS_BUILD.txt
index 64fd816..810aaa9 100644
--- a/Help/manual/OPTIONS_BUILD.txt
+++ b/Help/manual/OPTIONS_BUILD.txt
@@ -56,6 +56,9 @@
  build system.  Possible generator names are specified in the
  :manual:`cmake-generators(7)` manual.
 
+ If not specified, CMake checks the :envvar:`CMAKE_GENERATOR` environment
+ variable and otherwise falls back to a builtin default selection.
+
 ``-T <toolset-spec>``
  Toolset specification for the generator, if supported.
 
diff --git a/Help/manual/cmake-env-variables.7.rst 
b/Help/manual/cmake-env-variables.7.rst
index c433412..89c9119 100644
--- a/Help/manual/cmake-env-variables.7.rst
+++ b/Help/manual/cmake-env-variables.7.rst
@@ -23,6 +23,10 @@ Environment Variables that Control the Build
 
    /envvar/CMAKE_BUILD_PARALLEL_LEVEL
    /envvar/CMAKE_CONFIG_TYPE
+   /envvar/CMAKE_GENERATOR
+   /envvar/CMAKE_GENERATOR_INSTANCE
+   /envvar/CMAKE_GENERATOR_PLATFORM
+   /envvar/CMAKE_GENERATOR_TOOLSET
    /envvar/CMAKE_MSVCIDE_RUN_PATH
    /envvar/CMAKE_NO_VERBOSE
    /envvar/CMAKE_OSX_ARCHITECTURES
diff --git a/Help/release/dev/default-generator-env.rst 
b/Help/release/dev/default-generator-env.rst
new file mode 100644
index 0000000..3f20475
--- /dev/null
+++ b/Help/release/dev/default-generator-env.rst
@@ -0,0 +1,9 @@
+default-generator-env
+---------------------
+
+* The :envvar:`CMAKE_GENERATOR` environment variable was added
+  to specify a default generator to use when :manual:`cmake(1)` is
+  run without a ``-G`` option.  Additionally, environment variables
+  :envvar:`CMAKE_GENERATOR_PLATFORM`, :envvar:`CMAKE_GENERATOR_TOOLSET`,
+  and :envvar:`CMAKE_GENERATOR_INSTANCE` were created to configure
+  the generator.
diff --git a/Help/variable/CMAKE_GENERATOR.rst 
b/Help/variable/CMAKE_GENERATOR.rst
index cce04c1..ec52cd4 100644
--- a/Help/variable/CMAKE_GENERATOR.rst
+++ b/Help/variable/CMAKE_GENERATOR.rst
@@ -5,3 +5,8 @@ The generator used to build the project.  See 
:manual:`cmake-generators(7)`.
 
 The name of the generator that is being used to generate the build
 files.  (e.g.  ``Unix Makefiles``, ``Ninja``, etc.)
+
+The value of this variable should never be modified by project code.
+A generator may be selected via the :manual:`cmake(1)` ``-G`` option,
+interactively in :manual:`cmake-gui(1)`, or via the :envvar:`CMAKE_GENERATOR`
+environment variable.
diff --git a/Help/variable/CMAKE_GENERATOR_INSTANCE.rst 
b/Help/variable/CMAKE_GENERATOR_INSTANCE.rst
index 78c81b1..3657ed4 100644
--- a/Help/variable/CMAKE_GENERATOR_INSTANCE.rst
+++ b/Help/variable/CMAKE_GENERATOR_INSTANCE.rst
@@ -5,9 +5,10 @@ Generator-specific instance specification provided by user.
 
 Some CMake generators support selection of an instance of the native build
 system when multiple instances are available.  If the user specifies an
-instance (e.g. by setting this cache entry), or after a default instance is
-chosen when a build tree is first configured, the value will be available in
-this variable.
+instance (e.g. by setting this cache entry or via the
+:envvar:`CMAKE_GENERATOR_INSTANCE` environment variable), or after a default
+instance is chosen when a build tree is first configured, the value will be
+available in this variable.
 
 The value of this variable should never be modified by project code.
 A toolchain file specified by the :variable:`CMAKE_TOOLCHAIN_FILE`
diff --git a/Help/variable/CMAKE_GENERATOR_PLATFORM.rst 
b/Help/variable/CMAKE_GENERATOR_PLATFORM.rst
index 963f0a4..2c115a3 100644
--- a/Help/variable/CMAKE_GENERATOR_PLATFORM.rst
+++ b/Help/variable/CMAKE_GENERATOR_PLATFORM.rst
@@ -6,7 +6,8 @@ Generator-specific target platform specification provided by 
user.
 Some CMake generators support a target platform name to be given
 to the native build system to choose a compiler toolchain.
 If the user specifies a platform name (e.g. via the :manual:`cmake(1)` ``-A``
-option) the value will be available in this variable.
+option or via the :envvar:`CMAKE_GENERATOR_PLATFORM` environment variable)
+the value will be available in this variable.
 
 The value of this variable should never be modified by project code.
 A toolchain file specified by the :variable:`CMAKE_TOOLCHAIN_FILE`
diff --git a/Help/variable/CMAKE_GENERATOR_TOOLSET.rst 
b/Help/variable/CMAKE_GENERATOR_TOOLSET.rst
index e77f211..a01a8b7 100644
--- a/Help/variable/CMAKE_GENERATOR_TOOLSET.rst
+++ b/Help/variable/CMAKE_GENERATOR_TOOLSET.rst
@@ -5,7 +5,8 @@ Native build system toolset specification provided by user.
 
 Some CMake generators support a toolset specification to tell the
 native build system how to choose a compiler.  If the user specifies
-a toolset (e.g.  via the :manual:`cmake(1)` ``-T`` option) the value
+a toolset (e.g. via the :manual:`cmake(1)` ``-T`` option or via
+the :envvar:`CMAKE_GENERATOR_TOOLSET` environment variable) the value
 will be available in this variable.
 
 The value of this variable should never be modified by project code.

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=81b4d10d8f421242f9989ff0c2d37a12be66f405
commit 81b4d10d8f421242f9989ff0c2d37a12be66f405
Author:     Robert Maynard <robert.mayn...@kitware.com>
AuthorDate: Thu May 9 09:13:39 2019 -0400
Commit:     Robert Maynard <robert.mayn...@kitware.com>
CommitDate: Tue May 21 11:40:07 2019 -0400

    CUDA: More exhaustive checks to determine when to do device linking
    
    Previously CMake used fairly naive logic to determine when to do
    device linking which caused unnecessary device linking to occur
    frequently. We now use a more exhaustive algorithm to determine
    when we have a need for device linking.
    
    Fixes: #19238

diff --git a/Source/cmLinkLineDeviceComputer.cxx 
b/Source/cmLinkLineDeviceComputer.cxx
index 72edba3..6cfe5bb 100644
--- a/Source/cmLinkLineDeviceComputer.cxx
+++ b/Source/cmLinkLineDeviceComputer.cxx
@@ -3,14 +3,20 @@
 
 #include "cmLinkLineDeviceComputer.h"
 
+#include <algorithm>
 #include <set>
 #include <sstream>
 #include <utility>
+#include <vector>
 
 #include "cmAlgorithms.h"
 #include "cmComputeLinkInformation.h"
 #include "cmGeneratorTarget.h"
+#include "cmLocalGenerator.h"
+#include "cmStateDirectory.h"
+#include "cmStateSnapshot.h"
 #include "cmStateTypes.h"
+#include "cmSystemTools.h"
 
 class cmOutputConverter;
 
@@ -40,6 +46,27 @@ static bool cmLinkItemValidForDevice(std::string const& item)
           cmHasLiteralPrefix(item, "--library"));
 }
 
+bool cmLinkLineDeviceComputer::ComputeRequiresDeviceLinking(
+  cmComputeLinkInformation& cli)
+{
+  // Determine if this item might requires device linking.
+  // For this we only consider targets
+  typedef cmComputeLinkInformation::ItemVector ItemVector;
+  ItemVector const& items = cli.GetItems();
+  std::string config = cli.GetConfig();
+  for (auto const& item : items) {
+    if (item.Target &&
+        item.Target->GetType() == cmStateEnums::STATIC_LIBRARY) {
+      if ((!item.Target->GetPropertyAsBool("CUDA_RESOLVE_DEVICE_SYMBOLS")) &&
+          item.Target->GetPropertyAsBool("CUDA_SEPARABLE_COMPILATION")) {
+        // this dependency requires us to device link it
+        return true;
+      }
+    }
+  }
+  return false;
+}
+
 std::string cmLinkLineDeviceComputer::ComputeLinkLibraries(
   cmComputeLinkInformation& cli, std::string const& stdLibString)
 {
@@ -62,17 +89,12 @@ std::string cmLinkLineDeviceComputer::ComputeLinkLibraries(
     }
 
     if (item.Target) {
-      bool skip = false;
-      switch (item.Target->GetType()) {
-        case cmStateEnums::MODULE_LIBRARY:
-        case cmStateEnums::INTERFACE_LIBRARY:
-          skip = true;
-          break;
-        case cmStateEnums::STATIC_LIBRARY:
-          skip = item.Target->GetPropertyAsBool("CUDA_RESOLVE_DEVICE_SYMBOLS");
-          break;
-        default:
-          break;
+      bool skip = true;
+      if (item.Target->GetType() == cmStateEnums::STATIC_LIBRARY) {
+        if ((!item.Target->GetPropertyAsBool("CUDA_RESOLVE_DEVICE_SYMBOLS")) &&
+            item.Target->GetPropertyAsBool("CUDA_SEPARABLE_COMPILATION")) {
+          skip = false;
+        }
       }
       if (skip) {
         continue;
@@ -116,3 +138,56 @@ std::string 
cmLinkLineDeviceComputer::GetLinkerLanguage(cmGeneratorTarget*,
 {
   return "CUDA";
 }
+
+bool requireDeviceLinking(cmGeneratorTarget& target, cmLocalGenerator& lg,
+                          const std::string& config)
+{
+
+  if (target.GetType() == cmStateEnums::OBJECT_LIBRARY) {
+    return false;
+  }
+
+  if (const char* resolveDeviceSymbols =
+        target.GetProperty("CUDA_RESOLVE_DEVICE_SYMBOLS")) {
+    // If CUDA_RESOLVE_DEVICE_SYMBOLS has been explicitly set we need
+    // to honor the value no matter what it is.
+    return cmSystemTools::IsOn(resolveDeviceSymbols);
+  }
+
+  if (const char* separableCompilation =
+        target.GetProperty("CUDA_SEPARABLE_COMPILATION")) {
+    if (cmSystemTools::IsOn(separableCompilation)) {
+      bool doDeviceLinking = false;
+      switch (target.GetType()) {
+        case cmStateEnums::SHARED_LIBRARY:
+        case cmStateEnums::MODULE_LIBRARY:
+        case cmStateEnums::EXECUTABLE:
+          doDeviceLinking = true;
+          break;
+        default:
+          break;
+      }
+      return doDeviceLinking;
+    }
+  }
+
+  // Determine if we have any dependencies that require
+  // us to do a device link step
+  const std::string cuda_lang("CUDA");
+  cmGeneratorTarget::LinkClosure const* closure =
+    target.GetLinkClosure(config);
+
+  bool closureHasCUDA =
+    (std::find(closure->Languages.begin(), closure->Languages.end(),
+               cuda_lang) != closure->Languages.end());
+  if (closureHasCUDA) {
+    cmComputeLinkInformation* pcli = target.GetLinkInformation(config);
+    if (pcli) {
+      cmLinkLineDeviceComputer deviceLinkComputer(
+        &lg, lg.GetStateSnapshot().GetDirectory());
+      return deviceLinkComputer.ComputeRequiresDeviceLinking(*pcli);
+    }
+    return true;
+  }
+  return false;
+}
diff --git a/Source/cmLinkLineDeviceComputer.h 
b/Source/cmLinkLineDeviceComputer.h
index 26fc125..0ea5f69 100644
--- a/Source/cmLinkLineDeviceComputer.h
+++ b/Source/cmLinkLineDeviceComputer.h
@@ -12,6 +12,7 @@
 
 class cmComputeLinkInformation;
 class cmGeneratorTarget;
+class cmLocalGenerator;
 class cmOutputConverter;
 class cmStateDirectory;
 
@@ -26,6 +27,8 @@ public:
   cmLinkLineDeviceComputer& operator=(cmLinkLineDeviceComputer const&) =
     delete;
 
+  bool ComputeRequiresDeviceLinking(cmComputeLinkInformation& cli);
+
   std::string ComputeLinkLibraries(cmComputeLinkInformation& cli,
                                    std::string const& stdLibString) override;
 
@@ -33,4 +36,7 @@ public:
                                 std::string const& config) override;
 };
 
+bool requireDeviceLinking(cmGeneratorTarget& target, cmLocalGenerator& lg,
+                          const std::string& config);
+
 #endif
diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx 
b/Source/cmMakefileExecutableTargetGenerator.cxx
index beabf91..1113a2c 100644
--- a/Source/cmMakefileExecutableTargetGenerator.cxx
+++ b/Source/cmMakefileExecutableTargetGenerator.cxx
@@ -2,7 +2,6 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmMakefileExecutableTargetGenerator.h"
 
-#include <algorithm>
 #include <memory> // IWYU pragma: keep
 #include <set>
 #include <sstream>
@@ -87,20 +86,9 @@ void 
cmMakefileExecutableTargetGenerator::WriteDeviceExecutableRule(
     return;
   }
 
-  const std::string cuda_lang("CUDA");
-  cmGeneratorTarget::LinkClosure const* closure =
-    this->GeneratorTarget->GetLinkClosure(this->ConfigName);
-
-  const bool hasCUDA =
-    (std::find(closure->Languages.begin(), closure->Languages.end(),
-               cuda_lang) != closure->Languages.end());
-
-  bool doDeviceLinking = true;
-  if (const char* resolveDeviceSymbols =
-        this->GeneratorTarget->GetProperty("CUDA_RESOLVE_DEVICE_SYMBOLS")) {
-    doDeviceLinking = cmSystemTools::IsOn(resolveDeviceSymbols);
-  }
-  if (!hasCUDA || !doDeviceLinking) {
+  bool requiresDeviceLinking = requireDeviceLinking(
+    *this->GeneratorTarget, *this->LocalGenerator, this->ConfigName);
+  if (!requiresDeviceLinking) {
     return;
   }
 
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx 
b/Source/cmMakefileLibraryTargetGenerator.cxx
index f5d1fc9..d4d565d 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -2,7 +2,6 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmMakefileLibraryTargetGenerator.h"
 
-#include <algorithm>
 #include <memory> // IWYU pragma: keep
 #include <set>
 #include <sstream>
@@ -124,20 +123,10 @@ void 
cmMakefileLibraryTargetGenerator::WriteObjectLibraryRules()
 
 void cmMakefileLibraryTargetGenerator::WriteStaticLibraryRules()
 {
-  const std::string cuda_lang("CUDA");
-  cmGeneratorTarget::LinkClosure const* closure =
-    this->GeneratorTarget->GetLinkClosure(this->ConfigName);
-
-  const bool hasCUDA =
-    (std::find(closure->Languages.begin(), closure->Languages.end(),
-               cuda_lang) != closure->Languages.end());
-
-  bool doDeviceLinking = false;
-  if (const char* resolveDeviceSymbols =
-        this->GeneratorTarget->GetProperty("CUDA_RESOLVE_DEVICE_SYMBOLS")) {
-    doDeviceLinking = cmSystemTools::IsOn(resolveDeviceSymbols);
-  }
-  if (hasCUDA && doDeviceLinking) {
+
+  bool requiresDeviceLinking = requireDeviceLinking(
+    *this->GeneratorTarget, *this->LocalGenerator, this->ConfigName);
+  if (requiresDeviceLinking) {
     std::string linkRuleVar = "CMAKE_CUDA_DEVICE_LINK_LIBRARY";
     this->WriteDeviceLibraryRules(linkRuleVar, false);
   }
@@ -163,19 +152,9 @@ void 
cmMakefileLibraryTargetGenerator::WriteSharedLibraryRules(bool relink)
   }
 
   if (!relink) {
-    const std::string cuda_lang("CUDA");
-    cmGeneratorTarget::LinkClosure const* closure =
-      this->GeneratorTarget->GetLinkClosure(this->ConfigName);
-
-    const bool hasCUDA =
-      (std::find(closure->Languages.begin(), closure->Languages.end(),
-                 cuda_lang) != closure->Languages.end());
-    bool doDeviceLinking = true;
-    if (const char* resolveDeviceSymbols =
-          this->GeneratorTarget->GetProperty("CUDA_RESOLVE_DEVICE_SYMBOLS")) {
-      doDeviceLinking = cmSystemTools::IsOn(resolveDeviceSymbols);
-    }
-    if (hasCUDA && doDeviceLinking) {
+    bool requiresDeviceLinking = requireDeviceLinking(
+      *this->GeneratorTarget, *this->LocalGenerator, this->ConfigName);
+    if (requiresDeviceLinking) {
       std::string linkRuleVar = "CMAKE_CUDA_DEVICE_LINK_LIBRARY";
       this->WriteDeviceLibraryRules(linkRuleVar, relink);
     }
@@ -209,19 +188,9 @@ void 
cmMakefileLibraryTargetGenerator::WriteModuleLibraryRules(bool relink)
 {
 
   if (!relink) {
-    const std::string cuda_lang("CUDA");
-    cmGeneratorTarget::LinkClosure const* closure =
-      this->GeneratorTarget->GetLinkClosure(this->ConfigName);
-
-    const bool hasCUDA =
-      (std::find(closure->Languages.begin(), closure->Languages.end(),
-                 cuda_lang) != closure->Languages.end());
-    bool doDeviceLinking = true;
-    if (const char* resolveDeviceSymbols =
-          this->GeneratorTarget->GetProperty("CUDA_RESOLVE_DEVICE_SYMBOLS")) {
-      doDeviceLinking = cmSystemTools::IsOn(resolveDeviceSymbols);
-    }
-    if (hasCUDA && doDeviceLinking) {
+    bool requiresDeviceLinking = requireDeviceLinking(
+      *this->GeneratorTarget, *this->LocalGenerator, this->ConfigName);
+    if (requiresDeviceLinking) {
       std::string linkRuleVar = "CMAKE_CUDA_DEVICE_LINK_LIBRARY";
       this->WriteDeviceLibraryRules(linkRuleVar, relink);
     }
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx 
b/Source/cmNinjaNormalTargetGenerator.cxx
index 4d13006..f8a13ce 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -18,6 +18,7 @@
 #include "cmGeneratorTarget.h"
 #include "cmGlobalNinjaGenerator.h"
 #include "cmLinkLineComputer.h"
+#include "cmLinkLineDeviceComputer.h"
 #include "cmLocalGenerator.h"
 #include "cmLocalNinjaGenerator.h"
 #include "cmMakefile.h"
@@ -571,32 +572,9 @@ void 
cmNinjaNormalTargetGenerator::WriteDeviceLinkStatement()
 
   cmGeneratorTarget& genTarget = *this->GetGeneratorTarget();
 
-  // determine if we need to do any device linking for this target
-  const std::string cuda_lang("CUDA");
-  cmGeneratorTarget::LinkClosure const* closure =
-    genTarget.GetLinkClosure(this->GetConfigName());
-
-  const bool hasCUDA =
-    (std::find(closure->Languages.begin(), closure->Languages.end(),
-               cuda_lang) != closure->Languages.end());
-
-  bool doDeviceLinking = false;
-  if (const char* resolveDeviceSymbols =
-        genTarget.GetProperty("CUDA_RESOLVE_DEVICE_SYMBOLS")) {
-    doDeviceLinking = cmSystemTools::IsOn(resolveDeviceSymbols);
-  } else {
-    switch (genTarget.GetType()) {
-      case cmStateEnums::SHARED_LIBRARY:
-      case cmStateEnums::MODULE_LIBRARY:
-      case cmStateEnums::EXECUTABLE:
-        doDeviceLinking = true;
-        break;
-      default:
-        break;
-    }
-  }
-
-  if (!(doDeviceLinking && hasCUDA)) {
+  bool requiresDeviceLinking = requireDeviceLinking(
+    *this->GeneratorTarget, *this->GetLocalGenerator(), this->ConfigName);
+  if (!requiresDeviceLinking) {
     return;
   }
 
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx 
b/Source/cmVisualStudio10TargetGenerator.cxx
index c60706d..0685a41 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -10,6 +10,7 @@
 #include "cmGeneratorExpression.h"
 #include "cmGeneratorTarget.h"
 #include "cmGlobalVisualStudio10Generator.h"
+#include "cmLinkLineDeviceComputer.h"
 #include "cmLocalVisualStudio10Generator.h"
 #include "cmMakefile.h"
 #include "cmSourceFile.h"
@@ -3007,21 +3008,8 @@ bool 
cmVisualStudio10TargetGenerator::ComputeCudaLinkOptions(
   Options& cudaLinkOptions = *pOptions;
 
   // Determine if we need to do a device link
-  bool doDeviceLinking = false;
-  if (const char* resolveDeviceSymbols =
-        this->GeneratorTarget->GetProperty("CUDA_RESOLVE_DEVICE_SYMBOLS")) {
-    doDeviceLinking = cmSystemTools::IsOn(resolveDeviceSymbols);
-  } else {
-    switch (this->GeneratorTarget->GetType()) {
-      case cmStateEnums::SHARED_LIBRARY:
-      case cmStateEnums::MODULE_LIBRARY:
-      case cmStateEnums::EXECUTABLE:
-        doDeviceLinking = true;
-        break;
-      default:
-        break;
-    }
-  }
+  bool doDeviceLinking = requireDeviceLinking(
+    *this->GeneratorTarget, *this->LocalGenerator, configName);
 
   cudaLinkOptions.AddFlag("PerformDeviceLink",
                           doDeviceLinking ? "true" : "false");
diff --git a/bootstrap b/bootstrap
index c5274ce..ce27ca6 100755
--- a/bootstrap
+++ b/bootstrap
@@ -359,6 +359,7 @@ CMAKE_CXX_SOURCES="\
   cmLinkDirectoriesCommand \
   cmLinkItem \
   cmLinkLineComputer \
+  cmLinkLineDeviceComputer \
   cmListCommand \
   cmListFileCache \
   cmLocalCommonGenerator \

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4c0fb923b7747f1eed0bfa73b8d1653997e1bda9
commit 4c0fb923b7747f1eed0bfa73b8d1653997e1bda9
Author:     Brad King <brad.k...@kitware.com>
AuthorDate: Tue May 21 10:56:54 2019 -0400
Commit:     Brad King <brad.k...@kitware.com>
CommitDate: Tue May 21 10:58:18 2019 -0400

    IAR: Do not print compiler architecture id for non-IAR compilers
    
    The compiler identification message was modified in commit ea83d0f8fb
    (IAR: Generalize and add support for IAR RX compiler, 2019-04-05) to
    include the architecture id since IAR compilers are arch-specific.
    Revise the logic to avoid modifying the message for other compilers.

diff --git a/Modules/CMakeDetermineASMCompiler.cmake 
b/Modules/CMakeDetermineASMCompiler.cmake
index fb005ff..a48d33c 100644
--- a/Modules/CMakeDetermineASMCompiler.cmake
+++ b/Modules/CMakeDetermineASMCompiler.cmake
@@ -145,7 +145,7 @@ if(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID)
   else()
     set(_version "")
   endif()
-  if(CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID)
+  if(CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID AND 
"x${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}" STREQUAL "xIAR")
     set(_archid " ${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID}")
   else()
     set(_archid "")
diff --git a/Modules/CMakeDetermineCompilerId.cmake 
b/Modules/CMakeDetermineCompilerId.cmake
index 7036b93..2321e11 100644
--- a/Modules/CMakeDetermineCompilerId.cmake
+++ b/Modules/CMakeDetermineCompilerId.cmake
@@ -143,7 +143,7 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src)
     else()
       set(_version "")
     endif()
-    if(CMAKE_${lang}_COMPILER_ARCHITECTURE_ID)
+    if(CMAKE_${lang}_COMPILER_ARCHITECTURE_ID AND 
"x${CMAKE_${lang}_COMPILER_ID}" STREQUAL "xIAR")
       set(_archid " ${CMAKE_${lang}_COMPILER_ARCHITECTURE_ID}")
     else()
       set(_archid "")

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=26a99da206526efb203d0e448d7e095a07bec2fd
commit 26a99da206526efb203d0e448d7e095a07bec2fd
Author:     Cristian Adam <cristian.a...@gmail.com>
AuthorDate: Mon May 20 21:32:24 2019 +0200
Commit:     Brad King <brad.k...@kitware.com>
CommitDate: Tue May 21 10:29:47 2019 -0400

    find_package: Add option to prefer Config mode
    
    Add a `CMAKE_FIND_PACKAGE_PREFER_CONFIG` variable to tell
    `find_package` calls to look for a package configuration file
    first even if a find module is available.
    
    Fixes: #16805, #19236

diff --git a/Help/command/find_package.rst b/Help/command/find_package.rst
index eb44eb2..e5e5b2c 100644
--- a/Help/command/find_package.rst
+++ b/Help/command/find_package.rst
@@ -59,6 +59,13 @@ for finding the package, checking the version, and producing 
any needed
 messages.  Some find-modules provide limited or no support for versioning;
 check the module documentation.
 
+If the ``MODULE`` option is not specfied in the above signature,
+CMake first searches for the package using Module mode. Then, if the
+package is not found, it searches again using Config mode. A user
+may set the variable :variable:`CMAKE_FIND_PACKAGE_PREFER_CONFIG` to
+``TRUE`` to direct CMake first search using Config mode before falling
+back to Module mode.
+
 Full Signature and Config Mode
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
diff --git a/Help/manual/cmake-variables.7.rst 
b/Help/manual/cmake-variables.7.rst
index fd5e28f..1011ed2 100644
--- a/Help/manual/cmake-variables.7.rst
+++ b/Help/manual/cmake-variables.7.rst
@@ -172,6 +172,7 @@ Variables that Change Behavior
    /variable/CMAKE_FIND_NO_INSTALL_PREFIX
    /variable/CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY
    /variable/CMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY
+   /variable/CMAKE_FIND_PACKAGE_PREFER_CONFIG
    /variable/CMAKE_FIND_PACKAGE_RESOLVE_SYMLINKS
    /variable/CMAKE_FIND_PACKAGE_WARN_NO_MODULE
    /variable/CMAKE_FIND_ROOT_PATH
diff --git a/Help/release/dev/find-package-prefer-config.rst 
b/Help/release/dev/find-package-prefer-config.rst
new file mode 100644
index 0000000..377e8c5
--- /dev/null
+++ b/Help/release/dev/find-package-prefer-config.rst
@@ -0,0 +1,6 @@
+find-package-prefer-config
+--------------------------
+
+* Variable :variable:`CMAKE_FIND_PACKAGE_PREFER_CONFIG` was added to tell
+  :command:`find_package` calls to look for a package configuration
+  file first even if a find module is available.
diff --git a/Help/variable/CMAKE_FIND_PACKAGE_PREFER_CONFIG.rst 
b/Help/variable/CMAKE_FIND_PACKAGE_PREFER_CONFIG.rst
new file mode 100644
index 0000000..db658a1
--- /dev/null
+++ b/Help/variable/CMAKE_FIND_PACKAGE_PREFER_CONFIG.rst
@@ -0,0 +1,27 @@
+CMAKE_FIND_PACKAGE_PREFER_CONFIG
+---------------------------------
+
+Tell :command:`find_package` to try "Config" mode before "Module" mode if no
+mode was specified.
+
+The command :command:`find_package` operates without an explicit mode when
+the reduced signature is used without the ``MODULE`` option. In this case,
+by default, CMake first tries Module mode by searching for a
+``Find<pkg>.cmake`` module.  If it fails, CMake then searches for the package
+using Config mode.
+
+Set ``CMAKE_FIND_PACKAGE_PREFER_CONFIG`` to ``TRUE`` to tell
+:command:`find_package` to first search using Config mode before falling back
+to Module mode.
+
+This variable may be useful when a developer has compiled a custom version of
+a common library and wishes to link it to a dependent project.  If this
+variable is set to ``TRUE``, it would prevent a dependent project's call
+to :command:`find_package` from selecting the default library located by the
+system's ``Find<pkg>.cmake`` module before finding the developer's custom
+built library.
+
+Once this variable is set, it is the responsibility of the exported
+``<pkg>Config.cmake`` files to provide the same result variables as the
+``Find<pkg>.cmake`` modules so that dependent projects can use them
+interchangeably.
diff --git a/Help/variable/CMAKE_FIND_PACKAGE_WARN_NO_MODULE.rst 
b/Help/variable/CMAKE_FIND_PACKAGE_WARN_NO_MODULE.rst
index f1116bb..5c4f23a 100644
--- a/Help/variable/CMAKE_FIND_PACKAGE_WARN_NO_MODULE.rst
+++ b/Help/variable/CMAKE_FIND_PACKAGE_WARN_NO_MODULE.rst
@@ -17,3 +17,6 @@ Set ``CMAKE_FIND_PACKAGE_WARN_NO_MODULE`` to ``TRUE`` to tell
 :command:`find_package` to warn when it implicitly assumes Config mode.  This
 helps developers enforce use of an explicit mode in all calls to
 :command:`find_package` within a project.
+
+This variable has no effect if :variable:`CMAKE_FIND_PACKAGE_PREFER_CONFIG` is
+set to ``TRUE``.
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index 5310a1b..8eefaa7 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -499,50 +499,61 @@ bool 
cmFindPackageCommand::InitialPass(std::vector<std::string> const& args,
 
   // See if there is a Find<PackageName>.cmake module.
   bool loadedPackage = false;
-  if (this->UseFindModules && this->FindPackageUsingModuleMode()) {
-    loadedPackage = true;
-  } else {
-    // Handle CMAKE_FIND_PACKAGE_WARN_NO_MODULE (warn when CONFIG mode is
-    // implicitly assumed)
-    if (this->UseFindModules && this->UseConfigFiles &&
-        this->Makefile->IsOn("CMAKE_FIND_PACKAGE_WARN_NO_MODULE")) {
-      std::ostringstream aw;
-      if (this->RequiredCMakeVersion >= CMake_VERSION_ENCODE(2, 8, 8)) {
-        aw << "find_package called without either MODULE or CONFIG option and "
-              "no Find"
-           << this->Name
-           << ".cmake module is in CMAKE_MODULE_PATH.  "
-              "Add MODULE to exclusively request Module mode and fail if "
-              "Find"
-           << this->Name
-           << ".cmake is missing.  "
-              "Add CONFIG to exclusively request Config mode and search for a "
-              "package configuration file provided by "
-           << this->Name << " (" << this->Name << "Config.cmake or "
-           << cmSystemTools::LowerCase(this->Name) << "-config.cmake).  ";
-      } else {
-        aw << "find_package called without NO_MODULE option and no "
-              "Find"
-           << this->Name
-           << ".cmake module is in CMAKE_MODULE_PATH.  "
-              "Add NO_MODULE to exclusively request Config mode and search "
-              "for a "
-              "package configuration file provided by "
-           << this->Name << " (" << this->Name << "Config.cmake or "
-           << cmSystemTools::LowerCase(this->Name)
-           << "-config.cmake).  "
-              "Otherwise make Find"
-           << this->Name
-           << ".cmake available in "
-              "CMAKE_MODULE_PATH.";
-      }
-      aw << "\n"
-            "(Variable CMAKE_FIND_PACKAGE_WARN_NO_MODULE enabled this "
-            "warning.)";
-      this->Makefile->IssueMessage(MessageType::AUTHOR_WARNING, aw.str());
+  if (this->Makefile->IsOn("CMAKE_FIND_PACKAGE_PREFER_CONFIG")) {
+    if (this->UseConfigFiles && this->FindPackageUsingConfigMode()) {
+      loadedPackage = true;
+    } else if (this->FindPackageUsingModuleMode()) {
+      loadedPackage = true;
     }
-    if (this->FindPackageUsingConfigMode()) {
+  } else {
+    if (this->UseFindModules && this->FindPackageUsingModuleMode()) {
       loadedPackage = true;
+    } else {
+      // Handle CMAKE_FIND_PACKAGE_WARN_NO_MODULE (warn when CONFIG mode is
+      // implicitly assumed)
+      if (this->UseFindModules && this->UseConfigFiles &&
+          this->Makefile->IsOn("CMAKE_FIND_PACKAGE_WARN_NO_MODULE")) {
+        std::ostringstream aw;
+        if (this->RequiredCMakeVersion >= CMake_VERSION_ENCODE(2, 8, 8)) {
+          aw << "find_package called without either MODULE or CONFIG option "
+                "and "
+                "no Find"
+             << this->Name
+             << ".cmake module is in CMAKE_MODULE_PATH.  "
+                "Add MODULE to exclusively request Module mode and fail if "
+                "Find"
+             << this->Name
+             << ".cmake is missing.  "
+                "Add CONFIG to exclusively request Config mode and search for "
+                "a "
+                "package configuration file provided by "
+             << this->Name << " (" << this->Name << "Config.cmake or "
+             << cmSystemTools::LowerCase(this->Name) << "-config.cmake).  ";
+        } else {
+          aw << "find_package called without NO_MODULE option and no "
+                "Find"
+             << this->Name
+             << ".cmake module is in CMAKE_MODULE_PATH.  "
+                "Add NO_MODULE to exclusively request Config mode and search "
+                "for a "
+                "package configuration file provided by "
+             << this->Name << " (" << this->Name << "Config.cmake or "
+             << cmSystemTools::LowerCase(this->Name)
+             << "-config.cmake).  "
+                "Otherwise make Find"
+             << this->Name
+             << ".cmake available in "
+                "CMAKE_MODULE_PATH.";
+        }
+        aw << "\n"
+              "(Variable CMAKE_FIND_PACKAGE_WARN_NO_MODULE enabled this "
+              "warning.)";
+        this->Makefile->IssueMessage(MessageType::AUTHOR_WARNING, aw.str());
+      }
+
+      if (this->FindPackageUsingConfigMode()) {
+        loadedPackage = true;
+      }
     }
   }
 
diff --git a/Tests/FindPackageTest/CMakeLists.txt 
b/Tests/FindPackageTest/CMakeLists.txt
index 6c876a7..8802b73 100644
--- a/Tests/FindPackageTest/CMakeLists.txt
+++ b/Tests/FindPackageTest/CMakeLists.txt
@@ -541,7 +541,41 @@ endif()
 set(SortLib_DIR "" CACHE FILEPATH "Wipe out find results for testing." FORCE)
 unset(SortLib_VERSION)
 
-
 unset(CMAKE_FIND_PACKAGE_SORT_ORDER)
 unset(CMAKE_FIND_PACKAGE_SORT_DIRECTION)
 set(CMAKE_PREFIX_PATH )
+
+############################################################################
+##Test FIND_PACKAGE CMAKE_FIND_PACKAGE_PREFER_CONFIG
+
+set(CMAKE_PREFIX_PATH ${CMAKE_CURRENT_SOURCE_DIR}/PreferConfig)
+set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/PreferConfig)
+
+# prefer module mode
+set(CMAKE_FIND_PACKAGE_PREFER_CONFIG OFF)
+unset(ABC_FOUND)
+unset(ABC_CONFIG)
+
+find_package(ABC)
+if(NOT ABC_FOUND)
+    message(SEND_ERROR "Did not find ABC package")
+endif()
+if(ABC_CONFIG)
+    message(SEND_ERROR "Incorrectly found ABC in CONFIG mode, expected to find 
it with MODULE mode")
+endif()
+
+# Now prefer config mode
+set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)
+unset(ABC_FOUND)
+unset(ABC_CONFIG)
+
+find_package(ABC)
+if(NOT ABC_FOUND)
+    message(SEND_ERROR "Did not find ABC package")
+endif()
+if(NOT ABC_CONFIG)
+    message(SEND_ERROR "Incorrectly found ABC in MODULE mode, expected to find 
it with CONFIG mode")
+endif()
+
+set(CMAKE_FIND_PACKAGE_PREFER_CONFIG OFF)
+set(CMAKE_PREFIX_PATH)
diff --git a/Tests/FindPackageTest/PreferConfig/ABCConfig.cmake 
b/Tests/FindPackageTest/PreferConfig/ABCConfig.cmake
new file mode 100644
index 0000000..281a5cd
--- /dev/null
+++ b/Tests/FindPackageTest/PreferConfig/ABCConfig.cmake
@@ -0,0 +1 @@
+set(ABC_FOUND TRUE)
diff --git a/Tests/FindPackageTest/PreferConfig/FindABC.cmake 
b/Tests/FindPackageTest/PreferConfig/FindABC.cmake
new file mode 100644
index 0000000..281a5cd
--- /dev/null
+++ b/Tests/FindPackageTest/PreferConfig/FindABC.cmake
@@ -0,0 +1 @@
+set(ABC_FOUND TRUE)

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9c07cefee541d47be9c378a9285711e07be7a16f
commit 9c07cefee541d47be9c378a9285711e07be7a16f
Author:     Brad King <brad.k...@kitware.com>
AuthorDate: Tue May 21 08:46:41 2019 -0400
Commit:     Brad King <brad.k...@kitware.com>
CommitDate: Tue May 21 08:50:37 2019 -0400

    VS: Fix ApplicationTypeRevision in builtin check projects
    
    Do not use the entire `CMAKE_SYSTEM_VERSION`, but rather the first two
    components only.
    
    Fixes: #19275

diff --git a/Modules/CMakeDetermineCompilerId.cmake 
b/Modules/CMakeDetermineCompilerId.cmake
index 7036b93..f62672d 100644
--- a/Modules/CMakeDetermineCompilerId.cmake
+++ b/Modules/CMakeDetermineCompilerId.cmake
@@ -276,8 +276,8 @@ Id flags: ${testflags} 
${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS}
     else()
       set(id_system "")
     endif()
-    if(id_system AND CMAKE_SYSTEM_VERSION)
-      set(id_system_version 
"<ApplicationTypeRevision>${CMAKE_SYSTEM_VERSION}</ApplicationTypeRevision>")
+    if(id_system AND CMAKE_SYSTEM_VERSION MATCHES "^([0-9]+\\.[0-9]+)")
+      set(id_system_version 
"<ApplicationTypeRevision>${CMAKE_MATCH_1}</ApplicationTypeRevision>")
     else()
       set(id_system_version "")
     endif()
diff --git a/Source/cmGlobalVisualStudio10Generator.cxx 
b/Source/cmGlobalVisualStudio10Generator.cxx
index 6a78d0b..55374a4 100644
--- a/Source/cmGlobalVisualStudio10Generator.cxx
+++ b/Source/cmGlobalVisualStudio10Generator.cxx
@@ -784,11 +784,11 @@ bool 
cmGlobalVisualStudio10Generator::FindVCTargetsPath(cmMakefile* mf)
       if (this->GetSystemName() == "WindowsPhone") {
         cmXMLElement(epg, "ApplicationType").Content("Windows Phone");
         cmXMLElement(epg, "ApplicationTypeRevision")
-          .Content(this->GetSystemVersion());
+          .Content(this->GetApplicationTypeRevision());
       } else if (this->GetSystemName() == "WindowsStore") {
         cmXMLElement(epg, "ApplicationType").Content("Windows Store");
         cmXMLElement(epg, "ApplicationTypeRevision")
-          .Content(this->GetSystemVersion());
+          .Content(this->GetApplicationTypeRevision());
       }
       if (!this->WindowsTargetPlatformVersion.empty()) {
         cmXMLElement(epg, "WindowsTargetPlatformVersion")

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=639e14def6ada307c25a422a4b51f1fceaebeead
commit 639e14def6ada307c25a422a4b51f1fceaebeead
Author:     Brad King <brad.k...@kitware.com>
AuthorDate: Tue May 21 08:45:20 2019 -0400
Commit:     Brad King <brad.k...@kitware.com>
CommitDate: Tue May 21 08:50:01 2019 -0400

    VS: Factor out helper to compute ApplicationTypeRevision
    
    This is the first two components of `CMAKE_SYSTEM_VERSION`.

diff --git a/Source/cmGlobalVisualStudio10Generator.cxx 
b/Source/cmGlobalVisualStudio10Generator.cxx
index 4fa89d0..6a78d0b 100644
--- a/Source/cmGlobalVisualStudio10Generator.cxx
+++ b/Source/cmGlobalVisualStudio10Generator.cxx
@@ -1112,6 +1112,15 @@ std::string 
cmGlobalVisualStudio10Generator::GetInstalledNsightTegraVersion()
   return version;
 }
 
+std::string cmGlobalVisualStudio10Generator::GetApplicationTypeRevision() const
+{
+  // Return the first two '.'-separated components of the Windows version.
+  std::string::size_type end1 = this->SystemVersion.find('.');
+  std::string::size_type end2 =
+    end1 == std::string::npos ? end1 : this->SystemVersion.find('.', end1 + 1);
+  return this->SystemVersion.substr(0, end2);
+}
+
 static std::string cmLoadFlagTableString(Json::Value entry, const char* field)
 {
   if (entry.isMember(field)) {
diff --git a/Source/cmGlobalVisualStudio10Generator.h 
b/Source/cmGlobalVisualStudio10Generator.h
index 2f532a6..1d30cd6 100644
--- a/Source/cmGlobalVisualStudio10Generator.h
+++ b/Source/cmGlobalVisualStudio10Generator.h
@@ -110,6 +110,9 @@ public:
 
   static std::string GetInstalledNsightTegraVersion();
 
+  /** Return the first two components of CMAKE_SYSTEM_VERSION.  */
+  std::string GetApplicationTypeRevision() const;
+
   cmIDEFlagTable const* GetClFlagTable() const;
   cmIDEFlagTable const* GetCSharpFlagTable() const;
   cmIDEFlagTable const* GetRcFlagTable() const;
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx 
b/Source/cmVisualStudio10TargetGenerator.cxx
index ab9ef79..af90383 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -4099,29 +4099,29 @@ void 
cmVisualStudio10TargetGenerator::WriteApplicationTypeSettings(Elem& e1)
   bool isAppContainer = false;
   bool const isWindowsPhone = this->GlobalGenerator->TargetsWindowsPhone();
   bool const isWindowsStore = this->GlobalGenerator->TargetsWindowsStore();
-  std::string const& v = this->GlobalGenerator->GetSystemVersion();
+  std::string const& rev = this->GlobalGenerator->GetApplicationTypeRevision();
   if (isWindowsPhone || isWindowsStore) {
     e1.Element("ApplicationType",
                (isWindowsPhone ? "Windows Phone" : "Windows Store"));
     e1.Element("DefaultLanguage", "en-US");
-    if (cmHasLiteralPrefix(v, "10.0")) {
-      e1.Element("ApplicationTypeRevision", "10.0");
+    if (rev == "10.0") {
+      e1.Element("ApplicationTypeRevision", rev);
       // Visual Studio 14.0 is necessary for building 10.0 apps
       e1.Element("MinimumVisualStudioVersion", "14.0");
 
       if (this->GeneratorTarget->GetType() < cmStateEnums::UTILITY) {
         isAppContainer = true;
       }
-    } else if (v == "8.1") {
-      e1.Element("ApplicationTypeRevision", v);
+    } else if (rev == "8.1") {
+      e1.Element("ApplicationTypeRevision", rev);
       // Visual Studio 12.0 is necessary for building 8.1 apps
       e1.Element("MinimumVisualStudioVersion", "12.0");
 
       if (this->GeneratorTarget->GetType() < cmStateEnums::UTILITY) {
         isAppContainer = true;
       }
-    } else if (v == "8.0") {
-      e1.Element("ApplicationTypeRevision", v);
+    } else if (rev == "8.0") {
+      e1.Element("ApplicationTypeRevision", rev);
       // Visual Studio 11.0 is necessary for building 8.0 apps
       e1.Element("MinimumVisualStudioVersion", "11.0");
 
@@ -4153,7 +4153,7 @@ void 
cmVisualStudio10TargetGenerator::WriteApplicationTypeSettings(Elem& e1)
     "VS_WINDOWS_TARGET_PLATFORM_MIN_VERSION");
   if (targetPlatformMinVersion) {
     e1.Element("WindowsTargetPlatformMinVersion", targetPlatformMinVersion);
-  } else if (isWindowsStore && cmHasLiteralPrefix(v, "10.0")) {
+  } else if (isWindowsStore && rev == "10.0") {
     // If the min version is not set, then use the TargetPlatformVersion
     if (!targetPlatformVersion.empty()) {
       e1.Element("WindowsTargetPlatformMinVersion", targetPlatformVersion);

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c365243a3a282523062b5378898aa4fe6436f8fb
commit c365243a3a282523062b5378898aa4fe6436f8fb
Author:     Cristian Adam <cristian.a...@gmail.com>
AuthorDate: Mon May 20 21:20:10 2019 +0200
Commit:     Cristian Adam <cristian.a...@gmail.com>
CommitDate: Mon May 20 21:20:10 2019 +0200

    find_package: Factor out module and config find_package methods

diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index 7ebd211..5310a1b 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -498,57 +498,69 @@ bool 
cmFindPackageCommand::InitialPass(std::vector<std::string> const& args,
   this->SetModuleVariables(components);
 
   // See if there is a Find<PackageName>.cmake module.
-  if (this->UseFindModules) {
-    bool foundModule = false;
-    if (!this->FindModule(foundModule)) {
-      this->AppendSuccessInformation();
-      return false;
+  bool loadedPackage = false;
+  if (this->UseFindModules && this->FindPackageUsingModuleMode()) {
+    loadedPackage = true;
+  } else {
+    // Handle CMAKE_FIND_PACKAGE_WARN_NO_MODULE (warn when CONFIG mode is
+    // implicitly assumed)
+    if (this->UseFindModules && this->UseConfigFiles &&
+        this->Makefile->IsOn("CMAKE_FIND_PACKAGE_WARN_NO_MODULE")) {
+      std::ostringstream aw;
+      if (this->RequiredCMakeVersion >= CMake_VERSION_ENCODE(2, 8, 8)) {
+        aw << "find_package called without either MODULE or CONFIG option and "
+              "no Find"
+           << this->Name
+           << ".cmake module is in CMAKE_MODULE_PATH.  "
+              "Add MODULE to exclusively request Module mode and fail if "
+              "Find"
+           << this->Name
+           << ".cmake is missing.  "
+              "Add CONFIG to exclusively request Config mode and search for a "
+              "package configuration file provided by "
+           << this->Name << " (" << this->Name << "Config.cmake or "
+           << cmSystemTools::LowerCase(this->Name) << "-config.cmake).  ";
+      } else {
+        aw << "find_package called without NO_MODULE option and no "
+              "Find"
+           << this->Name
+           << ".cmake module is in CMAKE_MODULE_PATH.  "
+              "Add NO_MODULE to exclusively request Config mode and search "
+              "for a "
+              "package configuration file provided by "
+           << this->Name << " (" << this->Name << "Config.cmake or "
+           << cmSystemTools::LowerCase(this->Name)
+           << "-config.cmake).  "
+              "Otherwise make Find"
+           << this->Name
+           << ".cmake available in "
+              "CMAKE_MODULE_PATH.";
+      }
+      aw << "\n"
+            "(Variable CMAKE_FIND_PACKAGE_WARN_NO_MODULE enabled this "
+            "warning.)";
+      this->Makefile->IssueMessage(MessageType::AUTHOR_WARNING, aw.str());
     }
-    if (foundModule) {
-      this->AppendSuccessInformation();
-      return true;
+    if (this->FindPackageUsingConfigMode()) {
+      loadedPackage = true;
     }
   }
 
-  if (this->UseFindModules && this->UseConfigFiles &&
-      this->Makefile->IsOn("CMAKE_FIND_PACKAGE_WARN_NO_MODULE")) {
-    std::ostringstream aw;
-    if (this->RequiredCMakeVersion >= CMake_VERSION_ENCODE(2, 8, 8)) {
-      aw << "find_package called without either MODULE or CONFIG option and "
-            "no Find"
-         << this->Name
-         << ".cmake module is in CMAKE_MODULE_PATH.  "
-            "Add MODULE to exclusively request Module mode and fail if "
-            "Find"
-         << this->Name
-         << ".cmake is missing.  "
-            "Add CONFIG to exclusively request Config mode and search for a "
-            "package configuration file provided by "
-         << this->Name << " (" << this->Name << "Config.cmake or "
-         << cmSystemTools::LowerCase(this->Name) << "-config.cmake).  ";
-    } else {
-      aw
-        << "find_package called without NO_MODULE option and no "
-           "Find"
-        << this->Name
-        << ".cmake module is in CMAKE_MODULE_PATH.  "
-           "Add NO_MODULE to exclusively request Config mode and search for a "
-           "package configuration file provided by "
-        << this->Name << " (" << this->Name << "Config.cmake or "
-        << cmSystemTools::LowerCase(this->Name)
-        << "-config.cmake).  "
-           "Otherwise make Find"
-        << this->Name
-        << ".cmake available in "
-           "CMAKE_MODULE_PATH.";
-    }
-    aw << "\n"
-          "(Variable CMAKE_FIND_PACKAGE_WARN_NO_MODULE enabled this warning.)";
-    this->Makefile->IssueMessage(MessageType::AUTHOR_WARNING, aw.str());
-  }
-
-  // No find module.  Assume the project has a CMake config file.  Use
-  // a <PackageName>_DIR cache variable to locate it.
+  this->AppendSuccessInformation();
+  return loadedPackage;
+}
+
+bool cmFindPackageCommand::FindPackageUsingModuleMode()
+{
+  bool foundModule = false;
+  if (!this->FindModule(foundModule)) {
+    return false;
+  }
+  return foundModule;
+}
+
+bool cmFindPackageCommand::FindPackageUsingConfigMode()
+{
   this->Variable = this->Name;
   this->Variable += "_DIR";
 
@@ -580,9 +592,7 @@ bool 
cmFindPackageCommand::InitialPass(std::vector<std::string> const& args,
   this->IgnoredPaths.insert(ignored.begin(), ignored.end());
 
   // Find and load the package.
-  bool result = this->HandlePackageMode();
-  this->AppendSuccessInformation();
-  return result;
+  return this->HandlePackageMode();
 }
 
 void cmFindPackageCommand::SetModuleVariables(const std::string& components)
diff --git a/Source/cmFindPackageCommand.h b/Source/cmFindPackageCommand.h
index a11d253..4f6d97c 100644
--- a/Source/cmFindPackageCommand.h
+++ b/Source/cmFindPackageCommand.h
@@ -90,6 +90,9 @@ private:
     static PathLabel SystemRegistry;
   };
 
+  bool FindPackageUsingModuleMode();
+  bool FindPackageUsingConfigMode();
+
   // Add additional search path labels and groups not present in the
   // parent class
   void AppendSearchPathGroups();

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=62381effba418cdccff0b18f234e3a307446d635
commit 62381effba418cdccff0b18f234e3a307446d635
Author:     Saleem Abdulrasool <compn...@compnerd.org>
AuthorDate: Mon May 20 08:40:07 2019 -0700
Commit:     Saleem Abdulrasool <compn...@compnerd.org>
CommitDate: Mon May 20 09:28:35 2019 -0700

    Ninja,Swift: reuse `SWIFT_MODULE_NAME` for `SWIFT_MODULE`
    
    Rather than compute the value of `SWIFT_MODULE`, use the computed value
    of `SWIFT_MODULE_NAME`.  This is helpful strictly for Windows where you
    have multiple configuration variants with differing ABIs that need must
    co-exist.  In particular, this re-use permits the use of
    `CMAKE_DEBUG_POSTFIX` to have the import library and the DLL be named
    with the trailing suffix but have the same import name for the swift
    module and interface.

diff --git a/Source/cmNinjaNormalTargetGenerator.cxx 
b/Source/cmNinjaNormalTargetGenerator.cxx
index 06063b2..31afd9e 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -814,10 +814,15 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
       return targetNames.Base;
     }();
 
-    vars["SWIFT_MODULE"] = [this]() -> std::string {
-      cmGeneratorTarget::Names targetNames =
-        this->GetGeneratorTarget()->GetLibraryNames(this->GetConfigName());
+    vars["SWIFT_MODULE_NAME"] = [this]() -> std::string {
+      if (const char* name =
+            this->GetGeneratorTarget()->GetProperty("Swift_MODULE_NAME")) {
+        return name;
+      }
+      return this->GetGeneratorTarget()->GetName();
+    }();
 
+    vars["SWIFT_MODULE"] = [this](const std::string& module) -> std::string {
       std::string directory =
         this->GetLocalGenerator()->GetCurrentBinaryDirectory();
       if (const char* prop = this->GetGeneratorTarget()->GetProperty(
@@ -825,7 +830,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
         directory = prop;
       }
 
-      std::string name = targetNames.Base + ".swiftmodule";
+      std::string name = module + ".swiftmodule";
       if (const char* prop =
             this->GetGeneratorTarget()->GetProperty("Swift_MODULE")) {
         name = prop;
@@ -834,15 +839,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
       return this->GetLocalGenerator()->ConvertToOutputFormat(
         this->ConvertToNinjaPath(directory + "/" + name),
         cmOutputConverter::SHELL);
-    }();
-
-    vars["SWIFT_MODULE_NAME"] = [this]() -> std::string {
-      if (const char* name =
-            this->GetGeneratorTarget()->GetProperty("Swift_MODULE_NAME")) {
-        return name;
-      }
-      return this->GetGeneratorTarget()->GetName();
-    }();
+    }(vars["SWIFT_MODULE_NAME"]);
 
     vars["SWIFT_OUTPUT_FILE_MAP"] =
       this->GetLocalGenerator()->ConvertToOutputFormat(

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3205c7c950d5b90d47ce1c5c58073e511339b78c
commit 3205c7c950d5b90d47ce1c5c58073e511339b78c
Author:     Robert Maynard <robert.mayn...@kitware.com>
AuthorDate: Fri May 17 11:29:43 2019 -0400
Commit:     Brad King <brad.k...@kitware.com>
CommitDate: Mon May 20 11:05:16 2019 -0400

    cmNinjaLinkLineDeviceComputer now lives in the correct source file

diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index 42eed4d..d7a0f3e 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -786,6 +786,8 @@ set(SRCS ${SRCS}
   cmNinjaUtilityTargetGenerator.h
   cmNinjaLinkLineComputer.cxx
   cmNinjaLinkLineComputer.h
+  cmNinjaLinkLineDeviceComputer.cxx
+  cmNinjaLinkLineDeviceComputer.h
   )
 
 # Temporary variable for tools targets
diff --git a/Source/cmLinkLineDeviceComputer.cxx 
b/Source/cmLinkLineDeviceComputer.cxx
index 211d03b..72edba3 100644
--- a/Source/cmLinkLineDeviceComputer.cxx
+++ b/Source/cmLinkLineDeviceComputer.cxx
@@ -10,7 +10,6 @@
 #include "cmAlgorithms.h"
 #include "cmComputeLinkInformation.h"
 #include "cmGeneratorTarget.h"
-#include "cmGlobalNinjaGenerator.h"
 #include "cmStateTypes.h"
 
 class cmOutputConverter;
@@ -117,17 +116,3 @@ std::string 
cmLinkLineDeviceComputer::GetLinkerLanguage(cmGeneratorTarget*,
 {
   return "CUDA";
 }
-
-cmNinjaLinkLineDeviceComputer::cmNinjaLinkLineDeviceComputer(
-  cmOutputConverter* outputConverter, cmStateDirectory const& stateDir,
-  cmGlobalNinjaGenerator const* gg)
-  : cmLinkLineDeviceComputer(outputConverter, stateDir)
-  , GG(gg)
-{
-}
-
-std::string cmNinjaLinkLineDeviceComputer::ConvertToLinkReference(
-  std::string const& lib) const
-{
-  return GG->ConvertToNinjaPath(lib);
-}
diff --git a/Source/cmLinkLineDeviceComputer.h 
b/Source/cmLinkLineDeviceComputer.h
index cf66f64..26fc125 100644
--- a/Source/cmLinkLineDeviceComputer.h
+++ b/Source/cmLinkLineDeviceComputer.h
@@ -12,7 +12,6 @@
 
 class cmComputeLinkInformation;
 class cmGeneratorTarget;
-class cmGlobalNinjaGenerator;
 class cmOutputConverter;
 class cmStateDirectory;
 
@@ -34,21 +33,4 @@ public:
                                 std::string const& config) override;
 };
 
-class cmNinjaLinkLineDeviceComputer : public cmLinkLineDeviceComputer
-{
-public:
-  cmNinjaLinkLineDeviceComputer(cmOutputConverter* outputConverter,
-                                cmStateDirectory const& stateDir,
-                                cmGlobalNinjaGenerator const* gg);
-
-  cmNinjaLinkLineDeviceComputer(cmNinjaLinkLineDeviceComputer const&) = delete;
-  cmNinjaLinkLineDeviceComputer& operator=(
-    cmNinjaLinkLineDeviceComputer const&) = delete;
-
-  std::string ConvertToLinkReference(std::string const& input) const override;
-
-private:
-  cmGlobalNinjaGenerator const* GG;
-};
-
 #endif
diff --git a/Source/cmNinjaLinkLineDeviceComputer.cxx 
b/Source/cmNinjaLinkLineDeviceComputer.cxx
new file mode 100644
index 0000000..84c1b37
--- /dev/null
+++ b/Source/cmNinjaLinkLineDeviceComputer.cxx
@@ -0,0 +1,20 @@
+/* Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
+   file Copyright.txt or https://cmake.org/licensing for details.  */
+
+#include "cmNinjaLinkLineDeviceComputer.h"
+
+#include "cmGlobalNinjaGenerator.h"
+
+cmNinjaLinkLineDeviceComputer::cmNinjaLinkLineDeviceComputer(
+  cmOutputConverter* outputConverter, cmStateDirectory const& stateDir,
+  cmGlobalNinjaGenerator const* gg)
+  : cmLinkLineDeviceComputer(outputConverter, stateDir)
+  , GG(gg)
+{
+}
+
+std::string cmNinjaLinkLineDeviceComputer::ConvertToLinkReference(
+  std::string const& lib) const
+{
+  return GG->ConvertToNinjaPath(lib);
+}
diff --git a/Source/cmLinkLineDeviceComputer.h 
b/Source/cmNinjaLinkLineDeviceComputer.h
similarity index 51%
copy from Source/cmLinkLineDeviceComputer.h
copy to Source/cmNinjaLinkLineDeviceComputer.h
index cf66f64..84ced5b 100644
--- a/Source/cmLinkLineDeviceComputer.h
+++ b/Source/cmNinjaLinkLineDeviceComputer.h
@@ -1,39 +1,19 @@
 /* Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
    file Copyright.txt or https://cmake.org/licensing for details.  */
 
-#ifndef cmLinkLineDeviceComputer_h
-#define cmLinkLineDeviceComputer_h
+#ifndef cmNinjaLinkLineDeviceComputer_h
+#define cmNinjaLinkLineDeviceComputer_h
 
 #include "cmConfigure.h" // IWYU pragma: keep
 
 #include <string>
 
-#include "cmLinkLineComputer.h"
+#include "cmLinkLineDeviceComputer.h"
 
-class cmComputeLinkInformation;
-class cmGeneratorTarget;
 class cmGlobalNinjaGenerator;
 class cmOutputConverter;
 class cmStateDirectory;
 
-class cmLinkLineDeviceComputer : public cmLinkLineComputer
-{
-public:
-  cmLinkLineDeviceComputer(cmOutputConverter* outputConverter,
-                           cmStateDirectory const& stateDir);
-  ~cmLinkLineDeviceComputer() override;
-
-  cmLinkLineDeviceComputer(cmLinkLineDeviceComputer const&) = delete;
-  cmLinkLineDeviceComputer& operator=(cmLinkLineDeviceComputer const&) =
-    delete;
-
-  std::string ComputeLinkLibraries(cmComputeLinkInformation& cli,
-                                   std::string const& stdLibString) override;
-
-  std::string GetLinkerLanguage(cmGeneratorTarget* target,
-                                std::string const& config) override;
-};
-
 class cmNinjaLinkLineDeviceComputer : public cmLinkLineDeviceComputer
 {
 public:
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx 
b/Source/cmNinjaNormalTargetGenerator.cxx
index 680f881..4d13006 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -18,10 +18,10 @@
 #include "cmGeneratorTarget.h"
 #include "cmGlobalNinjaGenerator.h"
 #include "cmLinkLineComputer.h"
-#include "cmLinkLineDeviceComputer.h"
 #include "cmLocalGenerator.h"
 #include "cmLocalNinjaGenerator.h"
 #include "cmMakefile.h"
+#include "cmNinjaLinkLineDeviceComputer.h"
 #include "cmNinjaTypes.h"
 #include "cmOSXBundleGenerator.h"
 #include "cmOutputConverter.h"

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=13c92b4a300934e9f8573dee01ab4ec5e06fa7a1
commit 13c92b4a300934e9f8573dee01ab4ec5e06fa7a1
Author:     Eike Ziller <eike.zil...@qt.io>
AuthorDate: Mon May 20 14:36:42 2019 +0200
Commit:     Eike Ziller <eike.zil...@qt.io>
CommitDate: Mon May 20 14:36:42 2019 +0200

    Ninja: Fix creation of library symlinks in folders with spaces
    
    The arguments to 'cmake -E cmake_symlink_library' must be properly
    quoted.

diff --git a/Source/cmNinjaNormalTargetGenerator.cxx 
b/Source/cmNinjaNormalTargetGenerator.cxx
index dd63a54..98566c6 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -1082,7 +1082,9 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
         this->GetTargetFilePath(this->TargetNames.SharedObject));
       // If one link has to be created.
       if (targetOutputReal == soName || targetOutput == soName) {
-        symlinkVars["SONAME"] = soName;
+        symlinkVars["SONAME"] =
+          this->GetLocalGenerator()->ConvertToOutputFormat(
+            soName, cmOutputConverter::SHELL);
       } else {
         symlinkVars["SONAME"].clear();
         symlinks.push_back(soName);

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=083cf7e8a2515d9f838f3edbb2724fd3b17d83cd
commit 083cf7e8a2515d9f838f3edbb2724fd3b17d83cd
Author:     Eicke Herbertz <woll...@posteo.de>
AuthorDate: Fri Apr 12 00:16:46 2019 +0200
Commit:     Eicke Herbertz <woll...@posteo.de>
CommitDate: Thu May 16 23:00:27 2019 +0200

    cmake: Allow default generator to be set by environment variables
    
    When there is no Generator available in the Cache, this will read
    CMAKE_GENERATOR from environment before using the CMake platform default.
    If CMAKE_GENERATOR is empty, use the platform default.
    
    If a environment default generator is specified, subsequent variables
    CMAKE_GENERATOR_(INSTANCE,PLATFORM,TOOLSET) are also evaluated
    in the same way.

diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index fc24ac0..c861f3b 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -159,6 +159,9 @@ cmake::cmake(Role role, cmState::Mode mode)
 #endif
 
   this->GlobalGenerator = nullptr;
+  this->GeneratorInstanceSet = false;
+  this->GeneratorPlatformSet = false;
+  this->GeneratorToolsetSet = false;
   this->CurrentWorkingMode = NORMAL_MODE;
 
 #ifdef CMAKE_BUILD_WITH_CMAKE
@@ -174,6 +177,10 @@ cmake::cmake(Role role, cmState::Mode mode)
     this->AddProjectCommands();
   }
 
+  if (mode == cmState::Project) {
+    this->LoadEnvironmentPresets();
+  }
+
   // Make sure we can capture the build tool output.
   cmSystemTools::EnableVSConsoleOutput();
 
@@ -612,6 +619,35 @@ bool cmake::FindPackage(const std::vector<std::string>& 
args)
   return packageFound;
 }
 
+void cmake::LoadEnvironmentPresets()
+{
+  std::string envGenVar;
+  bool hasEnvironmentGenerator = false;
+  if (cmSystemTools::GetEnv("CMAKE_GENERATOR", envGenVar)) {
+    hasEnvironmentGenerator = true;
+    this->EnvironmentGenerator = envGenVar;
+  }
+
+  auto readGeneratorVar = [&](std::string name, std::string& key) {
+    std::string varValue;
+    if (cmSystemTools::GetEnv(name, varValue)) {
+      if (hasEnvironmentGenerator) {
+        key = varValue;
+      } else if (!this->GetIsInTryCompile()) {
+        std::string message = "Warning: Environment variable ";
+        message += name;
+        message += " will be ignored, because CMAKE_GENERATOR ";
+        message += "is not set.";
+        cmSystemTools::Message(message, "Warning");
+      }
+    }
+  };
+
+  readGeneratorVar("CMAKE_GENERATOR_INSTANCE", this->GeneratorInstance);
+  readGeneratorVar("CMAKE_GENERATOR_PLATFORM", this->GeneratorPlatform);
+  readGeneratorVar("CMAKE_GENERATOR_TOOLSET", this->GeneratorToolset);
+}
+
 // Parse the args
 void cmake::SetArgs(const std::vector<std::string>& args)
 {
@@ -759,7 +795,7 @@ void cmake::SetArgs(const std::vector<std::string>& args)
         cmSystemTools::Error("Multiple -A options not allowed");
         return;
       }
-      this->GeneratorPlatform = value;
+      this->SetGeneratorPlatform(value);
       havePlatform = true;
     } else if (arg.find("-T", 0) == 0) {
       std::string value = arg.substr(2);
@@ -775,7 +811,7 @@ void cmake::SetArgs(const std::vector<std::string>& args)
         cmSystemTools::Error("Multiple -T options not allowed");
         return;
       }
-      this->GeneratorToolset = value;
+      this->SetGeneratorToolset(value);
       haveToolset = true;
     } else if (arg.find("-G", 0) == 0) {
       std::string value = arg.substr(2);
@@ -806,6 +842,16 @@ void cmake::SetArgs(const std::vector<std::string>& args)
     else {
       this->SetDirectoriesFromFile(arg.c_str());
     }
+    // Empty instance, platform and toolset if only a generator is specified
+    if (this->GlobalGenerator) {
+      this->GeneratorInstance = "";
+      if (!this->GeneratorPlatformSet) {
+        this->GeneratorPlatform = "";
+      }
+      if (!this->GeneratorToolsetSet) {
+        this->GeneratorToolset = "";
+      }
+    }
   }
 
   const bool haveSourceDir = !this->GetHomeDirectory().empty();
@@ -1419,8 +1465,7 @@ int cmake::ActualConfigure()
 
   if (const std::string* instance =
         this->State->GetInitializedCacheValue("CMAKE_GENERATOR_INSTANCE")) {
-    if (!this->GeneratorInstance.empty() &&
-        this->GeneratorInstance != *instance) {
+    if (this->GeneratorInstanceSet && this->GeneratorInstance != *instance) {
       std::string message = "Error: generator instance: ";
       message += this->GeneratorInstance;
       message += "\nDoes not match the instance used previously: ";
@@ -1438,7 +1483,7 @@ int cmake::ActualConfigure()
 
   if (const std::string* platformName =
         this->State->GetInitializedCacheValue("CMAKE_GENERATOR_PLATFORM")) {
-    if (!this->GeneratorPlatform.empty() &&
+    if (this->GeneratorPlatformSet &&
         this->GeneratorPlatform != *platformName) {
       std::string message = "Error: generator platform: ";
       message += this->GeneratorPlatform;
@@ -1457,7 +1502,7 @@ int cmake::ActualConfigure()
 
   if (const std::string* tsName =
         this->State->GetInitializedCacheValue("CMAKE_GENERATOR_TOOLSET")) {
-    if (!this->GeneratorToolset.empty() && this->GeneratorToolset != *tsName) {
+    if (this->GeneratorToolsetSet && this->GeneratorToolset != *tsName) {
       std::string message = "Error: generator toolset: ";
       message += this->GeneratorToolset;
       message += "\nDoes not match the toolset used previously: ";
@@ -1535,6 +1580,16 @@ int cmake::ActualConfigure()
 
 std::unique_ptr<cmGlobalGenerator> cmake::EvaluateDefaultGlobalGenerator()
 {
+  if (!this->EnvironmentGenerator.empty()) {
+    cmGlobalGenerator* gen =
+      this->CreateGlobalGenerator(this->EnvironmentGenerator);
+    if (!gen) {
+      cmSystemTools::Error("CMAKE_GENERATOR was set but the specified "
+                           "generator doesn't exist. Using CMake default.");
+    } else {
+      return std::unique_ptr<cmGlobalGenerator>(gen);
+    }
+  }
 #if defined(_WIN32) && !defined(__CYGWIN__) && !defined(CMAKE_BOOT_MINGW)
   std::string found;
   // Try to find the newest VS installed on the computer and
diff --git a/Source/cmake.h b/Source/cmake.h
index 8b4b396..beec11d 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -201,18 +201,21 @@ public:
   void SetGeneratorInstance(std::string const& instance)
   {
     this->GeneratorInstance = instance;
+    this->GeneratorInstanceSet = true;
   }
 
   //! Set the name of the selected generator-specific platform.
   void SetGeneratorPlatform(std::string const& ts)
   {
     this->GeneratorPlatform = ts;
+    this->GeneratorPlatformSet = true;
   }
 
   //! Set the name of the selected generator-specific toolset.
   void SetGeneratorToolset(std::string const& ts)
   {
     this->GeneratorToolset = ts;
+    this->GeneratorToolsetSet = true;
   }
 
   const std::vector<std::string>& GetSourceExtensions() const
@@ -263,6 +266,9 @@ public:
    */
   int GetSystemInformation(std::vector<std::string>&);
 
+  //! Parse environment variables
+  void LoadEnvironmentPresets();
+
   //! Parse command line arguments
   void SetArgs(const std::vector<std::string>& args);
 
@@ -461,6 +467,9 @@ protected:
   std::string GeneratorInstance;
   std::string GeneratorPlatform;
   std::string GeneratorToolset;
+  bool GeneratorInstanceSet;
+  bool GeneratorPlatformSet;
+  bool GeneratorToolsetSet;
 
   //! read in a cmake list file to initialize the cache
   void ReadListFile(const std::vector<std::string>& args,
@@ -503,6 +512,7 @@ private:
   std::string CheckStampFile;
   std::string CheckStampList;
   std::string VSSolutionFile;
+  std::string EnvironmentGenerator;
   std::vector<std::string> SourceFileExtensions;
   std::unordered_set<std::string> SourceFileExtensionsSet;
   std::vector<std::string> HeaderFileExtensions;

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

Summary of changes:
 Help/command/find_package.rst                      |   7 ++
 Help/envvar/CMAKE_GENERATOR.rst                    |  16 +++
 Help/envvar/CMAKE_GENERATOR_INSTANCE.rst           |   7 ++
 Help/envvar/CMAKE_GENERATOR_PLATFORM.rst           |   8 ++
 Help/envvar/CMAKE_GENERATOR_TOOLSET.rst            |   8 ++
 Help/manual/OPTIONS_BUILD.txt                      |   3 +
 Help/manual/cmake-env-variables.7.rst              |   4 +
 Help/manual/cmake-variables.7.rst                  |   1 +
 Help/release/dev/default-generator-env.rst         |   9 ++
 Help/release/dev/find-package-prefer-config.rst    |   6 +
 Help/variable/CMAKE_FIND_PACKAGE_PREFER_CONFIG.rst |  27 +++++
 .../variable/CMAKE_FIND_PACKAGE_WARN_NO_MODULE.rst |   3 +
 Help/variable/CMAKE_GENERATOR.rst                  |   5 +
 Help/variable/CMAKE_GENERATOR_INSTANCE.rst         |   7 +-
 Help/variable/CMAKE_GENERATOR_PLATFORM.rst         |   3 +-
 Help/variable/CMAKE_GENERATOR_TOOLSET.rst          |   3 +-
 Modules/CMakeDetermineASMCompiler.cmake            |   2 +-
 Modules/CMakeDetermineCompilerId.cmake             |   6 +-
 Source/CMakeLists.txt                              |   2 +
 Source/cmFindPackageCommand.cxx                    | 121 ++++++++++++---------
 Source/cmFindPackageCommand.h                      |   3 +
 Source/cmGlobalVisualStudio10Generator.cxx         |  13 ++-
 Source/cmGlobalVisualStudio10Generator.h           |   3 +
 Source/cmLinkLineDeviceComputer.cxx                | 104 ++++++++++++++----
 Source/cmLinkLineDeviceComputer.h                  |  22 +---
 Source/cmMakefileExecutableTargetGenerator.cxx     |  18 +--
 Source/cmMakefileLibraryTargetGenerator.cxx        |  51 ++-------
 Source/cmNinjaLinkLineDeviceComputer.cxx           |  20 ++++
 ...eComputer.h => cmNinjaLinkLineDeviceComputer.h} |  26 +----
 Source/cmNinjaNormalTargetGenerator.cxx            |  57 +++-------
 Source/cmVisualStudio10TargetGenerator.cxx         |  34 ++----
 Source/cmake.cxx                                   |  67 +++++++++++-
 Source/cmake.h                                     |  10 ++
 Tests/EnforceConfig.cmake.in                       |   6 +
 Tests/FindPackageTest/CMakeLists.txt               |  36 +++++-
 Tests/FindPackageTest/PreferConfig/ABCConfig.cmake |   1 +
 Tests/FindPackageTest/PreferConfig/FindABC.cmake   |   1 +
 .../CommandLine/EnvGenerator/CMakeLists.txt        |  10 ++
 .../Envgen-A-platform-result.txt}                  |   0
 .../CommandLine/Envgen-A-platform-stderr-vs9.txt   |   2 +
 .../CommandLine/Envgen-A-platform-stderr.txt       |   2 +
 .../Envgen-G-implicit-platform-stdout.txt          |   1 +
 .../Envgen-T-toolset-result.txt}                   |   0
 .../CommandLine/Envgen-T-toolset-stderr.txt        |   2 +
 .../Envgen-bad-result.txt}                         |   0
 Tests/RunCMake/CommandLine/Envgen-bad-stderr.txt   |   5 +
 .../Envgen-instance-invalid-result.txt}            |   0
 .../CommandLine/Envgen-instance-invalid-stderr.txt |   2 +
 .../Envgen-ninja-result.txt}                       |   0
 Tests/RunCMake/CommandLine/Envgen-ninja-stderr.txt |   4 +
 .../Envgen-platform-invalid-result.txt}            |   0
 .../Envgen-platform-invalid-stderr-vs9.txt         |   2 +
 .../CommandLine/Envgen-platform-invalid-stderr.txt |   2 +
 .../Envgen-toolset-invalid-result.txt}             |   0
 .../CommandLine/Envgen-toolset-invalid-stderr.txt  |   2 +
 .../Envgen-unset-result.txt}                       |   0
 Tests/RunCMake/CommandLine/Envgen-unset-stderr.txt |   4 +
 .../Envgen-warnings-result.txt}                    |   0
 .../CommandLine/Envgen-warnings-stderr.txt         |   7 ++
 Tests/RunCMake/CommandLine/RunCMakeTest.cmake      |  68 ++++++++++++
 bootstrap                                          |   1 +
 61 files changed, 585 insertions(+), 249 deletions(-)
 create mode 100644 Help/envvar/CMAKE_GENERATOR.rst
 create mode 100644 Help/envvar/CMAKE_GENERATOR_INSTANCE.rst
 create mode 100644 Help/envvar/CMAKE_GENERATOR_PLATFORM.rst
 create mode 100644 Help/envvar/CMAKE_GENERATOR_TOOLSET.rst
 create mode 100644 Help/release/dev/default-generator-env.rst
 create mode 100644 Help/release/dev/find-package-prefer-config.rst
 create mode 100644 Help/variable/CMAKE_FIND_PACKAGE_PREFER_CONFIG.rst
 create mode 100644 Source/cmNinjaLinkLineDeviceComputer.cxx
 copy Source/{cmLinkLineDeviceComputer.h => cmNinjaLinkLineDeviceComputer.h} 
(51%)
 create mode 100644 Tests/FindPackageTest/PreferConfig/ABCConfig.cmake
 create mode 100644 Tests/FindPackageTest/PreferConfig/FindABC.cmake
 create mode 100644 Tests/RunCMake/CommandLine/EnvGenerator/CMakeLists.txt
 copy Tests/RunCMake/{while/MissingArgument-result.txt => 
CommandLine/Envgen-A-platform-result.txt} (100%)
 create mode 100644 Tests/RunCMake/CommandLine/Envgen-A-platform-stderr-vs9.txt
 create mode 100644 Tests/RunCMake/CommandLine/Envgen-A-platform-stderr.txt
 create mode 100644 
Tests/RunCMake/CommandLine/Envgen-G-implicit-platform-stdout.txt
 copy Tests/RunCMake/{while/MissingArgument-result.txt => 
CommandLine/Envgen-T-toolset-result.txt} (100%)
 create mode 100644 Tests/RunCMake/CommandLine/Envgen-T-toolset-stderr.txt
 copy Tests/RunCMake/{while/MissingArgument-result.txt => 
CommandLine/Envgen-bad-result.txt} (100%)
 create mode 100644 Tests/RunCMake/CommandLine/Envgen-bad-stderr.txt
 copy Tests/RunCMake/{while/MissingArgument-result.txt => 
CommandLine/Envgen-instance-invalid-result.txt} (100%)
 create mode 100644 
Tests/RunCMake/CommandLine/Envgen-instance-invalid-stderr.txt
 copy Tests/RunCMake/{while/MissingArgument-result.txt => 
CommandLine/Envgen-ninja-result.txt} (100%)
 create mode 100644 Tests/RunCMake/CommandLine/Envgen-ninja-stderr.txt
 copy Tests/RunCMake/{while/MissingArgument-result.txt => 
CommandLine/Envgen-platform-invalid-result.txt} (100%)
 create mode 100644 
Tests/RunCMake/CommandLine/Envgen-platform-invalid-stderr-vs9.txt
 create mode 100644 
Tests/RunCMake/CommandLine/Envgen-platform-invalid-stderr.txt
 copy Tests/RunCMake/{while/MissingArgument-result.txt => 
CommandLine/Envgen-toolset-invalid-result.txt} (100%)
 create mode 100644 Tests/RunCMake/CommandLine/Envgen-toolset-invalid-stderr.txt
 copy Tests/RunCMake/{while/MissingArgument-result.txt => 
CommandLine/Envgen-unset-result.txt} (100%)
 create mode 100644 Tests/RunCMake/CommandLine/Envgen-unset-stderr.txt
 copy Tests/RunCMake/{while/MissingArgument-result.txt => 
CommandLine/Envgen-warnings-result.txt} (100%)
 create mode 100644 Tests/RunCMake/CommandLine/Envgen-warnings-stderr.txt


hooks/post-receive
-- 
CMake
_______________________________________________
Cmake-commits mailing list
Cmake-commits@cmake.org
https://cmake.org/mailman/listinfo/cmake-commits

Reply via email to