Skip to content

Commit

Permalink
cmake: fix finding ogg through opusfile
Browse files Browse the repository at this point in the history
  • Loading branch information
madebr committed Jan 12, 2024
1 parent 3e4f2b0 commit a7a2e08
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1146,6 +1146,7 @@ if(SDL3MIXER_INSTALL)
cmake/Findlibxmp.cmake
cmake/Findlibxmp-lite.cmake
cmake/Findmodplug.cmake
cmake/FindOgg.cmake
cmake/FindOpusFile.cmake
cmake/Findmpg123.cmake
cmake/FindVorbis.cmake
Expand Down
10 changes: 4 additions & 6 deletions cmake/FindOgg.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,16 @@ set(Ogg_LINK_OPTIONS "${_ogg_link_options}" CACHE STRING "Extra link flags of og

set(Ogg_LINK_DIRECTORIES "${_ogg_link_directories}" CACHE PATH "Extra link directories of ogg")

find_package(Ogg)

find_package_handle_standard_args(Ogg
REQUIRED_VARS Ogg_LIBRARY Ogg_INCLUDE_PATH Ogg_FOUND
REQUIRED_VARS Ogg_LIBRARY Ogg_INCLUDE_PATH
)

if(Ogg_FOUND)
set(Ogg_dirs ${Ogg_INCLUDE_PATH})
if(EXISTS "${Ogg_INCLUDE_PATH}/opus")
list(APPEND Ogg_dirs "${Ogg_INCLUDE_PATH}/opus")
if(EXISTS "${Ogg_INCLUDE_PATH}/ogg")
list(APPEND Ogg_dirs "${Ogg_INCLUDE_PATH}/ogg")
endif()
if (NOT TARGET Ogg::Ogg)
if(NOT TARGET Ogg::Ogg)
add_library(Ogg::Ogg UNKNOWN IMPORTED)
set_target_properties(Ogg::Ogg PROPERTIES
IMPORTED_LOCATION "${Ogg_LIBRARY}"
Expand Down
4 changes: 2 additions & 2 deletions cmake/FindOpusFile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ find_package_handle_standard_args(OpusFile
REQUIRED_VARS OpusFile_LIBRARY OpusFile_INCLUDE_PATH Ogg_FOUND
)

if(OpusFile_FOUND AND Ogg_FOUND)
if(OpusFile_FOUND)
set(OpusFile_dirs ${OpusFile_INCLUDE_PATH})
if(EXISTS "${OpusFile_INCLUDE_PATH}/opus")
list(APPEND OpusFile_dirs "${OpusFile_INCLUDE_PATH}/opus")
endif()
if (NOT TARGET OpusFile::opusfile)
if(NOT TARGET OpusFile::opusfile)
add_library(OpusFile::opusfile UNKNOWN IMPORTED)
set_target_properties(OpusFile::opusfile PROPERTIES
IMPORTED_LOCATION "${OpusFile_LIBRARY}"
Expand Down

0 comments on commit a7a2e08

Please sign in to comment.