Skip to content

Commit

Permalink
cmake: Fix linking against system GLEW
Browse files Browse the repository at this point in the history
  • Loading branch information
Orphis committed Mar 19, 2017
1 parent c502692 commit e0cce76
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -960,8 +960,8 @@ if(ANDROID)
endif()

target_link_libraries(native ${LIBZIP_LIBRARY} ${ZLIB_LIBRARY} ${PNG_LIBRARY} rg_etc1 vjson udis86 ${RT_LIB} ${nativeExtraLibs} ${ATOMIC_LIB})
if(TARGET glew)
target_link_libraries(native glew)
if(TARGET Ext::GLEW)
target_link_libraries(native Ext::GLEW)
endif()

if(ANDROID)
Expand Down
9 changes: 7 additions & 2 deletions ext/glew/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
#find_package(GLEW)
if(NOT GLEW_FOUND)
find_package(GLEW)
if(GLEW_FOUND)
add_library(system_glew INTERFACE)
add_library(Ext::GLEW ALIAS system_glew)
target_link_libraries(system_glew INTERFACE GLEW::GLEW)
else()
find_package(OpenGL REQUIRED)
add_library(glew STATIC
GL/glew.h
GL/glxew.h
GL/wglew.h
glew.c
)
add_library(Ext::GLEW ALIAS glew)
target_link_libraries(glew PUBLIC ${OPENGL_LIBRARIES})
target_compile_definitions(glew PUBLIC GLEW_STATIC)
target_include_directories(glew PUBLIC . ${OPENGL_INCLUDE_DIR})
Expand Down

0 comments on commit e0cce76

Please sign in to comment.