Cmake Visual Studio 2015识别未知 [英] Cmake Visual Studio 2015 Identification Unknown

查看:354
本文介绍了Cmake Visual Studio 2015识别未知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

  target_link_libraries(glew PUBLIC opengl32 glu32)

当我试图生成使用viusal工作室编译器的代码(2015社区)。我遇到了问题与CMake添加链接库到Visual Studio项目与 -lopengl32 -lglue32 。这是错误的,因为视觉工作室不能处理这一点,并遇到以下错误时尝试编译:

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

运行Visual Studio Generator的输出是:

  C:\Project\build> cmake .. -GVisual Studio 14 2015 Win64
- C编译器标识未知
- CXX编译器识别未知
- 检查工作C编译器使用:Visual Studio 14 2015 Win64
- 检查工作C编译器使用:Visual Studio 14 2015 Win64 - 工作
- 检测C编译器ABI info
- 检测C编译器ABI info - done
- 检查CXX编译器是否正常工作:Visual Studio 14 2015 Win64
- 检查CXX编译器是否正常工作使用:Visual Studio 14 2015 Win64 - 工作
- 检测CXX编译器ABI信息
- 检测CXX编译器ABI信息 - 完成
- 找到OpenGL:opengl32
- 配置done
- 生成完成
- 生成文件已写入:C:/ Project / build

以下两行:

   -  C编译器标识未知
- - CXX编译器识别未知

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



有没有人有这个问题,知道如何

提前感谢



CMakeError.txt:

  C编译器标识源CMakeCCompilerId.c的编译没有在C:Project / build / CMakeFiles / 3.5.2 / CompilerIdC中生成可执行文件。 
编译CXX编译器标识源CMakeCXXCompilerId.cpp未在C:/Project/build/CMakeFiles/3.5.2/CompilerIdCXX中生成可执行文件。


解决方案

花了一些时间搜索i fixed it!我试图建立的项目的实际路径在其路径中包含 SPACE 。显然CMake不能处理这个。


So basically i am trying to use Cmake to build a project i am working on, the project uses GLEW (as shared library). GLEW links to both glu32.lib and opengl32.lib. They are added to the CMakelists.txt of glew on the target_link_libraries call like:

target_link_libraries(glew PUBLIC opengl32 glu32)

When i try to generate code for using the viusal studio compiler (2015 Community). I get problems with CMake adding the link libraries to the Visual studio project with -lopengl32 and -lglue32. This is wrong since visual studio cant handle this and gives met the following error when trying to compile:

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

The output of running the Visual Studio Generator is:

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 following two lines:

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

seem quite odd to me since it is able to run the Visual Studio compiler. I read something about this being the cause of the invalid -l addition to the linker.

Is there anyone that had this problem and knows how to solve it?

Thanks in advance

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

解决方案

After spending some time searching i fixed it! The actual path of the project i was trying to build contained a SPACE in its path. Appearantly CMake can't handle this.

这篇关于Cmake Visual Studio 2015识别未知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆