diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -148,6 +148,14 @@ PURPOSE "OpenGL dispatch library" ) +set(HAVE_DL_LIBRARY FALSE) +if(epoxy_HAS_GLX) + find_library(DL_LIBRARY dl) + if(DL_LIBRARY) + set(HAVE_DL_LIBRARY TRUE) + endif() +endif() + find_package(Wayland 1.2 REQUIRED COMPONENTS Cursor OPTIONAL_COMPONENTS Egl) set_package_properties(Wayland PROPERTIES TYPE REQUIRED @@ -573,11 +581,6 @@ generate_export_header(kwin EXPORT_FILE_NAME kwin_export.h) target_link_libraries(kwin kwinglutils ${epoxy_LIBRARY}) -# -ldl used by OpenGL code -find_library(DL_LIBRARY dl) -if (DL_LIBRARY) -target_link_libraries(kwin ${DL_LIBRARY}) -endif() kf5_add_kdeinit_executable(kwin_x11 main_x11.cpp) target_link_libraries(kdeinit_kwin_x11 kwin KF5::Crash) diff --git a/libkwineffects/kwinconfig.h.cmake b/libkwineffects/kwinconfig.h.cmake --- a/libkwineffects/kwinconfig.h.cmake +++ b/libkwineffects/kwinconfig.h.cmake @@ -21,5 +21,6 @@ #cmakedefine01 HAVE_EPOXY_GLX +#cmakedefine01 HAVE_DL_LIBRARY #endif diff --git a/plugins/platforms/x11/standalone/CMakeLists.txt b/plugins/platforms/x11/standalone/CMakeLists.txt --- a/plugins/platforms/x11/standalone/CMakeLists.txt +++ b/plugins/platforms/x11/standalone/CMakeLists.txt @@ -21,6 +21,10 @@ target_link_libraries(KWinX11Platform ${X11_Xinput_LIB}) endif() +if(HAVE_DL_LIBRARY) + target_link_libraries(KWinX11Platform ${DL_LIBRARY}) +endif() + install( TARGETS KWinX11Platform diff --git a/plugins/platforms/x11/standalone/glxbackend.cpp b/plugins/platforms/x11/standalone/glxbackend.cpp --- a/plugins/platforms/x11/standalone/glxbackend.cpp +++ b/plugins/platforms/x11/standalone/glxbackend.cpp @@ -43,7 +43,9 @@ #include #include +#if HAVE_DL_LIBRARY #include +#endif #ifndef XCB_GLX_BUFFER_SWAP_COMPLETE #define XCB_GLX_BUFFER_SWAP_COMPLETE 1 @@ -159,8 +161,10 @@ #if HAVE_EPOXY_GLX ret = glXGetProcAddress((const GLubyte*) name); #endif +#if HAVE_DL_LIBRARY if (ret == nullptr) ret = (glXFuncPtr) dlsym(RTLD_DEFAULT, name); +#endif return ret; } glXSwapIntervalMESA_func glXSwapIntervalMESA;