0
我正嘗試使用CMake GUI構建基於OpenCV的項目,但不斷收到錯誤。我跟着this線程,但仍不能解決我的問題。無法使用CMake Visual Studio 12構建OpenCV項目
以下是我在GUI中得到的消息(與錯誤一起):
CMake Warning at C:/SCCH/libs/opencv249_x86_3/OpenCVConfig.cmake:161 (message):
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:/SCCH/libs/opencv249_x86_3/OpenCVConfig.cmake
but it set OpenCV_FOUND to FALSE so package "OpenCV" is considered to be NOT FOUND.
我使用OpenCV的2.49(86)使用CMake的TBB庫建成並有針對性的爲Visual Studio 2013(版本12)。另外,我爲OpenCV定義了一個系統變量。並且,以下是我使用的建築(其中我收到上述錯誤)的一個項目解決方案(.sln)文件,我的CMakeLists.txt文件:
cmake_minimum_required(VERSION 2.8)
project(FlexTex)
SET(OpenCV_DIR "C:/SCCH/libs/opencv249_x86_3")
FIND_PACKAGE(OpenCV REQUIRED)
SET(FLEX_TEX_DLL_FILES ./LibFlexTexDLL/inc/FlexTexDLL.h ./LibFlexTexDLL/src/FlexTexDLL.cpp)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/LibFlexTexDLL/inc/)
ADD_LIBRARY(FlexTexDLL SHARED ${FLEX_TEX_DLL_FILES})
TARGET_LINK_LIBRARIES(FlexTexDLL ${OpenCV_LIBS})
SET(FLEX_TEX_PP_DLL_FILES ./LibFlexTexPPDLL/inc/defines.h ./LibFlexTexPPDLL/inc/FlexTexPPDLL.h ./LibFlexTexPPDLL/inc/FlexTexPPImpl.h ./LibFlexTexPPDLL/src/FlexTexPPDLL.cpp)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/LibFlexTexPPDLL/inc/)
ADD_LIBRARY(FlexTexPPDLL SHARED ${FLEX_TEX_PP_DLL_FILES})
TARGET_LINK_LIBRARIES(FlexTexPPDLL ${OpenCV_LIBS})
ADD_EXECUTABLE (FlexTexMain FlexTexMain/src/FlexTexMain.cpp)
TARGET_LINK_LIBRARIES(FlexTexMain FlexTexPPDLL)
不,我使用的整個VS 2013(12版)。是什麼讓你認爲我構建了VS2012(版本11)的OpenCV?謝謝。 – Sanchit 2015-04-03 13:04:51
你已經提到它有問題(在上次編輯之前),仍然有標籤「vs2012」。如果版本正常,請檢查您是否嘗試使用x64配置。因爲CMAKE告訴配置(OpenCV(x86)和創建的應用程序)不匹配。 – 2015-04-03 14:07:00