diff --git a/cmake/ncine_compiler_options.cmake b/cmake/ncine_compiler_options.cmake index 21a162d3..ba1b776e 100644 --- a/cmake/ncine_compiler_options.cmake +++ b/cmake/ncine_compiler_options.cmake @@ -202,4 +202,8 @@ else() # GCC and LLVM target_link_libraries(${NCINE_APP} PRIVATE dl) endif() endif() + + if(NOT ANDROID AND NOT APPLE) + target_link_libraries(${NCINE_APP} PUBLIC ${OpenGL_LIBRARY}) + endif() endif() diff --git a/cmake/ncine_imported_targets.cmake b/cmake/ncine_imported_targets.cmake index 8cf0f45d..aaa8f9bc 100644 --- a/cmake/ncine_imported_targets.cmake +++ b/cmake/ncine_imported_targets.cmake @@ -207,7 +207,15 @@ elseif(NOT ANDROID AND NOT NCINE_BUILD_ANDROID) # GCC and LLVM find_package(GLEW) endif() if(NOT NINTENDO_SWITCH) - find_package(OpenGL REQUIRED) + find_package(OpenGL QUIET) + if(OpenGL_FOUND) + message(STATUS "Using legacy GLX OpenGL implementation") + else(OpenGL_FOUND) + # If we couldn't find old GLX package, try to use modern libglvnd libOpenGL.so instead. + message(STATUS "Using modern GLVND OpenGL implementation") + FIND_LIBRARY(OpenGL_LIBRARY OpenGL) + SET(EXTRA_LIBS ${OpenGL_LIBRARY}) + endif(OpenGL_FOUND) endif() if(NCINE_ARM_PROCESSOR) include(check_atomic)