From e0d55c2833cd85fd8501962381ec10abc75426ad Mon Sep 17 00:00:00 2001 From: PGZXB Date: Wed, 31 Jul 2024 17:45:05 +0800 Subject: [PATCH] Update CMakeLists.txt --- CMakeLists.txt | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ffbd1a2..d683c6b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -44,11 +44,13 @@ if(IMGUI4CJ_GLFW_OPENGL3_BACKEND) # OpenGL3 list(APPEND IMGUI_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/external/cimgui/imgui/backends/imgui_impl_opengl3.cpp) - if (WIN32) # Windows - list(APPEND IMGUI_LIBRARIES opengl32) - else (WIN32) # Unix - list(APPEND IMGUI_LIBRARIES GL) - endif (WIN32) + + find_package(OpenGL REQUIRED) + if (OPENGL_FOUND) + list(APPEND IMGUI_LIBRARIES ${OPENGL_gl_LIBRARY}) + else (OPENGL_FOUND) + message(FATAL_ERROR "OpenGL not found") + endif() # GLFW list(APPEND IMGUI_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/external/cimgui/imgui/backends/imgui_impl_glfw.cpp)