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  ad815939c9b3f604c68a636c88f4842e1ab22129 (commit)
       via  0b14c3fded9c5e7c67c261949dc37d79d8236830 (commit)
       via  96820562c6ae7041b447d8d60a3bf5ea6b7a6ecc (commit)
       via  d2f859f1510c334403b948481f78e56731a29eac (commit)
       via  ae7d99fbd51e31e012f1434ebe7ba16ea1bef060 (commit)
       via  8d47b97a695111d2718c9f7a7729516e3a18e15e (commit)
       via  1b27ac78ac80a0edeaa90038a15b6ac985a29880 (commit)
       via  c7a4b1a58efd3b7ef8794547dcee738e8fd1b483 (commit)
       via  e221039e11fb4961b8cbbdbd2fd8f1af99534893 (commit)
       via  46de38dae2c43c0dc2dd24307a0615a11a881e39 (commit)
       via  5e9ecaae0e191aba8b02243cb94a68983d6ce3f0 (commit)
       via  b4ef7fbaa8257254abba0d7847941baf78fdb6ed (commit)
      from  d9cf0ec4d4a942aec3360d66855379f7360ab00d (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=ad815939c9b3f604c68a636c88f4842e1ab22129
commit ad815939c9b3f604c68a636c88f4842e1ab22129
Merge: 0b14c3fded b4ef7fbaa8
Author:     Brad King <brad.k...@kitware.com>
AuthorDate: Thu Nov 21 16:10:23 2019 +0000
Commit:     Kitware Robot <kwro...@kitware.com>
CommitDate: Thu Nov 21 11:10:34 2019 -0500

    Merge topic 'ccmake_fix_help_text_crash'
    
    b4ef7fbaa8 ccmake: Fix crash with cache entries almost the size of the 
window
    
    Acked-by: Kitware Robot <kwro...@kitware.com>
    Merge-request: !4062


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0b14c3fded9c5e7c67c261949dc37d79d8236830
commit 0b14c3fded9c5e7c67c261949dc37d79d8236830
Merge: 96820562c6 e221039e11
Author:     Brad King <brad.k...@kitware.com>
AuthorDate: Thu Nov 21 16:05:26 2019 +0000
Commit:     Kitware Robot <kwro...@kitware.com>
CommitDate: Thu Nov 21 11:05:52 2019 -0500

    Merge topic 'FindMPI-improve-error'
    
    e221039e11 FindMPI: Improve error when a component's language is not enabled
    
    Acked-by: Kitware Robot <kwro...@kitware.com>
    Acked-by: Ben Boeckel <ben.boec...@kitware.com>
    Merge-request: !4071


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=96820562c6ae7041b447d8d60a3bf5ea6b7a6ecc
commit 96820562c6ae7041b447d8d60a3bf5ea6b7a6ecc
Merge: d2f859f151 8d47b97a69
Author:     Brad King <brad.k...@kitware.com>
AuthorDate: Thu Nov 21 16:04:48 2019 +0000
Commit:     Kitware Robot <kwro...@kitware.com>
CommitDate: Thu Nov 21 11:05:03 2019 -0500

    Merge topic 'UseJava-javadoc-classpath-separator'
    
    8d47b97a69 UseJava: Use correct path separator in javadoc
    1b27ac78ac UseJava: Use list(APPEND) to simplify javadoc option construction
    c7a4b1a58e UseJava: Extract the path separator to module level
    
    Acked-by: Kitware Robot <kwro...@kitware.com>
    Merge-request: !3967


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d2f859f1510c334403b948481f78e56731a29eac
commit d2f859f1510c334403b948481f78e56731a29eac
Merge: ae7d99fbd5 46de38dae2
Author:     Brad King <brad.k...@kitware.com>
AuthorDate: Thu Nov 21 16:03:46 2019 +0000
Commit:     Kitware Robot <kwro...@kitware.com>
CommitDate: Thu Nov 21 11:04:03 2019 -0500

    Merge topic 'ExternalProject-list-sep-in-cache'
    
    46de38dae2 ExternalProject: replace LIST_SEPARATOR in initial cache files 
too
    
    Acked-by: Kitware Robot <kwro...@kitware.com>
    Merge-request: !4070


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ae7d99fbd51e31e012f1434ebe7ba16ea1bef060
commit ae7d99fbd51e31e012f1434ebe7ba16ea1bef060
Merge: d9cf0ec4d4 5e9ecaae0e
Author:     Brad King <brad.k...@kitware.com>
AuthorDate: Thu Nov 21 16:02:58 2019 +0000
Commit:     Kitware Robot <kwro...@kitware.com>
CommitDate: Thu Nov 21 11:03:09 2019 -0500

    Merge topic 'load_cache_in_script'
    
    5e9ecaae0e load_cache: Allow READ_WITH_PREFIX mode in cmake scripts
    
    Acked-by: Kitware Robot <kwro...@kitware.com>
    Merge-request: !4042


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8d47b97a695111d2718c9f7a7729516e3a18e15e
commit 8d47b97a695111d2718c9f7a7729516e3a18e15e
Author:     Nathan Burles <nathan.bur...@uk.ibm.com>
AuthorDate: Mon Nov 4 10:40:42 2019 +0000
Commit:     Brad King <brad.k...@kitware.com>
CommitDate: Wed Nov 20 10:38:44 2019 -0500

    UseJava: Use correct path separator in javadoc
    
    For both classpath and sourcepath.

diff --git a/Modules/UseJava.cmake b/Modules/UseJava.cmake
index 27f1218bbf..28f74ea6ed 100644
--- a/Modules/UseJava.cmake
+++ b/Modules/UseJava.cmake
@@ -1190,29 +1190,13 @@ function(create_javadoc _target)
     set(_javadoc_options -d ${_javadoc_builddir})
 
     if (_javadoc_sourcepath)
-        set(_start TRUE)
-        foreach(_path IN LISTS _javadoc_sourcepath)
-            if (_start)
-                set(_sourcepath ${_path})
-                set(_start FALSE)
-            else ()
-                set(_sourcepath ${_sourcepath}:${_path})
-            endif ()
-        endforeach()
-        list(APPEND _javadoc_options -sourcepath ${_sourcepath})
+        list(JOIN _javadoc_sourcepath "${_UseJava_PATH_SEP}" 
_javadoc_sourcepath)
+        list(APPEND _javadoc_options -sourcepath "\"${_javadoc_sourcepath}\"")
     endif ()
 
     if (_javadoc_classpath)
-        set(_start TRUE)
-        foreach(_path IN LISTS _javadoc_classpath)
-            if (_start)
-                set(_classpath ${_path})
-                set(_start FALSE)
-            else ()
-                set(_classpath ${_classpath}:${_path})
-            endif ()
-        endforeach()
-        list(APPEND _javadoc_options -classpath "${_classpath}")
+        list(JOIN _javadoc_classpath "${_UseJava_PATH_SEP}" _javadoc_classpath)
+        list(APPEND _javadoc_options -classpath "\"${_javadoc_classpath}\"")
     endif ()
 
     if (_javadoc_doctitle)

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1b27ac78ac80a0edeaa90038a15b6ac985a29880
commit 1b27ac78ac80a0edeaa90038a15b6ac985a29880
Author:     Nathan Burles <nathan.bur...@uk.ibm.com>
AuthorDate: Mon Nov 4 10:40:42 2019 +0000
Commit:     Brad King <brad.k...@kitware.com>
CommitDate: Wed Nov 20 10:38:44 2019 -0500

    UseJava: Use list(APPEND) to simplify javadoc option construction

diff --git a/Modules/UseJava.cmake b/Modules/UseJava.cmake
index 96b7c64afe..27f1218bbf 100644
--- a/Modules/UseJava.cmake
+++ b/Modules/UseJava.cmake
@@ -1199,7 +1199,7 @@ function(create_javadoc _target)
                 set(_sourcepath ${_sourcepath}:${_path})
             endif ()
         endforeach()
-        set(_javadoc_options ${_javadoc_options} -sourcepath ${_sourcepath})
+        list(APPEND _javadoc_options -sourcepath ${_sourcepath})
     endif ()
 
     if (_javadoc_classpath)
@@ -1212,33 +1212,34 @@ function(create_javadoc _target)
                 set(_classpath ${_classpath}:${_path})
             endif ()
         endforeach()
-        set(_javadoc_options ${_javadoc_options} -classpath "${_classpath}")
+        list(APPEND _javadoc_options -classpath "${_classpath}")
     endif ()
 
     if (_javadoc_doctitle)
-        set(_javadoc_options ${_javadoc_options} -doctitle 
'${_javadoc_doctitle}')
+        list(APPEND _javadoc_options -doctitle '${_javadoc_doctitle}')
     endif ()
 
     if (_javadoc_windowtitle)
-        set(_javadoc_options ${_javadoc_options} -windowtitle 
'${_javadoc_windowtitle}')
+        list(APPEND _javadoc_options -windowtitle '${_javadoc_windowtitle}')
     endif ()
 
     if (_javadoc_author)
-        set(_javadoc_options ${_javadoc_options} -author)
+        list(APPEND _javadoc_options -author)
     endif ()
 
     if (_javadoc_use)
-        set(_javadoc_options ${_javadoc_options} -use)
+        list(APPEND _javadoc_options -use)
     endif ()
 
     if (_javadoc_version)
-        set(_javadoc_options ${_javadoc_options} -version)
+        list(APPEND _javadoc_options -version)
     endif ()
 
     add_custom_target(${_target}_javadoc ALL
-        COMMAND ${Java_JAVADOC_EXECUTABLE} ${_javadoc_options}
-                            ${_javadoc_files}
-                            ${_javadoc_packages}
+        COMMAND ${Java_JAVADOC_EXECUTABLE}
+                ${_javadoc_options}
+                ${_javadoc_files}
+                ${_javadoc_packages}
         WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
     )
 

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c7a4b1a58efd3b7ef8794547dcee738e8fd1b483
commit c7a4b1a58efd3b7ef8794547dcee738e8fd1b483
Author:     Nathan Burles <nathan.bur...@uk.ibm.com>
AuthorDate: Thu Oct 31 11:27:18 2019 +0000
Commit:     Brad King <brad.k...@kitware.com>
CommitDate: Wed Nov 20 10:38:44 2019 -0500

    UseJava: Extract the path separator to module level
    
    It is currently only defined within the add_jar function, but is needed
    inside other functions in this module.

diff --git a/Modules/UseJava.cmake b/Modules/UseJava.cmake
index 07984885bc..96b7c64afe 100644
--- a/Modules/UseJava.cmake
+++ b/Modules/UseJava.cmake
@@ -408,6 +408,12 @@ set(_JAVA_EXPORT_TARGETS_SCRIPT 
${CMAKE_CURRENT_LIST_DIR}/javaTargets.cmake.in)
 set(_JAVA_CLASS_FILELIST_SCRIPT 
${CMAKE_CURRENT_LIST_DIR}/UseJavaClassFilelist.cmake)
 set(_JAVA_SYMLINK_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/UseJavaSymlinks.cmake)
 
+if (CMAKE_HOST_WIN32 AND NOT CYGWIN AND CMAKE_HOST_SYSTEM_NAME MATCHES 
"Windows")
+    set(_UseJava_PATH_SEP "$<SEMICOLON>")
+else ()
+    set(_UseJava_PATH_SEP ":")
+endif()
+
 function(add_jar _TARGET_NAME)
 
     cmake_parse_arguments(_add_jar
@@ -497,14 +503,8 @@ function(add_jar _TARGET_NAME)
         ${CMAKE_JAVA_LIBRARY_OUTPUT_PATH}
     )
 
-    if (CMAKE_HOST_WIN32 AND NOT CYGWIN AND CMAKE_HOST_SYSTEM_NAME MATCHES 
"Windows")
-        set(CMAKE_JAVA_INCLUDE_FLAG_SEP ";")
-    else ()
-        set(CMAKE_JAVA_INCLUDE_FLAG_SEP ":")
-    endif()
-
     foreach (JAVA_INCLUDE_DIR IN LISTS CMAKE_JAVA_INCLUDE_PATH)
-       string(APPEND CMAKE_JAVA_INCLUDE_PATH_FINAL 
"${CMAKE_JAVA_INCLUDE_FLAG_SEP}${JAVA_INCLUDE_DIR}")
+       string(APPEND CMAKE_JAVA_INCLUDE_PATH_FINAL 
"${_UseJava_PATH_SEP}${JAVA_INCLUDE_DIR}")
     endforeach()
 
     set(CMAKE_JAVA_CLASS_OUTPUT_PATH 
"${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${_TARGET_NAME}.dir")
@@ -576,7 +576,7 @@ function(add_jar _TARGET_NAME)
         if (TARGET ${_JAVA_INCLUDE_JAR})
             get_target_property(_JAVA_JAR_PATH ${_JAVA_INCLUDE_JAR} JAR_FILE)
             if (_JAVA_JAR_PATH)
-                string(APPEND CMAKE_JAVA_INCLUDE_PATH_FINAL 
"${CMAKE_JAVA_INCLUDE_FLAG_SEP}${_JAVA_JAR_PATH}")
+                string(APPEND CMAKE_JAVA_INCLUDE_PATH_FINAL 
"${_UseJava_PATH_SEP}${_JAVA_JAR_PATH}")
                 list(APPEND CMAKE_JAVA_INCLUDE_PATH ${_JAVA_JAR_PATH})
                 list(APPEND _JAVA_DEPENDS ${_JAVA_INCLUDE_JAR})
                 list(APPEND _JAVA_COMPILE_DEPENDS ${_JAVA_JAR_PATH})
@@ -584,7 +584,7 @@ function(add_jar _TARGET_NAME)
                 message(SEND_ERROR "add_jar: INCLUDE_JARS target 
${_JAVA_INCLUDE_JAR} is not a jar")
             endif ()
         else ()
-            string(APPEND CMAKE_JAVA_INCLUDE_PATH_FINAL 
"${CMAKE_JAVA_INCLUDE_FLAG_SEP}${_JAVA_INCLUDE_JAR}")
+            string(APPEND CMAKE_JAVA_INCLUDE_PATH_FINAL 
"${_UseJava_PATH_SEP}${_JAVA_INCLUDE_JAR}")
             list(APPEND CMAKE_JAVA_INCLUDE_PATH "${_JAVA_INCLUDE_JAR}")
             list(APPEND _JAVA_DEPENDS "${_JAVA_INCLUDE_JAR}")
             list(APPEND _JAVA_COMPILE_DEPENDS "${_JAVA_INCLUDE_JAR}")
@@ -1274,11 +1274,6 @@ function (create_javah)
     endif()
 
     set (_output_files)
-    if (WIN32 AND NOT CYGWIN AND CMAKE_HOST_SYSTEM_NAME MATCHES "Windows")
-      set(_classpath_sep "$<SEMICOLON>")
-    else ()
-      set(_classpath_sep ":")
-    endif()
 
     # handle javah options
     set (_javah_options)
@@ -1304,7 +1299,7 @@ function (create_javah)
           message(SEND_ERROR "create_javah: CLASSPATH entry ${_path} does not 
exist.")
         endif()
       endforeach()
-      string (REPLACE ";" "${_classpath_sep}" _classpath "${_classpath}")
+      string (REPLACE ";" "${_UseJava_PATH_SEP}" _classpath "${_classpath}")
       list (APPEND _javah_options -classpath "${_classpath}")
     endif()
 

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e221039e11fb4961b8cbbdbd2fd8f1af99534893
commit e221039e11fb4961b8cbbdbd2fd8f1af99534893
Author:     Keith Ballard <keith.m.ball...@gmail.com>
AuthorDate: Wed Nov 20 09:34:40 2019 -0500
Commit:     Brad King <brad.k...@kitware.com>
CommitDate: Wed Nov 20 10:23:33 2019 -0500

    FindMPI: Improve error when a component's language is not enabled
    
    Previously, if a CMake project requests a component for a language that is
    not enabled, it would simply give an error with the message
    
        Could NOT find MPI (missing: MPI_${LANG}_FOUND)
    
    which is not indicative that the language was not enabled.  This change
    provides an error message indicating that it failed to find the
    particular MPI component because no compiler was available for the
    language and the language might need to be enabled for the project.
    
    Closes: #19996

diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake
index 277903239d..6b1da4b03c 100644
--- a/Modules/FindMPI.cmake
+++ b/Modules/FindMPI.cmake
@@ -1391,6 +1391,7 @@ foreach(LANG IN ITEMS C CXX Fortran)
     endif()
   else()
     set(_MPI_FIND_${LANG} FALSE)
+    string(APPEND _MPI_FAIL_REASON "MPI component '${LANG}' was requested, but 
language ${LANG} is not enabled.  ")
   endif()
   if(_MPI_FIND_${LANG})
     if( ${LANG} STREQUAL CXX AND NOT MPICXX IN_LIST MPI_FIND_COMPONENTS )
@@ -1688,6 +1689,7 @@ endif()
 find_package_handle_standard_args(MPI
     REQUIRED_VARS ${_MPI_REQ_VARS}
     VERSION_VAR ${_MPI_MIN_VERSION}
+    REASON_FAILURE_MESSAGE "${_MPI_FAIL_REASON}"
     HANDLE_COMPONENTS)
 
 #=============================================================================

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=46de38dae2c43c0dc2dd24307a0615a11a881e39
commit 46de38dae2c43c0dc2dd24307a0615a11a881e39
Author:     Ben Boeckel <ben.boec...@kitware.com>
AuthorDate: Wed Nov 20 09:21:46 2019 -0500
Commit:     Ben Boeckel <ben.boec...@kitware.com>
CommitDate: Wed Nov 20 09:21:46 2019 -0500

    ExternalProject: replace LIST_SEPARATOR in initial cache files too

diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index 1e542663d0..db3716a1b1 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -1777,6 +1777,11 @@ function(_ep_write_initial_cache target_name 
script_filename script_initial_cach
   # Replace location tags.
   _ep_replace_location_tags(${target_name} script_initial_cache)
   _ep_replace_location_tags(${target_name} script_filename)
+  # Replace list separators.
+  get_property(sep TARGET ${target_name} PROPERTY _EP_LIST_SEPARATOR)
+  if(sep AND script_initial_cache)
+    string(REPLACE "${sep}" ";" script_initial_cache "${script_initial_cache}")
+  endif()
   # Write out the initial cache file to the location specified.
   file(GENERATE OUTPUT "${script_filename}" CONTENT "${script_initial_cache}")
 endfunction()

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5e9ecaae0e191aba8b02243cb94a68983d6ce3f0
commit 5e9ecaae0e191aba8b02243cb94a68983d6ce3f0
Author:     Charles Barto <chba...@microsoft.com>
AuthorDate: Tue Nov 12 17:17:17 2019 -0800
Commit:     Brad King <brad.k...@kitware.com>
CommitDate: Tue Nov 19 14:39:00 2019 -0500

    load_cache: Allow READ_WITH_PREFIX mode in cmake scripts

diff --git a/Help/release/dev/load_cache-script-mode.rst 
b/Help/release/dev/load_cache-script-mode.rst
new file mode 100644
index 0000000000..d84b08afe8
--- /dev/null
+++ b/Help/release/dev/load_cache-script-mode.rst
@@ -0,0 +1,5 @@
+load_cache-script-mode
+----------------------
+
+* The :command:`load_cache(READ_WITH_PREFIX)` command mode is now allowed
+  when using ``cmake -P`` to :ref:`Run a Script <Script Processing Mode>`.
diff --git a/Source/cmCommands.cxx b/Source/cmCommands.cxx
index ff73b279dd..563e0f162a 100644
--- a/Source/cmCommands.cxx
+++ b/Source/cmCommands.cxx
@@ -198,6 +198,7 @@ void GetScriptingCommands(cmState* state)
 #if !defined(CMAKE_BOOTSTRAP)
   state->AddBuiltinCommand("cmake_host_system_information",
                            cmCMakeHostSystemInformationCommand);
+  state->AddBuiltinCommand("load_cache", cmLoadCacheCommand);
   state->AddBuiltinCommand("remove", cmRemoveCommand);
   state->AddBuiltinCommand("variable_watch", cmVariableWatchCommand);
   state->AddBuiltinCommand("write_file", cmWriteFileCommand);
@@ -279,7 +280,6 @@ void GetProjectCommands(cmState* state)
   state->AddBuiltinCommand("target_link_options", cmTargetLinkOptionsCommand);
   state->AddBuiltinCommand("target_link_directories",
                            cmTargetLinkDirectoriesCommand);
-  state->AddBuiltinCommand("load_cache", cmLoadCacheCommand);
   state->AddBuiltinCommand("qt_wrap_cpp", cmQTWrapCPPCommand);
   state->AddBuiltinCommand("qt_wrap_ui", cmQTWrapUICommand);
   state->AddBuiltinCommand("remove_definitions", cmRemoveDefinitionsCommand);
@@ -339,7 +339,6 @@ void GetProjectCommandsInScriptMode(cmState* state)
   CM_UNEXPECTED_PROJECT_COMMAND("install");
   CM_UNEXPECTED_PROJECT_COMMAND("link_directories");
   CM_UNEXPECTED_PROJECT_COMMAND("link_libraries");
-  CM_UNEXPECTED_PROJECT_COMMAND("load_cache");
   CM_UNEXPECTED_PROJECT_COMMAND("project");
   CM_UNEXPECTED_PROJECT_COMMAND("qt_wrap_cpp");
   CM_UNEXPECTED_PROJECT_COMMAND("qt_wrap_ui");
diff --git a/Source/cmLoadCacheCommand.cxx b/Source/cmLoadCacheCommand.cxx
index 1184bcb583..d49e7117c1 100644
--- a/Source/cmLoadCacheCommand.cxx
+++ b/Source/cmLoadCacheCommand.cxx
@@ -24,12 +24,20 @@ bool cmLoadCacheCommand(std::vector<std::string> const& 
args,
 {
   if (args.empty()) {
     status.SetError("called with wrong number of arguments.");
+    return false;
   }
 
   if (args.size() >= 2 && args[1] == "READ_WITH_PREFIX") {
     return ReadWithPrefix(args, status);
   }
 
+  if (status.GetMakefile().GetCMakeInstance()->GetWorkingMode() ==
+      cmake::SCRIPT_MODE) {
+    status.SetError(
+      "Only load_cache(READ_WITH_PREFIX) may be used in script mode");
+    return false;
+  }
+
   // Cache entries to be excluded from the import list.
   // If this set is empty, all cache entries are brought in
   // and they can not be overridden.
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index 13712950bd..51a3db5964 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -279,6 +279,7 @@ add_RunCMake_test(include)
 add_RunCMake_test(include_directories)
 add_RunCMake_test(include_guard)
 add_RunCMake_test(list)
+add_RunCMake_test(load_cache)
 add_RunCMake_test(math)
 add_RunCMake_test(message)
 add_RunCMake_test(option)
diff --git a/Tests/RunCMake/load_cache/CMakeLists.txt 
b/Tests/RunCMake/load_cache/CMakeLists.txt
new file mode 100644
index 0000000000..2632ffa91f
--- /dev/null
+++ b/Tests/RunCMake/load_cache/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.16)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/load_cache/NewForm_Project.cmake 
b/Tests/RunCMake/load_cache/NewForm_Project.cmake
new file mode 100644
index 0000000000..13a450b8c4
--- /dev/null
+++ b/Tests/RunCMake/load_cache/NewForm_Project.cmake
@@ -0,0 +1,16 @@
+load_cache(${CMAKE_CURRENT_BINARY_DIR}/../test_project READ_WITH_PREFIX 
LOAD_CACHE_TEST_
+  CACHE_STRING
+  CACHE_BOOL
+  CACHE_INTERNAL)
+
+if(NOT LOAD_CACHE_TEST_CACHE_STRING STREQUAL "cache string")
+  message(FATAL_ERROR "CACHE_STRING: was ${CACHE_STRING}, expected \"cache 
string\"")
+endif()
+
+if(NOT LOAD_CACHE_TEST_CACHE_BOOL)
+  message(FATAL_ERROR "CACHE_BOOL: was falsey, expected ON")
+endif()
+
+if(NOT LOAD_CACHE_TEST_CACHE_INTERNAL STREQUAL "cache internal")
+  message(FATAL_ERROR "CACHE_INTERNAL: was ${CACHE_INTENRAL}, expected \"cache 
internal\"")
+endif()
diff --git a/Tests/RunCMake/load_cache/NewForm_Script.cmake 
b/Tests/RunCMake/load_cache/NewForm_Script.cmake
new file mode 100644
index 0000000000..f3cee92828
--- /dev/null
+++ b/Tests/RunCMake/load_cache/NewForm_Script.cmake
@@ -0,0 +1,16 @@
+load_cache(${RunCMake_BINARY_DIR}/test_project READ_WITH_PREFIX 
LOAD_CACHE_TEST_
+  CACHE_STRING
+  CACHE_BOOL
+  CACHE_INTERNAL)
+
+if(NOT LOAD_CACHE_TEST_CACHE_STRING STREQUAL "cache string")
+  message(FATAL_ERROR "CACHE_STRING: was ${CACHE_STRING}, expected \"cache 
string\"")
+endif()
+
+if(NOT LOAD_CACHE_TEST_CACHE_BOOL)
+  message(FATAL_ERROR "CACHE_BOOL: was falsey, expected ON")
+endif()
+
+if(NOT LOAD_CACHE_TEST_CACHE_INTERNAL STREQUAL "cache internal")
+  message(FATAL_ERROR "CACHE_INTERNAL: was ${CACHE_INTENRAL}, expected \"cache 
internal\"")
+endif()
diff --git a/Tests/RunCMake/load_cache/OldForm_Script-result.txt 
b/Tests/RunCMake/load_cache/OldForm_Script-result.txt
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/Tests/RunCMake/load_cache/OldForm_Script-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/load_cache/OldForm_Script-stderr.txt 
b/Tests/RunCMake/load_cache/OldForm_Script-stderr.txt
new file mode 100644
index 0000000000..9ad5c80ce1
--- /dev/null
+++ b/Tests/RunCMake/load_cache/OldForm_Script-stderr.txt
@@ -0,0 +1,2 @@
+^CMake Error at.*/Tests/RunCMake/load_cache/OldForm_Script.cmake:1 
\(load_cache\):
+  load_cache Only load_cache\(READ_WITH_PREFIX\) may be used in script mode$
diff --git a/Tests/RunCMake/load_cache/OldForm_Script.cmake 
b/Tests/RunCMake/load_cache/OldForm_Script.cmake
new file mode 100644
index 0000000000..9560f613c7
--- /dev/null
+++ b/Tests/RunCMake/load_cache/OldForm_Script.cmake
@@ -0,0 +1,13 @@
+load_cache(${RunCMake_BINARY_DIR}/test_project INCLUDE_INTERNALS 
CACHE_INTERNAL)
+
+if(NOT CACHE_STRING STREQUAL "cache string")
+  message(FATAL_ERROR "CACHE_STRING: was ${CACHE_STRING}, expected \"cache 
string\"")
+endif()
+
+if(NOT CACHE_BOOL)
+  message(FATAL_ERROR "CACHE_BOOL: was falsey, expected ON")
+endif()
+
+if(NOT CACHE_INTERNAL STREQUAL "cache internal")
+  message(FATAL_ERROR "CACHE_INTERNAL: was ${CACHE_INTENRAL}, expected \"cache 
internal\"")
+endif()
diff --git a/Tests/RunCMake/load_cache/RunCMakeTest.cmake 
b/Tests/RunCMake/load_cache/RunCMakeTest.cmake
new file mode 100644
index 0000000000..a0d54ea00a
--- /dev/null
+++ b/Tests/RunCMake/load_cache/RunCMakeTest.cmake
@@ -0,0 +1,13 @@
+include(RunCMake)
+
+file(WRITE ${RunCMake_BINARY_DIR}/test_project/CMakeCache.txt [[
+CACHE_STRING:STRING=cache string
+CACHE_BOOL:BOOL=ON
+CACHE_INTERNAL:INTERNAL=cache internal
+]])
+
+run_cmake(NewForm_Project)
+run_cmake_command(NewForm_Script ${CMAKE_COMMAND} 
-DRunCMake_BINARY_DIR=${RunCMake_BINARY_DIR}
+  -P "${RunCMake_SOURCE_DIR}/NewForm_Script.cmake")
+run_cmake_command(OldForm_Script ${CMAKE_COMMAND} 
-DRunCMake_BINARY_DIR=${RunCMake_BINARY_DIR}
+  -P "${RunCMake_SOURCE_DIR}/OldForm_Script.cmake")

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b4ef7fbaa8257254abba0d7847941baf78fdb6ed
commit b4ef7fbaa8257254abba0d7847941baf78fdb6ed
Author:     Sylvain Joubert <joubert...@gmail.com>
AuthorDate: Mon Nov 18 15:23:01 2019 +0100
Commit:     Sylvain Joubert <joubert...@gmail.com>
CommitDate: Tue Nov 19 20:06:31 2019 +0100

    ccmake: Fix crash with cache entries almost the size of the window
    
    The previous code:
    
    if (curFieldLen < width) {
      ...
      strncpy(bar + curFieldLen + 2, help, width - curFieldLen - 2);
    
    was not correctly guarded against cache entries whose size were exactly
    1 or 2 characters short of the window size.
    "if (curFieldLen - 2 < width)" would have prevented a copy of
    negative/max_int characters and a subsequent crash.
    
    The whole method was modernized with std::string instead of char*

diff --git a/Source/CursesDialog/cmCursesMainForm.cxx 
b/Source/CursesDialog/cmCursesMainForm.cxx
index 612b432b3f..2c92835159 100644
--- a/Source/CursesDialog/cmCursesMainForm.cxx
+++ b/Source/CursesDialog/cmCursesMainForm.cxx
@@ -365,7 +365,7 @@ void cmCursesMainForm::PrintKeys(int process /* = 0 */)
 
 // Print the key of the current entry and the CMake version
 // on the status bar. Designed for a width of 80 chars.
-void cmCursesMainForm::UpdateStatusBar(const char* message)
+void cmCursesMainForm::UpdateStatusBar(cm::optional<std::string> message)
 {
   int x;
   int y;
@@ -386,94 +386,58 @@ void cmCursesMainForm::UpdateStatusBar(const char* 
message)
     return;
   }
 
-  // Get the key of the current entry
-  FIELD* cur = current_field(this->Form);
-  int findex = field_index(cur);
-  cmCursesWidget* lbl = nullptr;
-  if (findex >= 0) {
-    lbl = reinterpret_cast<cmCursesWidget*>(
-      field_userptr(this->Fields[findex - 2]));
-  }
-  char help[128] = "";
-  const char* curField = "";
-  if (lbl) {
-    curField = lbl->GetValue();
+  // Find the current label index
+  // Field are grouped by 3, the label should be 2 less than the current index
+  using size_type = decltype(this->Fields)::size_type;
+  size_type currentLabelIndex = field_index(current_field(this->Form)) - 2;
+
+  // Use the status message if any, otherwise join the key and help string
+  std::string bar;
+  if (message) {
+    bar = *message;
+  } else {
+    // Get the key of the current entry
+    cmCursesWidget* labelWidget = reinterpret_cast<cmCursesWidget*>(
+      field_userptr(this->Fields[currentLabelIndex]));
+    std::string labelValue = labelWidget->GetValue();
+    bar = labelValue + ": ";
 
     // Get the help string of the current entry
     // and add it to the help string
-    const char* existingValue =
-      this->CMakeInstance->GetState()->GetCacheEntryValue(curField);
+    auto cmakeState = this->CMakeInstance->GetState();
+    const char* existingValue = cmakeState->GetCacheEntryValue(labelValue);
     if (existingValue) {
-      const char* hs = this->CMakeInstance->GetState()->GetCacheEntryProperty(
-        curField, "HELPSTRING");
-      if (hs) {
-        strncpy(help, hs, 127);
-        help[127] = '\0';
-      } else {
-        help[0] = 0;
-      }
-    } else {
-      sprintf(help, " ");
-    }
-  }
-
-  // Join the key, help string and pad with spaces
-  // (or truncate) as necessary
-  char bar[cmCursesMainForm::MAX_WIDTH];
-  size_t curFieldLen = strlen(curField);
-  size_t helpLen = strlen(help);
-
-  size_t width = std::min<size_t>(x, cmCursesMainForm::MAX_WIDTH);
-
-  if (message) {
-    curField = message;
-    curFieldLen = strlen(message);
-    strncpy(bar, curField, width);
-    if (curFieldLen < width) {
-      memset(bar + curFieldLen, ' ', width - curFieldLen);
-    }
-  } else {
-    strncpy(bar, curField, width);
-    if (curFieldLen < width) {
-      bar[curFieldLen] = ':';
-      bar[curFieldLen + 1] = ' ';
-      strncpy(bar + curFieldLen + 2, help, width - curFieldLen - 2);
-      if (curFieldLen + helpLen + 2 < width) {
-        memset(bar + curFieldLen + helpLen + 2, ' ',
-               width - (curFieldLen + helpLen + 2));
+      auto help = cmakeState->GetCacheEntryProperty(labelValue, "HELPSTRING");
+      if (help) {
+        bar += help;
       }
     }
   }
+  // Pad with spaces to erase any previous text,
+  // or truncate as necessary to fit the screen
+  bar.resize(x, ' ');
+  curses_move(y - 5, 0);
+  attron(A_STANDOUT);
+  char fmt_s[] = "%s";
+  printw(fmt_s, bar.c_str());
+  attroff(A_STANDOUT);
 
-  bar[width] = '\0';
-
-  // Highlight the current label
+  // Highlight the current label, reset others
   // Fields are grouped by 3, the first one being the label
   // so start at 0 and move up by 3 avoiding the last null entry
-  using size_type = decltype(this->Fields)::size_type;
   for (size_type index = 0; index < this->Fields.size() - 1; index += 3) {
-    bool currentLabel = index == static_cast<size_type>(findex - 2);
+    bool currentLabel = index == currentLabelIndex;
     set_field_fore(this->Fields[index], currentLabel ? A_STANDOUT : A_NORMAL);
   }
 
-  // Display CMake version info on the next line
+  // Display CMake version under the status bar
   // We want to display this on the right
-  char version[cmCursesMainForm::MAX_WIDTH];
-  char vertmp[128];
-  sprintf(vertmp, "CMake Version %s", cmVersion::GetCMakeVersion());
-  size_t sideSpace = (width - strlen(vertmp));
-  memset(version, ' ', sideSpace);
-  sprintf(version + sideSpace, "%s", vertmp);
-  version[width] = '\0';
-
-  // Now print both lines
-  char fmt_s[] = "%s";
-  curses_move(y - 5, 0);
-  attron(A_STANDOUT);
-  printw(fmt_s, bar);
-  attroff(A_STANDOUT);
-  curses_move(y - 4, 0);
-  printw(fmt_s, version);
+  std::string version = "CMake Version ";
+  version += cmVersion::GetCMakeVersion();
+  version.resize(std::min<std::string::size_type>(x, version.size()));
+  curses_move(y - 4, x - static_cast<int>(version.size()));
+  printw(fmt_s, version.c_str());
+
   pos_form_cursor(this->Form);
 }
 
@@ -710,7 +674,7 @@ void cmCursesMainForm::HandleInput()
     this->PrintKeys();
     if (this->SearchMode) {
       std::string searchstr = "Search: " + this->SearchString;
-      this->UpdateStatusBar(searchstr.c_str());
+      this->UpdateStatusBar(searchstr);
       this->PrintKeys(1);
       curses_move(y - 5, static_cast<unsigned int>(searchstr.size()));
       // curses_move(1,1);
@@ -1015,15 +979,6 @@ void cmCursesMainForm::JumpToCacheEntry(const char* astr)
     } else {
       form_driver(this->Form, REQ_NEXT_FIELD);
     }
-    /*
-    char buffer[1024];
-    sprintf(buffer, "Line: %d != %d / %d\n", findex, idx,
-    this->NumberOfVisibleEntries);
-    touchwin(stdscr);
-    refresh();
-    this->UpdateStatusBar( buffer );
-    usleep(100000);
-    */
     cur = current_field(this->Form);
     findex = field_index(cur);
     if (findex == start_index) {
diff --git a/Source/CursesDialog/cmCursesMainForm.h 
b/Source/CursesDialog/cmCursesMainForm.h
index 598fbdfba3..b7c204d64e 100644
--- a/Source/CursesDialog/cmCursesMainForm.h
+++ b/Source/CursesDialog/cmCursesMainForm.h
@@ -10,6 +10,8 @@
 #include <string>
 #include <vector>
 
+#include <cm/optional>
+
 #include "cmCursesCacheEntryComposite.h"
 #include "cmCursesForm.h"
 #include "cmCursesStandardIncludes.h"
@@ -67,8 +69,8 @@ public:
    * exception is during a resize. The optional argument specifies the
    * string to be displayed in the status bar.
    */
-  void UpdateStatusBar() override { this->UpdateStatusBar(nullptr); }
-  virtual void UpdateStatusBar(const char* message);
+  void UpdateStatusBar() override { this->UpdateStatusBar(cm::nullopt); }
+  void UpdateStatusBar(cm::optional<std::string> message);
 
   /**
    * Display current commands and their keys on the toolbar.  This

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

Summary of changes:
 Help/release/dev/load_cache-script-mode.rst        |   5 +
 Modules/ExternalProject.cmake                      |   5 +
 Modules/FindMPI.cmake                              |   2 +
 Modules/UseJava.cmake                              |  66 ++++-------
 Source/CursesDialog/cmCursesMainForm.cxx           | 123 +++++++--------------
 Source/CursesDialog/cmCursesMainForm.h             |   6 +-
 Source/cmCommands.cxx                              |   3 +-
 Source/cmLoadCacheCommand.cxx                      |   8 ++
 Tests/RunCMake/CMakeLists.txt                      |   1 +
 .../CMakeLists.txt                                 |   0
 Tests/RunCMake/load_cache/NewForm_Project.cmake    |  16 +++
 Tests/RunCMake/load_cache/NewForm_Script.cmake     |  16 +++
 .../OldForm_Script-result.txt}                     |   0
 .../RunCMake/load_cache/OldForm_Script-stderr.txt  |   2 +
 Tests/RunCMake/load_cache/OldForm_Script.cmake     |  13 +++
 Tests/RunCMake/load_cache/RunCMakeTest.cmake       |  13 +++
 16 files changed, 148 insertions(+), 131 deletions(-)
 create mode 100644 Help/release/dev/load_cache-script-mode.rst
 copy Tests/RunCMake/{CPackCommandLine => load_cache}/CMakeLists.txt (100%)
 create mode 100644 Tests/RunCMake/load_cache/NewForm_Project.cmake
 create mode 100644 Tests/RunCMake/load_cache/NewForm_Script.cmake
 copy Tests/RunCMake/{Android/BadSYSROOT-result.txt => 
load_cache/OldForm_Script-result.txt} (100%)
 create mode 100644 Tests/RunCMake/load_cache/OldForm_Script-stderr.txt
 create mode 100644 Tests/RunCMake/load_cache/OldForm_Script.cmake
 create mode 100644 Tests/RunCMake/load_cache/RunCMakeTest.cmake


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

Reply via email to