エラーメッセージが表示されました
CMake Error at /usr/local/share/cmake-3.4/Modules/FindPackageHandleStandardArgs.cmake:148 (message):
Could NOT find Qt4 (missing: QT_QTOPENGL_INCLUDE_DIR QT_QTOPENGL_LIBRARY
QT_QTMULTIMEDIA_INCLUDE_DIR QT_QTMULTIMEDIA_LIBRARY QT_PHONON_INCLUDE_DIR
QT_PHONON_LIBRARY) (found version "4.8.6")
Call Stack (most recent call first):
/usr/local/share/cmake-3.4/Modules/FindPackageHandleStandardArgs.cmake:388 (_FPHSA_FAILURE_MESSAGE)
/usr/local/share/cmake-3.4/Modules/FindQt4.cmake:1333 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
CMakeLists.txt:5 (find_package)
qT4.8.7パスは/usr/local/Trolltech/Qt-4.8.7
です
それらを一致させる方法は?
Cmakeの実行時にCMAKE_PREFIX_PATH
変数を指定します。望ましいQtインストールの*.cmake
ファイルが配置されているパスに設定します。
cmake -DCMAKE_PREFIX_PATH=/usr/local/Trolltech/Qt-4.8.7/<something-something>/lib/cmake/ ../myproject
(しかし、実際にはQt4にそのcmakeディレクトリがあるかどうかわかりません)
また、OSに付属のバージョンを使用できます。一部のモジュールが見つかりません。おそらくlibqt4-opengl
がインストールされていません。 apt-get
で取得します。
依存関係を取得します。
Sudo apt-get install qtmobility-dev libopencv-dev libtesseract-dev flite1-dev libphonon-dev
CMakeLists.txt
ファイルの編集:
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8b643ab..ffafc6b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2,7 +2,9 @@ cmake_minimum_required (VERSION 2.6)
project (TextReading)
find_package(OpenGL REQUIRED)
-find_package(Qt4 REQUIRED QtGui QtOpenGL QtXml QtMultimedia Phonon)
+find_package(Qt4 REQUIRED QtGui QtOpenGL QtXml Phonon)
+find_package(QtMobility REQUIRED MultimediaKit)
+include_directories(${QTMOBILITY_INCLUDE_DIRS})
find_package(OpenCV REQUIRED core imgproc video highgui)
# find_package(OpenMP REQUIRED)
@@ -151,5 +153,7 @@ target_link_libraries(TextReading
${MathGL_LIB}
${Flite_LIBS}
${QEXTSERIALPORT_LIBS}
+ ${QTMOBILITY_LIBRARIES}
+ udev
)
/usr/share/cmake-3.0/Modules/FindQtMobility.cmake
に次を入力します。
# - Try to find the QtMobility libraries
#
# This module will search for the QtMobility libraries.
#
# It supports both a minimum version and searching for individual
# components. For the minimum version, use
# find_package(QtMobility 1.2.0). For specific components, use
# find_package(QtMobility COMPONENTS ...). See below for a list of known
# components.
#
# Once done this will define
# QTMOBILITY_FOUND - QtMobility and all specified components were found.
# QTMOBILITY_INCLUDE_DIR - Include directory for global QtMobility files.
# QTMOBILITY_INCLUDE_DIRS - All found QtMobility components' include dirs.
# QTMOBILITY_LIBRARIES - All found QtMobility components' libraries.
# QTMOBILITY_VERSION - The version of QtMobility that was found.
#
# For each found component the following will be defined:
# QTMOBILITY_{COMPONENT}_INCLUDE_DIR - The include directory for the component.
# QTMOBILITY_{COMPONENT}_LIBRARY - The location of the library for the component.
#
# Note that searching for components will be limited to the specified components
# if the components option is used.
#
# Copyright (c) 2011 Arjen Hiemstra <[email protected]>
# Redistribution and use is allowed according to the terms of the BSD license.
set(QTMOBILITY_COMPONENTS
Bearer
Connectivity
Contacts
Feedback
Gallery
Location
Messaging
MultimediaKit
Organizer
PublishSubscribe
Sensors
ServiceFramework
SystemInfo
Versit
)
if (QtMobility_FIND_COMPONENTS)
foreach (component ${QtMobility_FIND_COMPONENTS})
string(TOUPPER ${component} _COMPONENT)
set(QTMOBILITY_USE_${_COMPONENT} 1)
endforeach (component)
endif (QtMobility_FIND_COMPONENTS)
find_path(QTMOBILITY_INCLUDE_DIR qmobilityglobal.h PATH_SUFFIXES QtMobility)
#Find the mobility version
if(QTMOBILITY_INCLUDE_DIR)
file(READ "${QTMOBILITY_INCLUDE_DIR}/qmobilityglobal.h" _qtmobility_global_header LIMIT 2000)
string(REGEX MATCH "#define QTM_VERSION_STR \"([0-9.]*)\"" _qtmobility_version_match "${_qtmobility_global_header}")
set(QTMOBILITY_VERSION "${CMAKE_MATCH_1}")
message(STATUS "QtMobility Version ${QTMOBILITY_VERSION} detected")
endif(QTMOBILITY_INCLUDE_DIR)
set(QTMOBILITY_VARIABLES "QTMOBILITY_INCLUDE_DIR")
set(QTMOBILITY_INCLUDE_DIRS ${QTMOBILITY_INCLUDE_DIR})
#A list of files to find for specific components
set(QTMOBILITY_FIND_FILES
QNetworkConfiguration #Bearer
QBluetoothSocket #Connectivity
QContact #Contacts
QFeedbackInterface #Feedback
QAbstractGallery #Gallery
QLandmark #Location
QMessage #Messaging
QMediaPlayer #MultimediaKit
QOrganizerItem #Organizer
QValueSpace #PublishSubscribe
QSensor #Sensors
QService #ServiceFramework
QSystemInfo #SystemInfo
QVersitDocument #Versit
)
list(LENGTH QTMOBILITY_COMPONENTS _component_count)
math(EXPR _component_count "${_component_count} - 1")
foreach (index RANGE ${_component_count})
list(GET QTMOBILITY_COMPONENTS ${index} component)
list(GET QTMOBILITY_FIND_FILES ${index} file)
string(TOUPPER ${component} _COMPONENT)
if (NOT QtMobility_FIND_COMPONENTS OR QTMOBILITY_USE_${_COMPONENT})
message(STATUS "Looking for QtMobility Component \"${component}\"")
find_path(QTMOBILITY_${_COMPONENT}_INCLUDE_DIR ${file} PATH_SUFFIXES Qt${component})
find_library(QTMOBILITY_${_COMPONENT}_LIBRARY NAMES Qt${component})
list(APPEND QTMOBILITY_VARIABLES "QTMOBILITY_${_COMPONENT}_INCLUDE_DIR" "QTMOBILITY_${_COMPONENT}_LIBRARY")
list(APPEND QTMOBILITY_INCLUDE_DIRS ${QTMOBILITY_${_COMPONENT}_INCLUDE_DIR})
list(APPEND QTMOBILITY_LIBRARIES ${QTMOBILITY_${_COMPONENT}_LIBRARY})
endif (NOT QtMobility_FIND_COMPONENTS OR QTMOBILITY_USE_${_COMPONENT})
endforeach (index)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(QtMobility REQUIRED_VARS ${QTMOBILITY_VARIABLES} VERSION_VAR QTMOBILITY_VERSION)
mark_as_advanced(${QTMOBILITY_VARIABLES})