1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-11-21 18:02:43 +01:00

cmake: make OpenGL an imported target

This commit is contained in:
Anonymous Maarten 2017-10-26 03:34:17 +02:00 committed by Daniel Evans
parent 5dc707aaed
commit 06c4bf09f7
5 changed files with 15 additions and 4 deletions

View File

@ -0,0 +1,14 @@
include("${CMAKE_ROOT}/Modules/FindOpenGL.cmake")
if(OPENGL_FOUND)
list(GET OPENGL_LIBRARIES 0 OPENGL_FIRST_LIBRARY)
set(OPENGL_OTHER_LIBRARIES "${OPENGL_LIBRARIES}")
list(REMOVE_AT OPENGL_OTHER_LIBRARIES 0)
add_library(OpenGL::OpenGL UNKNOWN IMPORTED)
set_target_properties(OpenGL::OpenGL PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES "C;CXX"
IMPORTED_LOCATION "${OPENGL_FIRST_LIBRARY}"
INTERFACE_LINK_LIBRARIES "${OPENGL_OTHER_LIBRARIES}"
INTERFACE_INCLUDE_DIRECTORIES "${OPENGL_INCLUDE_DIR}"
)
endif()

View File

@ -60,7 +60,6 @@ target_link_libraries(rwgame
PRIVATE
rwengine
${Boost_PROGRAM_OPTIONS_LIBRARY}
${OPENGL_LIBRARIES}
SDL2::SDL2
)

View File

@ -57,7 +57,7 @@ target_link_libraries(rwlib
PUBLIC
openrw::interface
PRIVATE
${OPENGL_LIBRARIES}
OpenGL::OpenGL
${Boost_FILESYSTEM_LIBRARY}
${Boost_SYSTEM_LIBRARY}
)

View File

@ -26,7 +26,6 @@ add_executable(rwviewer
target_link_libraries(rwviewer
rwengine
${OPENGL_LIBRARIES}
)
qt5_use_modules(rwviewer Widgets OpenGL)

View File

@ -71,7 +71,6 @@ target_include_directories(run_tests
target_link_libraries(run_tests
PRIVATE
rwengine
${OPENGL_LIBRARIES}
SDL2::SDL2
${PNG_LIBRARIES}
${Boost_FILESYSTEM_LIBRARY}