From 9d5e32b79b04e5784acd07dd82fec79bc9b4cc34 Mon Sep 17 00:00:00 2001
From: Ben Boeckel <ben.boeckel@kitware.com>
Date: Fri, 15 May 2020 09:58:46 -0400
Subject: Tests/RunCMake/export: handle collapsed newlines

When the build path is long with a space near the line length, a newline
is lost.
---
 Tests/RunCMake/export/DependOnDoubleExport-stderr.txt | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/Tests/RunCMake/export/DependOnDoubleExport-stderr.txt b/Tests/RunCMake/export/DependOnDoubleExport-stderr.txt
index b78c7e4..e8f8a09 100644
--- a/Tests/RunCMake/export/DependOnDoubleExport-stderr.txt
+++ b/Tests/RunCMake/export/DependOnDoubleExport-stderr.txt
@@ -3,8 +3,7 @@ CMake Error in CMakeLists.txt:
   that is not in this export set, but in multiple other export sets:
   .*/Tests/RunCMake/export/DependOnDoubleExport-build/exportset.cmake,
   .*/Tests/RunCMake/export/DependOnDoubleExport-build/manual.cmake.
-
-
++
   An exported target cannot depend upon another target which is exported
   multiple times.  Consider consolidating the exports of the "doubleexported"
   target to a single export.
-- 
cgit v0.12


From 28f2ad941906248d2de8c9c32ddd3a0e57b13fc5 Mon Sep 17 00:00:00 2001
From: Ben Boeckel <ben.boeckel@kitware.com>
Date: Fri, 22 May 2020 08:43:51 -0400
Subject: Tests/CPackWiXGenerator; support non-interactive sessions

---
 Tests/CPackWiXGenerator/CMakeLists.txt | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Tests/CPackWiXGenerator/CMakeLists.txt b/Tests/CPackWiXGenerator/CMakeLists.txt
index 73eaf4f..940e849 100644
--- a/Tests/CPackWiXGenerator/CMakeLists.txt
+++ b/Tests/CPackWiXGenerator/CMakeLists.txt
@@ -49,6 +49,9 @@ set(CPACK_PACKAGE_INSTALL_DIRECTORY "CPack Component Example")
 set(CPACK_WIX_UPGRADE_GUID "BF20CE5E-7F7C-401D-8F7C-AB45E8D170E6")
 set(CPACK_WIX_UNINSTALL "1")
 
+# Support non-interactive sessions (like CI).
+set(CPACK_WIX_LIGHT_EXTRA_FLAGS "-sval")
+
 set(CPACK_PACKAGE_EXECUTABLES
   "my-libapp" "CPack WiX Test"
   "my-other-app" "Second CPack WiX Test"
-- 
cgit v0.12


From 165e56950aef21468940384fe1b51cc7a676ef7d Mon Sep 17 00:00:00 2001
From: Ben Boeckel <ben.boeckel@kitware.com>
Date: Fri, 22 May 2020 10:59:52 -0400
Subject: Tests/CPackWiXGenerator: support suppressing verification

Verification requires access to an active Windows session which may not
be the case in all testing environments.
---
 Tests/CMakeLists.txt                               | 1 +
 Tests/CPackWiXGenerator/RunCPackVerifyResult.cmake | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 0c8a639..d7e567c 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -978,6 +978,7 @@ ${CMake_SOURCE_DIR}/Utilities/Release/push.bash --dir dev -- '${CMake_BUILD_NIGH
         --build-options
         --test-command ${CMAKE_CMAKE_COMMAND}
           "-DCPackWiXGenerator_BINARY_DIR:PATH=${CMake_BINARY_DIR}/Tests/CPackWiXGenerator"
+          "-Dno_verify:BOOL=${CMake_TEST_WIX_NO_VERIFY}"
           "-Dconfig=\${CTEST_CONFIGURATION_TYPE}"
           -P "${CMake_SOURCE_DIR}/Tests/CPackWiXGenerator/RunCPackVerifyResult.cmake")
 
diff --git a/Tests/CPackWiXGenerator/RunCPackVerifyResult.cmake b/Tests/CPackWiXGenerator/RunCPackVerifyResult.cmake
index ca9fd90..c549e61 100644
--- a/Tests/CPackWiXGenerator/RunCPackVerifyResult.cmake
+++ b/Tests/CPackWiXGenerator/RunCPackVerifyResult.cmake
@@ -74,4 +74,6 @@ endforeach()
 # error SMOK1076 : ICE61: This product should remove only older
 # versions of itself. The Maximum version is not less
 # than the current product. (1.0.0 1.0.0)
-run_wix_command(smoke -nologo -wx -sw1076 "${installer_file}")
+if (NOT no_verify)
+  run_wix_command(smoke -nologo -wx -sw1076 "${installer_file}")
+endif ()
-- 
cgit v0.12


From d89d333070a9d2275a1b502853b4e629e696809e Mon Sep 17 00:00:00 2001
From: Ben Boeckel <ben.boeckel@kitware.com>
Date: Fri, 15 May 2020 11:54:52 -0400
Subject: CTestCustom: ignore expat having symbol-less objects too

---
 CTestCustom.cmake.in | 1 +
 1 file changed, 1 insertion(+)

diff --git a/CTestCustom.cmake.in b/CTestCustom.cmake.in
index 5b78f2e..4c8267d 100644
--- a/CTestCustom.cmake.in
+++ b/CTestCustom.cmake.in
@@ -11,6 +11,7 @@ list(APPEND CTEST_CUSTOM_WARNING_EXCEPTION
   "warning: \\(Long double usage is reported only once for each file"
   "warning: To disable this warning use"
   "could not be inlined"
+  "libcmexpat.*has no symbols"
   "libcmcurl.*has no symbols"
   "not sorted slower link editing will result"
   "stl_deque.h:479"
-- 
cgit v0.12


From 0ed7e424abd49bb0e156b57af41a2528bc54329b Mon Sep 17 00:00:00 2001
From: Ben Boeckel <ben.boeckel@kitware.com>
Date: Fri, 8 May 2020 10:14:59 -0400
Subject: gitlab-ci: use the cmake_build_unix anchor

---
 .gitlab-ci.yml | 44 +++-----------------------------------------
 1 file changed, 3 insertions(+), 41 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 0a55ca3..cd63997 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -69,57 +69,19 @@ stages:
 build:debian10-iwyu:
     <<:
         - *debian10_iwyu
-    stage: build
-    only: *only_settings
-    tags:
-        - build
-        - docker
-        - linux
-
-    script:
-        - .gitlab/ci/sccache.sh
-        - sccache --start-server
-        - sccache --show-stats
-        - "$LAUNCHER ctest -VV -S .gitlab/ci/ctest_configure.cmake"
-        - "$LAUNCHER ctest -VV -S .gitlab/ci/ctest_build.cmake"
-        - sccache --show-stats
-    interruptible: true
+        - *cmake_build_unix
 
 build:fedora31-tidy:
     <<:
         - *fedora31_tidy
-    stage: build
-    only: *only_settings
-    tags:
-        - build
-        - docker
-        - linux
-
-    script:
-        - .gitlab/ci/sccache.sh
-        - sccache --start-server
-        - sccache --show-stats
-        - "$LAUNCHER ctest -VV -S .gitlab/ci/ctest_configure.cmake"
-        - "$LAUNCHER ctest -VV -S .gitlab/ci/ctest_build.cmake"
-        - sccache --show-stats
-    interruptible: true
+        - *cmake_build_unix
 
 build:fedora31-sphinx:
     <<:
         - *fedora31_sphinx
-    stage: build
-    only: *only_settings
+        - *cmake_build_unix
     tags:
         - build
         - docker
         - linux
         - linux-3.17 # Needed to be able to load Fedora's Qt libraries.
-
-    script:
-        - .gitlab/ci/sccache.sh
-        - sccache --start-server
-        - sccache --show-stats
-        - "$LAUNCHER ctest -VV -S .gitlab/ci/ctest_configure.cmake"
-        - "$LAUNCHER ctest -VV -S .gitlab/ci/ctest_build.cmake"
-        - sccache --show-stats
-    interruptible: true
-- 
cgit v0.12


From d5438f783a1d352e1709d10faf5e8f6e88830eca Mon Sep 17 00:00:00 2001
From: Ben Boeckel <ben.boeckel@kitware.com>
Date: Fri, 8 May 2020 10:50:13 -0400
Subject: ci: add make to the CI image

---
 .gitlab/ci/docker/fedora31/install_deps.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/.gitlab/ci/docker/fedora31/install_deps.sh b/.gitlab/ci/docker/fedora31/install_deps.sh
index 7f8da57..5f2985f 100755
--- a/.gitlab/ci/docker/fedora31/install_deps.sh
+++ b/.gitlab/ci/docker/fedora31/install_deps.sh
@@ -8,7 +8,8 @@ dnf install -y \
 dnf install --setopt=install_weak_deps=False -y \
     clang-tools-extra \
     gcc-c++ \
-    git-core
+    git-core \
+    make
 
 # Install documentation tools.
 dnf install --setopt=install_weak_deps=False -y \
-- 
cgit v0.12


From 3e1a1ba92d0e64324916f65214b633bc067997bf Mon Sep 17 00:00:00 2001
From: Ben Boeckel <ben.boeckel@kitware.com>
Date: Fri, 8 May 2020 12:48:46 -0400
Subject: ci: add dependencies for the test suite to the Fedora image

---
 .gitlab/ci/docker/fedora31/install_deps.sh | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/.gitlab/ci/docker/fedora31/install_deps.sh b/.gitlab/ci/docker/fedora31/install_deps.sh
index 5f2985f..bcb1564 100755
--- a/.gitlab/ci/docker/fedora31/install_deps.sh
+++ b/.gitlab/ci/docker/fedora31/install_deps.sh
@@ -17,4 +17,9 @@ dnf install --setopt=install_weak_deps=False -y \
     texinfo \
     qt5-qttools-devel
 
+# Tools needed for the test suite.
+dnf install --setopt=install_weak_deps=False -y \
+    findutils \
+    file
+
 dnf clean all
-- 
cgit v0.12


From a1b1fc611bc8aeb519b79b3e1b86ce4e4dbc55e9 Mon Sep 17 00:00:00 2001
From: Ben Boeckel <ben.boeckel@kitware.com>
Date: Fri, 8 May 2020 10:15:27 -0400
Subject: gitlab-ci: add Linux makefiles and ninja builders

---
 .gitlab-ci.yml                                | 135 +++++++++++++++++++++++++-
 .gitlab/ci/configure_common.cmake             |   6 ++
 .gitlab/ci/configure_fedora31_makefiles.cmake |   1 +
 .gitlab/ci/configure_fedora31_ninja.cmake     |   1 +
 .gitlab/ci/ctest_build.cmake                  |  11 +++
 .gitlab/ci/ctest_exclusions.cmake             |   1 +
 6 files changed, 154 insertions(+), 1 deletion(-)
 create mode 100644 .gitlab/ci/configure_fedora31_makefiles.cmake
 create mode 100644 .gitlab/ci/configure_fedora31_ninja.cmake

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index cd63997..6ef553a 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -4,7 +4,7 @@
     - tags@cmake/cmake
 
 .fedora31: &fedora31
-    image: "kitware/cmake:ci-fedora31-x86_64-2020-05-05"
+    image: "kitware/cmake:ci-fedora31-x86_64-2020-05-08"
 
     variables:
         GIT_CLONE_PATH: "$CI_BUILDS_DIR/gitlab-kitware-cmake ci"
@@ -21,6 +21,7 @@
     variables:
         CMAKE_CONFIGURATION: debian10_iwyu
         CTEST_NO_WARNINGS_ALLOWED: 1
+        CMake_SKIP_INSTALL: 1
 
 .fedora31_tidy: &fedora31_tidy
     extends: .fedora31
@@ -28,6 +29,7 @@
     variables:
         CMAKE_CONFIGURATION: fedora31_tidy
         CTEST_NO_WARNINGS_ALLOWED: 1
+        CMake_SKIP_INSTALL: 1
 
 .fedora31_sphinx: &fedora31_sphinx
     extends: .fedora31
@@ -36,6 +38,22 @@
         CMAKE_CONFIGURATION: fedora31_sphinx
         CTEST_NO_WARNINGS_ALLOWED: 1
         CTEST_SOURCE_SUBDIRECTORY: "Utilities/Sphinx"
+        CMake_SKIP_INSTALL: 1
+
+.fedora31_ninja: &fedora31_ninja
+    extends: .fedora31
+
+    variables:
+        CMAKE_CONFIGURATION: fedora31_ninja
+        CTEST_NO_WARNINGS_ALLOWED: 1
+
+.fedora31_makefiles: &fedora31_makefiles
+    extends: .fedora31
+
+    variables:
+        CMAKE_CONFIGURATION: fedora31_makefiles
+        CTEST_NO_WARNINGS_ALLOWED: 1
+        CMAKE_GENERATOR: "Unix Makefiles"
 
 before_script:
     - .gitlab/ci/cmake.sh
@@ -62,6 +80,79 @@ before_script:
 
     interruptible: true
 
+.cmake_build_artifacts: &cmake_build_artifacts
+    artifacts:
+        expire_in: 1d
+        paths:
+            # XXX(globbing): Can be simplified with support from
+            # https://gitlab.com/gitlab-org/gitlab-runner/issues/4840
+            - build/CTestTestfile.cmake
+            - build/*/CTestTestfile.cmake
+            - build/*/*/CTestTestfile.cmake
+            - build/*/*/*/CTestTestfile.cmake
+            - build/*/*/*/*/CTestTestfile.cmake
+
+            # Allow CMake to find CMAKE_ROOT.
+            - build/CMakeFiles/CMakeSourceDir.txt
+
+            # Take the install tree.
+            - build/install/
+
+            # We need the main binaries.
+            - build/bin/
+            # The cache is needed for the installation test.
+            - build/CMakeCache.txt
+            # Test binaries. Eventually these might be better under
+            # `Source/Tests` or the like.
+            - build/Tests/EnforceConfig.cmake
+            - build/Tests/CMakeBuildTest.cmake
+            - build/Tests/CMakeBuildDoubleProjectTest.cmake
+            - build/Tests/CMake*/runcompilecommands
+            - build/Tests/CMake*/test*
+            - build/Tests/CMake*/PseudoMemcheck/valgrind
+            - build/Tests/CMake*/PseudoMemcheck/purify
+            - build/Tests/CMake*/PseudoMemcheck/memcheck_fail
+            - build/Tests/CMake*/PseudoMemcheck/BC
+            - build/Tests/CMake*/PseudoMemcheck/NoLog
+            - build/Tests/CMake*Lib/*LibTests
+            - build/Source/kwsys/cmsysTest*
+            - build/Utilities/cmcurl/curltest
+            - build/Utilities/KWIML/test/kwiml_test
+            - build/Source/kwsys/libcmsysTestDynload.so
+
+            # Test directories.
+            - build/Tests/CTest*
+            - build/Tests/Find*
+            - build/Tests/Qt5*
+            - build/Tests/RunCMake/
+            - build/Tests/CMakeOnly/
+            - build/Tests/CMakeTests/
+
+            # CTest/CDash information.
+            - build/Testing/
+            - build/DartConfiguation.tcl
+            - build/CTestCustom.cmake
+
+.cmake_test_artifacts: &cmake_test_artifacts
+    artifacts:
+        expire_in: 1d
+        paths:
+            # Take the install tree.
+            - build/install/
+
+.cmake_test_unix: &cmake_test_unix
+    stage: test
+    only: *only_settings
+    tags:
+        - build
+        - docker
+        - linux
+
+    script:
+        - "$LAUNCHER ctest --output-on-failure -V -S .gitlab/ci/ctest_test.cmake"
+
+    interruptible: true
+
 stages:
     - build
     - test
@@ -85,3 +176,45 @@ build:fedora31-sphinx:
         - docker
         - linux
         - linux-3.17 # Needed to be able to load Fedora's Qt libraries.
+
+build:fedora31-ninja:
+    <<:
+        - *fedora31_ninja
+        - *cmake_build_unix
+        - *cmake_build_artifacts
+    when: manual
+
+test:fedora31-ninja:
+    <<:
+        - *fedora31_ninja
+        - *cmake_test_unix
+    tags:
+        - build
+        - docker
+        - linux
+        - linux-3.17 # Needed to be able to load Fedora's Qt libraries.
+    dependencies:
+        - build:fedora31-ninja
+    needs:
+        - build:fedora31-ninja
+
+build:fedora31-makefiles:
+    <<:
+        - *fedora31_makefiles
+        - *cmake_build_unix
+        - *cmake_build_artifacts
+    when: manual
+
+test:fedora31-makefiles:
+    <<:
+        - *fedora31_makefiles
+        - *cmake_test_unix
+    tags:
+        - build
+        - docker
+        - linux
+        - linux-3.17 # Needed to be able to load Fedora's Qt libraries.
+    dependencies:
+        - build:fedora31-makefiles
+    needs:
+        - build:fedora31-makefiles
diff --git a/.gitlab/ci/configure_common.cmake b/.gitlab/ci/configure_common.cmake
index fc2aaae..165ae55 100644
--- a/.gitlab/ci/configure_common.cmake
+++ b/.gitlab/ci/configure_common.cmake
@@ -1,3 +1,9 @@
 set(CTEST_USE_LAUNCHERS "ON" CACHE STRING "")
 
+# We run the install right after the build. Avoid rerunning it when installing.
+set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY "ON" CACHE STRING "")
+# Install CMake under the build tree.
+set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE PATH "")
+set(CMake_TEST_INSTALL "OFF" CACHE BOOL "")
+
 include("${CMAKE_CURRENT_LIST_DIR}/configure_sccache.cmake")
diff --git a/.gitlab/ci/configure_fedora31_makefiles.cmake b/.gitlab/ci/configure_fedora31_makefiles.cmake
new file mode 100644
index 0000000..33f0db0
--- /dev/null
+++ b/.gitlab/ci/configure_fedora31_makefiles.cmake
@@ -0,0 +1 @@
+include("${CMAKE_CURRENT_LIST_DIR}/configure_common.cmake")
diff --git a/.gitlab/ci/configure_fedora31_ninja.cmake b/.gitlab/ci/configure_fedora31_ninja.cmake
new file mode 100644
index 0000000..33f0db0
--- /dev/null
+++ b/.gitlab/ci/configure_fedora31_ninja.cmake
@@ -0,0 +1 @@
+include("${CMAKE_CURRENT_LIST_DIR}/configure_common.cmake")
diff --git a/.gitlab/ci/ctest_build.cmake b/.gitlab/ci/ctest_build.cmake
index 28bdb35..6402a5d 100644
--- a/.gitlab/ci/ctest_build.cmake
+++ b/.gitlab/ci/ctest_build.cmake
@@ -28,3 +28,14 @@ if ("$ENV{CTEST_NO_WARNINGS_ALLOWED}" AND num_warnings GREATER 0)
   message(FATAL_ERROR
     "Found ${num_warnings} warnings (treating as fatal).")
 endif ()
+
+if (NOT "$ENV{CMake_SKIP_INSTALL}")
+  ctest_build(APPEND
+    TARGET install
+    RETURN_VALUE install_result)
+
+  if (install_result)
+    message(FATAL_ERROR
+      "Failed to install")
+  endif ()
+endif ()
diff --git a/.gitlab/ci/ctest_exclusions.cmake b/.gitlab/ci/ctest_exclusions.cmake
index 5bb03ca..d8980f6 100644
--- a/.gitlab/ci/ctest_exclusions.cmake
+++ b/.gitlab/ci/ctest_exclusions.cmake
@@ -1,5 +1,6 @@
 set(test_exclusions
 )
+
 string(REPLACE ";" "|" test_exclusions "${test_exclusions}")
 if (test_exclusions)
   set(test_exclusions "(${test_exclusions})")
-- 
cgit v0.12


From 02c56b71a1f2f66be0ba79f0b3da66bfa3107ce7 Mon Sep 17 00:00:00 2001
From: Ben Boeckel <ben.boeckel@kitware.com>
Date: Thu, 14 May 2020 14:36:04 -0400
Subject: gitlab-ci: add a macos builder

---
 .gitlab-ci.yml                             | 112 ++++++++++++++++++++++-------
 .gitlab/ci/cmake.sh                        |  30 +++++++-
 .gitlab/ci/configure_macos_makefiles.cmake |   1 +
 .gitlab/ci/configure_macos_ninja.cmake     |   1 +
 .gitlab/ci/ninja.sh                        |  26 ++++++-
 .gitlab/ci/sccache.sh                      |  28 ++++++--
 6 files changed, 164 insertions(+), 34 deletions(-)
 create mode 100644 .gitlab/ci/configure_macos_makefiles.cmake
 create mode 100644 .gitlab/ci/configure_macos_ninja.cmake

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 6ef553a..421c3f9 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -55,6 +55,49 @@
         CTEST_NO_WARNINGS_ALLOWED: 1
         CMAKE_GENERATOR: "Unix Makefiles"
 
+.macos: &macos
+    variables:
+        # Note that shell runners only support runners with a single
+        # concurrency level. We can't use `$CI_CONCURRENCY_ID` because this may
+        # change between the build and test stages which CMake doesn't support.
+        # Even if we could, it could change if other runners on the machine
+        # could run at the same time, so we drop it.
+        GIT_CLONE_PATH: "$CI_BUILDS_DIR/gitlab-kitware-cmake ci"
+
+.macos_ninja: &macos_ninja
+    extends: .macos
+
+    variables:
+        CMAKE_CONFIGURATION: macos_ninja
+        CTEST_NO_WARNINGS_ALLOWED: 1
+
+.macos_makefiles: &macos_makefiles
+    extends: .macos
+
+    variables:
+        CMAKE_CONFIGURATION: macos_makefiles
+        CTEST_NO_WARNINGS_ALLOWED: 1
+        CMAKE_GENERATOR: "Unix Makefiles"
+
+.linux_builder_tags: &linux_builder_tags
+    tags:
+        - build
+        - docker
+        - linux
+
+.linux_builder_tags_qt: &linux_builder_tags_qt
+    tags:
+        - build
+        - docker
+        - linux
+        - linux-3.17 # Needed to be able to load Fedora's Qt libraries.
+
+.macos_builder_tags: &macos_builder_tags
+    tags:
+        - cmake # Since this is a bare runner, pin to a project.
+        - macos
+        - shell
+
 before_script:
     - .gitlab/ci/cmake.sh
     - .gitlab/ci/ninja.sh
@@ -65,14 +108,11 @@ before_script:
 .cmake_build_unix: &cmake_build_unix
     stage: build
     only: *only_settings
-    tags:
-        - build
-        - docker
-        - linux
 
     script:
         - .gitlab/ci/sccache.sh
-        - sccache --start-server
+        # Allow the server to already be running.
+        - "sccache --start-server || :"
         - sccache --show-stats
         - "$LAUNCHER ctest -VV -S .gitlab/ci/ctest_configure.cmake"
         - "$LAUNCHER ctest -VV -S .gitlab/ci/ctest_build.cmake"
@@ -143,10 +183,6 @@ before_script:
 .cmake_test_unix: &cmake_test_unix
     stage: test
     only: *only_settings
-    tags:
-        - build
-        - docker
-        - linux
 
     script:
         - "$LAUNCHER ctest --output-on-failure -V -S .gitlab/ci/ctest_test.cmake"
@@ -161,38 +197,33 @@ build:debian10-iwyu:
     <<:
         - *debian10_iwyu
         - *cmake_build_unix
+        - *linux_builder_tags
 
 build:fedora31-tidy:
     <<:
         - *fedora31_tidy
         - *cmake_build_unix
+        - *linux_builder_tags
 
 build:fedora31-sphinx:
     <<:
         - *fedora31_sphinx
         - *cmake_build_unix
-    tags:
-        - build
-        - docker
-        - linux
-        - linux-3.17 # Needed to be able to load Fedora's Qt libraries.
+        - *linux_builder_tags_qt
 
 build:fedora31-ninja:
     <<:
         - *fedora31_ninja
         - *cmake_build_unix
         - *cmake_build_artifacts
+        - *linux_builder_tags
     when: manual
 
 test:fedora31-ninja:
     <<:
         - *fedora31_ninja
         - *cmake_test_unix
-    tags:
-        - build
-        - docker
-        - linux
-        - linux-3.17 # Needed to be able to load Fedora's Qt libraries.
+        - *linux_builder_tags_qt
     dependencies:
         - build:fedora31-ninja
     needs:
@@ -203,18 +234,51 @@ build:fedora31-makefiles:
         - *fedora31_makefiles
         - *cmake_build_unix
         - *cmake_build_artifacts
+        - *linux_builder_tags
     when: manual
 
 test:fedora31-makefiles:
     <<:
         - *fedora31_makefiles
         - *cmake_test_unix
-    tags:
-        - build
-        - docker
-        - linux
-        - linux-3.17 # Needed to be able to load Fedora's Qt libraries.
+        - *linux_builder_tags_qt
     dependencies:
         - build:fedora31-makefiles
     needs:
         - build:fedora31-makefiles
+
+build:macos-ninja:
+    <<:
+        - *macos_ninja
+        - *cmake_build_unix
+        - *cmake_build_artifacts
+        - *macos_builder_tags
+    when: manual
+
+test:macos-ninja:
+    <<:
+        - *macos_ninja
+        - *cmake_test_unix
+        - *macos_builder_tags
+    dependencies:
+        - build:macos-ninja
+    needs:
+        - build:macos-ninja
+
+build:macos-makefiles:
+    <<:
+        - *macos_makefiles
+        - *cmake_build_unix
+        - *cmake_build_artifacts
+        - *macos_builder_tags
+    when: manual
+
+test:macos-makefiles:
+    <<:
+        - *macos_makefiles
+        - *cmake_test_unix
+        - *macos_builder_tags
+    dependencies:
+        - build:macos-makefiles
+    needs:
+        - build:macos-makefiles
diff --git a/.gitlab/ci/cmake.sh b/.gitlab/ci/cmake.sh
index 4b2f53f..658a62a 100755
--- a/.gitlab/ci/cmake.sh
+++ b/.gitlab/ci/cmake.sh
@@ -3,14 +3,38 @@
 set -e
 
 readonly version="3.17.2"
-readonly sha256sum="dc57f3cc448ca67fc8776b4ad4c22b087b9c6a8e459938b9622b8c7f4ef6b21e"
-readonly filename="cmake-$version-Linux-x86_64"
+
+case "$( uname -s )" in
+    Linux)
+        shatool="sha256sum"
+        sha256sum="dc57f3cc448ca67fc8776b4ad4c22b087b9c6a8e459938b9622b8c7f4ef6b21e"
+        platform="Linux"
+        ;;
+    Darwin)
+        shatool="shasum -a 256"
+        sha256sum="139500e20b080444fcafe57f24f57248c691c5187cce6695bee2b9aad6792c7d"
+        platform="Darwin"
+        ;;
+    *)
+        echo "Unrecognized platform $( uname -s )"
+        exit 1
+        ;;
+esac
+readonly shatool
+readonly sha256sum
+readonly platform
+
+readonly filename="cmake-$version-$platform-x86_64"
 readonly tarball="$filename.tar.gz"
 
 cd .gitlab
 
 echo "$sha256sum  $tarball" > cmake.sha256sum
 curl -OL "https://github.com/Kitware/CMake/releases/download/v$version/$tarball"
-sha256sum --check cmake.sha256sum
+$shatool --check cmake.sha256sum
 tar xf "$tarball"
 mv "$filename" cmake
+
+if [ "$( uname -s )" = "Darwin" ]; then
+    ln -s CMake.app/Contents/bin cmake/bin
+fi
diff --git a/.gitlab/ci/configure_macos_makefiles.cmake b/.gitlab/ci/configure_macos_makefiles.cmake
new file mode 100644
index 0000000..33f0db0
--- /dev/null
+++ b/.gitlab/ci/configure_macos_makefiles.cmake
@@ -0,0 +1 @@
+include("${CMAKE_CURRENT_LIST_DIR}/configure_common.cmake")
diff --git a/.gitlab/ci/configure_macos_ninja.cmake b/.gitlab/ci/configure_macos_ninja.cmake
new file mode 100644
index 0000000..33f0db0
--- /dev/null
+++ b/.gitlab/ci/configure_macos_ninja.cmake
@@ -0,0 +1 @@
+include("${CMAKE_CURRENT_LIST_DIR}/configure_common.cmake")
diff --git a/.gitlab/ci/ninja.sh b/.gitlab/ci/ninja.sh
index 31da12b..93c1ee9 100755
--- a/.gitlab/ci/ninja.sh
+++ b/.gitlab/ci/ninja.sh
@@ -3,13 +3,33 @@
 set -e
 
 readonly version="1.10.0"
-readonly sha256sum="6566836ddf3d72ca06685b34814e0c6fa0f0943542d651d0dab3150f10307c82"
-readonly filename="ninja-linux"
+
+case "$( uname -s )" in
+    Linux)
+        shatool="sha256sum"
+        sha256sum="6566836ddf3d72ca06685b34814e0c6fa0f0943542d651d0dab3150f10307c82"
+        platform="linux"
+        ;;
+    Darwin)
+        shatool="shasum -a 256"
+        sha256sum="2ee405c0e205d55666c60cc9c0d8d04c8ede06d3ef2e2c2aabe08fd81c17d22e"
+        platform="mac"
+        ;;
+    *)
+        echo "Unrecognized platform $( uname -s )"
+        exit 1
+        ;;
+esac
+readonly shatool
+readonly sha256sum
+readonly platform
+
+readonly filename="ninja-$platform"
 readonly tarball="$filename.zip"
 
 cd .gitlab
 
 echo "$sha256sum  $tarball" > ninja.sha256sum
 curl -OL "https://github.com/ninja-build/ninja/releases/download/v$version/$tarball"
-sha256sum --check ninja.sha256sum
+$shatool --check ninja.sha256sum
 ./cmake/bin/cmake -E tar xf "$tarball"
diff --git a/.gitlab/ci/sccache.sh b/.gitlab/ci/sccache.sh
index c88cdcc..f7d51ff 100755
--- a/.gitlab/ci/sccache.sh
+++ b/.gitlab/ci/sccache.sh
@@ -2,15 +2,35 @@
 
 set -e
 
-readonly version="0.2.12"
-readonly sha256sum="26fd04c1273952cc2a0f359a71c8a1857137f0ee3634058b3f4a63b69fc8eb7f"
-readonly filename="sccache-$version-x86_64-unknown-linux-musl"
+readonly version="0.2.13"
+
+case "$( uname -s )" in
+    Linux)
+        shatool="sha256sum"
+        sha256sum="28a5499e340865b08b632306b435913beb590fbd7b49a3f887a623b459fabdeb"
+        platform="x86_64-unknown-linux-musl"
+        ;;
+    Darwin)
+        shatool="shasum -a 256"
+        sha256sum="f564e948abadfc9e409eb1cd7babf24c6784057d5506c3b0a04cdd37cd830ae9"
+        platform="x86_64-apple-darwin"
+        ;;
+    *)
+        echo "Unrecognized platform $( uname -s )"
+        exit 1
+        ;;
+esac
+readonly shatool
+readonly sha256sum
+readonly platform
+
+readonly filename="sccache-$version-$platform"
 readonly tarball="$filename.tar.gz"
 
 cd .gitlab
 
 echo "$sha256sum  $tarball" > sccache.sha256sum
 curl -OL "https://github.com/mozilla/sccache/releases/download/$version/$tarball"
-sha256sum --check sccache.sha256sum
+$shatool --check sccache.sha256sum
 tar xf "$tarball"
 mv "$filename/sccache" .
-- 
cgit v0.12


From 809f9a99165e1e8463a9af398282c8fa01ff761b Mon Sep 17 00:00:00 2001
From: Ben Boeckel <ben.boeckel@kitware.com>
Date: Wed, 20 May 2020 09:37:45 -0400
Subject: gitlab: add powershell scripts for utilities

---
 .gitlab/ci/cmake.ps1     | 18 ++++++++++++++++++
 .gitlab/ci/ninja.ps1     | 17 +++++++++++++++++
 .gitlab/ci/sccache.ps1   | 22 ++++++++++++++++++++++
 .gitlab/ci/vcvarsall.ps1 |  9 +++++++++
 4 files changed, 66 insertions(+)
 create mode 100755 .gitlab/ci/cmake.ps1
 create mode 100755 .gitlab/ci/ninja.ps1
 create mode 100755 .gitlab/ci/sccache.ps1
 create mode 100755 .gitlab/ci/vcvarsall.ps1

diff --git a/.gitlab/ci/cmake.ps1 b/.gitlab/ci/cmake.ps1
new file mode 100755
index 0000000..3b42cae
--- /dev/null
+++ b/.gitlab/ci/cmake.ps1
@@ -0,0 +1,18 @@
+$erroractionpreference = "stop"
+
+$version = "3.17.2"
+$sha256sum = "CF82B1EB20B6FBE583487656FCD496490FFCCDFBCBBA0F26E19F1C9C63B0B041"
+$filename = "cmake-$version-win64-x64"
+$tarball = "$filename.zip"
+
+$outdir = $pwd.Path
+$outdir = "$outdir\.gitlab"
+Invoke-WebRequest -Uri "https://github.com/Kitware/CMake/releases/download/v$version/$tarball" -OutFile "$outdir\$tarball"
+$hash = Get-FileHash "$outdir\$tarball" -Algorithm SHA256
+if ($hash.Hash -ne $sha256sum) {
+    exit 1
+}
+
+Add-Type -AssemblyName System.IO.Compression.FileSystem
+[System.IO.Compression.ZipFile]::ExtractToDirectory("$outdir\$tarball", "$outdir")
+Move-Item -Path "$outdir\$filename" -Destination "$outdir\cmake"
diff --git a/.gitlab/ci/ninja.ps1 b/.gitlab/ci/ninja.ps1
new file mode 100755
index 0000000..91f8b02
--- /dev/null
+++ b/.gitlab/ci/ninja.ps1
@@ -0,0 +1,17 @@
+$erroractionpreference = "stop"
+
+$version = "1.10.0"
+$sha256sum = "919FD158C16BF135E8A850BB4046EC1CE28A7439EE08B977CD0B7F6B3463D178"
+$filename = "ninja-win"
+$tarball = "$filename.zip"
+
+$outdir = $pwd.Path
+$outdir = "$outdir\.gitlab"
+Invoke-WebRequest -Uri "https://github.com/ninja-build/ninja/releases/download/v$version/$tarball" -OutFile "$outdir\$tarball"
+$hash = Get-FileHash "$outdir\$tarball" -Algorithm SHA256
+if ($hash.Hash -ne $sha256sum) {
+    exit 1
+}
+
+Add-Type -AssemblyName System.IO.Compression.FileSystem
+[System.IO.Compression.ZipFile]::ExtractToDirectory("$outdir\$tarball", "$outdir")
diff --git a/.gitlab/ci/sccache.ps1 b/.gitlab/ci/sccache.ps1
new file mode 100755
index 0000000..6231c72
--- /dev/null
+++ b/.gitlab/ci/sccache.ps1
@@ -0,0 +1,22 @@
+$erroractionpreference = "stop"
+
+# 0.2.13 is unavailable right now.
+# https://github.com/mozilla/sccache/issues/677
+$version = "0.2.12"
+$sha256sum = "FD05E91C59B9497D4EBAE311B47A982F2A6EB942DCA3C9C314CC1FB36F8BC64D"
+$filename = "sccache-$version-x86_64-pc-windows-msvc"
+$tarball = "$filename.tar.gz"
+
+$outdir = $pwd.Path
+$outdir = "$outdir\.gitlab"
+Invoke-WebRequest -Uri "https://github.com/mozilla/sccache/releases/download/$version/$tarball" -OutFile "$outdir\$tarball"
+$hash = Get-FileHash "$outdir\$tarball" -Algorithm SHA256
+if ($hash.Hash -ne $sha256sum) {
+    exit 1
+}
+
+$curdir = $pwd.Path
+Set-Location -Path "$outdir"
+cmake -E tar xzf "$outdir\$tarball"
+Move-Item -Path "$outdir\$filename\sccache.exe" -Destination "$outdir\sccache.exe"
+Set-Location -Path "$curdir"
diff --git a/.gitlab/ci/vcvarsall.ps1 b/.gitlab/ci/vcvarsall.ps1
new file mode 100755
index 0000000..a48b511
--- /dev/null
+++ b/.gitlab/ci/vcvarsall.ps1
@@ -0,0 +1,9 @@
+$erroractionpreference = "stop"
+
+cmd /c "`"$env:VCVARSALL`" $VCVARSPLATFORM & set" |
+foreach {
+    if ($_ -match "=") {
+        $v = $_.split("=")
+        [Environment]::SetEnvironmentVariable($v[0], $v[1])
+    }
+}
-- 
cgit v0.12


From 5b564c371efefe3b86aea1a0d0575475e5b321c5 Mon Sep 17 00:00:00 2001
From: Ben Boeckel <ben.boeckel@kitware.com>
Date: Wed, 20 May 2020 09:36:54 -0400
Subject: gitlab-ci: add Windows infrastructure

---
 .gitlab-ci.yml                    | 79 ++++++++++++++++++++++++++++++++++++++-
 .gitlab/ci/configure_common.cmake |  4 ++
 2 files changed, 81 insertions(+), 2 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 421c3f9..5fd1702 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -79,6 +79,26 @@
         CTEST_NO_WARNINGS_ALLOWED: 1
         CMAKE_GENERATOR: "Unix Makefiles"
 
+.windows: &windows
+    variables:
+        # Note that shell runners only support runners with a single
+        # concurrency level. We can't use `$CI_CONCURRENCY_ID` because this may
+        # change between the build and test stages which CMake doesn't support.
+        # Even if we could, it could change if other runners on the machine
+        # could run at the same time, so we drop it.
+        # Blocked on https://gitlab.com/gitlab-org/gitlab-runner/-/merge_requests/2122
+        #GIT_CLONE_PATH: "$CI_BUILDS_DIR\\gitlab-kitware-cmake ci"
+
+.windows_ninja: &windows_ninja
+    extends: .windows
+
+    variables:
+        # Debug and RelWithDebinfo build types use the `/Zi` which results in
+        # uncacheable compiations.
+        # https://github.com/mozilla/sccache/issues/242
+        CMAKE_BUILD_TYPE: Release
+        CTEST_NO_WARNINGS_ALLOWED: 1
+
 .linux_builder_tags: &linux_builder_tags
     tags:
         - build
@@ -98,18 +118,33 @@
         - macos
         - shell
 
-before_script:
+.windows_builder_tags: &windows_builder_tags
+    tags:
+        - cmake # Since this is a bare runner, pin to a project.
+        - windows
+        - shell
+
+.before_script_unix: &before_script_unix
     - .gitlab/ci/cmake.sh
     - .gitlab/ci/ninja.sh
     - export PATH=$PWD/.gitlab:$PWD/.gitlab/cmake/bin:$PATH
     - cmake --version
     - ninja --version
 
+.before_script_windows: &before_script_windows
+    - Invoke-Expression -Command .gitlab/ci/cmake.ps1
+    - Invoke-Expression -Command .gitlab/ci/ninja.ps1
+    - $pwdpath = $pwd.Path
+    - Set-Item -Force -Path "env:PATH" -Value "$pwdpath\.gitlab;$pwdpath\.gitlab\cmake\bin;$env:PATH"
+    - cmake --version
+    - ninja --version
+
 .cmake_build_unix: &cmake_build_unix
     stage: build
     only: *only_settings
 
     script:
+        - *before_script_unix
         - .gitlab/ci/sccache.sh
         # Allow the server to already be running.
         - "sccache --start-server || :"
@@ -120,6 +155,23 @@ before_script:
 
     interruptible: true
 
+.cmake_build_windows: &cmake_build_windows
+    stage: build
+    only: *only_settings
+
+    script:
+        - *before_script_windows
+        - Invoke-Expression -Command .gitlab/ci/sccache.ps1
+        - Invoke-Expression -Command .gitlab/ci/vcvarsall.ps1
+        - sccache --start-server
+        - sccache --show-stats
+        - ctest -VV -S .gitlab/ci/ctest_configure.cmake
+        - ctest -VV -S .gitlab/ci/ctest_build.cmake
+        - sccache --show-stats
+        - sccache --stop-server
+
+    interruptible: true
+
 .cmake_build_artifacts: &cmake_build_artifacts
     artifacts:
         expire_in: 1d
@@ -148,17 +200,28 @@ before_script:
             - build/Tests/CMakeBuildTest.cmake
             - build/Tests/CMakeBuildDoubleProjectTest.cmake
             - build/Tests/CMake*/runcompilecommands
+            - build/Tests/CMake*/runcompilecommands.exe
             - build/Tests/CMake*/test*
             - build/Tests/CMake*/PseudoMemcheck/valgrind
             - build/Tests/CMake*/PseudoMemcheck/purify
             - build/Tests/CMake*/PseudoMemcheck/memcheck_fail
             - build/Tests/CMake*/PseudoMemcheck/BC
+            - build/Tests/CMake*/PseudoMemcheck/valgrind.exe
+            - build/Tests/CMake*/PseudoMemcheck/purify.exe
+            - build/Tests/CMake*/PseudoMemcheck/memcheck_fail.exe
+            - build/Tests/CMake*/PseudoMemcheck/BC.exe
             - build/Tests/CMake*/PseudoMemcheck/NoLog
             - build/Tests/CMake*Lib/*LibTests
+            - build/Tests/CMake*Lib/*LibTests.exe
             - build/Source/kwsys/cmsysTest*
+            - build/Source/kwsys/testConsoleBufChild.exe
             - build/Utilities/cmcurl/curltest
+            - build/Utilities/cmcurl/curltest.exe
             - build/Utilities/KWIML/test/kwiml_test
-            - build/Source/kwsys/libcmsysTestDynload.so
+            - build/Utilities/KWIML/test/kwiml_test.exe
+            - build/Source/kwsys/*cmsysTestDynload.*
+            - build/Source/kwsys/dynloaddir/cmsysTestDynloadImpl.dll
+            - build/Source/kwsys/dynloaddir/cmsysTestDynloadUse.dll
 
             # Test directories.
             - build/Tests/CTest*
@@ -185,10 +248,22 @@ before_script:
     only: *only_settings
 
     script:
+        - *before_script_unix
         - "$LAUNCHER ctest --output-on-failure -V -S .gitlab/ci/ctest_test.cmake"
 
     interruptible: true
 
+.cmake_test_windows: &cmake_test_windows
+    stage: test
+    only: *only_settings
+
+    script:
+        - *before_script_windows
+        - Invoke-Expression -Command .gitlab/ci/vcvarsall.ps1
+        - ctest --output-on-failure -V -S .gitlab/ci/ctest_test.cmake
+
+    interruptible: true
+
 stages:
     - build
     - test
diff --git a/.gitlab/ci/configure_common.cmake b/.gitlab/ci/configure_common.cmake
index 165ae55..4585224 100644
--- a/.gitlab/ci/configure_common.cmake
+++ b/.gitlab/ci/configure_common.cmake
@@ -6,4 +6,8 @@ set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY "ON" CACHE STRING "")
 set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE PATH "")
 set(CMake_TEST_INSTALL "OFF" CACHE BOOL "")
 
+if (NOT "$ENV{CMAKE_BUILD_TYPE}" STREQUAL "")
+  set(CMAKE_BUILD_TYPE "$ENV{CMAKE_BUILD_TYPE}" CACHE STRING "")
+endif ()
+
 include("${CMAKE_CURRENT_LIST_DIR}/configure_sccache.cmake")
-- 
cgit v0.12


From b566f0b30817270c89fc64bb11fade61bd08d0c0 Mon Sep 17 00:00:00 2001
From: Ben Boeckel <ben.boeckel@kitware.com>
Date: Wed, 20 May 2020 09:38:52 -0400
Subject: gitlab-ci: add windows builder

---
 .gitlab-ci.yml                                     | 26 ++++++++++++++++++++++
 .../ci/configure_windows_vs2019_x64_ninja.cmake    |  3 +++
 2 files changed, 29 insertions(+)
 create mode 100644 .gitlab/ci/configure_windows_vs2019_x64_ninja.cmake

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 5fd1702..5795af8 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -99,6 +99,14 @@
         CMAKE_BUILD_TYPE: Release
         CTEST_NO_WARNINGS_ALLOWED: 1
 
+.windows_vs2019_x64_ninja: &windows_vs2019_x64_ninja
+    extends: .windows_ninja
+
+    variables:
+        CMAKE_CONFIGURATION: windows_vs2019_x64_ninja
+        VCVARSALL: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Professional\\VC\\Auxiliary\\Build\\vcvarsall.bat"
+        VCVARSPLATFORM: x64
+
 .linux_builder_tags: &linux_builder_tags
     tags:
         - build
@@ -357,3 +365,21 @@ test:macos-makefiles:
         - build:macos-makefiles
     needs:
         - build:macos-makefiles
+
+build:windows-vs2019-x64-ninja:
+    <<:
+        - *windows_vs2019_x64_ninja
+        - *cmake_build_windows
+        - *cmake_build_artifacts
+        - *windows_builder_tags
+    when: manual
+
+test:windows-vs2019-x64-ninja:
+    <<:
+        - *windows_vs2019_x64_ninja
+        - *cmake_test_windows
+        - *windows_builder_tags
+    dependencies:
+        - build:windows-vs2019-x64-ninja
+    needs:
+        - build:windows-vs2019-x64-ninja
diff --git a/.gitlab/ci/configure_windows_vs2019_x64_ninja.cmake b/.gitlab/ci/configure_windows_vs2019_x64_ninja.cmake
new file mode 100644
index 0000000..e2f00dd
--- /dev/null
+++ b/.gitlab/ci/configure_windows_vs2019_x64_ninja.cmake
@@ -0,0 +1,3 @@
+set(CMake_TEST_WIX_NO_VERIFY "ON" CACHE BOOL "")
+
+include("${CMAKE_CURRENT_LIST_DIR}/configure_common.cmake")
-- 
cgit v0.12