Cmake Visual Studio 2015 识别未知

Cmake Visual Studio 2015 Identification Unknown

所以基本上我正在尝试使用 Cmake 构建我正在处理的项目,该项目使用 GLEW(作为共享库)。 GLEW link 到 glu32.lib 和 opengl32.lib。它们被添加到 target_link_libraries 调用的 CMakelists.txt 中,如:

target_link_libraries(glew PUBLIC opengl32 glu32)

当我尝试为使用 viusal studio 编译器(2015 社区)生成代码时。我在使用 -lopengl32-lglue32 将 link 库添加到 Visual studio 项目时遇到问题。这是错误的,因为 visual studio 无法处理此问题并在尝试编译时遇到以下错误:

 LINK : warning LNK4044: unrecognized option '/lglu32.lib'; 
 LINK : warning LNK4044: unrecognized option '/lopengl32.lib';

运行生成 Visual Studio 生成器的输出是:

C:\Project\build>cmake .. -G "Visual Studio 14 2015 Win64"
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
-- Check for working C compiler using: Visual Studio 14 2015 Win64
-- Check for working C compiler using: Visual Studio 14 2015 Win64 -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler using: Visual Studio 14 2015 Win64
-- Check for working CXX compiler using: Visual Studio 14 2015 Win64 -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Found OpenGL: opengl32
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Project/build

下面两行:

-- The C compiler identification is unknown
-- The CXX compiler identification is unknown

对我来说似乎很奇怪,因为它能够 运行 Visual Studio 编译器。我读到一些关于这是 -l 添加到 linker.

无效的原因

有没有人遇到过这个问题并且知道如何解决?

提前致谢

CMakeError.txt:

Compilation of the C compiler identification source "CMakeCCompilerId.c" did not produce an executable in "C:Project/build/CMakeFiles/3.5.2/CompilerIdC".
Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" did not produce an executable in "C:/Project/build/CMakeFiles/3.5.2/CompilerIdCXX".

我花了一些时间搜索后修复了它!我试图构建的项目的实际路径在其路径中包含 SPACE。显然 CMake 无法处理这个问题。