MantisBT - CMake
View Issue Details
0014060CMakeModulespublic2013-04-04 08:162016-06-10 14:31
Marcel Loose 
Kitware Robot 
normalminoralways
closedmoved 
LinuxUbuntu12.10
CMake 2.8.10.2 
 
0014060: FindGLUT puts NOTFOUND in GLUT_LIBRARIES
FindGLUT puts GLUT_Xmu_LIBRARY-NOTFOUND;GLUT_Xi_LIBRARY-NOTFOUND in the variable GLUT_LIBRARIES, when GLUT_FOUND is TRUE.

This causes CMake to bail out with the following error:

CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
GLUT_Xi_LIBRARY (ADVANCED)
    linked by target "foo" in directory /home/marcel/temp/cmake/findglut-bug
GLUT_Xmu_LIBRARY (ADVANCED)
    linked by target "foo" in directory /home/marcel/temp/cmake/findglut-bug
1. Create a CMakeLists.txt file that contains the following:

cmake_minimum_required(VERSION 2.8)
project(FindGLUT_Bug C)
find_package(GLUT)
if(GLUT_FOUND)
  add_executable(foo foo.c)
  target_link_libraries(foo ${GLUT_LIBRARIES})
endif()

2. Create a (empty) file foo.c

3. Run cmake
This bug is also present in cmake 2.8.9. Older versions of cmake (e.g. 2.8.0) set GLUT_FOUND to FALSE, which is probably also not what you'd want, because if I remove the NOTFOUND entries from GLUT_LIBRARIES, everything works fine.

Workaround:

set(_glut_libraries)
foreach(_lib ${GLUT_LIBRARIES})
  if(_lib)
    list(APPEND _glut_libraries ${_lib})
  endif()
endforeach()
set(GLUT_LIBRARIES ${_glut_libraries})
No tags attached.
Issue History
2013-04-04 08:16Marcel LooseNew Issue
2013-04-04 08:40Brad KingAssigned To => Rolf Eike Beer
2013-04-04 08:40Brad KingStatusnew => assigned
2013-04-17 06:17Rolf Eike BeerNote Added: 0032855
2013-04-17 08:51Marcel LooseNote Added: 0032858
2015-03-30 11:34Orion PoplawskiNote Added: 0038363
2016-02-25 13:07Rolf Eike BeerAssigned ToRolf Eike Beer =>
2016-02-25 13:07Rolf Eike BeerStatusassigned => backlog
2016-06-10 14:28Kitware RobotNote Added: 0042261
2016-06-10 14:28Kitware RobotStatusbacklog => resolved
2016-06-10 14:28Kitware RobotResolutionopen => moved
2016-06-10 14:28Kitware RobotAssigned To => Kitware Robot
2016-06-10 14:31Kitware RobotStatusresolved => closed

Notes
(0032855)
Rolf Eike Beer   
2013-04-17 06:17   
The current assumption of that module is that Xmu and Xi are needed by the GLUT lib on everything but Apple, BeOS, and Windows. Seems this is (no longer?) true. But I have no clue if it had been true, or is true on some platforms. That should be decided by someone who has a clue about GLUT at all. So the simple fix would be to only add those libs if they are found, but that would risk breaking something else.
(0032858)
Marcel Loose   
2013-04-17 08:51   
Well, I'm definitely not a GLUT expert either. But I think I narrowed down the probable cause. In line 26, "freeglut" was added somewhere between cmake 2.8.3 and 2.8.6.

It appears that (at least on Ubuntu Linux) you only need libglut.so, but that also depends on libX11. So, at least on Linux, FindGLUT should also do a find_package(X11).

I cannot judge for freeglut on other platforms.
(0038363)
Orion Poplawski   
2015-03-30 11:34   
Fedora bug filed: https://bugzilla.redhat.com/show_bug.cgi?id=1207045 [^]

For properly linked shared libraries you should only need -lglut. For static, that's a different story.
(0042261)
Kitware Robot   
2016-06-10 14:28   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.