Merge topic 'ctest-resource-fixes' into release-3.16

a033bafbe0 Help: Clarify how tests are run if no resource spec file is specified
a64ba0235f CTest: Clarify that resource requirements can be split
f9f294f5fa CTest: Add version field to resource spec file

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4080
diff --git a/Modules/CMakeParseImplicitIncludeInfo.cmake b/Modules/CMakeParseImplicitIncludeInfo.cmake
index 91d03cd..ff4c325 100644
--- a/Modules/CMakeParseImplicitIncludeInfo.cmake
+++ b/Modules/CMakeParseImplicitIncludeInfo.cmake
@@ -167,7 +167,7 @@
   set(log "")
 
   # go through each line of output...
-  string(REGEX REPLACE "\r?\n" ";" output_lines "${text}")
+  string(REGEX REPLACE "\r*\n" ";" output_lines "${text}")
   foreach(line IN LISTS output_lines)
     if(state STREQUAL start)
       string(FIND "${line}" "#include \"...\" search starts here:" rv)
diff --git a/Modules/FindODBC.cmake b/Modules/FindODBC.cmake
index 29d7af9..3f710db 100644
--- a/Modules/FindODBC.cmake
+++ b/Modules/FindODBC.cmake
@@ -92,6 +92,8 @@
   # List names of ODBC libraries on Windows
   if(NOT MINGW)
     set(ODBC_LIBRARY odbc32.lib)
+  else()
+    set(ODBC_LIBRARY libodbc32.a)
   endif()
   set(_odbc_lib_names odbc32;)
 
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 923d2a5..2e499b3 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -3148,6 +3148,22 @@
     }
   }
 
+  // Ensure that for the CMakeFiles/<target>.dir/generated_source_file
+  // we don't end up having:
+  // CMakeFiles/<target>.dir/CMakeFiles/<target>.dir/generated_source_file.obj
+  const char* unitySourceFile = source.GetProperty("UNITY_SOURCE_FILE");
+  const char* pchExtension = source.GetProperty("PCH_EXTENSION");
+  if (unitySourceFile || pchExtension) {
+    if (pchExtension) {
+      customOutputExtension = pchExtension;
+    }
+
+    cmsys::RegularExpression var("(CMakeFiles/[^/]+.dir/)");
+    if (var.find(objectName)) {
+      objectName.erase(var.start(), var.end() - var.start());
+    }
+  }
+
   // Replace the original source file extension with the object file
   // extension.
   bool keptSourceExtension = true;
@@ -3164,19 +3180,6 @@
       }
     }
 
-    const char* pchExtension = source.GetProperty("PCH_EXTENSION");
-    if (pchExtension) {
-      customOutputExtension = pchExtension;
-
-      // Make sure that for the CMakeFiles/<target>.dir/cmake_pch.h|xx.c|xx
-      // source file, we don't end up having
-      // CMakeFiles/<target>.dir/CMakeFiles/<target>.dir/cmake_pch.h|xx.pch
-      cmsys::RegularExpression var("(CMakeFiles/[^/]+.dir/)");
-      while (var.find(objectName)) {
-        objectName.erase(var.start(), var.end() - var.start());
-      }
-    }
-
     // Remove the source extension if it is to be replaced.
     if (replaceExt || customOutputExtension) {
       keptSourceExtension = false;