Skip to contentSkip to conversation

kernel-shark: Use cmake imported targets instead of variables

PATCH In review Tzvetomir Stoyanov (VMware) 2 participants 2 messages Jan 13, 2022 – Jan 15, 2022

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 kernel-shark: Use cmake imported targets instead of variables

Using cmake imported targets instead of package variables is recommended way to define package dependencies.

The GLUT_LIBRARY cmake variable was renamed in cmake 3.22.1, which breaks the Kernel Shark build with the latest cmake.

---
 src/CMakeLists.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
src/CMakeLists.txt +2 -2
index babb9c1..9e0b4ae 100644
@@ -59,8 +59,8 @@ if (OPENGL_FOUND)
                                      KsPlugins.cpp)
 
     target_link_libraries(kshark-plot  kshark
-                                       ${GLUT_LIBRARY}
-                                       ${OPENGL_LIBRARIES})
+                                       GLUT::GLUT
+                                       OpenGL::GLU)
 
     set_target_properties(kshark-plot PROPERTIES  SUFFIX ".so.${KS_VERSION_STRING}")
     install(TARGETS kshark-plot
Signature · 1 line
2.34.1
#1 lore raw

Hi Tzvetomir and Yordan,

I'm not sure my sign-off is necessary, but if Yordan wants it, you have it :-)

Cheers,
-Michal

Quoted 8 lines · Tzvetomir Stoyanov (VMware)

Using cmake imported targets instead of package variables is recommended way to define package dependencies.

The GLUT_LIBRARY cmake variable was renamed in cmake 3.22.1, which breaks the Kernel Shark build with the latest cmake.

Quoted 21 lines
---
 src/CMakeLists.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
src/CMakeLists.txt +2 -2
index babb9c1..9e0b4ae 100644
@@ -59,8 +59,8 @@ if (OPENGL_FOUND)
                                      KsPlugins.cpp)
 
     target_link_libraries(kshark-plot  kshark
-                                       ${GLUT_LIBRARY}
-                                       ${OPENGL_LIBRARIES})
+                                       GLUT::GLUT
+                                       OpenGL::GLU)
 
     set_target_properties(kshark-plot PROPERTIES  SUFFIX ".so.${KS_VERSION_STRING}")
     install(TARGETS kshark-plot
Signature · 1 line
2.34.1