Ich versuche ein cpp/qt5 Projekt mit cmake zu erstellen, aber die Kompilierung gibt einen Fehler bezüglich QT5 zurück.MacOS Sierra - CMake ist fehlgeschlagen mit Qt5
I QT5 mit Homebrew installiert haben,
Wenn ich tun:
brew --prefix qt5
ich
/usr/local/Cellar/qt5/5.6.0
So bin ich in der build
Ordner meines Projekts und ich mache:
cmake .. -DCMAKE_PREFIX_PATH=$(brew --prefix qt5) -G Xcode -DBUILD_TESTS=ON -DBUILD_TESTS_COVERAGE=off
mir diesen Fehler zurück:
CMake Error at CMakeLists.txt:124 (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.
die Linien von Fehlern in der CMakelist.txt:
## QT5 ##
find_package(Qt5 COMPONENTS Core Gui Widgets Concurrent Qml Quick REQUIRED)
set_target_properties(${BIN_NAME} PROPERTIES AUTOMOC ON)
set_target_properties(${BIN_NAME} PROPERTIES AUTOUIC ON)
target_link_libraries(${BIN_NAME} PUBLIC Qt5::Core PUBLIC Qt5::Widgets PUBLIC Qt5::Gui PUBLIC Qt5::Qml PUBLIC Qt5::Quick PUBLIC Qt5::Concurrent)
#########
Ich habe auch eine -DQt5_DIR=$(brew --prefix qt5)
auf den Befehl hinzuzufügen versucht, gleiche Ergebnis.
Irgendwelche Ideen? dank
Datei nicht 'Qt5Config.cmake' existiert in deiner QT5-Installation? – Tsyvarev
Wie überprüfe ich das? – F4Ke
Ich bin nicht vertraut mit brauen, aber es sollte definitiv in der Lage sein, eine Liste von Dateien für installierte Pakete zur Verfügung zu stellen. Aber im gegebenen Fall reicht es aus, nach der gegebenen Datei unter '/ usr/local/Cellar/qt5/5.6.0' zu suchen: Die Variable' CMAKE_PREFIX_PATH' fügt einfach neue * Präfixe * für die Suche ein. Wie für die Variable 'Qt5_DIR' sollte dieses Verzeichnis direkt die erforderliche Datei enthalten, um einen Effekt zu erzielen. – Tsyvarev