[Cmake-commits] CMake branch, master, updated. v3.14.0-427-gd2101e9

Kitware Robot kwrobot at kitware.com
Tue Mar 19 09:03:05 EDT 2019


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  d2101e944a03056dc2180dd790ba85175e04d653 (commit)
       via  3c4f92cf5bd38355b4843dd6e882fea012306a10 (commit)
       via  6bbc82b4b30ff17c5b3c899c482b1a724e15d5fb (commit)
       via  51a1a7e64f1d01a293eb848260925743f0fabf68 (commit)
       via  0587c4b247626cda58e55f3bdc0adc8c09ac8e16 (commit)
       via  146b95949194ccf9aff3cfbe2243bde9727e16d5 (commit)
       via  53184a727d0f3b233988212628fec6ef7803da69 (commit)
       via  0adb0e01784ab114efeb2bf24df9c40be706cf01 (commit)
       via  dfea916d3c1e09d7a008a27029540b5ec77adb5d (commit)
       via  ec3c968de27d0d352dce53e3400a33b1bc576496 (commit)
       via  1de0c827a16e1ef5b4c6c900982c6a76061d2c97 (commit)
       via  5536cec46e9af9af3ee5756e59b57bcb7fa23e44 (commit)
       via  98d48469534f7a491b8c358d513472806c858d22 (commit)
       via  a6d75a1ce0daec9c60ed850163f76416de35edb7 (commit)
       via  216416219ae438ec5e93a1e125298fa0b5fd64d9 (commit)
       via  31602583930b6c517c439ae8c15df26043031345 (commit)
       via  103aa9e46a5a59dc2c41cc1fa1aa6dd406b2924b (commit)
       via  6f24c4e93f6ae897b793f894b67543d86c7de477 (commit)
       via  482d9ef9a8fe640d45eabbf4d6b32cfe5c1d124d (commit)
       via  90b775848913296af976d05dc82b8a45add4c6cf (commit)
      from  a9a4f3b1936c8e9b659b7b59166d1e73dc6d2397 (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=d2101e944a03056dc2180dd790ba85175e04d653
commit d2101e944a03056dc2180dd790ba85175e04d653
Merge: 3c4f92c 482d9ef
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Tue Mar 19 12:58:44 2019 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Tue Mar 19 08:59:23 2019 -0400

    Merge topic 'xcodegen-use-std-string'
    
    482d9ef9a8 cmGlobalXCodeGenerator: Prefer std::string over char*
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Merge-request: !3111


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3c4f92cf5bd38355b4843dd6e882fea012306a10
commit 3c4f92cf5bd38355b4843dd6e882fea012306a10
Merge: 6bbc82b 53184a7
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Tue Mar 19 12:58:14 2019 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Tue Mar 19 08:58:39 2019 -0400

    Merge topic 'is-valid-utf8'
    
    53184a727d cm_utf8: add an is_valid function
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Merge-request: !3104


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6bbc82b4b30ff17c5b3c899c482b1a724e15d5fb
commit 6bbc82b4b30ff17c5b3c899c482b1a724e15d5fb
Merge: 51a1a7e 0adb0e0
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Tue Mar 19 12:57:44 2019 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Tue Mar 19 08:57:51 2019 -0400

    Merge topic 'CheckTypeSize-decl-warning'
    
    0adb0e0178 CheckTypeSize: Fix with clang '-Werror,-Wmissing-variable-declarations'
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Merge-request: !3112


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=51a1a7e64f1d01a293eb848260925743f0fabf68
commit 51a1a7e64f1d01a293eb848260925743f0fabf68
Merge: 0587c4b 90b7758
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Tue Mar 19 12:56:30 2019 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Tue Mar 19 08:56:37 2019 -0400

    Merge topic 'FindBLAS-mklroot'
    
    90b7758489 FindBLAS: respect MKLROOT and MKL_ROOT if available
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Merge-request: !3108


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0587c4b247626cda58e55f3bdc0adc8c09ac8e16
commit 0587c4b247626cda58e55f3bdc0adc8c09ac8e16
Merge: 146b959 ec3c968
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Tue Mar 19 12:55:09 2019 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Tue Mar 19 08:55:18 2019 -0400

    Merge topic 'file_time_comparison'
    
    ec3c968de2 cmake: Use scopes to limit temporary object lifetime
    1de0c827a1 cmDependsC: Read cache file modification time only once
    5536cec46e Rename cmFileTimeCache::FileTimeCompare to cmFileTimeCache::Compare
    98d4846953 Rename cmFileTimeCache::FileTimesDiffer to cmFileTimeCache::DifferS
    a6d75a1ce0 Substitute FileComparison in variable names with FileTimeCache
    216416219a Rename cmFileTimeComparison to cmFileTimeCache
    3160258393 cmFileTimeComparison: Replace anonymous private class with std::map
    103aa9e46a cmFileTimeComparison: Use cmFileTime internally
    ...
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Acked-by: Brad King <brad.king at kitware.com>
    Merge-request: !3101


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=146b95949194ccf9aff3cfbe2243bde9727e16d5
commit 146b95949194ccf9aff3cfbe2243bde9727e16d5
Merge: a9a4f3b dfea916
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Tue Mar 19 12:53:24 2019 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Tue Mar 19 08:53:35 2019 -0400

    Merge topic 'environment-modules'
    
    dfea916d3c FindEnvModules: Provide a CMake interface to environment modules
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Merge-request: !3076


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=53184a727d0f3b233988212628fec6ef7803da69
commit 53184a727d0f3b233988212628fec6ef7803da69
Author:     Ben Boeckel <ben.boeckel at kitware.com>
AuthorDate: Thu Mar 14 14:33:28 2019 -0400
Commit:     Ben Boeckel <ben.boeckel at kitware.com>
CommitDate: Mon Mar 18 14:18:13 2019 -0400

    cm_utf8: add an is_valid function

diff --git a/Source/cm_utf8.c b/Source/cm_utf8.c
index d41d097..62e7e8c 100644
--- a/Source/cm_utf8.c
+++ b/Source/cm_utf8.c
@@ -2,6 +2,8 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cm_utf8.h"
 
+#include <string.h>
+
 /*
   RFC 3629
   07-bit: 0xxxxxxx
@@ -85,3 +87,20 @@ const char* cm_utf8_decode_character(const char* first, const char* last,
     return first;
   }
 }
+
+int cm_utf8_is_valid(const char* s)
+{
+  if (!s) {
+    return 0;
+  }
+
+  const char* last = s + strlen(s);
+  const char* pos = s;
+  unsigned int pc;
+
+  while (pos != last && (pos = cm_utf8_decode_character(pos, last, &pc))) {
+    /* Nothing to do. */
+  }
+
+  return pos == last;
+}
diff --git a/Source/cm_utf8.h b/Source/cm_utf8.h
index fcb43e0..27dc559 100644
--- a/Source/cm_utf8.h
+++ b/Source/cm_utf8.h
@@ -13,6 +13,10 @@ extern "C" {
 const char* cm_utf8_decode_character(const char* first, const char* last,
                                      unsigned int* pc);
 
+/** Returns whether a C string is a sequence of valid UTF-8 encoded Unicode
+    codepoints.  Returns non-zero on success. */
+int cm_utf8_is_valid(const char* s);
+
 #ifdef __cplusplus
 } /* extern "C" */
 #endif
diff --git a/Tests/CMakeLib/testUTF8.cxx b/Tests/CMakeLib/testUTF8.cxx
index 7f52c82..a0bb5cd 100644
--- a/Tests/CMakeLib/testUTF8.cxx
+++ b/Tests/CMakeLib/testUTF8.cxx
@@ -13,6 +13,21 @@ static void test_utf8_char_print(test_utf8_char const c)
          static_cast<int>(d[3]));
 }
 
+static void byte_array_print(char const* s)
+{
+  unsigned char const* d = reinterpret_cast<unsigned char const*>(s);
+  bool started = false;
+  printf("[");
+  for (; *d; ++d) {
+    if (started) {
+      printf(",");
+    }
+    started = true;
+    printf("0x%02X", static_cast<int>(*d));
+  }
+  printf("]");
+}
+
 struct test_utf8_entry
 {
   int n;
@@ -46,6 +61,13 @@ static test_utf8_char const bad_chars[] = {
   { 0, 0, 0, 0, 0 }
 };
 
+static char const* good_strings[] = { "", "ASCII", "\xC2\xA9 Kitware", 0 };
+
+static char const* bad_strings[] = {
+  "\xC0\x80", /* Modified UTF-8 for embedded 0-byte. */
+  0
+};
+
 static void report_good(bool passed, test_utf8_char const c)
 {
   printf("%s: decoding good ", passed ? "pass" : "FAIL");
@@ -99,6 +121,46 @@ static bool decode_bad(test_utf8_char const s)
   return true;
 }
 
+static void report_valid(bool passed, char const* s)
+{
+  printf("%s: validity good ", passed ? "pass" : "FAIL");
+  byte_array_print(s);
+  printf(" (%s) ", s);
+}
+
+static void report_invalid(bool passed, char const* s)
+{
+  printf("%s: validity bad  ", passed ? "pass" : "FAIL");
+  byte_array_print(s);
+  printf(" ");
+}
+
+static bool is_valid(const char* s)
+{
+  bool valid = cm_utf8_is_valid(s) != 0;
+  if (!valid) {
+    report_valid(false, s);
+    printf("expected valid, reported as invalid\n");
+    return false;
+  }
+  report_valid(true, s);
+  printf("valid as expected\n");
+  return true;
+}
+
+static bool is_invalid(const char* s)
+{
+  bool valid = cm_utf8_is_valid(s) != 0;
+  if (valid) {
+    report_invalid(false, s);
+    printf("expected invalid, reported as valid\n");
+    return false;
+  }
+  report_invalid(true, s);
+  printf("invalid as expected\n");
+  return true;
+}
+
 int testUTF8(int /*unused*/, char* /*unused*/ [])
 {
   int result = 0;
@@ -106,11 +168,27 @@ int testUTF8(int /*unused*/, char* /*unused*/ [])
     if (!decode_good(*e)) {
       result = 1;
     }
+    if (!is_valid(e->str)) {
+      result = 1;
+    }
   }
   for (test_utf8_char const* c = bad_chars; (*c)[0]; ++c) {
     if (!decode_bad(*c)) {
       result = 1;
     }
+    if (!is_invalid(*c)) {
+      result = 1;
+    }
+  }
+  for (char const** s = good_strings; *s; ++s) {
+    if (!is_valid(*s)) {
+      result = 1;
+    }
+  }
+  for (char const** s = bad_strings; *s; ++s) {
+    if (!is_invalid(*s)) {
+      result = 1;
+    }
   }
   return result;
 }

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0adb0e01784ab114efeb2bf24df9c40be706cf01
commit 0adb0e01784ab114efeb2bf24df9c40be706cf01
Author:     Campbell Barton <ideasman42 at gmail.com>
AuthorDate: Mon Mar 18 08:47:26 2019 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Mon Mar 18 11:56:39 2019 -0400

    CheckTypeSize: Fix with clang '-Werror,-Wmissing-variable-declarations'
    
    Resolve issue building with missing variable declarations, error:
    
    ```
    /src/cmake_clang/CMakeFiles/CheckTypeSize/CMAKE_SIZEOF_UNSIGNED_LONG.c:24:6: error: no previous extern declaration for non-static variable 'info_size' [-Werror,-Wmissing-variable-declarations]
    char info_size[] =  {'I', 'N', 'F', 'O', ':', 's','i','z','e','[',
         ^
    1 error generated.
    ```

diff --git a/Modules/CheckTypeSize.c.in b/Modules/CheckTypeSize.c.in
index 2303c4e..82035a3 100644
--- a/Modules/CheckTypeSize.c.in
+++ b/Modules/CheckTypeSize.c.in
@@ -18,7 +18,7 @@
 #endif
 
 #define SIZE (sizeof(@type@))
-char info_size[] =  {'I', 'N', 'F', 'O', ':', 's','i','z','e','[',
+static char info_size[] =  {'I', 'N', 'F', 'O', ':', 's','i','z','e','[',
   ('0' + ((SIZE / 10000)%10)),
   ('0' + ((SIZE / 1000)%10)),
   ('0' + ((SIZE / 100)%10)),

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=dfea916d3c1e09d7a008a27029540b5ec77adb5d
commit dfea916d3c1e09d7a008a27029540b5ec77adb5d
Author:     Chuck Atkins <chuck.atkins at kitware.com>
AuthorDate: Thu Mar 7 15:39:07 2019 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Mon Mar 18 11:47:35 2019 -0400

    FindEnvModules: Provide a CMake interface to environment modules

diff --git a/Help/manual/cmake-modules.7.rst b/Help/manual/cmake-modules.7.rst
index d9b939f..fc4bfdc 100644
--- a/Help/manual/cmake-modules.7.rst
+++ b/Help/manual/cmake-modules.7.rst
@@ -125,6 +125,7 @@ They are normally called through the :command:`find_package` command.
    /module/FindDCMTK
    /module/FindDevIL
    /module/FindDoxygen
+   /module/FindEnvModules
    /module/FindEXPAT
    /module/FindFLEX
    /module/FindFLTK2
diff --git a/Help/module/FindEnvModules.rst b/Help/module/FindEnvModules.rst
new file mode 100644
index 0000000..72c120f
--- /dev/null
+++ b/Help/module/FindEnvModules.rst
@@ -0,0 +1 @@
+.. cmake-module:: ../../Modules/FindEnvModules.cmake
diff --git a/Help/release/dev/environment-modules.rst b/Help/release/dev/environment-modules.rst
new file mode 100644
index 0000000..eace35d
--- /dev/null
+++ b/Help/release/dev/environment-modules.rst
@@ -0,0 +1,5 @@
+environment-modules
+-------------------
+
+* The :module:`FindEnvModules` module was added to use Lua- and TCL-based
+  environment modules in :ref:`CTest Scripts <CTest Script>`.
diff --git a/Modules/FindEnvModules.cmake b/Modules/FindEnvModules.cmake
new file mode 100644
index 0000000..5d3452d
--- /dev/null
+++ b/Modules/FindEnvModules.cmake
@@ -0,0 +1,333 @@
+# Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+#[=======================================================================[.rst:
+FindEnvModules
+--------------
+
+Locate an environment module implementation and make commands available to
+CMake scripts to use them.  This is compatible with both Lua-based Lmod
+and TCL-based EnvironmentModules.
+
+This module is intended for the use case of setting up the compiler and library
+environment within a :ref:`CTest Script <CTest Script>` (``ctest -S``).  It can
+also be used in a :ref:`CMake Script <Script Processing Mode>` (``cmake -P``).
+
+.. note::
+
+  The loaded environment will not survive past the end of the calling process.
+  Do not use this module in project code (``CMakeLists.txt`` files) to load
+  a compiler environment; it will not be available during the build.  Instead
+  load the environment manually before running CMake or using the generated
+  build system.
+
+Example Usage
+^^^^^^^^^^^^^
+
+.. code-block:: cmake
+
+  set(CTEST_BUILD_NAME "CrayLinux-CrayPE-Cray-dynamic")
+  set(CTEST_BUILD_CONFIGURATION Release)
+  set(CTEST_BUILD_FLAGS "-k -j8")
+  set(CTEST_CMAKE_GENERATOR "Unix Makefiles")
+
+  ...
+
+  find_package(EnvModules REQUIRED)
+
+  env_module(purge)
+  env_module(load modules)
+  env_module(load craype)
+  env_module(load PrgEnv-cray)
+  env_module(load craype-knl)
+  env_module(load cray-mpich)
+  env_module(load cray-libsci)
+
+  set(ENV{CRAYPE_LINK_TYPE} dynamic)
+
+  ...
+
+Result Variables
+^^^^^^^^^^^^^^^^
+
+This module will set the following variables in your project:
+
+``EnvModules_FOUND``
+  Found the a compatible environment modules framework
+
+Cache Variables
+^^^^^^^^^^^^^^^
+
+The following cache variable will be set:
+
+``EnvModules_COMMAND``
+  The low level module command to use.  Currently supported are
+  implementations are the Lua based Lmod and TCL based EnvironmentModules.
+
+Environment Variables
+^^^^^^^^^^^^^^^^^^^^^
+
+``ENV{MODULESHOME}``
+  Usually set by the module environment implementation, used as a hint to
+  locate the module command to execute.
+
+Provided Functions
+^^^^^^^^^^^^^^^^^^
+
+This defines the following cmake functions for interacting with environment
+modules:
+
+.. command:: env_module
+
+  Execute an aribitrary module command:
+
+  .. code-block:: cmake
+
+    env_module(cmd arg1 ... argN)
+    env_module(
+      COMMAND cmd arg1 ... argN
+      [OUTPUT_VARIABLE <out-var>]
+      [RESULT_VARIABLE <ret-var>]
+    )
+
+  The options are:
+
+  ``cmd arg1 ... argN``
+    The module sub-command and arguments to execute as if they were
+    passed directly to the module command in your shell environment.
+
+  ``OUTPUT_VARIABLE <out-var>``
+    The standard output from executing the module command.
+
+  ``RESULT_VARIABLE <ret-var>``
+    The return code from executing the module command.
+
+.. command:: env_module_swap
+
+  Swap one module for another:
+
+  .. code-block:: cmake
+
+    env_module_swap(out_mod in_mod
+      [OUTPUT_VARIABLE <out-var>]
+      [RESULT_VARIABLE <ret-var>]
+    )
+
+  This is functionally equivalent to the ``module swap out_mod in_mod`` shell
+  command.  The options are:
+
+  ``OUTPUT_VARIABLE <out-var>``
+    The standard output from executing the module command.
+
+  ``RESULT_VARIABLE <ret-var>``
+    The return code from executing the module command.
+
+.. command:: env_module_list
+
+  Retrieve the list of currently loaded modules:
+
+  .. code-block:: cmake
+
+    env_module_list(<out-var>)
+
+  This is functionally equivalent to the ``module list`` shell command.
+  The result is stored in ``<out-var>`` as a properly formatted CMake
+  :ref:`semicolon-separated list <CMake Language Lists>` variable.
+
+.. command:: env_module_avail
+
+  Retrieve the list of available modules:
+
+  .. code-block:: cmake
+
+    env_module_avail([<mod-prefix>] <out-var>)
+
+  This is functionally equivalent to the ``module avail <mod-prefix>`` shell
+  command.  The result is stored in ``<out-var>`` as a properly formatted
+  CMake :ref:`semicolon-separated list <CMake Language Lists>` variable.
+
+#]=======================================================================]
+
+function(env_module)
+  if(NOT EnvModules_COMMAND)
+    message(FATAL_ERROR "Failed to process module command.  EnvModules_COMMAND not found")
+    return()
+  endif()
+
+  set(options)
+  set(oneValueArgs OUTPUT_VARIABLE RESULT_VARIABLE)
+  set(multiValueArgs COMMAND)
+  cmake_parse_arguments(MOD_ARGS
+    "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGV}
+  )
+  if(NOT MOD_ARGS_COMMAND)
+    # If no explicit command argument was given, then treat the calling syntax
+    # as: module(cmd args...)
+    set(exec_cmd ${ARGV})
+  else()
+    set(exec_cmd ${MOD_ARGS_COMMAND})
+  endif()
+
+  if(MOD_ARGS_OUTPUT_VARIABLE)
+    set(err_var_args ERROR_VARIABLE err_var)
+   endif()
+
+  execute_process(
+    COMMAND mktemp -t module.cmake.XXXXXXXXXXXX
+    OUTPUT_VARIABLE tempfile_name
+  )
+  string(STRIP "${tempfile_name}" tempfile_name)
+
+  # If the $MODULESHOME/init/cmake file exists then assume that the CMake
+  # "shell" functionality exits
+  if(EXISTS "$ENV{MODULESHOME}/init/cmake")
+    execute_process(
+      COMMAND ${EnvModules_COMMAND} cmake ${exec_cmd}
+      OUTPUT_FILE ${tempfile_name}
+      ${err_var_args}
+      RESULT_VARIABLE ret_var
+    )
+
+  else() # fallback to the sh shell and manually convert to CMake
+    execute_process(
+      COMMAND ${EnvModules_COMMAND} sh ${exec_cmd}
+      OUTPUT_VARIABLE out_var
+      ${err_var_args}
+      RESULT_VARIABLE ret_var
+    )
+  endif()
+
+  # If we executed successfully then process and cleanup the temp file
+  if(ret_var EQUAL 0)
+    # No CMake shell so we need to process the sh output into CMake code
+    if(NOT EXISTS "$ENV{MODULESHOME}/init/cmake")
+      file(WRITE ${tempfile_name} "")
+      string(REPLACE "\n" ";" out_var "${out_var}")
+      foreach(sh_cmd IN LISTS out_var)
+        if(sh_cmd MATCHES "^ *unset *([^ ]*)")
+          set(cmake_cmd "unset(ENV{${CMAKE_MATCH_1}})")
+        elseif(sh_cmd MATCHES "^ *export *([^ ]*)")
+          set(cmake_cmd "set(ENV{${CMAKE_MATCH_1}} \"\${${CMAKE_MATCH_1}}\")")
+        elseif(sh_cmd MATCHES " *([^ =]*) *= *(.*)")
+          set(var_name "${CMAKE_MATCH_1}")
+          set(var_value "${CMAKE_MATCH_2}")
+          if(var_value MATCHES "^\"(.*[^\\])\"")
+            # If it's in quotes, take the value as is
+            set(var_value "${CMAKE_MATCH_1}")
+          else()
+            # Otherwise, strip trailing spaces
+            string(REGEX REPLACE "([^\\])? +$" "\\1" var_value "${var_value}")
+          endif()
+          string(REPLACE "\\ " " " var_value "${var_value}")
+          set(cmake_cmd "set(${var_name} \"${var_value}\")")
+        else()
+          continue()
+        endif()
+        file(APPEND ${tempfile_name} "${cmake_cmd}\n")
+      endforeach()
+    endif()
+
+    # Process the change in environment variables
+    include(${tempfile_name})
+    file(REMOVE ${tempfile_name})
+  endif()
+
+  # Push the output back out to the calling scope
+  if(MOD_ARGS_OUTPUT_VARIABLE)
+    set(${MOD_ARGS_OUTPUT_VARIABLE} "${err_var}" PARENT_SCOPE)
+  endif()
+  if(MOD_ARGS_RESULT_VARIABLE)
+    set(${MOD_ARGS_RESULT_VARIABLE} ${ret_var} PARENT_SCOPE)
+  endif()
+endfunction(env_module)
+
+#------------------------------------------------------------------------------
+function(env_module_swap out_mod in_mod)
+  set(options)
+  set(oneValueArgs OUTPUT_VARIABLE RESULT_VARIABLE)
+  set(multiValueArgs)
+
+  cmake_parse_arguments(MOD_ARGS
+    "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGV}
+  )
+
+  env_module(COMMAND -t swap ${out_mod} ${in_mod}
+    OUTPUT_VARIABLE tmp_out
+    RETURN_VARIABLE tmp_ret
+  )
+
+  if(MOD_ARGS_OUTPUT_VARIABLE)
+    set(${MOD_ARGS_OUTPUT_VARIABLE} "${err_var}" PARENT_SCOPE)
+  endif()
+  if(MOD_ARGS_RESULT_VARIABLE)
+    set(${MOD_ARGS_RESULT_VARIABLE} ${tmp_ret} PARENT_SCOPE)
+  endif()
+endfunction()
+
+#------------------------------------------------------------------------------
+function(env_module_list out_var)
+  cmake_policy(SET CMP0007 NEW)
+  env_module(COMMAND -t list OUTPUT_VARIABLE tmp_out)
+
+  # Convert output into a CMake list
+  string(REPLACE "\n" ";" ${out_var} "${tmp_out}")
+
+  # Remove title headers and empty entries
+  list(REMOVE_ITEM ${out_var} "No modules loaded")
+  if(${out_var})
+    list(FILTER ${out_var} EXCLUDE REGEX "^(.*:)?$")
+  endif()
+  list(FILTER ${out_var} EXCLUDE REGEX "^(.*:)?$")
+
+  set(${out_var} ${${out_var}} PARENT_SCOPE)
+endfunction()
+
+#------------------------------------------------------------------------------
+function(env_module_avail)
+  cmake_policy(SET CMP0007 NEW)
+
+  if(ARGC EQUAL 1)
+    set(mod_prefix)
+    set(out_var ${ARGV0})
+  elseif(ARGC EQUAL 2)
+    set(mod_prefix ${ARGV0})
+    set(out_var ${ARGV1})
+  else()
+    message(FATAL_ERROR "Usage: env_module_avail([mod_prefix] out_var)")
+  endif()
+  env_module(COMMAND -t avail ${mod_prefix} OUTPUT_VARIABLE tmp_out)
+
+  # Convert output into a CMake list
+  string(REPLACE "\n" ";" tmp_out "${tmp_out}")
+
+  set(${out_var})
+  foreach(MOD IN LISTS tmp_out)
+    # Remove directory entries and empty values
+    if(MOD MATCHES "^(.*:)?$")
+      continue()
+    endif()
+
+    # Convert default modules
+    if(MOD MATCHES "^(.*)/$" ) # "foo/"
+      list(APPEND ${out_var} ${CMAKE_MATCH_1})
+    elseif(MOD MATCHES "^((.*)/.*)\\(default\\)$") # "foo/1.2.3(default)"
+      list(APPEND ${out_var} ${CMAKE_MATCH_2})
+      list(APPEND ${out_var} ${CMAKE_MATCH_1})
+    else()
+      list(APPEND ${out_var} ${MOD})
+    endif()
+  endforeach()
+
+  set(${out_var} ${${out_var}} PARENT_SCOPE)
+endfunction()
+
+#------------------------------------------------------------------------------
+# Make sure we know where the underlying module command is
+find_program(EnvModules_COMMAND
+  NAMES lmod modulecmd
+  HINTS ENV MODULESHOME
+  PATH_SUFFIXES libexec
+)
+
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+find_package_handle_standard_args(EnvModules DEFAULT_MSG EnvModules_COMMAND)
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 1b5ed03..5e9834f 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -1421,6 +1421,10 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
     add_subdirectory(FindDoxygen)
   endif()
 
+  if(CMake_TEST_FindEnvModules)
+    add_subdirectory(FindEnvModules)
+  endif()
+
   if(CMake_TEST_FindEXPAT)
     add_subdirectory(FindEXPAT)
   endif()
diff --git a/Tests/FindEnvModules/CMakeLists.txt b/Tests/FindEnvModules/CMakeLists.txt
new file mode 100644
index 0000000..95b7d1d
--- /dev/null
+++ b/Tests/FindEnvModules/CMakeLists.txt
@@ -0,0 +1,3 @@
+add_test(FindEnvModules.Test ${CMAKE_CMAKE_COMMAND}
+  -P ${CMAKE_CURRENT_LIST_DIR}/EnvModules.cmake
+)
diff --git a/Tests/FindEnvModules/EnvModules.cmake b/Tests/FindEnvModules/EnvModules.cmake
new file mode 100644
index 0000000..0c81bf2
--- /dev/null
+++ b/Tests/FindEnvModules/EnvModules.cmake
@@ -0,0 +1,35 @@
+find_package(EnvModules REQUIRED)
+message("module purge")
+env_module(COMMAND purge RESULT_VARIABLE ret_var)
+if(NOT ret_var EQUAL 0)
+  message(FATAL_ERROR "module(purge) returned ${ret_var}")
+endif()
+
+message("module avail")
+env_module_avail(avail_mods)
+foreach(mod IN LISTS avail_mods)
+  message("  ${mod}")
+endforeach()
+
+if(avail_mods)
+  list(GET avail_mods 0 mod0)
+  message("module load ${mod0}")
+  env_module(load ${mod0})
+
+  message("module list")
+  env_module_list(loaded_mods)
+  foreach(mod IN LISTS loaded_mods)
+    message("  ${mod}")
+  endforeach()
+
+  list(LENGTH loaded_mods num_loaded_mods)
+  message("Number of modules loaded: ${num_loaded_mods}")
+  if(NOT num_loaded_mods EQUAL 1)
+    message(FATAL_ERROR "Exactly 1 module should be loaded.  Found ${num_loaded_mods}")
+  endif()
+
+  list(GET loaded_mods 0 mod0_actual)
+  if(NOT (mod0_actual MATCHES "^${mod0}"))
+    message(FATAL_ERROR "Loaded module does not match ${mod0}.  Actual: ${mod0_actual}")
+  endif()
+endif()

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ec3c968de27d0d352dce53e3400a33b1bc576496
commit ec3c968de27d0d352dce53e3400a33b1bc576496
Author:     Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Thu Mar 14 17:40:24 2019 +0100
Commit:     Sebastian Holtermann <sebholt at xwmw.org>
CommitDate: Mon Mar 18 15:09:11 2019 +0100

    cmake: Use scopes to limit temporary object lifetime

diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index ff8dc43..e1b775e 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -2430,20 +2430,22 @@ static bool cmakeCheckStampFile(const std::string& stampName)
   }
 
   // Compare the stamp dependencies against the dependency file itself.
-  cmFileTimeCache ftc;
-  std::string dep;
-  while (cmSystemTools::GetLineFromStream(fin, dep)) {
-    int result;
-    if (!dep.empty() && dep[0] != '#' &&
-        (!ftc.Compare(stampDepends, dep, &result) || result < 0)) {
-      // The stamp depends file is older than this dependency.  The
-      // build system is really out of date.
-      std::cout << "CMake is re-running because " << stampName
-                << " is out-of-date.\n";
-      std::cout << "  the file '" << dep << "'\n";
-      std::cout << "  is newer than '" << stampDepends << "'\n";
-      std::cout << "  result='" << result << "'\n";
-      return false;
+  {
+    cmFileTimeCache ftc;
+    std::string dep;
+    while (cmSystemTools::GetLineFromStream(fin, dep)) {
+      int result;
+      if (!dep.empty() && dep[0] != '#' &&
+          (!ftc.Compare(stampDepends, dep, &result) || result < 0)) {
+        // The stamp depends file is older than this dependency.  The
+        // build system is really out of date.
+        std::cout << "CMake is re-running because " << stampName
+                  << " is out-of-date.\n";
+        std::cout << "  the file '" << dep << "'\n";
+        std::cout << "  is newer than '" << stampDepends << "'\n";
+        std::cout << "  result='" << result << "'\n";
+        return false;
+      }
     }
   }
 

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1de0c827a16e1ef5b4c6c900982c6a76061d2c97
commit 1de0c827a16e1ef5b4c6c900982c6a76061d2c97
Author:     Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Thu Mar 14 13:58:24 2019 +0100
Commit:     Sebastian Holtermann <sebholt at xwmw.org>
CommitDate: Mon Mar 18 15:09:11 2019 +0100

    cmDependsC: Read cache file modification time only once
    
    Using cmFileTime to store and compare file times in cmDependsC allows us to
    read the cache file modification time only once instead of over and over again
    for each comparison.

diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx
index a85f5ee..58b4ebb 100644
--- a/Source/cmDependsC.cxx
+++ b/Source/cmDependsC.cxx
@@ -6,6 +6,7 @@
 #include <utility>
 
 #include "cmAlgorithms.h"
+#include "cmFileTime.h"
 #include "cmLocalGenerator.h"
 #include "cmMakefile.h"
 #include "cmSystemTools.h"
@@ -247,6 +248,8 @@ void cmDependsC::ReadCacheFile()
   cmIncludeLines* cacheEntry = nullptr;
   bool haveFileName = false;
 
+  cmFileTime cacheFileTime;
+  bool const cacheFileTimeGood = cacheFileTime.Load(this->CacheFileName);
   while (cmSystemTools::GetLineFromStream(fin, line)) {
     if (line.empty()) {
       cacheEntry = nullptr;
@@ -256,11 +259,12 @@ void cmDependsC::ReadCacheFile()
     // the first line after an empty line is the name of the parsed file
     if (!haveFileName) {
       haveFileName = true;
-      int newer = 0;
-      bool res =
-        cmSystemTools::FileTimeCompare(this->CacheFileName, line, &newer);
 
-      if (res && newer == 1) // cache is newer than the parsed file
+      cmFileTime fileTime;
+      bool const res = cacheFileTimeGood && fileTime.Load(line);
+      bool const newer = res && cacheFileTime.Newer(fileTime);
+
+      if (res && newer) // cache is newer than the parsed file
       {
         cacheEntry = new cmIncludeLines;
         this->FileCache[line] = cacheEntry;

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5536cec46e9af9af3ee5756e59b57bcb7fa23e44
commit 5536cec46e9af9af3ee5756e59b57bcb7fa23e44
Author:     Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Thu Mar 14 17:22:15 2019 +0100
Commit:     Sebastian Holtermann <sebholt at xwmw.org>
CommitDate: Mon Mar 18 15:09:11 2019 +0100

    Rename cmFileTimeCache::FileTimeCompare to cmFileTimeCache::Compare

diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx
index 54d7705..8ea9a83 100644
--- a/Source/CTest/cmCTestBuildHandler.cxx
+++ b/Source/CTest/cmCTestBuildHandler.cxx
@@ -513,7 +513,7 @@ public:
     // Order files by modification time.  Use lexicographic order
     // among files with the same time.
     int result;
-    if (this->FTC->FileTimeCompare(l, r, &result) && result != 0) {
+    if (this->FTC->Compare(l, r, &result) && result != 0) {
       return result < 0;
     }
     return l < r;
diff --git a/Source/cmDepends.cxx b/Source/cmDepends.cxx
index 1bfb370..efadaf1 100644
--- a/Source/cmDepends.cxx
+++ b/Source/cmDepends.cxx
@@ -177,8 +177,7 @@ bool cmDepends::CheckDependencies(
       if (dependerExists) {
         // The dependee and depender both exist.  Compare file times.
         int result = 0;
-        if ((!this->FileTimeCache->FileTimeCompare(depender, dependee,
-                                                   &result) ||
+        if ((!this->FileTimeCache->Compare(depender, dependee, &result) ||
              result < 0)) {
           // The depender is older than the dependee.
           regenerate = true;
@@ -195,8 +194,8 @@ bool cmDepends::CheckDependencies(
         // The dependee exists, but the depender doesn't. Regenerate if the
         // internalDepends file is older than the dependee.
         int result = 0;
-        if ((!this->FileTimeCache->FileTimeCompare(internalDependsFileName,
-                                                   dependee, &result) ||
+        if ((!this->FileTimeCache->Compare(internalDependsFileName, dependee,
+                                           &result) ||
              result < 0)) {
           // The depends-file is older than the dependee.
           regenerate = true;
diff --git a/Source/cmFileTimeCache.cxx b/Source/cmFileTimeCache.cxx
index 81912db..1fff6a9 100644
--- a/Source/cmFileTimeCache.cxx
+++ b/Source/cmFileTimeCache.cxx
@@ -29,8 +29,8 @@ bool cmFileTimeCache::Load(std::string const& fileName, cmFileTime& fileTime)
   return true;
 }
 
-bool cmFileTimeCache::FileTimeCompare(std::string const& f1,
-                                      std::string const& f2, int* result)
+bool cmFileTimeCache::Compare(std::string const& f1, std::string const& f2,
+                              int* result)
 {
   // Get the modification time for each file.
   cmFileTime ft1, ft2;
diff --git a/Source/cmFileTimeCache.h b/Source/cmFileTimeCache.h
index 043b7aa..a47904c 100644
--- a/Source/cmFileTimeCache.h
+++ b/Source/cmFileTimeCache.h
@@ -34,8 +34,7 @@ public:
    * When true is returned, result has -1, 0, +1 for
    * f1 older, same, or newer than f2.
    */
-  bool FileTimeCompare(std::string const& f1, std::string const& f2,
-                       int* result);
+  bool Compare(std::string const& f1, std::string const& f2, int* result);
 
   /**
    * @brief Compare file modification times.
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index b835059..f3d5a94 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -1277,8 +1277,7 @@ bool cmLocalUnixMakefileGenerator3::UpdateDependencies(
     this->GlobalGenerator->GetCMakeInstance()->GetFileTimeCache();
   {
     int result;
-    if (!ftc->FileTimeCompare(internalDependFile, tgtInfo, &result) ||
-        result < 0) {
+    if (!ftc->Compare(internalDependFile, tgtInfo, &result) || result < 0) {
       if (verbose) {
         std::ostringstream msg;
         msg << "Dependee \"" << tgtInfo << "\" is newer than depender \""
@@ -1297,7 +1296,7 @@ bool cmLocalUnixMakefileGenerator3::UpdateDependencies(
     dirInfoFile += "/CMakeFiles";
     dirInfoFile += "/CMakeDirectoryInformation.cmake";
     int result;
-    if (!ftc->FileTimeCompare(internalDependFile, dirInfoFile, &result) ||
+    if (!ftc->Compare(internalDependFile, dirInfoFile, &result) ||
         result < 0) {
       if (verbose) {
         std::ostringstream msg;
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index f2484b3..ff8dc43 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -2139,7 +2139,7 @@ int cmake::CheckBuildSystem()
   std::string dep_newest = *dep++;
   for (; dep != depends.end(); ++dep) {
     int result = 0;
-    if (this->FileTimeCache->FileTimeCompare(dep_newest, *dep, &result)) {
+    if (this->FileTimeCache->Compare(dep_newest, *dep, &result)) {
       if (result < 0) {
         dep_newest = *dep;
       }
@@ -2158,7 +2158,7 @@ int cmake::CheckBuildSystem()
   std::string out_oldest = *out++;
   for (; out != outputs.end(); ++out) {
     int result = 0;
-    if (this->FileTimeCache->FileTimeCompare(out_oldest, *out, &result)) {
+    if (this->FileTimeCache->Compare(out_oldest, *out, &result)) {
       if (result > 0) {
         out_oldest = *out;
       }
@@ -2175,8 +2175,7 @@ int cmake::CheckBuildSystem()
   // If any output is older than any dependency then rerun.
   {
     int result = 0;
-    if (!this->FileTimeCache->FileTimeCompare(out_oldest, dep_newest,
-                                              &result) ||
+    if (!this->FileTimeCache->Compare(out_oldest, dep_newest, &result) ||
         result < 0) {
       if (verbose) {
         std::ostringstream msg;
@@ -2436,7 +2435,7 @@ static bool cmakeCheckStampFile(const std::string& stampName)
   while (cmSystemTools::GetLineFromStream(fin, dep)) {
     int result;
     if (!dep.empty() && dep[0] != '#' &&
-        (!ftc.FileTimeCompare(stampDepends, dep, &result) || result < 0)) {
+        (!ftc.Compare(stampDepends, dep, &result) || result < 0)) {
       // The stamp depends file is older than this dependency.  The
       // build system is really out of date.
       std::cout << "CMake is re-running because " << stampName

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=98d48469534f7a491b8c358d513472806c858d22
commit 98d48469534f7a491b8c358d513472806c858d22
Author:     Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Thu Mar 14 17:11:21 2019 +0100
Commit:     Sebastian Holtermann <sebholt at xwmw.org>
CommitDate: Mon Mar 18 15:09:11 2019 +0100

    Rename cmFileTimeCache::FileTimesDiffer to cmFileTimeCache::DifferS

diff --git a/Source/cmFileCopier.cxx b/Source/cmFileCopier.cxx
index 560d893..8913e6d 100644
--- a/Source/cmFileCopier.cxx
+++ b/Source/cmFileCopier.cxx
@@ -532,7 +532,7 @@ bool cmFileCopier::InstallFile(const std::string& fromFile,
   bool copy = true;
   if (!this->Always) {
     // If both files exist with the same time do not copy.
-    if (!this->FileTimes.FileTimesDiffer(fromFile, toFile)) {
+    if (!this->FileTimes.DifferS(fromFile, toFile)) {
       copy = false;
     }
   }
diff --git a/Source/cmFileTimeCache.cxx b/Source/cmFileTimeCache.cxx
index ff205b7..81912db 100644
--- a/Source/cmFileTimeCache.cxx
+++ b/Source/cmFileTimeCache.cxx
@@ -44,8 +44,7 @@ bool cmFileTimeCache::FileTimeCompare(std::string const& f1,
   return false;
 }
 
-bool cmFileTimeCache::FileTimesDiffer(std::string const& f1,
-                                      std::string const& f2)
+bool cmFileTimeCache::DifferS(std::string const& f1, std::string const& f2)
 {
   // Get the modification time for each file.
   cmFileTime ft1, ft2;
diff --git a/Source/cmFileTimeCache.h b/Source/cmFileTimeCache.h
index d284fdb..043b7aa 100644
--- a/Source/cmFileTimeCache.h
+++ b/Source/cmFileTimeCache.h
@@ -42,7 +42,7 @@ public:
    * @return true unless both files exist and have modification times less
    *         than 1 second apart.
    */
-  bool FileTimesDiffer(std::string const& f1, std::string const& f2);
+  bool DifferS(std::string const& f1, std::string const& f2);
 
 private:
   typedef std::unordered_map<std::string, cmFileTime> FileTimeMap;

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a6d75a1ce0daec9c60ed850163f76416de35edb7
commit a6d75a1ce0daec9c60ed850163f76416de35edb7
Author:     Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Thu Mar 14 17:15:04 2019 +0100
Commit:     Sebastian Holtermann <sebholt at xwmw.org>
CommitDate: Mon Mar 18 15:09:11 2019 +0100

    Substitute FileComparison in variable names with FileTimeCache

diff --git a/Source/cmDepends.cxx b/Source/cmDepends.cxx
index 4e97af2..1bfb370 100644
--- a/Source/cmDepends.cxx
+++ b/Source/cmDepends.cxx
@@ -177,8 +177,8 @@ bool cmDepends::CheckDependencies(
       if (dependerExists) {
         // The dependee and depender both exist.  Compare file times.
         int result = 0;
-        if ((!this->FileComparison->FileTimeCompare(depender, dependee,
-                                                    &result) ||
+        if ((!this->FileTimeCache->FileTimeCompare(depender, dependee,
+                                                   &result) ||
              result < 0)) {
           // The depender is older than the dependee.
           regenerate = true;
@@ -195,8 +195,8 @@ bool cmDepends::CheckDependencies(
         // The dependee exists, but the depender doesn't. Regenerate if the
         // internalDepends file is older than the dependee.
         int result = 0;
-        if ((!this->FileComparison->FileTimeCompare(internalDependsFileName,
-                                                    dependee, &result) ||
+        if ((!this->FileTimeCache->FileTimeCompare(internalDependsFileName,
+                                                   dependee, &result) ||
              result < 0)) {
           // The depends-file is older than the dependee.
           regenerate = true;
diff --git a/Source/cmDepends.h b/Source/cmDepends.h
index bbc79be..fc6571d 100644
--- a/Source/cmDepends.h
+++ b/Source/cmDepends.h
@@ -72,7 +72,7 @@ public:
   void Clear(const std::string& file);
 
   /** Set the file comparison object */
-  void SetFileComparison(cmFileTimeCache* fc) { this->FileComparison = fc; }
+  void SetFileTimeCache(cmFileTimeCache* fc) { this->FileTimeCache = fc; }
 
 protected:
   // Write dependencies for the target file to the given stream.
@@ -98,7 +98,7 @@ protected:
 
   // Flag for verbose output.
   bool Verbose = false;
-  cmFileTimeCache* FileComparison = nullptr;
+  cmFileTimeCache* FileTimeCache = nullptr;
 
   std::string Language;
 
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index 30b9790..b835059 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -1274,7 +1274,7 @@ bool cmLocalUnixMakefileGenerator3::UpdateDependencies(
   // project but no other sources were touched.
   bool needRescanDependInfo = false;
   cmFileTimeCache* ftc =
-    this->GlobalGenerator->GetCMakeInstance()->GetFileComparison();
+    this->GlobalGenerator->GetCMakeInstance()->GetFileTimeCache();
   {
     int result;
     if (!ftc->FileTimeCompare(internalDependFile, tgtInfo, &result) ||
@@ -1318,7 +1318,7 @@ bool cmLocalUnixMakefileGenerator3::UpdateDependencies(
   if (!needRescanDirInfo) {
     cmDependsC checker;
     checker.SetVerbose(verbose);
-    checker.SetFileComparison(ftc);
+    checker.SetFileTimeCache(ftc);
     // cmDependsC::Check() fills the vector validDependencies() with the
     // dependencies for those files where they are still valid, i.e. neither
     // the files themselves nor any files they depend on have changed.
@@ -1439,8 +1439,8 @@ bool cmLocalUnixMakefileGenerator3::ScanDependencies(
 
     if (scanner) {
       scanner->SetLocalGenerator(this);
-      scanner->SetFileComparison(
-        this->GlobalGenerator->GetCMakeInstance()->GetFileComparison());
+      scanner->SetFileTimeCache(
+        this->GlobalGenerator->GetCMakeInstance()->GetFileTimeCache());
       scanner->SetLanguage(lang);
       scanner->SetTargetDirectory(targetDir);
       scanner->Write(ruleFileStream, internalRuleFileStream);
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 84ac5b1..f2484b3 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -138,7 +138,7 @@ cmake::cmake(Role role, cmState::Mode mode)
   this->DebugOutput = false;
   this->DebugTryCompile = false;
   this->ClearBuildSystem = false;
-  this->FileComparison = new cmFileTimeCache;
+  this->FileTimeCache = new cmFileTimeCache;
 
   this->State = new cmState;
   this->State->SetMode(mode);
@@ -222,7 +222,7 @@ cmake::~cmake()
 #ifdef CMAKE_BUILD_WITH_CMAKE
   delete this->VariableWatch;
 #endif
-  delete this->FileComparison;
+  delete this->FileTimeCache;
 }
 
 #if defined(CMAKE_BUILD_WITH_CMAKE)
@@ -2139,7 +2139,7 @@ int cmake::CheckBuildSystem()
   std::string dep_newest = *dep++;
   for (; dep != depends.end(); ++dep) {
     int result = 0;
-    if (this->FileComparison->FileTimeCompare(dep_newest, *dep, &result)) {
+    if (this->FileTimeCache->FileTimeCompare(dep_newest, *dep, &result)) {
       if (result < 0) {
         dep_newest = *dep;
       }
@@ -2158,7 +2158,7 @@ int cmake::CheckBuildSystem()
   std::string out_oldest = *out++;
   for (; out != outputs.end(); ++out) {
     int result = 0;
-    if (this->FileComparison->FileTimeCompare(out_oldest, *out, &result)) {
+    if (this->FileTimeCache->FileTimeCompare(out_oldest, *out, &result)) {
       if (result > 0) {
         out_oldest = *out;
       }
@@ -2175,8 +2175,8 @@ int cmake::CheckBuildSystem()
   // If any output is older than any dependency then rerun.
   {
     int result = 0;
-    if (!this->FileComparison->FileTimeCompare(out_oldest, dep_newest,
-                                               &result) ||
+    if (!this->FileTimeCache->FileTimeCompare(out_oldest, dep_newest,
+                                              &result) ||
         result < 0) {
       if (verbose) {
         std::ostringstream msg;
diff --git a/Source/cmake.h b/Source/cmake.h
index a9aaaeb..f8a2319 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -329,7 +329,7 @@ public:
   /**
    * Get the file comparison class
    */
-  cmFileTimeCache* GetFileComparison() { return this->FileComparison; }
+  cmFileTimeCache* GetFileTimeCache() { return this->FileTimeCache; }
 
   // Do we want debug output during the cmake run.
   bool GetDebugOutput() { return this->DebugOutput; }
@@ -509,7 +509,7 @@ private:
   std::unordered_set<std::string> HeaderFileExtensionsSet;
   bool ClearBuildSystem;
   bool DebugTryCompile;
-  cmFileTimeCache* FileComparison;
+  cmFileTimeCache* FileTimeCache;
   std::string GraphVizFile;
   InstalledFilesMap InstalledFiles;
 

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=216416219ae438ec5e93a1e125298fa0b5fd64d9
commit 216416219ae438ec5e93a1e125298fa0b5fd64d9
Author:     Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Wed Mar 13 19:10:19 2019 +0100
Commit:     Sebastian Holtermann <sebholt at xwmw.org>
CommitDate: Mon Mar 18 15:09:11 2019 +0100

    Rename cmFileTimeComparison to cmFileTimeCache
    
    The name `cmFileTimeCache` reflects the functionality of the class more
    appropriately.

diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index f615496..596c7f5 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -238,8 +238,8 @@ set(SRCS
   cmFilePathChecksum.h
   cmFileTime.cxx
   cmFileTime.h
-  cmFileTimeComparison.cxx
-  cmFileTimeComparison.h
+  cmFileTimeCache.cxx
+  cmFileTimeCache.h
   cmFortranParserImpl.cxx
   cmFSPermissions.cxx
   cmFSPermissions.h
diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx
index 07bc7e7..54d7705 100644
--- a/Source/CTest/cmCTestBuildHandler.cxx
+++ b/Source/CTest/cmCTestBuildHandler.cxx
@@ -5,7 +5,7 @@
 #include "cmAlgorithms.h"
 #include "cmCTest.h"
 #include "cmDuration.h"
-#include "cmFileTimeComparison.h"
+#include "cmFileTimeCache.h"
 #include "cmGeneratedFileStream.h"
 #include "cmMakefile.h"
 #include "cmProcessOutput.h"
@@ -503,7 +503,7 @@ void cmCTestBuildHandler::GenerateXMLHeader(cmXMLWriter& xml)
 class cmCTestBuildHandler::FragmentCompare
 {
 public:
-  FragmentCompare(cmFileTimeComparison* ftc)
+  FragmentCompare(cmFileTimeCache* ftc)
     : FTC(ftc)
   {
   }
@@ -520,7 +520,7 @@ public:
   }
 
 private:
-  cmFileTimeComparison* FTC = nullptr;
+  cmFileTimeCache* FTC = nullptr;
 };
 
 void cmCTestBuildHandler::GenerateXMLLaunched(cmXMLWriter& xml)
@@ -530,7 +530,7 @@ void cmCTestBuildHandler::GenerateXMLLaunched(cmXMLWriter& xml)
   }
 
   // Sort XML fragments in chronological order.
-  cmFileTimeComparison ftc;
+  cmFileTimeCache ftc;
   FragmentCompare fragmentCompare(&ftc);
   typedef std::set<std::string, FragmentCompare> Fragments;
   Fragments fragments(fragmentCompare);
diff --git a/Source/cmDepends.cxx b/Source/cmDepends.cxx
index c128b02..4e97af2 100644
--- a/Source/cmDepends.cxx
+++ b/Source/cmDepends.cxx
@@ -2,7 +2,7 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmDepends.h"
 
-#include "cmFileTimeComparison.h"
+#include "cmFileTimeCache.h"
 #include "cmGeneratedFileStream.h"
 #include "cmLocalGenerator.h"
 #include "cmMakefile.h"
diff --git a/Source/cmDepends.h b/Source/cmDepends.h
index 20c91ca..bbc79be 100644
--- a/Source/cmDepends.h
+++ b/Source/cmDepends.h
@@ -12,7 +12,7 @@
 #include <string>
 #include <vector>
 
-class cmFileTimeComparison;
+class cmFileTimeCache;
 class cmLocalGenerator;
 
 /** \class cmDepends
@@ -72,10 +72,7 @@ public:
   void Clear(const std::string& file);
 
   /** Set the file comparison object */
-  void SetFileComparison(cmFileTimeComparison* fc)
-  {
-    this->FileComparison = fc;
-  }
+  void SetFileComparison(cmFileTimeCache* fc) { this->FileComparison = fc; }
 
 protected:
   // Write dependencies for the target file to the given stream.
@@ -101,7 +98,7 @@ protected:
 
   // Flag for verbose output.
   bool Verbose = false;
-  cmFileTimeComparison* FileComparison = nullptr;
+  cmFileTimeCache* FileComparison = nullptr;
 
   std::string Language;
 
diff --git a/Source/cmFileCopier.h b/Source/cmFileCopier.h
index a11c371..003b8f6 100644
--- a/Source/cmFileCopier.h
+++ b/Source/cmFileCopier.h
@@ -5,7 +5,7 @@
 
 #include "cmConfigure.h" // IWYU pragma: keep
 
-#include "cmFileTimeComparison.h"
+#include "cmFileTimeCache.h"
 #include "cm_sys_stat.h"
 #include "cmsys/RegularExpression.hxx"
 
@@ -28,7 +28,7 @@ protected:
   cmMakefile* Makefile;
   const char* Name;
   bool Always;
-  cmFileTimeComparison FileTimes;
+  cmFileTimeCache FileTimes;
 
   // Whether to install a file not matching any expression.
   bool MatchlessFiles;
diff --git a/Source/cmFileTimeComparison.cxx b/Source/cmFileTimeCache.cxx
similarity index 68%
rename from Source/cmFileTimeComparison.cxx
rename to Source/cmFileTimeCache.cxx
index 2115029..ff205b7 100644
--- a/Source/cmFileTimeComparison.cxx
+++ b/Source/cmFileTimeCache.cxx
@@ -1,17 +1,16 @@
 /* Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
    file Copyright.txt or https://cmake.org/licensing for details.  */
-#include "cmFileTimeComparison.h"
+#include "cmFileTimeCache.h"
 
 #include <string>
 #include <unordered_map>
 #include <utility>
 
-cmFileTimeComparison::cmFileTimeComparison() = default;
+cmFileTimeCache::cmFileTimeCache() = default;
 
-cmFileTimeComparison::~cmFileTimeComparison() = default;
+cmFileTimeCache::~cmFileTimeCache() = default;
 
-bool cmFileTimeComparison::Load(std::string const& fileName,
-                                cmFileTime& fileTime)
+bool cmFileTimeCache::Load(std::string const& fileName, cmFileTime& fileTime)
 {
   // Use the stored time if available.
   {
@@ -30,8 +29,8 @@ bool cmFileTimeComparison::Load(std::string const& fileName,
   return true;
 }
 
-bool cmFileTimeComparison::FileTimeCompare(std::string const& f1,
-                                           std::string const& f2, int* result)
+bool cmFileTimeCache::FileTimeCompare(std::string const& f1,
+                                      std::string const& f2, int* result)
 {
   // Get the modification time for each file.
   cmFileTime ft1, ft2;
@@ -45,8 +44,8 @@ bool cmFileTimeComparison::FileTimeCompare(std::string const& f1,
   return false;
 }
 
-bool cmFileTimeComparison::FileTimesDiffer(std::string const& f1,
-                                           std::string const& f2)
+bool cmFileTimeCache::FileTimesDiffer(std::string const& f1,
+                                      std::string const& f2)
 {
   // Get the modification time for each file.
   cmFileTime ft1, ft2;
diff --git a/Source/cmFileTimeComparison.h b/Source/cmFileTimeCache.h
similarity index 79%
rename from Source/cmFileTimeComparison.h
rename to Source/cmFileTimeCache.h
index 80ea409..d284fdb 100644
--- a/Source/cmFileTimeComparison.h
+++ b/Source/cmFileTimeCache.h
@@ -1,7 +1,7 @@
 /* Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
    file Copyright.txt or https://cmake.org/licensing for details.  */
-#ifndef cmFileTimeComparison_h
-#define cmFileTimeComparison_h
+#ifndef cmFileTimeCache_h
+#define cmFileTimeCache_h
 
 #include "cmConfigure.h" // IWYU pragma: keep
 
@@ -9,17 +9,17 @@
 #include <string>
 #include <unordered_map>
 
-/** \class cmFileTimeComparison
+/** \class cmFileTimeCache
  * \brief Caches file modification times in an internal map for fast lookups.
  */
-class cmFileTimeComparison
+class cmFileTimeCache
 {
 public:
-  cmFileTimeComparison();
-  ~cmFileTimeComparison();
+  cmFileTimeCache();
+  ~cmFileTimeCache();
 
-  cmFileTimeComparison(const cmFileTimeComparison&) = delete;
-  cmFileTimeComparison& operator=(const cmFileTimeComparison&) = delete;
+  cmFileTimeCache(const cmFileTimeCache&) = delete;
+  cmFileTimeCache& operator=(const cmFileTimeCache&) = delete;
 
   /**
    * @brief Loads the file time from the cache or the file system.
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index d1093be..30b9790 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -12,7 +12,7 @@
 
 #include "cmAlgorithms.h"
 #include "cmCustomCommandGenerator.h"
-#include "cmFileTimeComparison.h"
+#include "cmFileTimeCache.h"
 #include "cmGeneratedFileStream.h"
 #include "cmGeneratorTarget.h"
 #include "cmGlobalGenerator.h"
@@ -1273,7 +1273,7 @@ bool cmLocalUnixMakefileGenerator3::UpdateDependencies(
   // happen when a new source file is added and CMake regenerates the
   // project but no other sources were touched.
   bool needRescanDependInfo = false;
-  cmFileTimeComparison* ftc =
+  cmFileTimeCache* ftc =
     this->GlobalGenerator->GetCMakeInstance()->GetFileComparison();
   {
     int result;
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 08e284e..84ac5b1 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -9,7 +9,7 @@
 #include "cmDocumentationFormatter.h"
 #include "cmDuration.h"
 #include "cmExternalMakefileProjectGenerator.h"
-#include "cmFileTimeComparison.h"
+#include "cmFileTimeCache.h"
 #include "cmGeneratorTarget.h"
 #include "cmGlobalGenerator.h"
 #include "cmGlobalGeneratorFactory.h"
@@ -138,7 +138,7 @@ cmake::cmake(Role role, cmState::Mode mode)
   this->DebugOutput = false;
   this->DebugTryCompile = false;
   this->ClearBuildSystem = false;
-  this->FileComparison = new cmFileTimeComparison;
+  this->FileComparison = new cmFileTimeCache;
 
   this->State = new cmState;
   this->State->SetMode(mode);
@@ -2431,7 +2431,7 @@ static bool cmakeCheckStampFile(const std::string& stampName)
   }
 
   // Compare the stamp dependencies against the dependency file itself.
-  cmFileTimeComparison ftc;
+  cmFileTimeCache ftc;
   std::string dep;
   while (cmSystemTools::GetLineFromStream(fin, dep)) {
     int result;
diff --git a/Source/cmake.h b/Source/cmake.h
index 1ffeabc..a9aaaeb 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -26,7 +26,7 @@
 
 class cmExternalMakefileProjectGeneratorFactory;
 class cmFileAPI;
-class cmFileTimeComparison;
+class cmFileTimeCache;
 class cmGlobalGenerator;
 class cmGlobalGeneratorFactory;
 class cmMakefile;
@@ -329,7 +329,7 @@ public:
   /**
    * Get the file comparison class
    */
-  cmFileTimeComparison* GetFileComparison() { return this->FileComparison; }
+  cmFileTimeCache* GetFileComparison() { return this->FileComparison; }
 
   // Do we want debug output during the cmake run.
   bool GetDebugOutput() { return this->DebugOutput; }
@@ -509,7 +509,7 @@ private:
   std::unordered_set<std::string> HeaderFileExtensionsSet;
   bool ClearBuildSystem;
   bool DebugTryCompile;
-  cmFileTimeComparison* FileComparison;
+  cmFileTimeCache* FileComparison;
   std::string GraphVizFile;
   InstalledFilesMap InstalledFiles;
 
diff --git a/bootstrap b/bootstrap
index 77293c8..537b43b 100755
--- a/bootstrap
+++ b/bootstrap
@@ -305,7 +305,7 @@ CMAKE_CXX_SOURCES="\
   cmFileCopier \
   cmFileInstaller \
   cmFileTime \
-  cmFileTimeComparison \
+  cmFileTimeCache \
   cmFindBase \
   cmFindCommon \
   cmFindFileCommand \

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=31602583930b6c517c439ae8c15df26043031345
commit 31602583930b6c517c439ae8c15df26043031345
Author:     Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Wed Mar 13 19:03:35 2019 +0100
Commit:     Sebastian Holtermann <sebholt at xwmw.org>
CommitDate: Mon Mar 18 15:09:10 2019 +0100

    cmFileTimeComparison: Replace anonymous private class with std::map
    
    After the switch to `cmFileTime`, the anonymous private class of
    `cmFileTimeComparison` held only a `std::map`.  This moves the
    `std::map` to the `cmFileTimeComparison` class itself and removes the
    instantiation of an anonymous private class.

diff --git a/Source/cmFileTimeComparison.cxx b/Source/cmFileTimeComparison.cxx
index 5022cab..2115029 100644
--- a/Source/cmFileTimeComparison.cxx
+++ b/Source/cmFileTimeComparison.cxx
@@ -6,72 +6,33 @@
 #include <unordered_map>
 #include <utility>
 
-class cmFileTimeComparisonInternal
-{
-public:
-  inline bool Load(std::string const& fname, cmFileTime& ftm);
-  inline bool FileTimeCompare(std::string const& f1, std::string const& f2,
-                              int* result);
-
-  bool FileTimesDiffer(std::string const& f1, std::string const& f2);
+cmFileTimeComparison::cmFileTimeComparison() = default;
 
-private:
-  typedef std::unordered_map<std::string, cmFileTime> FileStatsMap;
-  FileStatsMap Files;
-};
+cmFileTimeComparison::~cmFileTimeComparison() = default;
 
-bool cmFileTimeComparisonInternal::Load(std::string const& fname,
-                                        cmFileTime& ftm)
+bool cmFileTimeComparison::Load(std::string const& fileName,
+                                cmFileTime& fileTime)
 {
   // Use the stored time if available.
   {
-    auto fit = this->Files.find(fname);
-    if (fit != this->Files.end()) {
-      ftm = fit->second;
+    auto fit = this->FileTimes.find(fileName);
+    if (fit != this->FileTimes.end()) {
+      fileTime = fit->second;
       return true;
     }
   }
   // Read file time from OS
-  if (!ftm.Load(fname)) {
+  if (!fileTime.Load(fileName)) {
     return false;
   }
   // Store file time in cache
-  this->Files[fname] = ftm;
+  this->FileTimes[fileName] = fileTime;
   return true;
 }
 
-cmFileTimeComparison::cmFileTimeComparison()
-{
-  this->Internals = new cmFileTimeComparisonInternal;
-}
-
-cmFileTimeComparison::~cmFileTimeComparison()
-{
-  delete this->Internals;
-}
-
-bool cmFileTimeComparison::Load(std::string const& fileName,
-                                cmFileTime& fileTime)
-{
-  return this->Internals->Load(fileName, fileTime);
-}
-
 bool cmFileTimeComparison::FileTimeCompare(std::string const& f1,
                                            std::string const& f2, int* result)
 {
-  return this->Internals->FileTimeCompare(f1, f2, result);
-}
-
-bool cmFileTimeComparison::FileTimesDiffer(std::string const& f1,
-                                           std::string const& f2)
-{
-  return this->Internals->FileTimesDiffer(f1, f2);
-}
-
-bool cmFileTimeComparisonInternal::FileTimeCompare(std::string const& f1,
-                                                   std::string const& f2,
-                                                   int* result)
-{
   // Get the modification time for each file.
   cmFileTime ft1, ft2;
   if (this->Load(f1, ft1) && this->Load(f2, ft2)) {
@@ -84,8 +45,8 @@ bool cmFileTimeComparisonInternal::FileTimeCompare(std::string const& f1,
   return false;
 }
 
-bool cmFileTimeComparisonInternal::FileTimesDiffer(std::string const& f1,
-                                                   std::string const& f2)
+bool cmFileTimeComparison::FileTimesDiffer(std::string const& f1,
+                                           std::string const& f2)
 {
   // Get the modification time for each file.
   cmFileTime ft1, ft2;
diff --git a/Source/cmFileTimeComparison.h b/Source/cmFileTimeComparison.h
index cc321f0..80ea409 100644
--- a/Source/cmFileTimeComparison.h
+++ b/Source/cmFileTimeComparison.h
@@ -7,8 +7,7 @@
 
 #include "cmFileTime.h"
 #include <string>
-
-class cmFileTimeComparisonInternal;
+#include <unordered_map>
 
 /** \class cmFileTimeComparison
  * \brief Caches file modification times in an internal map for fast lookups.
@@ -45,8 +44,9 @@ public:
    */
   bool FileTimesDiffer(std::string const& f1, std::string const& f2);
 
-protected:
-  cmFileTimeComparisonInternal* Internals;
+private:
+  typedef std::unordered_map<std::string, cmFileTime> FileTimeMap;
+  FileTimeMap FileTimes;
 };
 
 #endif

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=103aa9e46a5a59dc2c41cc1fa1aa6dd406b2924b
commit 103aa9e46a5a59dc2c41cc1fa1aa6dd406b2924b
Author:     Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Wed Mar 13 18:50:06 2019 +0100
Commit:     Sebastian Holtermann <sebholt at xwmw.org>
CommitDate: Mon Mar 18 15:09:10 2019 +0100

    cmFileTimeComparison: Use cmFileTime internally
    
    This replaces OS dependent code in `cmFileTimeComparison` with `cmFileTime`
    instances that provide the required file time load and comparison operations.
    
    A new public `cmFileTimeComparison::Load` method is introduced that,
    for a given file name, updates the `cmFileTimeComparison` cache on demand and
    returns a `cmFileTime` instance on success.

diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index 140754c..f615496 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -800,8 +800,6 @@ foreach(check
   endif()
   set_property(SOURCE cmFileTime.cxx APPEND PROPERTY
     COMPILE_DEFINITIONS CMake_${check}=${CMake_${check}})
-  set_property(SOURCE cmFileTimeComparison.cxx APPEND PROPERTY
-    COMPILE_DEFINITIONS CMake_${check}=${CMake_${check}})
 endforeach()
 
 # create a library used by the command line and the GUI
diff --git a/Source/cmFileTimeComparison.cxx b/Source/cmFileTimeComparison.cxx
index 8b3911e..5022cab 100644
--- a/Source/cmFileTimeComparison.cxx
+++ b/Source/cmFileTimeComparison.cxx
@@ -3,74 +3,40 @@
 #include "cmFileTimeComparison.h"
 
 #include <string>
-#include <time.h>
 #include <unordered_map>
 #include <utility>
 
-// Use a platform-specific API to get file times efficiently.
-#if !defined(_WIN32) || defined(__CYGWIN__)
-#  include "cm_sys_stat.h"
-#  define cmFileTimeComparison_Type struct stat
-#else
-#  include "cmsys/Encoding.hxx"
-#  include <windows.h>
-#  define cmFileTimeComparison_Type FILETIME
-#endif
-
 class cmFileTimeComparisonInternal
 {
 public:
-  // Internal comparison method.
-  inline bool FileTimeCompare(const std::string& f1, const std::string& f2,
+  inline bool Load(std::string const& fname, cmFileTime& ftm);
+  inline bool FileTimeCompare(std::string const& f1, std::string const& f2,
                               int* result);
 
-  bool FileTimesDiffer(const std::string& f1, const std::string& f2);
+  bool FileTimesDiffer(std::string const& f1, std::string const& f2);
 
 private:
-  typedef std::unordered_map<std::string, cmFileTimeComparison_Type>
-    FileStatsMap;
+  typedef std::unordered_map<std::string, cmFileTime> FileStatsMap;
   FileStatsMap Files;
-
-  // Internal methods to lookup and compare modification times.
-  inline bool Stat(const std::string& fname, cmFileTimeComparison_Type* st);
-  inline int Compare(cmFileTimeComparison_Type* st1,
-                     cmFileTimeComparison_Type* st2);
-  inline bool TimesDiffer(cmFileTimeComparison_Type* st1,
-                          cmFileTimeComparison_Type* st2);
 };
 
-bool cmFileTimeComparisonInternal::Stat(const std::string& fname,
-                                        cmFileTimeComparison_Type* st)
+bool cmFileTimeComparisonInternal::Load(std::string const& fname,
+                                        cmFileTime& ftm)
 {
   // Use the stored time if available.
-  cmFileTimeComparisonInternal::FileStatsMap::iterator fit =
-    this->Files.find(fname);
-  if (fit != this->Files.end()) {
-    *st = fit->second;
-    return true;
-  }
-
-#if !defined(_WIN32) || defined(__CYGWIN__)
-  // POSIX version.  Use the stat function.
-  int res = ::stat(fname.c_str(), st);
-  if (res != 0) {
+  {
+    auto fit = this->Files.find(fname);
+    if (fit != this->Files.end()) {
+      ftm = fit->second;
+      return true;
+    }
+  }
+  // Read file time from OS
+  if (!ftm.Load(fname)) {
     return false;
   }
-#else
-  // Windows version.  Get the modification time from extended file
-  // attributes.
-  WIN32_FILE_ATTRIBUTE_DATA fdata;
-  if (!GetFileAttributesExW(cmsys::Encoding::ToWide(fname).c_str(),
-                            GetFileExInfoStandard, &fdata)) {
-    return false;
-  }
-
-  // Copy the file time to the output location.
-  *st = fdata.ftLastWriteTime;
-#endif
-
-  // Store the time for future use.
-  this->Files[fname] = *st;
+  // Store file time in cache
+  this->Files[fname] = ftm;
   return true;
 }
 
@@ -84,133 +50,33 @@ cmFileTimeComparison::~cmFileTimeComparison()
   delete this->Internals;
 }
 
-bool cmFileTimeComparison::FileTimeCompare(const std::string& f1,
-                                           const std::string& f2, int* result)
+bool cmFileTimeComparison::Load(std::string const& fileName,
+                                cmFileTime& fileTime)
 {
-  return this->Internals->FileTimeCompare(f1, f2, result);
+  return this->Internals->Load(fileName, fileTime);
 }
 
-bool cmFileTimeComparison::FileTimesDiffer(const std::string& f1,
-                                           const std::string& f2)
+bool cmFileTimeComparison::FileTimeCompare(std::string const& f1,
+                                           std::string const& f2, int* result)
 {
-  return this->Internals->FileTimesDiffer(f1, f2);
-}
-
-int cmFileTimeComparisonInternal::Compare(cmFileTimeComparison_Type* s1,
-                                          cmFileTimeComparison_Type* s2)
-{
-#if !defined(_WIN32) || defined(__CYGWIN__)
-#  if CMake_STAT_HAS_ST_MTIM
-  // Compare using nanosecond resolution.
-  if (s1->st_mtim.tv_sec < s2->st_mtim.tv_sec) {
-    return -1;
-  }
-  if (s1->st_mtim.tv_sec > s2->st_mtim.tv_sec) {
-    return 1;
-  }
-  if (s1->st_mtim.tv_nsec < s2->st_mtim.tv_nsec) {
-    return -1;
-  }
-  if (s1->st_mtim.tv_nsec > s2->st_mtim.tv_nsec) {
-    return 1;
-  }
-#  elif CMake_STAT_HAS_ST_MTIMESPEC
-  // Compare using nanosecond resolution.
-  if (s1->st_mtimespec.tv_sec < s2->st_mtimespec.tv_sec) {
-    return -1;
-  }
-  if (s1->st_mtimespec.tv_sec > s2->st_mtimespec.tv_sec) {
-    return 1;
-  }
-  if (s1->st_mtimespec.tv_nsec < s2->st_mtimespec.tv_nsec) {
-    return -1;
-  }
-  if (s1->st_mtimespec.tv_nsec > s2->st_mtimespec.tv_nsec) {
-    return 1;
-  }
-#  else
-  // Compare using 1 second resolution.
-  if (s1->st_mtime < s2->st_mtime) {
-    return -1;
-  }
-  if (s1->st_mtime > s2->st_mtime) {
-    return 1;
-  }
-#  endif
-  // Files have the same time.
-  return 0;
-#else
-  // Compare using system-provided function.
-  return (int)CompareFileTime(s1, s2);
-#endif
+  return this->Internals->FileTimeCompare(f1, f2, result);
 }
 
-bool cmFileTimeComparisonInternal::TimesDiffer(cmFileTimeComparison_Type* s1,
-                                               cmFileTimeComparison_Type* s2)
+bool cmFileTimeComparison::FileTimesDiffer(std::string const& f1,
+                                           std::string const& f2)
 {
-#if !defined(_WIN32) || defined(__CYGWIN__)
-#  if CMake_STAT_HAS_ST_MTIM
-  // Times are integers in units of 1ns.
-  long long bil = 1000000000;
-  long long t1 = s1->st_mtim.tv_sec * bil + s1->st_mtim.tv_nsec;
-  long long t2 = s2->st_mtim.tv_sec * bil + s2->st_mtim.tv_nsec;
-  if (t1 < t2) {
-    return (t2 - t1) >= bil;
-  }
-  if (t2 < t1) {
-    return (t1 - t2) >= bil;
-  }
-  return false;
-#  elif CMake_STAT_HAS_ST_MTIMESPEC
-  // Times are integers in units of 1ns.
-  long long bil = 1000000000;
-  long long t1 = s1->st_mtimespec.tv_sec * bil + s1->st_mtimespec.tv_nsec;
-  long long t2 = s2->st_mtimespec.tv_sec * bil + s2->st_mtimespec.tv_nsec;
-  if (t1 < t2) {
-    return (t2 - t1) >= bil;
-  }
-  if (t2 < t1) {
-    return (t1 - t2) >= bil;
-  }
-  return false;
-#  else
-  // Times are integers in units of 1s.
-  if (s1->st_mtime < s2->st_mtime) {
-    return (s2->st_mtime - s1->st_mtime) >= 1;
-  }
-  if (s1->st_mtime > s2->st_mtime) {
-    return (s1->st_mtime - s2->st_mtime) >= 1;
-  }
-  return false;
-#  endif
-#else
-  // Times are integers in units of 100ns.
-  LARGE_INTEGER t1;
-  LARGE_INTEGER t2;
-  t1.LowPart = s1->dwLowDateTime;
-  t1.HighPart = s1->dwHighDateTime;
-  t2.LowPart = s2->dwLowDateTime;
-  t2.HighPart = s2->dwHighDateTime;
-  if (t1.QuadPart < t2.QuadPart) {
-    return (t2.QuadPart - t1.QuadPart) >= static_cast<LONGLONG>(10000000);
-  } else if (t2.QuadPart < t1.QuadPart) {
-    return (t1.QuadPart - t2.QuadPart) >= static_cast<LONGLONG>(10000000);
-  } else {
-    return false;
-  }
-#endif
+  return this->Internals->FileTimesDiffer(f1, f2);
 }
 
-bool cmFileTimeComparisonInternal::FileTimeCompare(const std::string& f1,
-                                                   const std::string& f2,
+bool cmFileTimeComparisonInternal::FileTimeCompare(std::string const& f1,
+                                                   std::string const& f2,
                                                    int* result)
 {
   // Get the modification time for each file.
-  cmFileTimeComparison_Type s1;
-  cmFileTimeComparison_Type s2;
-  if (this->Stat(f1, &s1) && this->Stat(f2, &s2)) {
+  cmFileTime ft1, ft2;
+  if (this->Load(f1, ft1) && this->Load(f2, ft2)) {
     // Compare the two modification times.
-    *result = this->Compare(&s1, &s2);
+    *result = ft1.Compare(ft2);
     return true;
   }
   // No comparison available.  Default to the same time.
@@ -218,15 +84,14 @@ bool cmFileTimeComparisonInternal::FileTimeCompare(const std::string& f1,
   return false;
 }
 
-bool cmFileTimeComparisonInternal::FileTimesDiffer(const std::string& f1,
-                                                   const std::string& f2)
+bool cmFileTimeComparisonInternal::FileTimesDiffer(std::string const& f1,
+                                                   std::string const& f2)
 {
   // Get the modification time for each file.
-  cmFileTimeComparison_Type s1;
-  cmFileTimeComparison_Type s2;
-  if (this->Stat(f1, &s1) && this->Stat(f2, &s2)) {
+  cmFileTime ft1, ft2;
+  if (this->Load(f1, ft1) && this->Load(f2, ft2)) {
     // Compare the two modification times.
-    return this->TimesDiffer(&s1, &s2);
+    return ft1.DifferS(ft2);
   }
   // No comparison available.  Default to different times.
   return true;
diff --git a/Source/cmFileTimeComparison.h b/Source/cmFileTimeComparison.h
index b4e4eb3..cc321f0 100644
--- a/Source/cmFileTimeComparison.h
+++ b/Source/cmFileTimeComparison.h
@@ -5,14 +5,13 @@
 
 #include "cmConfigure.h" // IWYU pragma: keep
 
+#include "cmFileTime.h"
 #include <string>
 
 class cmFileTimeComparisonInternal;
 
 /** \class cmFileTimeComparison
- * \brief Helper class for comparing file modification times.
- *
- * Compare file modification times or test if file modification times differ.
+ * \brief Caches file modification times in an internal map for fast lookups.
  */
 class cmFileTimeComparison
 {
@@ -24,19 +23,27 @@ public:
   cmFileTimeComparison& operator=(const cmFileTimeComparison&) = delete;
 
   /**
-   *  Compare file modification times.
-   *  Return true for successful comparison and false for error.
-   *  When true is returned, result has -1, 0, +1 for
-   *  f1 older, same, or newer than f2.
+   * @brief Loads the file time from the cache or the file system.
+   * @return true on success
    */
-  bool FileTimeCompare(const std::string& f1, const std::string& f2,
+  bool Load(std::string const& fileName, cmFileTime& fileTime);
+
+  /**
+   * @brief Compare file modification times.
+   * @return true for successful comparison and false for error.
+   *
+   * When true is returned, result has -1, 0, +1 for
+   * f1 older, same, or newer than f2.
+   */
+  bool FileTimeCompare(std::string const& f1, std::string const& f2,
                        int* result);
 
   /**
-   *  Compare file modification times.  Return true unless both files
-   *  exist and have modification times less than 1 second apart.
+   * @brief Compare file modification times.
+   * @return true unless both files exist and have modification times less
+   *         than 1 second apart.
    */
-  bool FileTimesDiffer(const std::string& f1, const std::string& f2);
+  bool FileTimesDiffer(std::string const& f1, std::string const& f2);
 
 protected:
   cmFileTimeComparisonInternal* Internals;

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6f24c4e93f6ae897b793f894b67543d86c7de477
commit 6f24c4e93f6ae897b793f894b67543d86c7de477
Author:     Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Wed Mar 13 16:54:01 2019 +0100
Commit:     Sebastian Holtermann <sebholt at xwmw.org>
CommitDate: Mon Mar 18 15:09:10 2019 +0100

    New cmFileTime class
    
    The new cmFileTime class stores the file modification time as an OS independent
    nanosecond count.  Its main use is to load and compare file modification times
    in nanosecond and second resolution.

diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index 696826f..140754c 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -236,6 +236,8 @@ set(SRCS
   cmFileLockResult.h
   cmFilePathChecksum.cxx
   cmFilePathChecksum.h
+  cmFileTime.cxx
+  cmFileTime.h
   cmFileTimeComparison.cxx
   cmFileTimeComparison.h
   cmFortranParserImpl.cxx
@@ -796,6 +798,8 @@ foreach(check
   else()
     set(CMake_${check} 0)
   endif()
+  set_property(SOURCE cmFileTime.cxx APPEND PROPERTY
+    COMPILE_DEFINITIONS CMake_${check}=${CMake_${check}})
   set_property(SOURCE cmFileTimeComparison.cxx APPEND PROPERTY
     COMPILE_DEFINITIONS CMake_${check}=${CMake_${check}})
 endforeach()
diff --git a/Source/cmFileTime.cxx b/Source/cmFileTime.cxx
new file mode 100644
index 0000000..253457f
--- /dev/null
+++ b/Source/cmFileTime.cxx
@@ -0,0 +1,49 @@
+/* Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
+   file Copyright.txt or https://cmake.org/licensing for details.  */
+#include "cmFileTime.h"
+
+#include <string>
+#include <time.h>
+
+// Use a platform-specific API to get file times efficiently.
+#if !defined(_WIN32) || defined(__CYGWIN__)
+#  include "cm_sys_stat.h"
+#else
+#  include "cmsys/Encoding.hxx"
+#  include <windows.h>
+#endif
+
+bool cmFileTime::Load(std::string const& fileName)
+{
+#if !defined(_WIN32) || defined(__CYGWIN__)
+  // POSIX version.  Use the stat function.
+  struct stat fst;
+  if (::stat(fileName.c_str(), &fst) != 0) {
+    return false;
+  }
+#  if CMake_STAT_HAS_ST_MTIM
+  // Nanosecond resolution
+  this->NS = fst.st_mtim.tv_sec * NsPerS + fst.st_mtim.tv_nsec;
+#  elif CMake_STAT_HAS_ST_MTIMESPEC
+  // Nanosecond resolution
+  this->NS = fst.st_mtimespec.tv_sec * NsPerS + fst.st_mtimespec.tv_nsec;
+#  else
+  // Second resolution
+  this->NS = fst.st_mtime * NsPerS;
+#  endif
+#else
+  // Windows version.  Get the modification time from extended file attributes.
+  WIN32_FILE_ATTRIBUTE_DATA fdata;
+  if (!GetFileAttributesExW(cmsys::Encoding::ToWide(fileName).c_str(),
+                            GetFileExInfoStandard, &fdata)) {
+    return false;
+  }
+
+  // Copy the file time to the output location.
+  this->NS = (static_cast<NSC>(fdata.ftLastWriteTime.dwHighDateTime) << 32) |
+    static_cast<NSC>(fdata.ftLastWriteTime.dwLowDateTime);
+  // The file time resolution is 100 ns.
+  this->NS *= 100;
+#endif
+  return true;
+}
diff --git a/Source/cmFileTime.h b/Source/cmFileTime.h
new file mode 100644
index 0000000..4c8e556
--- /dev/null
+++ b/Source/cmFileTime.h
@@ -0,0 +1,130 @@
+/* Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
+   file Copyright.txt or https://cmake.org/licensing for details.  */
+#ifndef cmFileTime_h
+#define cmFileTime_h
+
+#include "cmConfigure.h" // IWYU pragma: keep
+
+#include <string>
+
+/** \class cmFileTime
+ * \brief Abstract file modification time with support for comparison with
+ *        other file modification times.
+ */
+class cmFileTime
+{
+public:
+  typedef long long NSC;
+  static constexpr NSC NsPerS = 1000000000;
+
+  cmFileTime() = default;
+  ~cmFileTime() = default;
+
+  /**
+   * @brief Loads the file time of fileName from the file system
+   * @return true on success
+   */
+  bool Load(std::string const& fileName);
+
+  /**
+   * @brief Return true if this is older than ftm
+   */
+  bool Older(cmFileTime const& ftm) const { return (this->NS - ftm.NS) < 0; }
+
+  /**
+   * @brief Return true if this is newer than ftm
+   */
+  bool Newer(cmFileTime const& ftm) const { return (ftm.NS - this->NS) < 0; }
+
+  /**
+   * @brief Return true if this is the same as ftm
+   */
+  bool Equal(cmFileTime const& ftm) const { return this->NS == ftm.NS; }
+
+  /**
+   * @brief Return true if this is not the same as ftm
+   */
+  bool Differ(cmFileTime const& ftm) const { return this->NS != ftm.NS; }
+
+  /**
+   * @brief Compare file modification times.
+   * @return -1, 0, +1 for this older, same, or newer than ftm.
+   */
+  int Compare(cmFileTime const& ftm)
+  {
+    NSC const diff = this->NS - ftm.NS;
+    if (diff == 0) {
+      return 0;
+    }
+    return (diff < 0) ? -1 : 1;
+  }
+
+  // -- Comparison in second resolution
+
+  /**
+   * @brief Return true if this is at least a second older than ftm
+   */
+  bool OlderS(cmFileTime const& ftm) const
+  {
+    return (ftm.NS - this->NS) >= cmFileTime::NsPerS;
+  }
+
+  /**
+   * @brief Return true if this is at least a second newer than ftm
+   */
+  bool NewerS(cmFileTime const& ftm) const
+  {
+    return (this->NS - ftm.NS) >= cmFileTime::NsPerS;
+  }
+
+  /**
+   * @brief Return true if this is within the same second as ftm
+   */
+  bool EqualS(cmFileTime const& ftm) const
+  {
+    NSC diff = this->NS - ftm.NS;
+    if (diff < 0) {
+      diff = -diff;
+    }
+    return (diff < cmFileTime::NsPerS);
+  }
+
+  /**
+   * @brief Return true if this is older or newer than ftm by at least a second
+   */
+  bool DifferS(cmFileTime const& ftm) const
+  {
+    NSC diff = this->NS - ftm.NS;
+    if (diff < 0) {
+      diff = -diff;
+    }
+    return (diff >= cmFileTime::NsPerS);
+  }
+
+  /**
+   * @brief Compare file modification times.
+   * @return -1: this at least a second older, 0: this within the same second
+   *         as ftm, +1: this at least a second newer than ftm.
+   */
+  int CompareS(cmFileTime const& ftm) const
+  {
+    NSC const diff = this->NS - ftm.NS;
+    if (diff <= -cmFileTime::NsPerS) {
+      return -1;
+    }
+    if (diff >= cmFileTime::NsPerS) {
+      return 1;
+    }
+    return 0;
+  }
+
+  /**
+   * @brief The file modification time in nanoseconds
+   */
+  NSC GetNS() const { return this->NS; }
+
+private:
+  NSC NS = 0;
+};
+
+#endif
diff --git a/bootstrap b/bootstrap
index af05024..77293c8 100755
--- a/bootstrap
+++ b/bootstrap
@@ -304,6 +304,7 @@ CMAKE_CXX_SOURCES="\
   cmFileCommand \
   cmFileCopier \
   cmFileInstaller \
+  cmFileTime \
   cmFileTimeComparison \
   cmFindBase \
   cmFindCommon \

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=482d9ef9a8fe640d45eabbf4d6b32cfe5c1d124d
commit 482d9ef9a8fe640d45eabbf4d6b32cfe5c1d124d
Author:     Gregor Jasny <gjasny at googlemail.com>
AuthorDate: Sun Mar 17 20:22:26 2019 +0100
Commit:     Gregor Jasny <gjasny at googlemail.com>
CommitDate: Sun Mar 17 20:41:35 2019 +0100

    cmGlobalXCodeGenerator: Prefer std::string over char*

diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 53baed5..4bfa0b1 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -1022,7 +1022,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeFileReferenceFromPath(
                         this->CreateString(fileType));
 
   // Store the file path relative to the top of the source tree.
-  std::string path = this->RelativeToSource(fullpath.c_str());
+  std::string path = this->RelativeToSource(fullpath);
   std::string name = cmSystemTools::GetFilenameName(path);
   const char* sourceTree =
     (cmSystemTools::FileIsFullPath(path.c_str()) ? "<absolute>"
@@ -3063,7 +3063,7 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects(
   // Point Xcode at the top of the source tree.
   {
     std::string pdir =
-      this->RelativeToBinary(root->GetCurrentSourceDirectory().c_str());
+      this->RelativeToBinary(root->GetCurrentSourceDirectory());
     this->RootObject->AddAttribute("projectDirPath", this->CreateString(pdir));
     this->RootObject->AddAttribute("projectRoot", this->CreateString(""));
   }
@@ -3457,7 +3457,7 @@ void cmGlobalXCodeGenerator::OutputXCodeSharedSchemes(
       cmXCodeScheme schm(obj, testables[targetName],
                          this->CurrentConfigurationTypes, this->XcodeVersion);
       schm.WriteXCodeSharedScheme(xcProjDir,
-                                  this->RelativeToSource(xcProjDir.c_str()));
+                                  this->RelativeToSource(xcProjDir));
     }
   }
 }
@@ -3559,7 +3559,7 @@ std::string cmGlobalXCodeGenerator::ConvertToRelativeForMake(
   return cmSystemTools::ConvertToOutputPath(p);
 }
 
-std::string cmGlobalXCodeGenerator::RelativeToSource(const char* p)
+std::string cmGlobalXCodeGenerator::RelativeToSource(const std::string& p)
 {
   // We force conversion because Xcode breakpoints do not work unless
   // they are in a file named relative to the source tree.
@@ -3567,7 +3567,7 @@ std::string cmGlobalXCodeGenerator::RelativeToSource(const char* p)
     cmSystemTools::JoinPath(this->ProjectSourceDirectoryComponents), p);
 }
 
-std::string cmGlobalXCodeGenerator::RelativeToBinary(const char* p)
+std::string cmGlobalXCodeGenerator::RelativeToBinary(const std::string& p)
 {
   return this->CurrentLocalGenerator->MaybeConvertToRelativePath(
     cmSystemTools::JoinPath(this->ProjectOutputDirectoryComponents), p);
diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h
index 95db852..b80a9ad 100644
--- a/Source/cmGlobalXCodeGenerator.h
+++ b/Source/cmGlobalXCodeGenerator.h
@@ -119,8 +119,8 @@ private:
                                 const std::string& name);
   bool CreateGroups(std::vector<cmLocalGenerator*>& generators);
   std::string XCodeEscapePath(const std::string& p);
-  std::string RelativeToSource(const char* p);
-  std::string RelativeToBinary(const char* p);
+  std::string RelativeToSource(const std::string& p);
+  std::string RelativeToBinary(const std::string& p);
   std::string ConvertToRelativeForMake(std::string const& p);
   void CreateCustomCommands(cmXCodeObject* buildPhases,
                             cmXCodeObject* sourceBuildPhase,

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=90b775848913296af976d05dc82b8a45add4c6cf
commit 90b775848913296af976d05dc82b8a45add4c6cf
Author:     Mario Emmenlauer <mario at emmenlauer.de>
AuthorDate: Fri Mar 15 14:39:55 2019 +0100
Commit:     Mario Emmenlauer <mario at emmenlauer.de>
CommitDate: Fri Mar 15 20:13:35 2019 +0100

    FindBLAS: respect MKLROOT and MKL_ROOT if available
    
    Fixes: #19052

diff --git a/Modules/FindBLAS.cmake b/Modules/FindBLAS.cmake
index 0aa4f50..bfa449f 100644
--- a/Modules/FindBLAS.cmake
+++ b/Modules/FindBLAS.cmake
@@ -83,6 +83,13 @@ This module defines the following variables:
 
     set(BLA_VENDOR Intel10_64lp)
     find_package(BLAS)
+
+Hints
+^^^^^
+
+Set ``MKLROOT`` environment variable to a directory that contains an MKL
+installation.
+
 #]=======================================================================]
 
 include(${CMAKE_CURRENT_LIST_DIR}/CheckFunctionExists.cmake)
@@ -394,6 +401,24 @@ if (BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All")
         endif ()
       endif ()
 
+      if (DEFINED ENV{MKLROOT})
+        set(_BLAS_MKLROOT_LIB_DIR "$ENV{MKLROOT}")
+      endif ()
+      if (_BLAS_MKLROOT_LIB_DIR)
+        if( SIZEOF_INTEGER EQUAL 8 )
+          set( _BLAS_MKL_PATH_PREFIX "intel64" )
+        else()
+          set( _BLAS_MKL_PATH_PREFIX "ia32" )
+        endif()
+        if (WIN32)
+          string(APPEND _BLAS_MKLROOT_LIB_DIR "/lib/${_BLAS_MKL_PATH_PREFIX}_win")
+        elseif (APPLE)
+          string(APPEND _BLAS_MKLROOT_LIB_DIR "/lib/${_BLAS_MKL_PATH_PREFIX}_mac")
+        else ()
+          string(APPEND _BLAS_MKLROOT_LIB_DIR "/lib/${_BLAS_MKL_PATH_PREFIX}_lin")
+        endif ()
+      endif ()
+
       foreach (IT ${BLAS_SEARCH_LIBS})
         string(REPLACE " " ";" SEARCH_LIBS ${IT})
         if (NOT ${_LIBRARIES})
@@ -404,6 +429,7 @@ if (BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All")
             ""
             "${SEARCH_LIBS}"
             "${CMAKE_THREAD_LIBS_INIT};${BLAS_mkl_LM};${BLAS_mkl_LDL}"
+            "${_BLAS_MKLROOT_LIB_DIR}"
             )
         endif ()
       endforeach ()

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

Summary of changes:
 Help/manual/cmake-modules.7.rst          |   1 +
 Help/module/FindEnvModules.rst           |   1 +
 Help/release/dev/environment-modules.rst |   5 +
 Modules/CheckTypeSize.c.in               |   2 +-
 Modules/FindBLAS.cmake                   |  26 +++
 Modules/FindEnvModules.cmake             | 333 +++++++++++++++++++++++++++++++
 Source/CMakeLists.txt                    |   8 +-
 Source/CTest/cmCTestBuildHandler.cxx     |  10 +-
 Source/cmDepends.cxx                     |   9 +-
 Source/cmDepends.h                       |   9 +-
 Source/cmDependsC.cxx                    |  12 +-
 Source/cmFileCopier.cxx                  |   2 +-
 Source/cmFileCopier.h                    |   4 +-
 Source/cmFileTime.cxx                    |  49 +++++
 Source/cmFileTime.h                      | 130 ++++++++++++
 Source/cmFileTimeCache.cxx               |  57 ++++++
 Source/cmFileTimeCache.h                 |  51 +++++
 Source/cmFileTimeComparison.cxx          | 233 ---------------------
 Source/cmFileTimeComparison.h            |  45 -----
 Source/cmGlobalXCodeGenerator.cxx        |  10 +-
 Source/cmGlobalXCodeGenerator.h          |   4 +-
 Source/cmLocalUnixMakefileGenerator3.cxx |  17 +-
 Source/cm_utf8.c                         |  19 ++
 Source/cm_utf8.h                         |   4 +
 Source/cmake.cxx                         |  43 ++--
 Source/cmake.h                           |   6 +-
 Tests/CMakeLib/testUTF8.cxx              |  78 ++++++++
 Tests/CMakeLists.txt                     |   4 +
 Tests/FindEnvModules/CMakeLists.txt      |   3 +
 Tests/FindEnvModules/EnvModules.cmake    |  35 ++++
 bootstrap                                |   3 +-
 31 files changed, 867 insertions(+), 346 deletions(-)
 create mode 100644 Help/module/FindEnvModules.rst
 create mode 100644 Help/release/dev/environment-modules.rst
 create mode 100644 Modules/FindEnvModules.cmake
 create mode 100644 Source/cmFileTime.cxx
 create mode 100644 Source/cmFileTime.h
 create mode 100644 Source/cmFileTimeCache.cxx
 create mode 100644 Source/cmFileTimeCache.h
 delete mode 100644 Source/cmFileTimeComparison.cxx
 delete mode 100644 Source/cmFileTimeComparison.h
 create mode 100644 Tests/FindEnvModules/CMakeLists.txt
 create mode 100644 Tests/FindEnvModules/EnvModules.cmake


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list