Unknown arguments specified

Hi community,

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

    "3.5.1" "VERSION_GREATER_EQUAL" "3.12"

  Unknown arguments specified


-- Configuring incomplete, errors occurred!

getting the above error while compiling the cmake code.

here is my cmake code.

# See https://cmake.org/cmake/help/v3.12/policy/CMP0074.html required by certain
# version of zlib which CURL depends on.
if("${CMAKE_VERSION}" VERSION_GREATER_EQUAL "3.12")
  cmake_policy(SET CMP0074 NEW)
endif()

any help would really appreciated.

Tried with the below code also, but then getting the same error.

if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.12")
  cmake_policy(SET CMP0074 NEW)
endif()

Thank you.
Regards,
Maiya

What version of CMake are you using? The VERSION_GREATER_EQUAL expression requires at least CMake 3.7.

its 3.5.1. However, why unknown arguments specified am getting?
Since it is value if that condition succeeds then control go inside the condition otherwise not. But here am getting unown arguments specified. I just wonder the way we specified in that condition is might be wrong? not the value of cmake version itself, which I believe.

Please correct me if I am wrong.

As Craig said, the operator VERSION_GREATER_EQUAL was introduced in CMake 3.7. So when CMake 3.5.1 is parsing the if() command, it doesn’t recognise that arugment and so it reports an unknown argument error.

If you need to support CMake so ancient, you can reword the condition using NOT and VERSION_LESS.