运行CMake时出现问题

运行CMake时出现问题,cmake,Cmake,我在运行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. M

我在运行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}
)

问题在于对
project
命令的错误调用:

project (Password Generator)
这将
Password
设置为项目的名称,并指定它只使用一种名为
Generator
的编程语言(当然CMake不支持)

您应该使项目名称成为有效的C标识符,例如:

project(PasswordGenerator)

问题在于对
project
命令的错误调用:

project (Password Generator)
这将
Password
设置为项目的名称,并指定它只使用一种名为
Generator
的编程语言(当然CMake不支持)

您应该使项目名称成为有效的C标识符,例如:

project(PasswordGenerator)

我猜
$source\u dir
应该是
${source\u dir}
?使用
项目(密码生成器)
您实际上将
密码
指定为项目名称并请求“生成器”语言支持,这显然不是您所期望的。最好不要以项目的名义使用空格。例如,改用
project(Password\u Generator)
。我想
$source\u dir
应该是
${source\u dir}
?使用
project(Password Generator)
时,您实际上将
Password
指定为项目名称,并请求“Generator”语言支持,这显然不是您所期望的。最好不要以项目的名义使用空格。例如,改用
项目(密码生成器)