I am a maintainer of a library (OpenXLSX) and have recently augmented the CMake configuration to auto-pull dependencies via find_package or FetchContent from their source repositories, instead of including a copy of the dependencies with our own library.
I have been asking one of our Windows users to test a new configuration for me, and it seems to be non-trivial to get git working for FetchContent.
On their configuration, CMake complains about not finding git.
As this is a generic “getting started” problem:
Is there a comprehensive guide on installing CMake on Windows so that integration with git is working & commands like FetchContent can be used?
I have no access to a Windows test system, so I can’t trial & error a solution for this.
Any help is appreciated so I can instruct our users on how to prepare their CMake for building OpenXLSX.
With you phrasing this as an “or” question - are you saying that CMake on Windows runs without MinGW?
My question, reduced to the simplest form is:
“How do Windows users install CMake so that it can build projects whose CMake configuration invokes FetchContent commands?”
with the implication being that - as per the observed errors - FetchContent uses git in the background, and CMake in the install that my user reported a test from, does not “find” git.
Your last bullet list sounds like what I am looking for, and reasonably to the point.
Regarding your prior comment: I don’t understand the question about the build system - it’s CMake, hence me posting here The target system for Windows users is the system on which the build is taking place, i.e. also Windows.
For the toolchain: I would assume both work, gcc/g++ or MSVC, but I have no experience with MSVC (nor do I intend to ever touch it), so let’s focus on g++ for starters.
I will see if one of our users can test the installation sequence you proposed:
install MSYS2
via MSYS2, install
mingw-w64-x86_64-cmake
mingw-w64-x86_64-toolchain
git
run cmake from the mingw64 shell (without ninja, which I assume you wrote as an example)
Okay, so here is the list of steps that I actually needed and for which I needed to do some digging.
It would be really nice if you could include these (with optional build systems MSYS, mingw and Ninja) into the documentation:
Install MSYS2:
In a Powershell (run as Administrator): run winget install --id MSYS2.MSYS2 -e
→ After performing this step, the “MSYS2 MSYS shell” and the “MSYS2 MinGW 64-bit shell” should be accessible from the Start Menu
In MSYS2 MSYS shell: run pacman -Syu
The previous instruction might require a close & reopen of the MSYS2 MSYS shell
In MSYS2 MSYS shell: run pacman -Su
Install development toolchain:
In MSYS2 MinGW 64‑bit shell: run pacman -S --needed base-devel mingw-w64-x86_64-toolchain
Install cmake & git in MSYS2 environment:
In MSYS2 MinGW 64‑bit shell: run pacman -S --needed mingw-w64-x86_64-cmake mingw-w64-x86_64-git (optional) In MSYS2 MinGW 64‑bit shell: run pacman -S --needed mingw-w64-x86_64-ninja
**
Verify installation:**
In MSYS2 MinGW 64‑bit shell: verify versions of git, cmake, gcc, g++