From e9b1f29414165ff28c855d45df50c69a2f6b01d9 Mon Sep 17 00:00:00 2001 From: Julien Schueller Date: Mon, 5 Jun 2023 12:20:16 +0200 Subject: [PATCH] CMake: Use GNUInstallDirs --- CMakeLists.txt | 11 +++++------ lib/src/CMakeLists.txt | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f71316c..85e1bf2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -43,16 +43,15 @@ if (MSVC) set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4197 /wd4244 /wd4251 /wd4267 /wd4996") endif () -if (NOT DEFINED CMAKE_INSTALL_LIBDIR) - set (CMAKE_INSTALL_LIBDIR lib${LIB_SUFFIX}) -endif () +include (GNUInstallDirs) set (OTMORRIS_LIBRARY_PATH ${CMAKE_INSTALL_LIBDIR}) -set (OTMORRIS_INCLUDE_PATH include) +set (OTMORRIS_BIN_PATH ${CMAKE_INSTALL_BINDIR}) +set (OTMORRIS_INCLUDE_PATH ${CMAKE_INSTALL_INCLUDEDIR}) set (OTMORRIS_SWIG_INCLUDE_DIRS ${OTMORRIS_INCLUDE_PATH}/${PACKAGE_NAME}/swig) -set (OTMORRIS_DATA_PATH share) +set (OTMORRIS_DATA_PATH ${CMAKE_INSTALL_DATAROOTDIR}) set (OTMORRIS_CONFIG_CMAKE_PATH ${CMAKE_INSTALL_LIBDIR}/cmake/otmorris) -set (OTMORRIS_DOC_PATH share/${PACKAGE_NAME}/doc) +set (OTMORRIS_DOC_PATH ${CMAKE_INSTALL_DATAROOTDIR}/${PACKAGE_NAME}/doc) set (CMAKE_CXX_STANDARD 11) diff --git a/lib/src/CMakeLists.txt b/lib/src/CMakeLists.txt index aff33df..f0c9073 100644 --- a/lib/src/CMakeLists.txt +++ b/lib/src/CMakeLists.txt @@ -40,7 +40,7 @@ install(EXPORT OTMORRIS-Targets install(TARGETS otmorris EXPORT OTMORRIS-Targets - RUNTIME DESTINATION bin + RUNTIME DESTINATION ${OTMORRIS_BIN_PATH} LIBRARY DESTINATION ${OTMORRIS_LIBRARY_PATH} ARCHIVE DESTINATION ${OTMORRIS_LIBRARY_PATH} )