Skip to content

Commit

Permalink
[c]: use GNUInstallDirs to help determine installation paths
Browse files Browse the repository at this point in the history
In particular, this handles cases where libraries should be installed in
e.g. `/usr/lib64` rather than `/usr/lib`.

https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html
  • Loading branch information
musicinmybrain committed Jan 3, 2025
1 parent d0d7a26 commit 53e26fb
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions c/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,11 @@ add_custom_command(
COMMAND ${CMAKE_CTEST_COMMAND}
)
############ Installation section ############
set(include_install_dir "include")
set(lib_install_dir "lib/")
set(bin_install_dir "bin/")
set(config_install_dir "lib/cmake/")
include(GNUInstallDirs)
set(include_install_dir "${CMAKE_INSTALL_INCLUDEDIR}")
set(lib_install_dir "${CMAKE_INSTALL_LIBDIR}/")
set(bin_install_dir "${CMAKE_INSTALL_BINDIR}/")
set(config_install_dir "${CMAKE_INSTALL_LIBDIR}/cmake/")

set(project_config "${CMAKE_CURRENT_BINARY_DIR}/generated/${PROJECT_NAME}Config.cmake")
set(targets_export_name "${PROJECT_NAME}Targets")
Expand Down

0 comments on commit 53e26fb

Please sign in to comment.