Build Qt project with CMake problem
amigo421 last edited by A Former User
this is a copy of the question on stackoverflow here
here is a doc about that, but it doesn't look correct for me ,
so I've copied cmake instructions into my cmakelists.txt and it doesn't work.
it's clear why it doesn't work - because there is no one instruction how to search qt:
I suppose two cases:
- some additional cmake instructions requires to set
- some environment variables should be set
but nothing about that.
the instruction :
refers to extra cmake script from qt kit , isn't it?
I see the directory with that name (annd contains *.cmake scripts but another names) but there is no the script with this name
these are the only .cmake files with qt in names in cmake 3.6 :
cmake-3.6\Modules\DeployQt4.cmake cmake-3.6\Modules\FindosgQt.cmake cmake-3.6\Modules\FindQt.cmake cmake-3.6\Modules\FindQt3.cmake cmake-3.6\Modules\FindQt4.cmake cmake-3.6\Modules\Qt4ConfigDependentSettings.cmake cmake-3.6\Modules\Qt4Macros.cmake cmake-3.6\Modules\UseQt4.cmake
-G "CodeBlocks - MinGW Makefiles" C:\dev\workspace\algolist.v2 CMake Warning at CMakeLists.txt:14 (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:
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.
CMake Error at CMakeLists.txt:20 (target_link_libraries): Cannot
specify link libraries for target "helloworld" which is not built by
-- Configuring incomplete, errors occurred! See also "C:/dev/workspace/algolist.v2/cmake-build-debug/CMakeFiles/CMakeOutput.log".
seems it found Qt5Widgets, but absolutely not clear how it does this...
so it looks for cmake files inside Qt5Widgets folder, in Qt kit.
I can add this folder to the path but I don't think this is a valid way,
because there is a lot of subfolders with cmake files
Qt5.8 beta, built with MinGW, Win10, cmake 3.6
You need to use CMAKE_PREFIX_PATH