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

CMake: Use GNUInstallDirs variables instead of hard-coded paths #404

Merged
merged 3 commits into from
Sep 15, 2023
Merged
Changes from 1 commit
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
36 changes: 18 additions & 18 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -106,6 +89,23 @@ include(FindPackageRegimport)
init_package_regimport()
include(LoadFetchContent)

# Set install paths ============================================================

set(TILEDARRAY_INSTALL_BINDIR "${CMAKE_INSTALL_BINDIR}"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These should come after include(GNUInstallDirs)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I moved the set of install paths into the place after include(GNUInstallDirs)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@evaleev would have to comment on whether TILEDARRAY_INSTALL_XYZ need to be set before include-ing the TA-specific CMake modules.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it appears that currently TILEDARRAY_INSTALL_* vars are not used by files in cmake/modules but were used in the past. So keeping the original location of the definitions of TILEDARRAY_INSTALL_* would be ideal.

Thanks, @topazus !

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)
Expand Down Expand Up @@ -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
Expand Down