From 95b5e9805095df2b11b1fadc315654c923a9d0c6 Mon Sep 17 00:00:00 2001 From: topazus Date: Wed, 24 May 2023 12:12:00 +0800 Subject: [PATCH 1/3] Use GNUInstallDirs variables instead of hard-coded paths --- CMakeLists.txt | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a50f0a789f..ec53f6bccd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -76,23 +76,6 @@ project(TiledArray HOMEPAGE_URL "https://valeevgroup.github.io/tiledarray/") enable_language(C) # C needed even for basic platform introspection -# Set install paths ============================================================ - -set(TILEDARRAY_INSTALL_BINDIR "bin" - CACHE PATH "TiledArray binary install directory") -set(TILEDARRAY_INSTALL_INCLUDEDIR "include" - CACHE PATH "TiledArray INCLUDE install directory") -set(TILEDARRAY_INSTALL_LIBDIR "lib" - CACHE PATH "TiledArray LIB install directory") -set(TILEDARRAY_INSTALL_SHAREDIR "share/tiledarray/${TILEDARRAY_EXT_VERSION}" - CACHE PATH "TiledArray DATA install directory") -set(TILEDARRAY_INSTALL_DATADIR "${TILEDARRAY_INSTALL_SHAREDIR}/data" - CACHE PATH "TiledArray DATA install directory") -set(TILEDARRAY_INSTALL_DOCDIR "${TILEDARRAY_INSTALL_SHAREDIR}/doc" - CACHE PATH "TiledArray DOC install directory") -set(TILEDARRAY_INSTALL_CMAKEDIR "lib/cmake/tiledarray" - CACHE PATH "TiledArray CMAKE install directory") - # Add module directory and modules ============================================= list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/modules/) include(CMakePushCheckState) @@ -106,6 +89,23 @@ include(FindPackageRegimport) init_package_regimport() include(LoadFetchContent) +# Set install paths ============================================================ + +set(TILEDARRAY_INSTALL_BINDIR "${CMAKE_INSTALL_BINDIR}" + CACHE PATH "TiledArray binary install directory") +set(TILEDARRAY_INSTALL_INCLUDEDIR "${CMAKE_INSTALL_INCLUDEDIR}" + CACHE PATH "TiledArray INCLUDE install directory") +set(TILEDARRAY_INSTALL_LIBDIR "${CMAKE_INSTALL_LIBDIR}" + CACHE PATH "TiledArray LIB install directory") +set(TILEDARRAY_INSTALL_SHAREDIR "share/tiledarray/${TILEDARRAY_EXT_VERSION}" + CACHE PATH "TiledArray DATA install directory") +set(TILEDARRAY_INSTALL_DATADIR "${TILEDARRAY_INSTALL_SHAREDIR}/data" + CACHE PATH "TiledArray DATA install directory") +set(TILEDARRAY_INSTALL_DOCDIR "${TILEDARRAY_INSTALL_SHAREDIR}/doc" + CACHE PATH "TiledArray DOC install directory") +set(TILEDARRAY_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/tiledarray" + CACHE PATH "TiledArray CMAKE install directory") + # Load extra CMake features ==================================================== include(CMakeDependentOption) @@ -431,7 +431,7 @@ CONFIGURE_FILE( # install config files install(FILES ${PROJECT_BINARY_DIR}/tiledarray.pc - DESTINATION lib/pkgconfig) + DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") # include extra cmake files install(FILES From f044490078c1722f74cdf311ce0675289584dd3e Mon Sep 17 00:00:00 2001 From: Eduard Valeyev Date: Thu, 14 Sep 2023 16:45:56 -0400 Subject: [PATCH 2/3] move definitions of `TILEDARRAY_INSTALL_*` to address https://github.com/ValeevGroup/tiledarray/pull/404/files#r1208030129 --- CMakeLists.txt | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ec53f6bccd..66c4ad2d74 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -76,6 +76,23 @@ project(TiledArray HOMEPAGE_URL "https://valeevgroup.github.io/tiledarray/") enable_language(C) # C needed even for basic platform introspection +# Set install paths ============================================================ + +set(TILEDARRAY_INSTALL_BINDIR "${CMAKE_INSTALL_BINDIR}" + CACHE PATH "TiledArray binary install directory") +set(TILEDARRAY_INSTALL_INCLUDEDIR "${CMAKE_INSTALL_INCLUDEDIR}" + CACHE PATH "TiledArray INCLUDE install directory") +set(TILEDARRAY_INSTALL_LIBDIR "${CMAKE_INSTALL_LIBDIR}" + CACHE PATH "TiledArray LIB install directory") +set(TILEDARRAY_INSTALL_SHAREDIR "share/tiledarray/${TILEDARRAY_EXT_VERSION}" + CACHE PATH "TiledArray DATA install directory") +set(TILEDARRAY_INSTALL_DATADIR "${TILEDARRAY_INSTALL_SHAREDIR}/data" + CACHE PATH "TiledArray DATA install directory") +set(TILEDARRAY_INSTALL_DOCDIR "${TILEDARRAY_INSTALL_SHAREDIR}/doc" + CACHE PATH "TiledArray DOC install directory") +set(TILEDARRAY_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/tiledarray" + CACHE PATH "TiledArray CMAKE install directory") + # Add module directory and modules ============================================= list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/modules/) include(CMakePushCheckState) @@ -89,23 +106,6 @@ include(FindPackageRegimport) init_package_regimport() include(LoadFetchContent) -# Set install paths ============================================================ - -set(TILEDARRAY_INSTALL_BINDIR "${CMAKE_INSTALL_BINDIR}" - CACHE PATH "TiledArray binary install directory") -set(TILEDARRAY_INSTALL_INCLUDEDIR "${CMAKE_INSTALL_INCLUDEDIR}" - CACHE PATH "TiledArray INCLUDE install directory") -set(TILEDARRAY_INSTALL_LIBDIR "${CMAKE_INSTALL_LIBDIR}" - CACHE PATH "TiledArray LIB install directory") -set(TILEDARRAY_INSTALL_SHAREDIR "share/tiledarray/${TILEDARRAY_EXT_VERSION}" - CACHE PATH "TiledArray DATA install directory") -set(TILEDARRAY_INSTALL_DATADIR "${TILEDARRAY_INSTALL_SHAREDIR}/data" - CACHE PATH "TiledArray DATA install directory") -set(TILEDARRAY_INSTALL_DOCDIR "${TILEDARRAY_INSTALL_SHAREDIR}/doc" - CACHE PATH "TiledArray DOC install directory") -set(TILEDARRAY_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/tiledarray" - CACHE PATH "TiledArray CMAKE install directory") - # Load extra CMake features ==================================================== include(CMakeDependentOption) From 3cb0767f82f6237d4907757efca3e2e2af0f9c8b Mon Sep 17 00:00:00 2001 From: Eduard Valeyev Date: Fri, 15 Sep 2023 08:24:35 -0400 Subject: [PATCH 3/3] redefine TILEDARRAY_INSTALL_SHAREDIR in terms of CMAKE_INSTALL_DATAROOTDIR --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 66c4ad2d74..19400f63ed 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -84,7 +84,7 @@ set(TILEDARRAY_INSTALL_INCLUDEDIR "${CMAKE_INSTALL_INCLUDEDIR}" CACHE PATH "TiledArray INCLUDE install directory") set(TILEDARRAY_INSTALL_LIBDIR "${CMAKE_INSTALL_LIBDIR}" CACHE PATH "TiledArray LIB install directory") -set(TILEDARRAY_INSTALL_SHAREDIR "share/tiledarray/${TILEDARRAY_EXT_VERSION}" +set(TILEDARRAY_INSTALL_SHAREDIR "${CMAKE_INSTALL_DATAROOTDIR}/tiledarray/${TILEDARRAY_EXT_VERSION}" CACHE PATH "TiledArray DATA install directory") set(TILEDARRAY_INSTALL_DATADIR "${TILEDARRAY_INSTALL_SHAREDIR}/data" CACHE PATH "TiledArray DATA install directory")