我在运行cmake时遇到一些问题。我使用自制软件安装了cmake。我也已经重新安装了它,但是,它总是给我错误。我该如何解决? 谢谢!
CMake Error: Could not find cmake module file: CMakeDetermineGeneratorCompiler.cmake
CMake Error: Error required internal CMake variable not set, cmake may not be built correctly.
Missing variable is:
CMAKE_Generator_COMPILER_ENV_VAR
CMake Error: Error required internal CMake variable not set, cmake may not be built correctly.
Missing variable is:
CMAKE_Generator_COMPILER
CMake Error: Could not find cmake module file:CMakeFiles/3.13.4/CMakeGeneratorCompiler.cmake
CMake Error at CMakeLists.txt:2 (project):
No CMAKE_Generator_COMPILER could be found.
Tell CMake where to find the compiler by setting the CMake cache entry
CMAKE_Generator_COMPILER to the full path to the compiler, or to the
compiler name if it is in the PATH.
CMake Error: Could not find cmake module file: CMakeGeneratorInformation.cmake
CMake Error: CMAKE_Generator_COMPILER not set, after EnableLanguage
CMakeLists.txt:
cmake_minimum_required (VERSION 3.13.4)
project (Password Generator)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror -std=c++14")
set (source_dir "${PROJECT_SRC_DIR}/src/")
file (GLOB source_files "$source_dir/*.cpp")
add_executable(
Password Generator
${source_files}
)
答案 0 :(得分:0)
问题出在您对project
命令的错误调用上:
project (Password Generator)
这会将Password
设置为项目的名称,并指定它仅使用一种名为Generator
的编程语言(CMake当然不支持)。
您应将项目名称设置为有效的C标识符,例如:
project(PasswordGenerator)