Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. CMake - syntax error ?

CMake - syntax error ?

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorialquestionannouncement
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    Vaclav_
    wrote on last edited by
    #1

    I hope this forum will forgive me to ask this, but... CMake wants to have line added cmake_minimum_required(VERSION 3.5) after which opencv.sh complains ./opencv.sh: line 1: syntax error near unexpected token `VERSION' ./opencv.sh: line 1: `cmake_minimum_required(VERSION 3.5)' I am enclosing my crude log to illustrate some details. And no, I do not know how to change CMake options to remove this version requirement and still would like to know the "syntax" error I made. pre lang="text">

    CMake Error at traincascade/CMakeLists.txt:2 (ocv_check_dependencies):
    Unknown CMake command "ocv_check_dependencies".
    CMake Warning (dev) in CMakeLists.txt:
    No cmake_minimum_required command is present. A line of code such as

    cmake_minimum_required(VERSION 3.5)

    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!
    after adding
    CMake Error at traincascade/CMakeLists.txt:2 (ocv_check_dependencies):
    Unknown CMake command "ocv_check_dependencies".
    CMake Warning (dev) in CMakeLists.txt:
    No cmake_minimum_required command is present. A line of code such as

    cmake_minimum_required(VERSION 3.5)

    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!
    after adding

    Cmake complains

    im-desktop:~$ ./opencv.sh
    ./opencv.sh: line 1: syntax error near unexpected token `VERSION'
    ./opencv.sh: line 1: `cmake_minimum_required(VERSION 3.5)'
    jim@jim-desktop:~$

    Cheers Vaclav

    J 1 Reply Last reply
    0
    • V Vaclav_

      I hope this forum will forgive me to ask this, but... CMake wants to have line added cmake_minimum_required(VERSION 3.5) after which opencv.sh complains ./opencv.sh: line 1: syntax error near unexpected token `VERSION' ./opencv.sh: line 1: `cmake_minimum_required(VERSION 3.5)' I am enclosing my crude log to illustrate some details. And no, I do not know how to change CMake options to remove this version requirement and still would like to know the "syntax" error I made. pre lang="text">

      CMake Error at traincascade/CMakeLists.txt:2 (ocv_check_dependencies):
      Unknown CMake command "ocv_check_dependencies".
      CMake Warning (dev) in CMakeLists.txt:
      No cmake_minimum_required command is present. A line of code such as

      cmake_minimum_required(VERSION 3.5)

      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!
      after adding
      CMake Error at traincascade/CMakeLists.txt:2 (ocv_check_dependencies):
      Unknown CMake command "ocv_check_dependencies".
      CMake Warning (dev) in CMakeLists.txt:
      No cmake_minimum_required command is present. A line of code such as

      cmake_minimum_required(VERSION 3.5)

      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!
      after adding

      Cmake complains

      im-desktop:~$ ./opencv.sh
      ./opencv.sh: line 1: syntax error near unexpected token `VERSION'
      ./opencv.sh: line 1: `cmake_minimum_required(VERSION 3.5)'
      jim@jim-desktop:~$

      Cheers Vaclav

      J Offline
      J Offline
      Jochen Arndt
      wrote on last edited by
      #2

      ./opencv.sh: line 1: syntax error near unexpected token `VERSION'
      ./opencv.sh: line 1: `cmake_minimum_required(VERSION 3.5)'

      The error ir pretty clear: There is a syntax error in line 1 of the file opencv.sh. The .sh extension indicates that it is a shell script file which is processed by the shell (probably bash) which will off course know nothing about CMake commands.

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

      cmake_minimum_required(VERSION 3.5)

      Here CMake complains about a missing command in the file CMakeLists.txt. So you have to add the command to the CMake file CMakeLists.txt.

      V 1 Reply Last reply
      0
      • J Jochen Arndt

        ./opencv.sh: line 1: syntax error near unexpected token `VERSION'
        ./opencv.sh: line 1: `cmake_minimum_required(VERSION 3.5)'

        The error ir pretty clear: There is a syntax error in line 1 of the file opencv.sh. The .sh extension indicates that it is a shell script file which is processed by the shell (probably bash) which will off course know nothing about CMake commands.

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

        cmake_minimum_required(VERSION 3.5)

        Here CMake complains about a missing command in the file CMakeLists.txt. So you have to add the command to the CMake file CMakeLists.txt.

        V Offline
        V Offline
        Vaclav_
        wrote on last edited by
        #3

        It is not about clarity of the error - I am asking WHAT is the syntax error. I have "cut and paste" the required line from the CMake output. Do I need to define "token" VERSION" ? How?

        L J 2 Replies Last reply
        0
        • V Vaclav_

          It is not about clarity of the error - I am asking WHAT is the syntax error. I have "cut and paste" the required line from the CMake output. Do I need to define "token" VERSION" ? How?

          L Offline
          L Offline
          leon de boer
          wrote on last edited by
          #4

          You are missing the point it is complaining about there is no cmake_minimum_required(VERSION 3.5) in CMakeLists.txt You said you cut and paste "cmake_minimum_required(VERSION 3.5)" but did you put it into CMakeLists.txt, you didn't put in the script file per chance?????? I am not being condescending here but I need to check, you do get the script file has nothing to do with cmake. Like you we are a bit perplexed because it's step 1 of any cmake file. Usually the first two lines of CMakeLists.txt are

          make_minimum_required (VERSION x.x)
          project (_MY_PROJECT_NAME_)

          _MY_PROJECT_NAME_ being what you want to call the project I am sorry for having to ask and check all these really beginner stuff but there is something strange going on. Whatever the situation I suggest you simply open up a command line window, change to the directory and manually type in the cmake command (so we have any scripts out of the way) and we can see the exact screen spit from cmake itself without the script which is just another source of possible error. Assuming we pass all this basic stuff there is left one other possibility that your first makelist pulls other makelists and those later makelists have version requirements but that is not the sort of error you seem to be getting. The problem is the exact messages change depending on version CMake and exact OS type so I will leave it as a possibility.

          In vino veritas

          1 Reply Last reply
          0
          • V Vaclav_

            It is not about clarity of the error - I am asking WHAT is the syntax error. I have "cut and paste" the required line from the CMake output. Do I need to define "token" VERSION" ? How?

            J Offline
            J Offline
            Jochen Arndt
            wrote on last edited by
            #5

            The syntax error is: The program processing the file is not able to parse the command cmake_minimum_required(VERSION 3.5). The reason is: You have pasted the command into the file opencv.sh which is processed by the shell (the Unix command line interpreter; see Unix shell - Wikipedia[^] ). But it should be pasted into the file CMakeLists.txt which is processed by CMake. The solution (see my initial answer):

            Quote:

            So you have to add the command to the CMake file CMakeLists.txt.

            instead of opencv.sh.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups