Unknown CMake command "gmx_set_custom_target_output" error

GROMACS version:2021.2 & 3
GROMACS modification: NO

Appreciate your help in resolving the following CMake error.

CMake command executed in “x64 Native Tools Command Prompt for VS 2019”

Command:

cmake -G "NMake Makefiles" -S. -B./build -DGMX_GPU=CUDA -DGMX_FFT_LIBRARY=mkl -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=off -DMKL_INCLUDE_DIR="C:/Program Files (x86)/Intel/oneAPI/mkl/2021.1.1/include" -DMKL_LIBRARIES="C:/Program Files (x86)/Intel/oneAPI/mkl/2021.1.1/lib/intel64/mkl_intel_lp64.lib;C:/Program Files (x86)/Intel/oneAPI/mkl/2021.1.1/lib/intel64/mkl_sequential.lib;C:/Program Files (x86)/Intel/oneAPI/mkl/2021.4.0/lib/intel64/mkl_core.lib"

Error

CMake Error at gromacs/ewald/CMakeLists.txt:157 (gmx_set_custom_target_output):
  Unknown CMake command "gmx_set_custom_target_output".

CMakelist Line 157

add_custom_target(ocl_pme_kernels DEPENDS ${PME_OCL_KERNELS} )
gmx_set_custom_target_output(ocl_pme_kernels ${PME_OCL_KERNELS})

Complete Output

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 MSVC 19.29.30136.0
-- The CXX compiler identification is MSVC 19.29.30136.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at gromacs/ewald/CMakeLists.txt:157 (gmx_set_custom_target_output):
  Unknown CMake command "gmx_set_custom_target_output".


CMake Warning (dev) in CMakeLists.txt:
  No cmake_minimum_required command is present.  A line of code such as

    cmake_minimum_required(VERSION 3.21)

  should be added at the top of the file.  The version specified may be lower
  if you wish to support older CMake versions for this project.  For more
  information run "cmake --help-policy CMP0000".
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Configuring incomplete, errors occurred!

I suggest to look at the cmake invocation in the gitlab actions where windows tests are running:

(check the “Raw logs” under the cog icon)