Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cmake config files #345

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required (VERSION 3.2.0)
project (DiscordRPC)
project (DiscordRPC VERSION 3.4.0)

include(GNUInstallDirs)

Expand Down
3 changes: 3 additions & 0 deletions cmake/Config.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@PACKAGE_INIT@

include("${CMAKE_CURRENT_LIST_DIR}/@[email protected]")
28 changes: 27 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ endif(CLANG_FORMAT_CMD)

install(
TARGETS discord-rpc
EXPORT "discord-rpc"
EXPORT "${PROJECT_NAME}Targets"
RUNTIME
DESTINATION "${CMAKE_INSTALL_BINDIR}"
LIBRARY
Expand All @@ -139,9 +139,35 @@ install(
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
)

install(
EXPORT "${PROJECT_NAME}Targets"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
NAMESPACE "${PROJECT_NAME}::"
)

install(
FILES
"../include/discord_rpc.h"
"../include/discord_register.h"
DESTINATION "include"
)

include(CMakePackageConfigHelpers)

configure_package_config_file("../cmake/Config.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
)

write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
COMPATIBILITY SameMajorVersion
)

install(
FILES
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
DESTINATION
"${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
)