Cmake Visual Studio 2015识别未知

时间:2016-05-07 13:32:14

标签: c++ visual-studio-2015 cmake glew

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

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

当我尝试生成使用viusal studio编译器(2015社区)的代码时。我遇到问题,CMake使用 -lopengl32 -lglue32 将链接库添加到Visual Studio项目中。这是错误的,因为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

运行Visual Studio Generator的输出是:

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

以下两行:

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".

对我来说似乎很奇怪,因为它能够运行Visual Studio编译器。我读到了一些关于这是添加到链接器 -l <​​/ strong>无效的原因。

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

提前致谢

CMakeError.txt:

function javascript_abort(){
   throw new Error('This is not an error. This is just to abort javascript');
}

1 个答案:

答案 0 :(得分:0)

花了一些时间搜索我修好了!我尝试构建的项目的实际路径在其路径中包含 SPACE 。看来,CMake无法解决这个问题。