Q:

I'm on Windows and there is a FindGLEW.cmake file in my CMake modules folder, presumably put there when I installed CMake-3.6. I found GLEW on sourceforge and downloaded the zip file for Windows. I unzipped and installed in C:\Program Files\glew. When I've created my own libraries and used CMake to build and install them, this is the default location they are installed to so I am pretty confident I'm OK here.

The snippet from my CMakeLists.txt is:

find_package(GLEW REQUIRED)

include_directories(${GLEW_INCLUDE_DIRS})

link_libraries(${GLEW_LIBRARIES})

The actual error message from CMake is:

CMake Error at C:/Program Files/CMake/share/cmake-3.6/Modules/FindPackageHandleStandardArgs.cmake:148 (message):

Could NOT find GLEW (missing: GLEW_INCLUDE_DIR GLEW_LIBRARY)

Call Stack (most recent call first):

C:/Program Files/CMake/share/cmake-3.6/Modules/FindPackageHandleStandardArgs.cmake:388 (_FPHSA_FAILURE_MESSAGE)

C:/Program Files/CMake/share/cmake-3.6/Modules/FindGLEW.cmake:44 (find_package_handle_standard_args)

source/CMakeLists.txt:5 (find_package)

Is it possible the FindGLEW.cmake is broken? I've looked at a couple of other FindXXXXX.cmake files and they are like snowflakes, each one pretty unique. So it's hard for me to say with any certainty that it's following convention.

 

A:

Looking in the sources, the package is looking for GLEW in relative paths. These relative paths are searched using different prefixes, including the content of the variable CMAKE_PREFIX_PATH:

  • <prefix>/include for find_path which is used to find include directories.
  • <prefix>/lib for find_library which is used to find libraries.

Assuming C:/Program Files/glew/include and C:/Program Files/glew/lib exist, add C:/Program Files/glew to your CMAKE_PREFIX_PATH variable. Something like:

list(APPEND CMAKE_PREFIX_PATH "C:/Program Files/glew")

find_package(GLEW REQUIRED)

Note that the following lines:

include_directories(${GLEW_INCLUDE_DIRS})

link_libraries(${GLEW_LIBRARIES})

may be dropped using imported target Glew::Glew:

add_executable(foo ...)

target_link_libraries(foo Glew::Glew)

 

From: https://stackoverflow.com/questions/40271558/cmake-cant-find-glew

CMake can't find GLEW的更多相关文章

  1. OPGL+GLFW+GLEW配置详细步骤

    转载自:https://blog.csdn.net/weixin_40921421/article/details/80211813 本文设计的工具包: 链接:https://pan.baidu.co ...

  2. 【OpenGL】搭建opgl环境

    *GLFW+GLEW环境. 工具: GLFW库(下载) GLEW库 cMake软件(下载) 用cMake编译GLFW和GLEW成vs工程文件包,运行得到编译后文件. 在编译后文件夹中找到各个必需文件, ...

  3. (一)VS2015下配置OpenGL

    刚开始用OpenGL,一开始不太明白配置库的原理,在VS2015下耗费了大量时间.这里将配置过程做个笔记,以供日后查看.配置过程中,需要下载cmake构建工具以及glew和glfw库. 下载地址为: ...

  4. 基于cmake编译glew

    cmake已经成为了C/C++开源项目的主流构建工具.glew也提供了cmake的脚本,但用cmake编译glew容易采坑:glew的github上的代码,无论是master分支还是glew-2.1. ...

  5. OpenGL开发环境配置-Windows/MinGW/Clion/CMake

    因为某些原因,不想用过于臃肿的VS了,转而使用常用的jetbrains的CLion,Clion沿袭了jetbrans的优良传统,基本代码提示功能还是比较好的,不过就是对于windows不熟悉cmake ...

  6. CMake入门

    CMake入门 CMake是一个跨平台的安装编译工具,可以用简单的语句来描述所有平台的安装(编译过程).他能够输出各种各样的makefile或者project文件,能测试编译器所支持的C++特性,类似 ...

  7. clion中配置glfw和glew

    clion中只能用cmake文件配置 最开始不清楚cmake语法走了不少弯路 如果遇到symbol(s) not found for architecture x86_64错误,百分百是cmake没配 ...

  8. GLFW+GLEW搭建opengl环境(备忘)

    使用VS2017社区版本(免费版) 下载GLFW和GLEW源码. 使用CMAKE生成工程文件 打开右击GLFW和GLEW项目编译 GLFW默认是静态库 编译GLEW时调整为静态库.将生成的lib和源码 ...

  9. 基于glew,freeglut的imshow

    OpenGL显示图片,这篇博客使用glew + freeglut + gdal来实现imshow. 主要修改: 使用BGR而不是RGB,保持和opencv行为一致 纯C,去掉C++相关的 去掉GDAL ...

随机推荐

  1. github view source

    https://insight.io/ http://www.cnplugins.com/devtool/octotree/

  2. C++ classes and uniform initialization

     // classes and uniform initialization #include <iostream> using namespace std; class Circle ...

  3. java入门学习(十四)运算语句for

    循环可用来重复执行一条语句或者含有多条语句的语句块.在大多数程序中都会需要重复执行一块语句. for 循环的基本语法是: for (表达式1:表达式2:表达式3) { 若干语句 } for语句由关键字 ...

  4. Delphi 设置快捷键

    = 'Repeat %s(&' + #32 + ')';  //设置快捷键  这个是设置空格的  如果设置字符,  就可以这样写= 'Repeat %s(&H)‘ const SRep ...

  5. In-Place upgrade to Team Foundation Server (TFS) 2015 from TFS 2013Team Foundation Server TFS TFS 2015 TFS upgrade TFS with Sharepoint

    This upgrade document gives detailed step by step procedure for the In-Place upgrade from TFS 2013 t ...

  6. IIS7下配置ASP+ACCESS环境

    先要设置应用程序池(Application Pool)为Classic .NET AppPool,而不是默认的Default AppPool,可以在网站目录里对每个站点设置,也可以在站点进行单独设置. ...

  7. struct net_device网络设备结构体详解

    转自:http://blog.csdn.net/viewsky11/article/details/53046787 在linux中使用struct net_device结构体来描述每一个网络设备.同 ...

  8. 权力的游戏第七季/全集Game of Thrones迅雷下载

    艾美及金球奖获奖HBO原创剧集<权力的游戏>第七季将于2016年夏天晚些时候开拍.新的一季共有七集,主要拍摄地为北爱尔兰,部分镜头也将在西班牙和冰岛取景.上映时间预计将略有推迟,至2017 ...

  9. RecyclerView常见问题解决方案,RecyclerView嵌套自动滚动,RecyclerView 高度设置wrap_content 无作用等问题

    1,ScrollView或者RecyclerView1 嵌套RecyclerView2  进入页面自动跳转到recyclerView2上面页面会自动滚动貌似是RecyclerView 自动获得了焦点两 ...

  10. Material Designer的低版本兼容实现(六)—— Ripple Layout

    新版的Android5.0添加了涟漪效果,虽然开源的库提供了各种控件便于大家使用涟漪效果.但是仍旧不可能满足所有需求,因此我今天改出来一个类叫做,LayoutRipple,其实感觉跟应该叫Ripple ...