Description: cmake: use system microprofile Author: Andrea Pappacoda Forwarded: no Last-Update: 2022-03-30 --- yuzu-mainline-0-969+dfsg.orig/externals/CMakeLists.txt +++ yuzu-mainline-0-969+dfsg/externals/CMakeLists.txt @@ -43,8 +43,13 @@ if(NOT MbedTLS_FOUND) endif() # MicroProfile -add_library(microprofile INTERFACE) -target_include_directories(microprofile INTERFACE ./microprofile) +find_package(microprofile MODULE) +if (NOT microprofile_FOUND) + message(STATUS "microprofile not found, falling back to externals") + add_library(microprofile INTERFACE) + target_include_directories(microprofile INTERFACE ./microprofile) + add_library(microprofile::microprofile ALIAS microprofile) +endif() # libusb if (NOT LIBUSB_FOUND OR YUZU_USE_BUNDLED_LIBUSB) --- /dev/null +++ yuzu-mainline-0-969+dfsg/externals/find-modules/Findmicroprofile.cmake @@ -0,0 +1,20 @@ +# SPDX-FileCopyrightText: 2022 Andrea Pappacoda +# +# SPDX-License-Identifier: GPL-2.0-or-later + +find_package(PkgConfig QUIET) +if (PKG_CONFIG_FOUND) + pkg_search_module(microprofile IMPORTED_TARGET microprofile) + if (microprofile_FOUND) + set_target_properties(PkgConfig::microprofile PROPERTIES IMPORTED_GLOBAL True) + add_library(microprofile::microprofile ALIAS PkgConfig::microprofile) + set(microprofile_VERSION "${microprofile_VERSION}") + set(microprofile_FOUND True) + endif() +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(microprofile + REQUIRED_VARS microprofile_FOUND + VERSION_VAR microprofile_VERSION +) --- yuzu-mainline-0-969+dfsg.orig/src/common/CMakeLists.txt +++ yuzu-mainline-0-969+dfsg/src/common/CMakeLists.txt @@ -179,7 +179,7 @@ endif() create_target_directory_groups(common) -target_link_libraries(common PUBLIC ${Boost_LIBRARIES} fmt::fmt microprofile Threads::Threads) +target_link_libraries(common PUBLIC ${Boost_LIBRARIES} fmt::fmt microprofile::microprofile Threads::Threads) target_link_libraries(common PRIVATE lz4::lz4 xbyak) if (MSVC) target_link_libraries(common PRIVATE zstd::zstd)