简体   繁体   中英

CMake can't find FindGLEW.cmake

Ubuntu12.04 Cocos2d-x-3.4 When I buid the test project,there are some errors:

It appears you are builing natively for Linux with GCC
-- OpenGL include dirs: /usr/include
**CMake Error at cmake/Modules/CocosBuildHelpers.cmake:44** (find_package):
  **Could not find module FindGLEW.cmake or a configuration file for package
  GLEW**.

  Adjust CMAKE_MODULE_PATH to find FindGLEW.cmake or set GLEW_DIR to the
  directory containing a CMake configuration file for GLEW.  The file will
  have one of the following names:

    GLEWConfig.cmake
    glew-config.cmake

Call Stack (most recent call first):
  CMakeLists.txt:159 (cocos_find_package)

I have checked the path cmake/Modules/ . There is no FindGLEW.cmake file. But I don't know where I can get it, or how I can fix this problem.

  • Some packages that are aware of CMake provide their own Find*.cmake. For example Eigen does so. By having a quick look into the GLEW sources, they don't ship their own find package macro.

  • Sometimes the projects relying on external libraries ship their own Find*.cmake for the external dependency. A quick look at their repository reveals, they ship it neither.

But CMake 2.8.10 or newer contains the test, see its documentation . The test was improved in 3.1. You can update your CMake installation and it will work.

I fixed it.But,I haven't understood it clearly. I make a file "FindGLEW.cmake" in the path "cmake/Modules" The content of that file just like the url said. http://www-i8.informatik.rwth-aachen.de/svnrepo/OpenFlipper/branches/Free/cmake/FindGLEW.cmake

I had a similar problem ie cmake not finding "FindGlew.cmake" with the following error: By not providing "FindGlew.cmake" in CMAKE_MODULE_PATH this project...

Which was weird because I did have that module... Only it was called FindGLEW.cmake (residing in /usr/share/cmake/Modules/ for Fedora/Linux).

And so, I had to make a link to FindGlew.cmake using sudo ln -sf /usr/share/cmake/Modules/FindGLEW.cmake /usr/share/cmake/Modules/FindGlew.cmake

To be on the safe side I run a small script I whipped up which produces a list of all permutations of uppercase and lowercase letters in FindGlew and makes links to all of them. Just a precaution when dealing with time-wasters to-be-programmers aspriring to create the bigger-and-better make . Yeah right...

ps If FindGLEW.cmake does not exist in your system then you need to upgrade cmake and/or install additional module glew-devel .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM