2016-02-05 129 views
3

我正在嘗試使用CMake構建一個Qt Quick Controls應用程序。我用下面的文檔:CMake未找到Qt5QuickCompiler

http://doc.qt.io/QtQuickCompiler/qquickcompiler-building-with-cmake.html

當運行CMake,我得到這個錯誤:

By not providing "FindQt5QuickCompiler.cmake" in CMAKE_MODULE_PATH this 
    project has asked CMake to find a package configuration file provided by 
    "Qt5QuickCompiler", but CMake did not find one. 

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

    Qt5QuickCompilerConfig.cmake 
    qt5quickcompiler-config.cmake 

在這一行:

FIND_PACKAGE(Qt5QuickCompiler) 

顯然CMake未找到Qt5QuickCompiler。我檢查了我的Qt文件夾(C:\ Qt),但它不在那裏。但我可以運行這個應用程序QMake

我需要設置什麼才能找到Qt5QuickCompiler

+1

請不要張貼的截圖再次,它不回答你的問題。你沒有下載Qt Quick編譯器,對吧? (1)寫一個答案,你沒有下載它,但它是必要的。 (2)接受一個給定的答案,因爲他們可能會幫助你。在答案中添加評論,表明您錯過了下載。這歸功於這些人的幫助。 (3)如果你認爲這個問題對其他人沒有意義,那就刪除它。 – usr1234567

回答

2

錯誤很明顯:CMake沒有Qt5QuickCompiler找到它的模塊。它只是不知道它是什麼。我剛剛檢查過相應的cmake文件夾,它沒有該文件。我不確定Qt文檔頁面在討論什麼,但CMake發行版中沒有這樣的文件。也許Qt資源有這個文件的地方?

2

您需要使用Qt Quick編譯器構建Qt5,您可以從http://www.qt.io/qt-quick/下載Qt Quick編譯器。在Qt Quick編譯器的編譯目錄中,您會看到Qt5QuickCompilerConfig.cmake
路徑複製到該目錄中,並加入到CMAKE_PREFIX_PATH這樣

cmake -DCMAKE_PRFEIX_PATH=<pathToFile> <pathToSrcDirOfYourProject> 
+0

看來,該文件不可訪問。 – Orient

+1

現在我認爲該文件已過時。看來,該功能默認情況下在非商業版本中可用。我不確定。 – Orient