fix: create OpenAL::OpenAL target alias for Linux
Some checks failed
Build / Build (push) Successful in 9m28s
Build and Release / prepare (push) Successful in 1s
Build and Release / build_linux (push) Failing after 8m58s
Build and Release / build_macos (push) Failing after 11s
Build and Release / build_windows (push) Failing after 12s
Build and Release / publish_release (push) Has been skipped
MSVC Build / build-windows (windows-latest) (push) Has been cancelled

- FindOpenAL on Linux creates OPENAL_LIBRARY/OPENAL_INCLUDE_DIR
- But code expects OpenAL::OpenAL target
- Add compatibility layer to create proper target
This commit is contained in:
ShiftyX1 2025-12-08 20:25:59 +03:00
parent 42dcf7c888
commit b68e5567b8

View File

@ -14,6 +14,15 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
find_package(OpenAL CONFIG REQUIRED)
else()
find_package(OpenAL REQUIRED)
# Create OpenAL::OpenAL alias if not exists
if(NOT TARGET OpenAL::OpenAL AND TARGET OpenAL::AL)
add_library(OpenAL::OpenAL ALIAS OpenAL::AL)
elseif(NOT TARGET OpenAL::OpenAL AND OPENAL_FOUND)
add_library(OpenAL::OpenAL INTERFACE IMPORTED)
set_target_properties(OpenAL::OpenAL PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${OPENAL_INCLUDE_DIR}"
INTERFACE_LINK_LIBRARIES "${OPENAL_LIBRARY}")
endif()
endif()
find_package(ZLIB REQUIRED)
find_package(PNG REQUIRED)