I try to make a program using Qt in CLion.
After clicking New Project in the starting window of CLion I choose Qt Widgets Executable on the left and add the following Qt CMake prefix path:
C:\Qt\6.0.3
Then I click on "create" and get the "Open Project Wizard" window. I click on "Manage toolchains..." and add a new toolchain. Next to "Environment:" I write:
C:\Qt\Tools\mingw810_64
and everything looks fine. Then I click on Ok and again on Ok and after few seconds I get the following message below:
CMake Error at CMakeLists.txt:21 (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.
Please, can you help me?
(Qt is installed on my computer)
Setting Toolchains, treat qt mingw tool path as default
when you create qt project, please set qt cmake prefix path, such as "D:\Qt\6.1.2\mingw81_64\lib\cmake"
try previous version of qt.
OR
try Visual Studio IDE.
Related
I have installed the latest version of OpenDDS I followed the configuration and installation documents provided.
I can perfectly run opendds examples with the terminal.
I need to integrate OpenDDS with QT, since OpenDDS supports CMake
I have tried to load CMakeList.txt in qt for messenger_1 and messeger_2 examples I got, unknown CMake command "OPENDDS_TARGET_SOURCE"
I wasn't able to run the IShape example either.
This most probably means that CMake does not find the OpenDDS package files.
CMake reads the CMake variable CMAKE_PREFIX_PATH and extends its default package search path by this. By default Qt Creator sets that to your Qt install path (which is good since you want to use Qt), but to use OpenDDS you need to point it to its source/install path as well (see the OpenDDS CMake documentation).
You can add multiple paths to CMAKE_PREFIX_PATH, separated by ; on Windows, or : on Linux/macOS.
In Qt Creator the CMAKE_PREFIX_PATH is set up in the CMake Configuration part of the Kit. So:
Open "Options > Kits > Kits" and choose the kit you use for your project
Scroll down to CMake Configuration and click Change
Find the CMAKE_PREFIX_PATH line and change it to something like
CMAKE_PREFIX_PATH:STRING=%{Qt:QT_INSTALL_PREFIX};C:\path\to\OpenDDS or if you are on Linux/macOS
CMAKE_PREFIX_PATH:STRING=%{Qt:QT_INSTALL_PREFIX};/path/to/OpenDDS
You might need to close and re-open the project after that (but maybe not).
I am using Window 10, Visual Studio 2017. I have installed OpenCV properly and I can run some basic projects of C++ OpenCV that can be found around the internet.
I have also followed this video which shows How to Build Open Source Projects Using CMake and Visual Studio.
But, I can not run this project on my machine. I try File->Open->CMake to open the CMakeLists.txt which can be found in the downloaded repository, and I get this error:
CMake Error at C:\Users\Majid\Desktop\imgwarp-opencv\imgwarp-opencv\src\CMakeLists.txt:2 (FIND_PACKAGE):
By not providing "FindOpenCV.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "OpenCV", but
CMake did not find one.
Could not find a package configuration file provided by "OpenCV" with any
of the following names:
OpenCVConfig.cmake
opencv-config.cmake
Add the installation prefix of "OpenCV" to CMAKE_PREFIX_PATH or set
"OpenCV_DIR" to a directory containing one of the above files. If "OpenCV"
provides a separate development package or SDK, be sure it has been
installed.
I think I must extract the downloaded opencv-4.0.1-vc14_vc15.exe file somewhere in the project folder and link the CMakeLists.txt file (which one?) to the OpenCVConfig.cmake which is in the extracted opencv. Or maybe not.
I have also CMake gui and if I should run it that way I will appreciate that you explain it that way instead of using Visual Studio File->Open->CMake. No matter how, any way that helps me run this project is welcome. Please explain it step by step.
In one line (forget all the above): What should I do to run this project properly?
I try to build a C++ project with CMake on Visual Studio 2017. So far the CMake support is quite convincing. However, how do I call the PACKAGE target introduced by cpack? Does anyone have an idea how to do this from within the GUI (it does not show up in the context menu of the CMakeLists.txt file). The INSTALL as well as the BUILD_ALL target show up in the context menu of the CMakeLists.txt file but the PACKAGE target is missing. Is this a bug or am I missing something?
The default CMake PACKAGE target is only added by CMake if a file named CPackConfig.cmake exists in the outermost CMake build directory.
The CPackConfig.cmake file is usually generated automatically by CMake when the CPack module is included. It may however be generated under a different name, if the variable CPACK_OUTPUT_CONFIG_FILE is set before the inclusion of CPack.
I want to compile an open project, it needs Eigen3, I followed its guideline but stuck in this step:
"Set environment variable Eigen3_DIR to {YOUR_EIGEN3_DIRECTORY}/eigen3/cmake."
I have installed CMake gui and it printed following errors after configuration
Make Error at src/CMakeLists.txt:15 (find_package):
By not providing "FindEigen3.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "Eigen3", but
CMake did not find one.
Could not find a package configuration file provided by "Eigen3" with any
of the following names:
Eigen3Config.cmake
eigen3-config.cmake
Add the installation prefix of "Eigen3" to CMAKE_PREFIX_PATH or set
"Eigen3_DIR" to a directory containing one of the above files. If "Eigen3"
provides a separate development package or SDK, be sure it has been
installed.
But I have downloaded Eigen3 from here, and set the Eigen3_DIR as follows
So what should I do to fix it? I am just a beginner in cmake.
I am assuming you are using Windows. You will need Visual Studio installed. You can use the community version. You will need to do the following:
Create a directory called "build" within your Eigen directory.
Go to the build directory and do "cmake ..". This will create Visual Studio projects.
Load the .sln using Visual Studio.
Build the solution.
Ensure that the project called INSTALL was built also.
This will create the Eigen3Config.cmake file in your install directory. In my case the install directory was "C:\Program Files(X86)\Eigen3. Use this to as the value for Eigen3_DIR variable.
By default Eigen does not come with the Eigen3Config.cmake file. You will see Eigen3Config.cmake.in file. This is used to build the Eigen3Config.cmake file.
HTH
I don't know a lot about cmake, I'm trying to build a client using cmake and Qt. Getting the following error:
CMake Error at alethzero/CMakeLists.txt:26 (find_package): By not
providing "FindQt5Widgets.cmake" in CMAKE_MODULE_PATH this project
has asked CMake to find a package configuration file provided by
"Qt5Widgets", but CMake did not find one.
Could not find a package configuration file provided by "Qt5Widgets"
with any of the following names:
Qt5WidgetsConfig.cmake
qt5widgets-config.cmake
Add the installation prefix of "Qt5Widgets" to CMAKE_PREFIX_PATH or
set "Qt5Widgets_DIR" to a directory containing one of the above
files. If "Qt5Widgets" provides a separate development package or
SDK, be sure it has been installed.
-- Configuring incomplete, errors occurred!
As far as I understand, I need to add the QT path to CMake. How do I do it? I have Qt installed in /home/user/Programs. All the explanations I find are "just do this or that". I need the exact Terminal commands so I can just learn how to do it in the future.
Thanks!
UPDATE: export CMAKE_PREFIX_PATH=/home/user/Programs did not help me.
Well, here you have a solution for Windows: How to find qt5 CMake module on windows
set (CMAKE_PREFIX_PATH "C:\\Qt\\Qt5.0.1\\5.0.1\\msvc2010\\")
For your environment, I think you will have to change the path where Qt is located...
Maybe this will help you:
https://github.com/Cockatrice/Cockatrice/issues/205
This is documented:
http://doc.qt.io/qt-5/cmake-manual.html
The easiest way to use CMake is to set the CMAKE_PREFIX_PATH
environment variable to the install prefix of Qt 5
Do this
export CMAKE_PREFIX_PATH=/home/user/Programs/<other_stuff>
where references the compiler etc, so that this complete path is valid:
/home/user/Programs/<other_stuff>/bin/qmake*
I needed this on my macOS after Qt installation with brew install qt5:
export CMAKE_PREFIX_PATH=/usr/local/Cellar/qt5/5.7.0/
For ubuntu:
cmake -DCMAKE_PREFIX_PATH=/home/ryan/Qt/5.11.2/gcc_64 ..
/home/ryan/Qt/ is the Qt installation root path
at an Ubuntu 16.04.4 LTS desktop the solution was
cmake .. -DMAKE_PREFIX_PATH=/usr/include/x86_64-linux-gnu/qt5