Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changes required to build with cmake 3.22.2 on linux #658

Closed
mpictor opened this issue Jul 10, 2022 · 0 comments
Closed

changes required to build with cmake 3.22.2 on linux #658

mpictor opened this issue Jul 10, 2022 · 0 comments
Milestone

Comments

@mpictor
Copy link

mpictor commented Jul 10, 2022

I'm not submitting a PR, as I doubt these changes are sufficiently backward compatible for merge as-is, and it's unlikely that I'd find the time to follow up on feedback etc etc. My hope is that someone else will find this useful and perhaps can massage it into a form suitable for merge.

The changes I made are:

  1. set gl preference so cmake doesn't complain; not strictly necessary, and both GLVND and LEGACY seem to work.
  2. in all CMakeLists.txt, replace GLUT_LIBRARY with GLUT_LIBRARIES
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d8525ba..58202ad 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -32,6 +32,8 @@
 
 cmake_minimum_required(VERSION 2.8.12)
 
+set(OpenGL_GL_PREFERENCE "GLVND")
+
 ######################################################################################
 # Project declaration and options
 ######################################################################################
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index 8c6733f..6f1ffd1 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -25,11 +25,11 @@ if (Threads_FOUND AND OPENGL_FOUND AND GLUT_FOUND)
   add_executable(freenect-chunkview chunkview.c)
   add_executable(freenect-micview micview.c)
 
-  target_link_libraries(freenect-glview freenect ${OPENGL_LIBRARIES} ${GLUT_LIBRARY} ${CMAKE_THREAD_LIBS_INIT} ${MATH_LIB})
-  target_link_libraries(freenect-regview freenect ${OPENGL_LIBRARIES} ${GLUT_LIBRARY} ${CMAKE_THREAD_LIBS_INIT} ${MATH_LIB})
-  target_link_libraries(freenect-hiview freenect ${OPENGL_LIBRARIES} ${GLUT_LIBRARY} ${CMAKE_THREAD_LIBS_INIT} ${MATH_LIB})
-  target_link_libraries(freenect-chunkview freenect ${OPENGL_LIBRARIES} ${GLUT_LIBRARY} ${CMAKE_THREAD_LIBS_INIT} ${MATH_LIB})
-  target_link_libraries(freenect-micview freenect ${OPENGL_LIBRARIES} ${GLUT_LIBRARY} ${CMAKE_THREAD_LIBS_INIT} ${MATH_LIB})
+  target_link_libraries(freenect-glview freenect ${OPENGL_LIBRARIES} ${GLUT_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${MATH_LIB})
+  target_link_libraries(freenect-regview freenect ${OPENGL_LIBRARIES} ${GLUT_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${MATH_LIB})
+  target_link_libraries(freenect-hiview freenect ${OPENGL_LIBRARIES} ${GLUT_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${MATH_LIB})
+  target_link_libraries(freenect-chunkview freenect ${OPENGL_LIBRARIES} ${GLUT_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${MATH_LIB})
+  target_link_libraries(freenect-micview freenect ${OPENGL_LIBRARIES} ${GLUT_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${MATH_LIB})
 
   install(TARGETS freenect-glview freenect-regview freenect-hiview freenect-chunkview freenect-micview
           DESTINATION bin)
@@ -51,7 +51,7 @@ if (BUILD_C_SYNC)
   if (OPENGL_FOUND AND GLUT_FOUND)
     include_directories(${OPENGL_INCLUDE_DIR} ${GLUT_INCLUDE_DIR})
     add_executable(freenect-glpclview glpclview.c)
-    target_link_libraries(freenect-glpclview freenect_sync ${OPENGL_LIBRARIES} ${GLUT_LIBRARY} ${MATH_LIB})
+    target_link_libraries(freenect-glpclview freenect_sync ${OPENGL_LIBRARIES} ${GLUT_LIBRARIES} ${MATH_LIB})
     install(TARGETS freenect-glpclview
             DESTINATION bin)
   endif ()
diff --git a/wrappers/cpp/CMakeLists.txt b/wrappers/cpp/CMakeLists.txt
index 6d17924..c2222a8 100644
--- a/wrappers/cpp/CMakeLists.txt
+++ b/wrappers/cpp/CMakeLists.txt
@@ -18,8 +18,8 @@ if (BUILD_EXAMPLES)
     target_compile_features(freenect-cppview PUBLIC cxx_std_11)
     target_compile_features(freenect-cpp_pcview PUBLIC cxx_std_11)
 
-    target_link_libraries(freenect-cppview freenect ${OPENGL_LIBRARIES} ${GLUT_LIBRARY} ${CMAKE_THREAD_LIBS_INIT} ${MATH_LIB})
-    target_link_libraries(freenect-cpp_pcview freenect ${OPENGL_LIBRARIES} ${GLUT_LIBRARY} ${CMAKE_THREAD_LIBS_INIT} ${MATH_LIB})
+    target_link_libraries(freenect-cppview freenect ${OPENGL_LIBRARIES} ${GLUT_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${MATH_LIB})
+    target_link_libraries(freenect-cpp_pcview freenect ${OPENGL_LIBRARIES} ${GLUT_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${MATH_LIB})
 
     install(TARGETS freenect-cppview freenect-cpp_pcview
             DESTINATION bin)
@piedar piedar added this to the next milestone Sep 19, 2022
piedar added a commit that referenced this issue Sep 19, 2022
Signed-off-by: Benn Snyder <benn.snyder@gmail.com>
@piedar piedar closed this as completed in f6de60f Sep 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants