CMake Error:Failed to find "glu32" in "" with CMAKE_CXX_LIBRARY_ARCHITECTURE "".

1 开发环境

    计算机系统:Win8.1

    Qt版本:5.2.1

    Qt Creator版本:3.0.1

    VTK版本:6.2.0

   CMake版本:3.1.0

    编译器:VS2012 Win64

2 问题描述

    根据《VS2012编译安装VTK-6.2.0_支持Qt5.2.1》编译好VTK库后,使用CMake对源码VTK-6.2.0/Examples/GUI/Qt目录中的FourPaneViewer单独进行配置时,出现这这个错误:

CMake Error at C:/Qt/Qt5.2.1/5.2.1/msvc2012_64_opengl/lib/cmake/Qt5Gui/Qt5GuiConfigExtras.cmake:16 (message):
  Failed to find "glu32" in "" with CMAKE_CXX_LIBRARY_ARCHITECTURE "".
Call Stack (most recent call first):
  C:/Qt/Qt5.2.1/5.2.1/msvc2012_64_opengl/lib/cmake/Qt5Gui/Qt5GuiConfigExtras.cmake:52 (_qt5gui_find_extra_libs)
  C:/Qt/Qt5.2.1/5.2.1/msvc2012_64_opengl/lib/cmake/Qt5Gui/Qt5GuiConfig.cmake:152 (include)
  C:/Qt/Qt5.2.1/5.2.1/msvc2012_64_opengl/lib/cmake/Qt5Widgets/Qt5WidgetsConfig.cmake:94 (find_package)
  E:/VTK/VTK-6.2.0_install/lib/cmake/vtk-6.2/Modules/vtkGUISupportQt.cmake:17 (find_package)

3 解决方法1

    其实这个问题在《VS2012编译安装VTK-6.2.0_支持Qt5.2.1》的第4章已经出现过,可以用其中的方法来解决这个问题。

    为CMake添加一个项目:

CMAKE_PREFIX_PATH
    并且将其值设为:

C:\Program Files (x86)\Windows Kits\8.0\Lib\win8\um\x64 
    如下图所示:

CMake Error:Failed to find "glu32" in "" with CMAKE_CXX_LIBRARY_ARCHITECTURE ""._第1张图片

    这样,问题就解决!

4 解决方法2

    根据参考资料[1]的方法,在打开下面的文件:

C:/Qt/Qt5.2.1/5.2.1/msvc2012_64_opengl/lib/cmake/Qt5Gui/Qt5GuiConfigExtras.cmake
    然后在其第52行(因为错误是出现在第52行)前添加:

set(CMAKE_LIBRARY_PATH "C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x64")
    这样,问题就解决!

参考资料

[1]Failed to find "glu32" in "" with CMAKE_CXX_LIBRARY_ARCHITECTURE ""

你可能感兴趣的:(CMake Error:Failed to find "glu32" in "" with CMAKE_CXX_LIBRARY_ARCHITECTURE "".)