diff --git a/cmake/macros/TargetGlad.cmake b/cmake/macros/TargetGlad.cmake index 59cb14a31b..929f61c3f2 100644 --- a/cmake/macros/TargetGlad.cmake +++ b/cmake/macros/TargetGlad.cmake @@ -15,22 +15,16 @@ macro(TARGET_GLAD) find_library(EGL EGL) target_link_libraries(${TARGET_NAME} ${EGL}) else() - if (APPLE) - set(GLAD_VER "41") + if (USE_GLES) + set(GLAD_VER "32es") else() - if (USE_GLES) - set(GLAD_VER "32es") - else() - set(GLAD_VER "45") - add_dependency_external_projects(glad45) - endif() - if (WIN32) - find_package(OpenGL REQUIRED) - target_link_libraries(${TARGET_NAME} "${OPENGL_LIBRARY}") - # we don't need the include, because we get everything from GLAD - #target_include_directories(${TARGET_NAME} PUBLIC ${OPENGL_INCLUDE_DIR}) - endif() + set(GLAD_VER "45") endif() + find_package(OpenGL REQUIRED) + list(APPEND GLAD_EXTRA_LIBRARIES ${OPENGL_LIBRARY}) + if (NOT WIN32) + list(APPEND GLAD_EXTRA_LIBRARIES dl) + endif() set(GLAD "glad${GLAD_VER}") string(TOUPPER ${GLAD} GLAD_UPPER) add_dependency_external_projects(${GLAD}) @@ -40,4 +34,5 @@ macro(TARGET_GLAD) target_include_directories(${TARGET_NAME} PUBLIC ${GLAD_INCLUDE_DIRS}) target_link_libraries(${TARGET_NAME} ${GLAD_LIBRARY}) + target_link_libraries(${TARGET_NAME} ${GLAD_EXTRA_LIBRARIES}) endmacro()