Cmake error when trying to build gromacs-2022.1

GROMACS version:2022.1
GROMACS modification: No
cmake version: 3.16.3

I am trying to build gromacs on wsl2 (Ubuntu-20.4 5.10.102.1-microsoft-standard-WSL2)
I have tried with gcc version 10 & 8 and get the same error:
CMake Warning (dev) in CMakeLists.txt:
No project() command is present. The top-level CMakeLists.txt file must
contain a literal, direct call to the project() command. Add a line of
code such as

project(ProjectName)

near the top of the file, but after cmake_minimum_required().

CMake is pretending there is a “project(Project)” command on the first
line.
This warning is for project developers. Use -Wno-dev to suppress it.

– The C compiler identification is GNU 8.4.0
– The CXX compiler identification is GNU 8.4.0
– Check for working C compiler: /usr/bin/cc
– Check for working C compiler: /usr/bin/cc – works
– Detecting C compiler ABI info
– Detecting C compiler ABI info - done
– Detecting C compile features
– Detecting C compile features - done
– Check for working CXX compiler: /usr/bin/c++
– Check for working CXX compiler: /usr/bin/c++ – works
– Detecting CXX compiler ABI info
– Detecting CXX compiler ABI info - done
– Detecting CXX compile features
– Detecting CXX compile features - done
CMake Error at gromacs/ewald/CMakeLists.txt:202 (gmx_set_custom_target_output):
Unknown CMake command “gmx_set_custom_target_output”.

I would appreciate it if anyone could help with this problem.

Thanks,
Peter

Hello Peter.

Judging by No project() command is present, it looks like you’re running CMake from a wrong directory. You should pass the very top-level directory to CMake (the one with INSTALL and README files), not the src directory.

That was indeed the problem and an oversight on my part since the Gromacs installation instructions clearly state that. Thanks a lot for your help. I really appreciate it.