From 99985a1d5bc4072db6e1858b6b99223f080fdd51 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Fri, 27 Jul 2018 20:31:53 -0400 Subject: [PATCH] Add profile.d files to set LAMMPS_POTENTIALS environment variable --- cmake/CMakeLists.txt | 11 ++++++++++- cmake/etc/profile.d/lammps.csh.in | 2 ++ cmake/etc/profile.d/lammps.sh.in | 2 ++ 3 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 cmake/etc/profile.d/lammps.csh.in create mode 100644 cmake/etc/profile.d/lammps.sh.in diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 88efd90221..8567e4395e 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -961,7 +961,16 @@ endif() ############################################################################### # Install potential files in data directory ############################################################################### -install(DIRECTORY ${LAMMPS_SOURCE_DIR}/../potentials DESTINATION ${CMAKE_INSTALL_DATADIR}/lammps) +set(LAMMPS_POTENTIALS_DIR ${CMAKE_INSTALL_FULL_DATADIR}/lammps/potentials) +install(DIRECTORY ${LAMMPS_SOURCE_DIR}/../potentials DESTINATION ${CMAKE_INSTALL_DATADIR}/lammps/potentials) + +configure_file(etc/profile.d/lammps.sh.in ${CMAKE_BINARY_DIR}/etc/profile.d/lammps.sh @ONLY) +configure_file(etc/profile.d/lammps.csh.in ${CMAKE_BINARY_DIR}/etc/profile.d/lammps.csh @ONLY) +install( + FILES ${CMAKE_BINARY_DIR}/etc/profile.d/lammps.sh + ${CMAKE_BINARY_DIR}/etc/profile.d/lammps.csh + DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/profile.d +) ############################################################################### # Testing diff --git a/cmake/etc/profile.d/lammps.csh.in b/cmake/etc/profile.d/lammps.csh.in new file mode 100644 index 0000000000..def49bf75c --- /dev/null +++ b/cmake/etc/profile.d/lammps.csh.in @@ -0,0 +1,2 @@ +# set environment for LAMMPS executables to find potential files +if ( "$?LAMMPS_POTENTIALS" == 0 ) setenv LAMMPS_POTENTIALS @LAMMPS_POTENTIALS_DIR@ diff --git a/cmake/etc/profile.d/lammps.sh.in b/cmake/etc/profile.d/lammps.sh.in new file mode 100644 index 0000000000..acd75fa0cf --- /dev/null +++ b/cmake/etc/profile.d/lammps.sh.in @@ -0,0 +1,2 @@ +# set environment for LAMMPS executables to find potential files +export LAMMPS_POTENTIALS=${LAMMPS_POTENTIALS-@LAMMPS_POTENTIALS_DIR@}