我试图为C++ CMake项目使用Qt,该项目不使用Qt库。
我正在跟踪官方指南,但它根本不起作用。以下是我的步骤:
PATH。CMakeLists.txt文件。您可能已经注意到,实际上在正式指南中根本没有提到第4步。我非常习惯于CMake,因此我问自己:
为什么generator不提供正常的"MinGW Makefiles“生成器?

最后一个问题是:
如何使Qt通过CMake?使用MinGW编译器
回答问题:
根据官方指南,当您正确设置PATH时,步骤5不应该发生。
为什么PATH**?** CMake找不到编译器集
创建这些错误的是忍者生成器,如果您使用CMake手动执行此操作,也会发生同样的情况。

CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_CXX_COMPILER_ENV_VAR
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_CXX_COMPILER
CMake Error: Could not find cmake module file: D:/Programming/C++/Test/SupportQt/build/CMakeFiles/3.0.2/CMakeCXXCompiler.cmake
CMake Error at CMakeLists.txt:1 (project):
No CMAKE_C_COMPILER could be found.
Tell CMake where to find the compiler by setting the CMake cache entry
CMAKE_C_COMPILER to the full path to the compiler, or to the compiler name
if it is in the PATH.
CMake Error at CMakeLists.txt:1 (project):
No CMAKE_CXX_COMPILER could be found.
Tell CMake where to find the compiler by setting 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.
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_C_COMPILER_ENV_VAR
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_C_COMPILER
CMake Error: Could not find cmake module file: D:/Programming/C++/Test/SupportQt/build/CMakeFiles/3.0.2/CMakeCCompiler.cmake
CMake Error: CMake was unable to find a build program corresponding to "Ninja". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.-- Configuring incomplete, errors occurred!查看配置菜单,看看是否忘记安装什么,我无意中发现了编译器安装页面。当然,我也在那里添加了我的编译器,但是它什么也没做。
为什么CMake在使用CMake时不使用编译器列表?
它确实使用编译器列表,如果您在工具包选择中选择正确的编译器。

发布于 2015-01-18 00:28:18
就像通常你在想办法后不久才寻求帮助一样,我现在觉得很蠢.
为什么Qt在使用CMake时不使用编译器列表?
确实如此,但前提是您将Kit设置为使用正确的编译器!

为什么CMake没有在路径中找到编译器集?
这实际上是CMake的忍者发生器的问题。如果直接使用CMake,也会发生同样的情况。
为什么generator不提供正常的"MinGW Makefiles“生成器?
确实如此,但前提是您在工具包中选择了一个MinGW编译器!

如何使Qt通过CMake?使用MinGW编译器
通过正确设置一切,不要过分依赖官方指南。

https://stackoverflow.com/questions/28005590
复制相似问题