Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

SOLVED: CMAKE_PREFIX_PATH doesn't help CMake in finding Qt5

Aquarius_Girl:

From here: http://ift.tt/2Arzolj

I tried this:


cmake_minimum_required(VERSION 2.8.12)

project(qtquick_hello_cmake)

set(CMAKE_PREFIX_PATH "/opt/Qt5.9.1/5.9.1/")

set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)

find_package(Qt5 COMPONENTS Quick Core REQUIRED)

qt5_add_resources(RESOURCES qml.qrc)

add_executable(${PROJECT_NAME} "main.cpp" "qml.qrc")

qt5_use_modules(${PROJECT_NAME} Quick Core)

target_link_libraries(${PROJECT_NAME} Qt5::Core Qt5::Quick)

Here is the output of cmake .


:~/junk/qtquick_hello_cmake$ cmake .
CMake Error at CMakeLists.txt:11 (find_package):
By not providing "FindQt5.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "Qt5", but
CMake did not find one.

Could not find a package configuration file provided by "Qt5" with any of
the following names:

Qt5Config.cmake
qt5-config.cmake

Add the installation prefix of "Qt5" to CMAKE_PREFIX_PATH or set "Qt5_DIR"
to a directory containing one of the above files. If "Qt5" provides a
separate development package or SDK, be sure it has been installed.


-- Configuring incomplete, errors occurred!
See also "/home/.../junk/qtquick_hello_cmake/CMakeFiles/CMakeOutput.log".

This is to show that /opt/Qt5.9.1/ does exist.


:~/junk/qtquick_hello_cmake$ cd /opt/Qt5.9.1/5.9.1/
:/opt/Qt5.9.1/5.9.1$ ls
android_armv7 android_x86 gcc_64 Src

Here I run the cmake with -DCMAKE option, but the output is still same:


:~/junk/qtquick_hello_cmake$ cmake -DCMAKE_PREFIX_PATH=/opt/Qt5.9.1/5.9.1/ -DWITH_QT5=1 .
CMake Error at CMakeLists.txt:11 (find_package):
By not providing "FindQt5.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "Qt5", but
CMake did not find one.

Could not find a package configuration file provided by "Qt5" with any of
the following names:

Qt5Config.cmake
qt5-config.cmake

Add the installation prefix of "Qt5" to CMAKE_PREFIX_PATH or set "Qt5_DIR"
to a directory containing one of the above files. If "Qt5" provides a
separate development package or SDK, be sure it has been installed.


-- Configuring incomplete, errors occurred!
See also "/home/.../junk/qtquick_hello_cmake/CMakeFiles/CMakeOutput.log".

Contents of the directory:


:~/junk/qtquick_hello_cmake$ ls
CMakeCache.txt CMakeFiles CMakeLists.txt main.cpp main.qml qml.qrc



Posted in S.E.F
via StackOverflow & StackExchange Atomic Web Robots
This Question have been answered
HERE


This post first appeared on Stack Solved, please read the originial post: here

Share the post

SOLVED: CMAKE_PREFIX_PATH doesn't help CMake in finding Qt5

×

Subscribe to Stack Solved

Get updates delivered right to your inbox!

Thank you for your subscription

×