Just installed QT and trying to build a QT project from inside the QTcreator using Cmake instead of Qmake.
I get the following error:
Starting to parse CMake project, using: "DCMAKE_BUILD_TYPE:STRING=Debug",
"-DCMAKE_CXX_COMPILER:STRING=",
"-DCMAKE_C_COMPILER:STRING=",
"DCMAKE_PREFIX_PATH:STRING=C:/Qt/5.13.1/msvc2015_64",
"DQT_QMAKE_EXECUTABLE:STRING=C:/Qt/5.13.1/msvc2015_64/bin/qmake.exe".
The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:3 (project):
The CMAKE_CXX_COMPILER:
cl
is not a full path and was not found in the PATH.
To use the JOM generator with Visual C++, cmake must be run from a shell
that can use the compiler cl from the command line. This environment is
unable to invoke the cl compiler. To fix this problem, run cmake from the
Visual Studio Command Prompt (vcvarsall.bat).
Tell CMake where to find the compiler by setting either the environment
variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
to the compiler, or to the compiler name if it is in the PATH.
Configuring incomplete, errors occurred!
See also "C:/Users/tany/AppData/Local/Temp/QtCreator-pKrFgC/qtc-cmake-DqmsxZqd/CMakeFiles/CMakeOutput.log".
See also "C:/Users/tany/AppData/Local/Temp/QtCreator-pKrFgC/qtc-cmake-DqmsxZqd/CMakeFiles/CMakeError.log".
CMake Deprecation Warning:
The 'cmake-server(7)' is deprecated. Please port clients to use the
'cmake-file-api(7)' instead.
CMake Project parsing failed.
Now if I use the Cmake-GUI instead, I can configure and generate the project files successfully, after supplying the environment variable CMAKE_PREFIX_PATH.
But I can't get this to work from inside the QTcreator.
Anyone has any experience with using Cmake with QTcreator then please help.
Thank you!
The error message says that your C++ compiler Visual Studio 2015 (64 bits) could not be located. Maybe when you run cmake-gui it finds another C++ compiler like mingw?
In Qtcreator's settings dialog you have a tab showing the detected compilers, and another one with the available kits.
It seems that QtCreator is using a deprecated version of cmake. Update QtCreator to a new (unreleased, as writing this comment, version 4.10.0 is broken) or downgrade cmake to choco.exe install cmake --version 3.11 --force (a newer version might work).
Please also make sure to install jom (as this is the default for QtCreator/CMake on windows).
choco.exe install jom (how can I tell it to use make?)
The deprecation warning is harmless. CMake deprecated the cmake-server and provides a new API for the same purpose now. Qt Creator will support that from 4.11.
The error tells you, that CMake is unable find the cl compiler. cl.exe comes with Visual Studio. Make sure you mark C++ there during the installation process. It is not installed by default anymore.
Alternatively install the MinGW tool chain from the Qt installer. In Qt context it is easier to use than the Visual Studio tool chain.
Related
I'm trying to build a project with MSVC 2013 and Qt Creator 4.4.0 with JOM and was having issues to configure JOM. So, I tried to erase Qt Creator's configuration files completely and start from scratch.
In the fresh Qt configuration, after I opened the project, I set the CMake (3.9.3) location and ran CMake on the project. Unfortunately, by default, the Qt 5.6.3 Kit seems to choose the NMake generator instead of the NMake JOM generator. After deleting the build directory, I changed the generator to NMake JOM in the Kit configurations, but met the following error message:
CMake Error: Generator: execution of make failed. Make command was: "jom" "/NOLOGO" "cmTC_276f9\fast"
Any idea of why this is happening? As far as I remember, Qt Creator is supposed to build the projects with JOM by default.
I had the same exact problem. Add the location of jom.exe (typically it is path like [...]\Qt5.12.1\Tools\QtCreator\bin\) to your PATH.
I am now trying to build openflipper binary code on my computer. I got this error from cmake:
CMake Error at CMakeLists.txt:66 (message):
Could not found any QT Version. Please specify QT5_INSTALL_PATH to build
with QT5 or specify the QT_QMAKE_EXECUTABLE to the QT4 qmake
And I'm sure I've installed qt5.3, and already set the QTDIR and add qt directory to my system path.
Would anyone plz give a hand ? Thx.
openflipper version 2.1
Looking back on this question, I think a proper fix should be adding a new CMake entry as QT5_ROOT=${path-where-Qt5Config.cmake-lives}.
In my case, it should be Qt5_ROOT=C:\Qt\5.9.1\msvc2015_64\lib\cmake\qt5.
You can do this either from Cmake-gui or passing it into terminal as cmake -DQT5_ROOT=${path-where-Qt5Config.cmake-live} ${path-to-your-source-file}
I am trying to install kde-connect following this.
Although my kubuntu version is 14.04, I wanted to compile them so that I can have the latest version. But when I followed the instructions to compile, i get the following error.
-- Found Qt-Version 5.2.1 (using /usr/bin/qmake)
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
QT_QT_INCLUDE_DIR
used as include directory in directory /home/vinaychandra/Downloads/t/CMakeFiles/CMakeTmp
CMake Error: Internal CMake error, TryCompile configure of cmake failed
CMake Error at /usr/share/kde4/apps/cmake/modules/FindKDE4Internal.cmake:1311 (message):
Unable to compile a basic Qt application. Qt has not been found correctly.
Call Stack (most recent call first):
/usr/share/cmake-2.8/Modules/FindKDE4.cmake:95 (find_package)
CMakeLists.txt:7 (find_package)
Please point out how to correct this.
I have tried giving -DQT_QT_INCLUDE_DIR=/usr/share/qt4/
then it tells that You must build your code with position independent code if Qt was built with -reduce-relocations.
Your cmake by default uses a different QT version.
So, you must explicitly tell him which version of QT he have to use for this job.
This one
-DQT_QT_INCLUDE_DIR=/usr/share/qt4/
Is wrong because you mustn't give QT position explicitly.
All you need is to use the right qmake.
So, give'em this flag and you'll be happy!
-DQT_QMAKE_EXECUTABLE=/usr/bin/qmake-qt4
Since most of kde applications are not ported to Qt5, you need Qt4.x for building kdeconnect(don't know x, mine is 4.8.6).
Also Qt4 installer is not available (I think !), so you have to build it also from source. Building Qt4 is quite easy, just download the source and run the usual commands.
After building it, it qmake name will be qmake-qt4 in /usr/bin.
So for building kdeconnect, first run its cmake, then a Cmaketextcache.txt file will form.
In that change the path of qmake (i.e somewhere written /usr/bin/qmake to /usr/bin/qmake-qt4) and also the path of qt include dir to (I think /usr/include/qt5 to /usr/include/qt4), and run the cmake again.
If some packages are missing, then you have to install it.
But with the above changes, you will get a make file to install it.
Unfortunately, the cited documentation is lagging behind the current state of kdeconnect. I ran into similar problems but I managed to solve them by installing the following required packages from the Kubuntu repositories:
sshfs
libfakekey-dev
libxtst-dev
libqca2-dev
libqjson-dev
I trust these are all of them. I installed kdeconnect from the latest git commit and it seems to run fine.
This answer comes a bit late, but this is the first Google search result for the question. In systems with qtchooser (Kubuntu, Ubuntu at least), this can be fixed by running first:
export QT_SELECT=qt4
This makes all of the Qt build tools to default to the Qt4 version instead of Qt5. You can check which Qt version is active by running:
qmake --version
Try kde connect install on ubuntu: https://fazlerabbi37.github.io/blogs/install_kde_connect_in_ubuntu_18.04.html
(in 18.04 & 19.04 it works with simple sudo apt install kdeconnect
Install kde connect on android device (google play store is where I installed from)
Invoke kde connect from desktop
Invoke kde connect from android and search device.
Your ubuntu will be found / initiating a search from desktop results in android phone pulled up for pairing
Accept pairing request
Provide access to folders
Try clicking on a video/image file for transfer
I could see the new file transferring in /Downloads folder of desktop
allowing/disallowing desktop to access sms, notifications etc are now a choice
Note: Pl treat this with pinch of salt. This appears very simple, effective for a main reason it worked for me in no time.
Hie,
I am new to VTK.I want to use QVTKPluginWidget in Qt designer.
I am using Visual Studio 2008 with MSVC compiler
CMake- 2.8.10.1
Qt Version -4.8.3
VTK - 5.0
As per VTK User's Guide we have to configure VTK Lib with Cmake with setting
few options like,
VTK_USE_GUISUPPORT=Turn On
configure
Desired Qt version cmake take itself
configure
then
set qt_qmake_executable
ON Build Example
configure
after doing this i am getting this warning in Cmake
CMake Warning (dev) at GUISupport/Qt/CMakeLists.txt:113 (ADD_LIBRARY):
Policy CMP0003 should be set before this line. Add code such as
if(COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW)
endif(COMMAND cmake_policy)
as early as possible but after the most recent call to
cmake_minimum_required or cmake_policy(VERSION). This warning appears
because target "QVTKWidgetPlugin" links to some libraries for which the
linker must search:
vfw32, opengl32
and other libraries with known full path:
C:/Qt/4.8.3/lib/QtGuid4.lib
E:/DebugLibrary/VtkBin/bin/Debug/vtkRendering.lib
CMake is adding directories in the second list to the linker search path
in
case they are needed to find libraries from the first list (for backwards
compatibility with CMake 2.4). Set policy CMP0003 to OLD or NEW to enable
or disable this behavior explicitly. Run "cmake --help-policy CMP0003"
for
more information.
This warning is for project developers. Use -Wno-dev to suppress it.
Generating done
Then have to build this library in Visual studio then Copy the
QVTKPluginWidget.dll in Plugin/Designer Folder.
Then we should get QVTKWidget in designer
But i am not getting that in designer after doing this process.Kindly help
me.
You have to build VTK with BUILD_SHARED_LIBS=ON (as described here http://www.vtk.org/Wiki/VTK/Tutorials/QtSetup) to use the widget in Designer.
Since 4.8.0 is out, I've reinstalled Qt, and now I want to use cmake too. To make cmake work, I remember having to add the mingw bin folder (QtSDK\Desktop\Qt\4.7.3) to PATH back in Qt4.7.3, so I guessed that there would be a similar folder in QtSDK\Desktop\Qt\4.8.0 now but this is not the case. My question is, does anybody else have experience with setting up Qt and cmake? I could use some help right now, as I've googled for a bit and was unable to find any ways to make cmake work.
When trying to build, I get this well known message:
CMake Error at C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:91 (MESSAGE):
Could NOT find Qt4 (missing: QT_QMAKE_EXECUTABLE QT_INCLUDE_DIR)
Call Stack (most recent call first):
C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:252 (_FPHSA_FAILURE_MESSAGE)
C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindQt4.cmake:1171 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
CMakeLists.txt:3 (find_package)
You just need to set the path to qmake in QT_QMAKE_EXECUTABLE, and then cmake can use qmake -query to find all the other paths it needs (similar to pkg-config on Linux).
Steps for building a project using Qt and CMake usually are:
Check out / create project source folder
Create build folder outside the project folder
Start Qt command prompt / cmd and cd into build folder e.g. cd build\project
Run cmake or cmake-gui passing path to source folder e.g. cmake-gui ..\..\source\project
Set any variables, such as QT_QMAKE_EXECUTABLE and CMAKE_BUILD_TYPE
Run your build tool, or run cmake --build .
So, I found out what was the problem, and I think I should have known before. I simply added C:\QtSDK\Desktop\Qt\4.8.0\msvc2010\bin to my PATH variable. It may be useful to note that, in a default 4.8.0 install, qmake is located in C:\QtSDK\Desktop\Qt\4.8.0\msvc2010\bin as opposed to C:\QtSDK\Desktop\Qt\4.7.3\mingw\bin in 4.7.3. Notice the difference; msvc2010 vs mingw. It's actually glaringly obvious, as msvc2010 was the only folder in that directory.
I didn't try skyhisi's answer as it was no longer needed, but I'm guessing that it's another correct (if not better) way to make cmake work.
Just ran into the same problem... Take a look into findQt4.cmake
FIND_PROGRAM(QT_QMAKE_EXECUTABLE NAMES qmake qmake4 qmake-qt4 qmake-mac PATHS
"[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\4.0.0;InstallDir]/bin"
"[HKEY_CURRENT_USER\\Software\\Trolltech\\Versions\\4.0.0;InstallDir]/bin"
"[HKEY_CURRENT_USER\\Software\\Trolltech\\Versions\\${qt_install_version};InstallDir]/bin"
$ENV{QTDIR}/bin
DOC "The qmake executable for the Qt installation to use")
You can either alter registry keys, or, I personally prefer deleting all those keys altogether and modify $ENV{QTDIR} variable. Good luck.
I had this problem for a slightly different reason. Maybe this will help someone else:
I uninstalled Qt 4.8.3 and then installed qt 4.8.4. Based on Slava's answer I discovered that CMake is getting the value of $(qt_install_version} from:
[HKEY_CURRENT_USER\\Software\\Trolltech\\Versions\\DefaultVersion]
This was still set to 4.8.3 even though all the other registry entries were updated to 4.8.4. Changing the value of the DefaultVersion key to 4.8.4 fixed the problem for me.
I had the same problem and I solved providing the path to qmake,
QT_QMAKE_EXECUTABLE /opt/qt-4.8.7/bin/qmake
On Mac, while the binaries are saved in /usr/local/Trolltech/Qt-4.8.7/bin
the required qmake required as value of QT_QMAKE_EXECUTABLE is, for my OS, stored in the path /opt/qt-4.8.7/bin/qmake . Hope this help as well.