2016-05-07 188 views
0

所以基本上我試圖用Cmake來構建一個我正在使用的項目,該項目使用GLEW(作爲共享庫)。 GLEW鏈接到glu32.lib和opengl32.lib。它們被添加到GLEW的的CMakeLists.txt上target_link_libraries調用諸如:Cmake Visual Studio 2015標識未知

target_link_libraries(glew PUBLIC opengl32 glu32) 

當我嘗試使用viusal工作室編譯器(2015年社區)生成代碼。我遇到了CMake將鏈接庫添加到Visual studio項目的問題,其中-lopengl32-lglue32。這是錯誤的,因爲視覺工作室不能處理這一點,並給出滿足在編譯的時候出現以下錯誤:

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編譯器。我讀了一些關於這個除鏈接器外無效的原因。

有沒有人有這個問題,並知道如何解決它?

在此先感謝

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

回答

0

花一些時間搜索後我定了!我試圖建立的項目的實際路徑中包含一條路徑中的SPACE。顯然CMake不能處理這個。