1
votes

First of all I wanna say I am aware of below questions

Parse error. Function missing ending ")" CMAKE

CMake's execute_process and arbitrary shell scripts

But I couldn't understand solution provided in these questions, because I don't know much about cmake commands and also I think my problem context is different.

I am trying to compile https://github.com/openalpr/imageclipper this software. I am following instructions in README file which says to do only two following commands

1.) cmake ./

2.) make

But while issuing first command I get this error ->


C:\Users\vishal tewatia\Downloads\imageclipper-master>cmake ./ CMake Error at CMakeLists.txt:25: Parse error. Function missing ending ")". Instead found unterminated string with text ")

ENDIF()

SET(SRC

src/imageclipper.cpp

)

ADD_EXECUTABLE( ${PROJECT_NAME} ${SRC} )

TARGET_LINK_LIBRARIES( ${PROJECT_NAME} ${OpenCV_LIBS}

C:/boost_1_65_1/stage/lib

)".

-- Configuring incomplete, errors occurred! See also "C:/Users/vishal tewatia/Downloads/imageclipper-master/CMakeFiles/CMakeOutput.log".


Below is CMakeLists.txt file

cmake_minimum_required (VERSION 2.6) 

project(imageclipper)
SET(PROJECT_VERSION "0.1")


SET(OpenCV_DIR "C:\opencv\build\install\x64\vc15\bin\")


# Opencv Package
FIND_PACKAGE( OpenCV REQUIRED )
IF (${OpenCV_VERSION} VERSION_LESS 2.3.0)
    MESSAGE(FATAL_ERROR "OpenCV version is not compatible : 
${OpenCV_VERSION}")
ENDIF()



SET(SRC
  src/imageclipper.cpp
)

ADD_EXECUTABLE( ${PROJECT_NAME} ${SRC} )
TARGET_LINK_LIBRARIES( ${PROJECT_NAME}  ${OpenCV_LIBS} 
    C:/boost_1_65_1/stage/lib
    )

I don't understand why is it says that function has missing ")" , because in CMakeLists.txt file all opened brackets are closed. or if the error is regarding "C:/boost_1_65_1/stage/lib" this address not properly formatted , I am not sure then what to do , Please help.

1
Perhaps a problem with backward slashes in the path when you set OpenCV_DIR? Backward slashes in CMake strings needs to be escaped like in C++ strings. - Some programmer dude
That's likely it. Best to just use forward slashes all the time. - Retired Ninja
and set custom paths on the command line, not in cmake code. Otherwise when I try to build your project on a machine where I have installed opencv somewhere else, it won't work! - Richard Hodges

1 Answers

3
votes

ok , so I found the solution , All it needs is \\ instead of \ while setting OpenCV_DIR