Demos (master): cmake: Link m library on all unices.

Jose Fonseca jrfonseca at kemper.freedesktop.org
Thu Mar 17 20:40:31 UTC 2011


Module: Demos
Branch: master
Commit: 858e8c6d9fee438a364a4bb687df06fd26767d5f
URL:    http://cgit.freedesktop.org/mesa/demos/commit/?id=858e8c6d9fee438a364a4bb687df06fd26767d5f

Author: José Fonseca <jfonseca at vmware.com>
Date:   Thu Mar 17 20:40:08 2011 +0000

cmake: Link m library on all unices.

It seems that recent gcc or cmake versions are getting more picky about it.

---

 CMakeLists.txt                |    8 ++++++--
 src/egl/opengl/CMakeLists.txt |    4 ++--
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3f8fc9f..dea47aa 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -16,7 +16,11 @@ find_path (GLEW_INCLUDE_DIR GL/glew.h
       /usr/include/GL
 )
 
-if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
+if (UNIX)
+	link_libraries(m)
+endif (UNIX)
+
+if (WIN32)
 	# Nobody likes to include windows.h:
 	# - Microsoft's GL/gl.h header depends on windows.h but doesn't include it;
 	# - GLEW temporarily defines the necessary defines but undefines them later
@@ -37,7 +41,7 @@ if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
 	add_definitions (-DGLAPIENTRY=__stdcall)
 
 	link_libraries (winmm)
-endif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
+endif (WIN32)
 
 if (MSVC)
 	# Enable math constants defines
diff --git a/src/egl/opengl/CMakeLists.txt b/src/egl/opengl/CMakeLists.txt
index 3a012e1..ede9ec3 100644
--- a/src/egl/opengl/CMakeLists.txt
+++ b/src/egl/opengl/CMakeLists.txt
@@ -6,10 +6,10 @@ add_executable(eglinfo eglinfo.c)
 target_link_libraries(eglinfo ${EGL_egl_LIBRARY})
 
 add_executable(eglgears_screen eglgears.c)
-target_link_libraries(eglgears_screen ${EGL_egl_LIBRARY} eglut_screen m)
+target_link_libraries(eglgears_screen ${EGL_egl_LIBRARY} eglut_screen)
 
 if(X11_FOUND)
   add_executable(eglgears_x11 eglgears.c)
-  target_link_libraries(eglgears_x11 ${EGL_egl_LIBRARY} eglut_x11 m)
+  target_link_libraries(eglgears_x11 ${EGL_egl_LIBRARY} eglut_x11)
 endif(X11_FOUND)
 




More information about the mesa-commit mailing list