Cmake not seeing project or cmake_minimum_required

I’m trying to install a package called libsnark on a mac (OS 15.1.1, M3). I’m using cmake 3.31 available from homebrew. Its CMakeLists.txt file starts with

cmake_minimum_required(VERSION 2.8)

project (libsnark)

Nevertheless, when I run cmake I get the following errors/warnings:

CMake Warning (dev) in CMakeLists.txt:
  cmake_minimum_required() should be called prior to this top-level project()
  call.  Please see the cmake-commands(7) manual for usage documentation of
  both commands.

and

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.

Why is this happening, and how can I debug this?

Right after the above lines there is the following

set(
  CURVE
  "BN128"
  CACHE
  STRING
  "Default curve: one of ALT_BN128, BN128, EDWARDS, MNT4, MNT6"
)

Nevertheless, later in the file it has

if(${CURVE} STREQUAL "BN128")
  add_definitions(
    -DBN_SUPPORT_SNARK=1
  )
endif()

but this gives the error

CMake Error at CMakeLists.txt:2 (if):
  if given arguments:

    "STREQUAL" "BN128"

  Unknown arguments specified

(It’s strange that this says it’s at line 2, when the actual statement is at line 165).

An suggestions as to how to debug this?

[quote=“Victor Miller, post:1, topic:13091, username:algebravic”]
this
[/quote]Can I use different generator in same project? - #4 by Masoudahg1