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

Use CMAKE_INSTALL_LIBDIR #819

Merged
merged 1 commit into from
Feb 26, 2024
Merged
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
19 changes: 10 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -593,10 +593,11 @@ endif()
# Installation (https://github.com/forexample/package-example)

# Layout. This works for all platforms:
# * <prefix>/lib/cmake/<PROJECT-NAME>
# * <prefix>/lib/
# * <prefix>/<CMAKE_INSTALL_LIBDIR>/cmake/<PROJECT-NAME>
# * <prefix>/<CMAKE_INSTALL_LIBDIR>/
# * <prefix>/include/
set(config_install_dir "lib/cmake/${PROJECT_NAME}")
include(GNUInstallDirs)
set(config_install_dir "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}")
set(include_install_dir "include")

set(generated_dir "${CMAKE_CURRENT_BINARY_DIR}/generated")
Expand Down Expand Up @@ -632,7 +633,7 @@ configure_package_config_file(
)

# Targets:
# * <prefix>/lib/libh3.so
# * <prefix>/<CMAKE_INSTALL_LIBDIR>/libh3.so
# * header location after install: <prefix>/include/h3/h3api.h
# * headers can be included by C++ code `#include <h3/h3api.h>`
# Installing the library and filters system-wide.
Expand All @@ -647,8 +648,8 @@ install(
TARGETS h3
EXPORT "${TARGETS_EXPORT_NAME}"
COMPONENT libh3
LIBRARY DESTINATION "lib"
ARCHIVE DESTINATION "lib"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
RUNTIME DESTINATION "bin"
INCLUDES DESTINATION "${include_install_dir}"
)
Expand All @@ -663,16 +664,16 @@ install(
)

# Config
# * <prefix>/lib/cmake/h3/h3Config.cmake
# * <prefix>/lib/cmake/h3/h3ConfigVersion.cmake
# * <prefix>/<CMAKE_INSTALL_LIBDIR>/cmake/h3/h3Config.cmake
# * <prefix>/<CMAKE_INSTALL_LIBDIR>/cmake/h3/h3ConfigVersion.cmake
install(
FILES "${project_config}" "${version_config}"
DESTINATION "${config_install_dir}"
COMPONENT libh3-dev
)

# Config
# * <prefix>/lib/cmake/h3/h3Targets.cmake
# * <prefix>/<CMAKE_INSTALL_LIBDIR>/cmake/h3/h3Targets.cmake
install(
EXPORT "${TARGETS_EXPORT_NAME}"
NAMESPACE "${namespace}"
Expand Down
Loading