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. sublime text2 用ctags插件实现方法定位(转)

    我们用sublime几乎都会首先安装这个插件,这个插件是管理插件的功能,先安装它,再安装其他插件就方便了. 点击sublime的菜单栏 view->show console :现在打开了控制台, ...

  2. MCU PWM DAC OP Voltage Output

  3. ARM JTAG 信号 RTCK 应该如何处理?

    用户在调试内嵌可综合内核的 CPU 如 ARM7TDMI-S 时,需要通过打开仿真器的自适应时钟功能. 此时,ARM仿真器根据 RTCK 时钟信号的频率,产生可用于 CPU 内核当前时钟主频的最快的 ...

  4. PHP开启curl_init

    windows主机出现“Call to undefined function curl_init”错误提示,没有定义的函数,也就是php还没打开对curl_init函数的支持. 全文:http://j ...

  5. 用C扩展Python3

    官方文档: https://docs.python.org/3/extending/index.html 交叉编译到aarch64上面 以交叉编译到aarch64上面为例,下面是Extest.c的实现 ...

  6. Unity3D实践系列03,使用Visual Studio编写脚本与调试

    在Unity3D中,只有把脚本赋予Scene中的GameObject,脚本才会得以执行. 添加Camera类型的GameObject. Unity3D默认使用"MonoDevelop&quo ...

  7. window.onbeforeunload() 事件调用ajax

    经常有这样的需求,就是在离开某个web页面时,用户不一定点注销,这样会导致会话不能及时销毁.为实现用户离开页面时,自动注销功能,需要在web页面的onbeforeunload事件处理函数中发送注销命令 ...

  8. HttpSession javax.servlet.http.HttpServletRequest.getSession(boolean arg0)理解

    request.getSession()和request.getSession(true)意思相同:获取session,如果session不存在,就新建一个 reqeust.getSession(fa ...

  9. linux find 10天内改动过的文件

    find . -name "*.h" -mtime -10 -type f -print find . -regex ".*\.\(c\|h\)" -mtime ...

  10. 深入理解Java Callable接口

    概述Callable和Runnbale一样代表着任务,区别在于Callable有返回值并且可以抛出异常.其使用如下: public class CallableDemo { static class ...