Merge pull request #11362 from alucryd/feat/system-libmgba

try for system libmgba first
This commit is contained in:
Pierre Bourdon 2023-01-17 23:35:02 +01:00 committed by GitHub
commit 4fc6488844
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 2 deletions

15
CMake/FindLIBMGBA.cmake Normal file
View File

@ -0,0 +1,15 @@
find_path(LIBMGBA_INCLUDE_DIR flags.h PATH_SUFFIXES mgba)
find_library(LIBMGBA_LIBRARY mgba)
mark_as_advanced(LIBMGBA_INCLUDE_DIR LIBMGBA_LIBRARY)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(LIBMGBA DEFAULT_MSG
LIBMGBA_INCLUDE_DIR LIBMGBA_LIBRARY)
if(LIBMGBA_FOUND AND NOT mGBA::mgba)
add_library(mGBA::mgba UNKNOWN IMPORTED)
set_target_properties(mGBA::mgba PROPERTIES
IMPORTED_LOCATION "${LIBMGBA_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${LIBMGBA_INCLUDE_DIR}"
)
endif()

View File

@ -945,8 +945,11 @@ if(NOT ENABLE_QT)
set(USE_MGBA 0)
endif()
if(USE_MGBA)
find_package(LIBMGBA)
if(NOT LIBMGBA_FOUND)
message(STATUS "Using static libmgba from Externals")
add_subdirectory(Externals/mGBA)
endif()
endif()
find_package(SYSTEMD)