mirror of
https://github.com/rwengine/openrw.git
synced 2024-09-04 01:29:45 +02:00
cmake: make SDL2 an imported target
This commit is contained in:
parent
9f1ba0fe76
commit
66a28acaa4
@ -194,3 +194,15 @@ IF(SDL2_STATIC)
|
||||
SET(SDL2_LIBRARY ${SDL2_LINK_FLAGS})
|
||||
ENDIF()
|
||||
ENDIF(SDL2_STATIC)
|
||||
|
||||
if(SDL2_FOUND)
|
||||
set(SDL2_EXTRA_LIBS "${SDL2_LIBRARY_TEMP}")
|
||||
list(REMOVE_ITEM SDL2_EXTRA_LIBS "${SDL2_LIBRARY_PATH}")
|
||||
add_library(SDL2::SDL2 UNKNOWN IMPORTED)
|
||||
set_target_properties(SDL2::SDL2 PROPERTIES
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES "C;CXX"
|
||||
IMPORTED_LINK_DEPENDENT_LIBRARIES "${SDL2_EXTRA_LIBS}"
|
||||
IMPORTED_LOCATION "${SDL2_LIBRARY_PATH}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${SDL2_INCLUDE_DIR}"
|
||||
)
|
||||
endif()
|
||||
|
@ -50,7 +50,6 @@ target_include_directories(rwgame
|
||||
PRIVATE
|
||||
${BULLET_INCLUDE_DIR}
|
||||
${OPENAL_INCLUDE_DIR}
|
||||
${SDL2_INCLUDE_DIR}
|
||||
)
|
||||
|
||||
target_include_directories(rwgame
|
||||
@ -64,7 +63,7 @@ target_link_libraries(rwgame
|
||||
${Boost_LIBRARIES}
|
||||
${OPENGL_LIBRARIES}
|
||||
${BULLET_LIBRARIES}
|
||||
${SDL2_LIBRARY}
|
||||
SDL2::SDL2
|
||||
)
|
||||
|
||||
install(TARGETS rwgame RUNTIME DESTINATION "${BIN_DIR}")
|
||||
|
@ -60,7 +60,6 @@ target_include_directories(run_tests
|
||||
SYSTEM
|
||||
PRIVATE
|
||||
${BULLET_INCLUDE_DIR}
|
||||
${SDL2_INCLUDE_DIR}
|
||||
)
|
||||
|
||||
target_include_directories(run_tests
|
||||
@ -74,7 +73,7 @@ target_link_libraries(run_tests
|
||||
rwengine
|
||||
${OPENGL_LIBRARIES}
|
||||
${BULLET_LIBRARIES}
|
||||
${SDL2_LIBRARY}
|
||||
SDL2::SDL2
|
||||
${PNG_LIBRARIES}
|
||||
${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user