Cmake Visual Studio 2015 Identification Unknown

我的未来我决定 提交于 2019-12-12 00:35:25

问题


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

回答1:


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.



来源:https://stackoverflow.com/questions/37089187/cmake-visual-studio-2015-identification-unknown

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!