diff options
author | Vitaly Zaitsev <vitaly@easycoding.org> | 2020-08-19 02:16:11 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-19 02:16:11 +0300 |
commit | 584e0c3dd3eb5ac0631b0840c3852ea274960862 (patch) | |
tree | 229a33796ea91a6efe583bd12ea8c0001679506a | |
parent | 05ca8e1cacb5db9152411ad8df1d2d61f0fe82aa (diff) |
Fixed installation on other than Ubuntu GNU/Linux distributions. (#226)
Fixes the installation paths by using cmake variables.
-rw-r--r-- | CMakeLists.txt | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 1b524f7..3e9b862 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -73,8 +73,9 @@ target_include_directories(cxxopts INTERFACE ) if(CXXOPTS_ENABLE_INSTALL) + include(GNUInstallDirs) include(CMakePackageConfigHelpers) - set(CXXOPTS_CMAKE_DIR "lib/cmake/cxxopts" CACHE STRING + set(CXXOPTS_CMAKE_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/cxxopts" CACHE STRING "Installation directory for cmake files, relative to ${CMAKE_INSTALL_PREFIX}.") set(version_config "${PROJECT_BINARY_DIR}/cxxopts-config-version.cmake") set(project_config "${PROJECT_BINARY_DIR}/cxxopts-config.cmake") @@ -100,8 +101,8 @@ if(CXXOPTS_ENABLE_INSTALL) NAMESPACE cxxopts::) # Install the header file and export the target - install(TARGETS cxxopts EXPORT ${targets_export_name} DESTINATION lib) - install(FILES ${PROJECT_SOURCE_DIR}/include/cxxopts.hpp DESTINATION include) + install(TARGETS cxxopts EXPORT ${targets_export_name} DESTINATION ${CMAKE_INSTALL_LIBDIR}) + install(FILES ${PROJECT_SOURCE_DIR}/include/cxxopts.hpp DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) endif() add_subdirectory(src) |