Question

I'm trying to build a Qt5 project using cmake but I keep having the same error for a while now:

CMake Error at /Users/guillaume/Qt/5.2.1/android_x86/lib/cmake/Qt5Gui/Qt5GuiConfigExtras.cmake:16 (message):
Failed to find "GLESv2" in "" with CMAKE_CXX_LIBRARY_ARCHITECTURE "".
Call Stack (most recent call first):
/Users/guillaume/Qt/5.2.1/android_x86/lib/cmake/Qt5Gui/Qt5GuiConfigExtras.cmake:51 (_qt5gui_find_extra_libs)
/Users/guillaume/Qt/5.2.1/android_x86/lib/cmake/Qt5Gui/Qt5GuiConfig.cmake:143 (include)
/Users/guillaume/Qt/5.2.1/clang_64/lib/cmake/Qt5Widgets/Qt5WidgetsConfig.cmake:88 (find_package)
/Users/guillaume/Qt/5.2.1/clang_64/lib/cmake/Qt5/Qt5Config.cmake:26 (find_package)
CMakeLists.txt:17 (find_package)

It seems to be the find_package(Qt5Gui..) in QtWidget which use androidx86 path instead of clang_64 path but I dont know why it won't go with the clang_64 path even when using the NO_DEFAULT_PATH option.. Any help or working cmake file would be appreciated.
[edit UPDATED]
Here is my CMakeList.txt. My cmake version is 2.8.12.2:

#YCStats CmakeList.txt
cmake_minimum_required(VERSION 2.8.8)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/")
set(GCC_COVERAGE_LINK)
project(YCStats)
set( CMAKE_INCLUDE_CURRENT_DIR ON )
set( CMAKE_AUTOMOC ON)
set(QT5_PATH $ENV{HOME}/Qt/5.2.1/clang_64/ CACHE PATH "Path to Qt5")
set(QT5_MODULE_PATH ${QT5_PATH}/lib/cmake)
set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ${QT5_MODULE_PATH})
find_package( Qt5Widgets)
find_package( OpenCV REQUIRED )
find_package( FFMPEG REQUIRED )
find_package( TESS REQUIRED )
include_directories(
    ${FFMPEG_INCLUDE_DIR}
    ${TESS_INCLUDE_DIR}
)
file(
    GLOB_RECURSE
    source_files
    src/*.cpp
)
file(
    GLOB_RECURSE
    header_files
    src/*.h
)
add_executable(
    YCStats.x
    ${source_files}
    ${header_files}
)
target_link_libraries(
    YCStats.x
    ${OpenCV_LIBS}
    ${FFMPEG_LIBRARIES}
    ${TESS_LIBRARIES}
)
qt5_use_modules(YCStats.x Widgets)

edit 2: SOLUTION

Finally I manage to build it and make it work by putting the line set( Qt5${_module_dep}_DIR " ") before every error making find_package() (in Qt5WidgetsConfig.cmake, Qt5CoreConfig.cmake ...). It seems to allow NO_DEFAULT_PATH to work normally. For people having the same problem, if your cmake works but you get a warning with the wrong path when using make command you should put the set() command described above in the corresponding file: Qt5"CoresspondingModule"Config.cmake
ps: I had also to change the concerned find_package with:

find_package(Qt5${_module_dep}
                5.2.1 ${_Qt5Widgets_FIND_VERSION_EXACT}
                ${_Qt5Widgets_DEPENDENCIES_FIND_QUIET}
                ${_Qt5Widgets_FIND_DEPENDENCIES_REQUIRED}
                PATHS "${CMAKE_CURRENT_LIST_DIR}/../Qt5${_module_dep}" 
                NO_DEFAULT_PATH
            ) 

pay attention to the new path I used.

Was it helpful?

Solution

See my CMakeList.txt updated and edit2: SOLUTION.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top