Compilation project with Cmake . I'm getting an error - opencv

I'm trying to compile a project with CMake. I'm getting an error:
Found OpenCV Windows Pack but it has not binaries compatible with your
configuration.
You should manually point CMake variable OpenCV_DIR to your build of OpenCV
library.
Call Stack (most recent call first):
CMakeLists.txt:9 (FIND_PACKAGE)
CMake Error at CMakeLists.txt:9 (FIND_PACKAGE):
Found package configuration file:
C:/Users/Ghenja/AppData/Local/opencv/build/OpenCVConfig.cmake
but it set OpenCV_FOUND to FALSE so package "OpenCV" is considered to be
NOT FOUND.
I don't understand what is happening. Please help me to solve this problem.

Clean your project and remove CMakeCache.txt. OpenCV_FOUND is probably cached now.
If that doesn't work, then run your cmake command with additional flags just to be sure:
cmake -DOpenCV_FOUND:BOOL=ON -DOpenCV_DIR=/path/to/your/OpenCV

Related

CMake error on Windows when building extra modules and CUDA

I am using Windows and using the CMake GUI. In CMake, I set the source code path at
C:/Users/me/Downloads/opencv
opencv and opencv_contribwere obtained from the OpenCV github repos
I set the build path in Cmake as C:/Users/me/Downloads/builds/opencv
I then set OPENCV_EXTRA_MODULES_PATH as C:/Users/me/Downloads/opencv-3.4/source/opencv_contrib/modules and checked WITH_CUDA
after Configuring, I get the error:
CMake Error at cmake/OpenCVDetectCUDA.cmake:125 (string):
string sub-command REPLACE requires at least four arguments.
Call Stack (most recent call first):
cmake/OpenCVDetectCUDA.cmake:174 (ocv_wipeout_deprecated)
cmake/OpenCVFindLibsPerf.cmake:43 (include)
CMakeLists.txt:688 (include)
can anyone help with this?

'cmake' will raise "OpenCVGenSetupVars.cmake" error (when configure OpenCV)

Recently I am tring to build OpenCV4 use cmake and vs2019 in Windows, but when I configure something, I got the following ERROR:
CMake Warning at cmake/OpenCVGenSetupVars.cmake:54 (message):
CONFIGURATION IS NOT SUPPORTED: validate setupvars script in install
directory
Call Stack (most recent call first):
CMakeLists.txt:1059 (include)
I check the file OpenCVGenSetupVars.cmake:54 and find these:
if(IS_ABSOLUTE "${__python_path}")
set(OPENCV_PYTHON_DIR_RELATIVE_CMAKECONFIG "${__python_path}")
message(WARNING "CONFIGURATION IS NOT SUPPORTED: validate setupvars script in install directory")
But my "python_path" is right, and I have no idea. Do you know what should I to do ?
I had the same problem. The compilation was still successful after ignoring this warning. So the second time I built it, I removed the configuration option(OPENCV_GENERATE_SETUPVARS).

opencv cmake warning meanings: CMakeLists.txt:1066 (include)

I am now building from source the opencv4.1.0 with cmake3.13. The cmake configuration gives a warning message saying:
CMake Warning at cmake/OpenCVGenSetupVars.cmake:54 (message):
CONFIGURATION IS NOT SUPPORTED: validate setupvars script in install
directory
Call Stack (most recent call first):
CMakeLists.txt:1066 (include)
What does this warning mean? Does that need be carefully addressed for starting the building process?
check the file cmake/OpenCVGenSetupVars.cmake
if(DEFINED __python_path)
if(IS_ABSOLUTE "${__python_path}")
set(OPENCV_PYTHON_DIR_RELATIVE_CMAKECONFIG "${__python_path}")
message(WARNING "CONFIGURATION IS NOT SUPPORTED: validate setupvars script in install directory")
It seems like you have set your Python path wrong
In windows you have to make an relative path in environtment settings to python/libs/site-packages. So in cmake set PYTHON3_SITE_PACKAGES to the relative path e.g %PYTHON_SITE_PACKAGES%.
And remember to run cmake / visual studio as administrator.

Error ZED installing with Cmake and openCV

i would like to install my ZED Camera from Stereolabs. Iwas following each step precisely (https://www.stereolabs.com/documentation/overview/getting-started/application-development.html#installation) but it didn't work. From the errorlog it says, that the path of the config and directory is wrong. So I put it manually but still going to the wrong file and directory.Errorlog and my configuration
CMake Warning at C:/Program Files (x86)/ZED SDK/dependencies/opencv_3.1.0/OpenCVConfig.cmake:166 (message):
Found OpenCV Windows Pack but it has no binaries compatible with your
configuration.
You should manually point CMake variable OpenCV_DIR to your build of OpenCV
library.
Call Stack (most recent call first):
CMakeLists.txt:41 (find_package)
CMake Error at CMakeLists.txt:41 (find_package):
Found package configuration file:
C:/Program Files (x86)/ZED SDK/dependencies/opencv_3.1.0/OpenCVConfig.cmake
but it set OpenCV_FOUND to FALSE so package "OpenCV" is considered to be
NOT FOUND.
Thanks for any help!
Horst

Building opencv with cmake error

I am trying to build opencv with cmake and am running into issues.
I have downloaded the Windows opencv 2.3.1 to C:/Users/chris/opencv. I open up the CMake GUI (2.8.5 version of CMake) and put the source directory as C:/Users/chris/opencv/modules and the "Where to build the binaries" at C:/temp/opencv_binaries
I hit Configure and chose Visual Studio 2010. I then hit Configure again and get the following error output:
CMake Error at calib3d/CMakeLists.txt:1 (define_opencv_module):
Unknown CMake command "define_opencv_module".
CMake Warning (dev) in CMakeLists.txt:
No cmake_minimum_required command is present. A line of code such as
cmake_minimum_required(VERSION 2.8)
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!
What gives? What should I do to fix this?
Unless it has changed recently, the source directory should be C:/Users/chris/opencv/ - it will be the highest-level directory with a CMakeLists.txt file in it.
This warning is for project developers. Use -Wno-dev to suppress it.
To turn -Wno-dev on you just need to select Options -> Suppress dev Warnings (-Wno-dev) in the menu of CMake GUI.
what is the content of your CMakeLists.txt file?
for avoiding the warning, insert "cmake_minimum_required(VERSION 2.8)" into the first line of your CMakeLists.txt

Resources