mirror of
https://github.com/rwengine/openrw.git
synced 2024-09-04 09:39:46 +02:00
cmake: simplify packages to ALIASed libraries
This commit is contained in:
parent
9231ecbcb0
commit
66b576dcee
@ -1,17 +1,17 @@
|
||||
# Override CMake's FindBullet module:
|
||||
# create an IMPORTED TARGET
|
||||
# - create a bullet::bullet TARGET
|
||||
|
||||
include("${CMAKE_ROOT}/Modules/FindBullet.cmake")
|
||||
|
||||
if(BULLET_FOUND AND NOT TARGET bullet::bullet)
|
||||
list(GET BULLET_LIBRARIES 0 BULLET_FIRST_LIBRARY)
|
||||
set(BULLET_OTHER_LIBRARIES "${BULLET_LIBRARIES}")
|
||||
list(REMOVE_AT BULLET_OTHER_LIBRARIES 0)
|
||||
add_library(bullet::bullet UNKNOWN IMPORTED)
|
||||
set_target_properties(bullet::bullet PROPERTIES
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES "C;CXX"
|
||||
IMPORTED_LOCATION "${BULLET_FIRST_LIBRARY}"
|
||||
INTERFACE_LINK_LIBRARIES "${BULLET_OTHER_LIBRARIES}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${BULLET_INCLUDE_DIR}"
|
||||
)
|
||||
add_library(bullet INTERFACE)
|
||||
target_link_libraries(bullet
|
||||
INTERFACE
|
||||
${BULLET_LIBRARIES}
|
||||
)
|
||||
target_include_directories(bullet SYSTEM
|
||||
INTERFACE
|
||||
"${BULLET_INCLUDE_DIR}"
|
||||
)
|
||||
add_library(bullet::bullet ALIAS bullet)
|
||||
endif()
|
||||
|
@ -62,14 +62,14 @@ include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(FFmpeg DEFAULT_MSG FFMPEG_LIBRARIES FFMPEG_INCLUDE_DIR)
|
||||
|
||||
if(FFMPEG_FOUND AND NOT TARGET ffmpeg::ffmpeg)
|
||||
list(GET FFMPEG_LIBRARIES 0 FFMPEG_FIRST_LIBRARY)
|
||||
set(FFMPEG_OTHER_LIBRARIES "${FFMPEG_LIBRARIES}")
|
||||
list(REMOVE_AT FFMPEG_OTHER_LIBRARIES 0)
|
||||
add_library(ffmpeg::ffmpeg UNKNOWN IMPORTED)
|
||||
set_target_properties(ffmpeg::ffmpeg PROPERTIES
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES "C;CXX"
|
||||
IMPORTED_LOCATION "${FFMPEG_FIRST_LIBRARY}"
|
||||
INTERFACE_LINK_LIBRARIES "${FFMPEG_OTHER_LIBRARIES}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${FFMPEG_INCLUDE_DIR}"
|
||||
)
|
||||
add_library(ffmpeg INTERFACE)
|
||||
target_link_libraries(ffmpeg
|
||||
INTERFACE
|
||||
${FFMPEG_LIBRARIES}
|
||||
)
|
||||
target_include_directories(ffmpeg SYSTEM
|
||||
INTERFACE
|
||||
"${FFMPEG_INCLUDE_DIR}"
|
||||
)
|
||||
add_library(ffmpeg::ffmpeg ALIAS ffmpeg)
|
||||
endif()
|
||||
|
@ -65,8 +65,10 @@ IF(GLM_FOUND)
|
||||
ENDIF(GLM_FOUND)
|
||||
|
||||
if(GLM_FOUND AND NOT TARGET glm::glm)
|
||||
add_library(glm::glm INTERFACE IMPORTED)
|
||||
set_target_properties(glm::glm PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${GLM_INCLUDE_DIR}"
|
||||
)
|
||||
add_library(glm INTERFACE)
|
||||
target_include_directories(glm SYSTEM
|
||||
INTERFACE
|
||||
"${GLM_INCLUDE_DIR}"
|
||||
)
|
||||
add_library(glm::glm ALIAS glm)
|
||||
endif()
|
||||
|
@ -1,13 +1,17 @@
|
||||
# Override CMake's FindBullet module:
|
||||
# create an IMPORTED TARGET
|
||||
# Override CMake's FindOpenAL module:
|
||||
# - create a OpenAL::OpenAL target
|
||||
|
||||
include("${CMAKE_ROOT}/Modules/FindOpenAL.cmake")
|
||||
|
||||
if(OPENAL_FOUND AND NOT TARGET OpenAL::OpenAL)
|
||||
add_library(OpenAL::OpenAL UNKNOWN IMPORTED)
|
||||
set_target_properties(OpenAL::OpenAL PROPERTIES
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES "C;CXX"
|
||||
IMPORTED_LOCATION "${OPENAL_LIBRARY}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${OPENAL_INCLUDE_DIR}"
|
||||
)
|
||||
add_library(OpenAL INTERFACE)
|
||||
target_link_libraries(OpenAL
|
||||
INTERFACE
|
||||
"${OPENAL_LIBRARY}"
|
||||
)
|
||||
target_include_directories(OpenAL SYSTEM
|
||||
INTERFACE
|
||||
"${OPENAL_INCLUDE_DIR}"
|
||||
)
|
||||
add_library(OpenAL::OpenAL ALIAS OpenAL)
|
||||
endif()
|
||||
|
@ -1,14 +1,17 @@
|
||||
# Override CMake's FindOpenGL module:
|
||||
# - create a OPENGL::GL TARGET
|
||||
|
||||
include("${CMAKE_ROOT}/Modules/FindOpenGL.cmake")
|
||||
|
||||
if(OPENGL_FOUND AND NOT TARGET OpenGL::GL)
|
||||
list(GET OPENGL_LIBRARIES 0 OPENGL_FIRST_LIBRARY)
|
||||
set(OPENGL_OTHER_LIBRARIES "${OPENGL_LIBRARIES}")
|
||||
list(REMOVE_AT OPENGL_OTHER_LIBRARIES 0)
|
||||
add_library(OpenGL::GL UNKNOWN IMPORTED)
|
||||
set_target_properties(OpenGL::GL PROPERTIES
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES "C;CXX"
|
||||
IMPORTED_LOCATION "${OPENGL_FIRST_LIBRARY}"
|
||||
INTERFACE_LINK_LIBRARIES "${OPENGL_OTHER_LIBRARIES}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${OPENGL_INCLUDE_DIR}"
|
||||
)
|
||||
add_library(OpenGL INTERFACE)
|
||||
target_link_libraries(OpenGL
|
||||
INTERFACE
|
||||
${OPENGL_LIBRARIES}
|
||||
)
|
||||
target_include_directories(OpenGL SYSTEM
|
||||
INTERFACE
|
||||
"${OPENGL_INCLUDE_DIR}"
|
||||
)
|
||||
add_library(OpenGL::GL ALIAS OpenGL)
|
||||
endif()
|
||||
|
@ -169,7 +169,7 @@ IF(SDL2_LIBRARY_TEMP)
|
||||
IF(MINGW)
|
||||
SET(SDL2_LIBRARY_TEMP ${MINGW32_LIBRARY} ${SDL2_LIBRARY_TEMP})
|
||||
ENDIF(MINGW)
|
||||
|
||||
|
||||
IF(WIN32)
|
||||
SET(SDL2_LIBRARY_TEMP winmm imm32 version msimg32 ${SDL2_LIBRARY_TEMP})
|
||||
ENDIF(WIN32)
|
||||
@ -196,13 +196,14 @@ IF(SDL2_STATIC)
|
||||
ENDIF(SDL2_STATIC)
|
||||
|
||||
if(SDL2_FOUND AND NOT TARGET SDL2::SDL2)
|
||||
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}"
|
||||
)
|
||||
add_library(SDL2 INTERFACE)
|
||||
target_link_libraries(SDL2
|
||||
INTERFACE
|
||||
${SDL2_LIBRARY}
|
||||
)
|
||||
target_include_directories(SDL2 SYSTEM
|
||||
INTERFACE
|
||||
"${SDL2_INCLUDE_DIR}"
|
||||
)
|
||||
add_library(SDL2::SDL2 ALIAS SDL2)
|
||||
endif()
|
||||
|
Loading…
Reference in New Issue
Block a user