coeblt
coeblt

Reputation: 39

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.

Upvotes: 1

Views: 2015

Answers (3)

bliako
bliako

Reputation: 1133

I had a similar problem i.e. 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...

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

Upvotes: 0

usr1234567
usr1234567

Reputation: 23394

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

Upvotes: 1

coeblt
coeblt

Reputation: 39

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

Upvotes: 1

Related Questions