fix finding of discord-rpc

This commit is contained in:
adam-bloom 2021-01-11 20:47:09 -07:00
parent 9efe184538
commit 238a46fe5f
2 changed files with 40 additions and 3 deletions

View File

@ -212,9 +212,12 @@ if (NOT DISABLE_DISCORD_RPC)
include_directories(DISCORDRPC_PROCESS_INCLUDES)
endif()
elseif (APPLE AND MACOS_USE_DEPENDENCIES)
add_definitions(-D__ENABLE_DISCORD__)
set(HAVE_DISCORD_RPC TRUE)
message("Building with libdiscord-rpc.dylib")
find_package(discordrpc CONFIG REQUIRED)
if(${DISCORDRPC_FOUND})
add_definitions(-D__ENABLE_DISCORD__)
set(HAVE_DISCORD_RPC TRUE)
message("Building with libdiscord-rpc.dylib")
endif()
elseif(NOT HAVE_DISCORD_RPC AND EXISTS "${ROOT_DIR}/discord-rpc")
# Don't build discord's examples, some of which are in C and do not honour
# the flags we set for C++. Also we don't use the provided examples.

View File

@ -0,0 +1,34 @@
# This file is modified from duktapeConfig.cmake
# - Try to find discordrpc
# Once done this will define
#
# DISCORDRPC_FOUND - system has discordrpc
# DISCORDRPC_INCLUDE_DIRS - the discordrpc include directory
# DISCORDRPC_LIBRARIES - Link these to use discordrpc
# DISCORDRPC_DEFINITIONS - Compiler switches required for using discordrpc
#
PKG_CHECK_MODULES(PC_DISCORD_RPC QUIET discord-rpc libdiscord-rpc)
find_path(DISCORDRPC_INCLUDE_DIR discord_rpc.h
HINTS ${PC_DISCORD_RPC_INCLUDEDIR} ${PC_DISCORD_RPC_INCLUDE_DIRS}
PATH_SUFFIXES discord-rpc)
find_library(DISCORDRPC_LIBRARY
NAMES discord-rpc libdiscord-rpc
HINTS ${PC_DISCORD_RPC_LIBDIR} ${PC_DISCORD_RPC_LIBRARY_DIRS})
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(discordrpc
REQUIRED_VARS DISCORDRPC_LIBRARY DISCORDRPC_INCLUDE_DIR)
if (DISCORDRPC_FOUND)
set (DISCORDRPC_LIBRARIES ${DISCORDRPC_LIBRARY})
set (DISCORDRPC_INCLUDE_DIRS ${DISCORDRPC_INCLUDE_DIR} )
endif ()
MARK_AS_ADVANCED(
DISCORDRPC_INCLUDE_DIR
DISCORDRPC_LIBRARY
)