CMake error at CMakeLists.txt:30 (project): No CMAKE_C_COMPILER could be found

后端 未结 19 2586
抹茶落季
抹茶落季 2020-11-22 12:57

I\'m trying make a Visual Studio solution with CMake to compile the latest version of aseprite and CMake keeps giving me the:

No CMAKE_C_COMPILER could be fo         


        
19条回答
  •  生来不讨喜
    2020-11-22 13:40

    For me, this problem went away on Windows when I moved my project to a shallower parent directory, i.e. to:

    C:\Users\spenc\Desktop\MyProjectDirectory

    instead of

    C:\Users\spenc\Desktop\...\MyProjectDirectory.

    I think the source of the problem was that MSBuild has a file path length restriction to 260 characters. This causes the basic compiler test CMake performs to build a project called CompilerIdCXX.vcxproj to fail with the error:

    C1083: Cannot open source file: 'CMakeCXXCompilerId.cpp'

    because the length of the file's path e.g.

    C:\Users\spenc\Desktop\...\MyProjectDirectory\build\CMakeFiles\...\CMakeCXXCompilerId.cpp

    exceeds the MAX_PATH restriction.

    CMake then concludes there is no CXX compiler.

提交回复
热议问题