Cmake compiler problem

I’ll preface this with me being a mechanical engineer and only really having experience coding in C++, so there may be an easy solution that I’m unaware of.

I’m trying to compile the full ogs on Windows with Visual Studio, I’ve cloned the git repository on VS from github, however, once opening this it states “CMake Generation Failed” - Debug
as well as:
1> Command line: “C:\WINDOWS\system32\cmd.exe” /c “%SYSTEMROOT%\System32\chcp.com 65001 >NUL && “C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\CMake\bin\cmake.exe” -G “Ninja” -DCMAKE_BUILD_TYPE:STRING=“Release” -DCMAKE_CONFIGURATION_TYPES:STRING=“Release” -DCMAKE_MAKE_PROGRAM=“C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\Ninja\ninja.exe” “C:\Users\richa\Source\Repos\OpenGeoSys” 2>&1”
1> Working directory: C:/Users/richa/Source/Repos/build/release
1> [CMake] – Generator: Ninja
1> [CMake] CMake Deprecation Warning at scripts/cmake/json-cmake/JSONParser.cmake:1 (cmake_minimum_required):
1> [CMake] Compatibility with CMake < 3.5 will be removed from a future version of
1> [CMake] CMake.
1> [CMake]
1> [CMake] Update the VERSION argument value or use a … suffix to tell
1> [CMake] CMake that the project does not need compatibility with older versions.
1> [CMake] Call Stack (most recent call first):
1> [CMake] scripts/cmake/Versions.cmake:1 (include)
1> [CMake] CMakeLists.txt:68 (include)
1> [CMake]
1> [CMake]
1> [CMake] – Could NOT find Git (missing: GIT_EXECUTABLE)
1> [CMake] CMake Error at scripts/cmake/GitSetup.cmake:17 (message):
1> [CMake] Git was not found. Either install Git or provide an OGS_VERSION as an
1> [CMake] environment- or CMake-variable!
1> [CMake] Call Stack (most recent call first):
1> [CMake] CMakeLists.txt:69 (include)
1> [CMake] – Configuring incomplete, errors occurred!

Additionally, It also shows this when I attempt to debug
"# Git detection
find_package(Git)
if(NOT Git_FOUND)
message(FATAL_ERROR “Git was not found. Either install Git or provide an
OGS_VERSION as an environment- or CMake-variable!”
)
"
From what I understand I’m missing the “git” file, could anyone direct me to the right place to download this? and would I download this to the same folderthat the repository has been loaded into?

Any help is greatly appreciated!

Hi Richard,

that’s strange. The error message indicates that Git is not installed on your system.
Did you really clone the repo with Git? Did you clone it directly from VS? Maybe VS includes some Git functionality that’s not detected by CMake.

You could try to install Git as explained in the dev guide: Set Up Prerequisites. On that page select windows in the upper part of the page:

Maybe it’s already pre-selected. Then scroll down to “Install Git” and follow the instructions.
Afterwards try to build OGS again.

Good luck!

Best regards,
Christoph

Hi Richard,

I guess git (the executable) is not available in the command line, i.e. not in your PATH.

You can test this if you simply run git [and then ENTER] in the command line. If it is not available you can add it to the PATH environment variable, see e.g. this: Git: Installing Git in PATH with GitHub client for Windows - Stack Overflow

Also I noticed you used CMake which is bundled with Visual Studio, we do not know if this works and do not support this.

Thank you for both of your help, I completely missed the prerequisites for the software.
I managed to get it compiled in Visual Studio.

1 Like