CMake错误-找不到CMAKE_C_COMPILER。对于特定项目

时间:2018-09-11 20:32:13

标签: c++ visual-studio cmake

我正在尝试编译基于cmake的OpenGL项目,该项目可以在Windows环境下的MacBook上完美编译。在Windows上运行时,会引发此错误

The C compiler identification is unknown
The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:2 (project):
No CMAKE_C_COMPILER could be found.

起初,我可能是由于系统上缺少某些库而引起的,但是当我按照here的说明尝试从here进行另一个项目时,我能够成功编译它并生成一个VS解决方案。似乎无法理解我所缺少的内容

这是我的CmakeLists.txt文件

cmake_minimum_required(VERSION 3.10)
project(GLParticles)

set(CMAKE_CXX_STANDARD 11)

add_executable(GLParticles main.cpp ParticleWorld.cpp ParticleWorld.h)

include_directories(GLTestBed/ext/glew-2.1.0/include)
include_directories(GLTestBed/ext/SFML-2.4.2/include)

include_directories(GLTestBed/src)
include_directories(GLTestBed/ext/glm)


target_link_libraries(GLParticles GlTestBed)

if(APPLE)
  include_directories(/usr/local/include)

  target_link_libraries(GLParticles GlTestBed
    /usr/local/Cellar/glew/2.1.0/lib/libGLEW.2.1.0.dylib
    /usr/local/Cellar/sfml/2.4.2_1/lib/libsfml-window.2.4.2.dylib
    /usr/local/Cellar/sfml/2.4.2_1/lib/libsfml-system.2.4.2.dylib)

  SET(CMAKE_CXX_LINK_FLAGS "-framework OpenGL")
endif()

add_subdirectory(GLTestBed)

0 个答案:

没有答案