Installing Cmake packages

I’ve been using separate build files to install individual cake packages. I use the mkdir build command to install a new package. I make a new one for each package so I have build_1 build_2 etc. I navigate to that folder and then use a
cmake … -D PKG_PACKAGE_NAME=yes …/cmake
make install

command sequence in that folder. It seems to work for many examples, however sometimes when I try to run an example or my own input file I’ll get a message that whichever package I have installed is “not enabled in this lammps binary”. Sometimes the packages are enabled sometimes they are not. It is very confusing why it does or does not work. Any tips or pointers would be greatly appreciated.

You must configure all packages you want for the same build folder. What you do is in contradiction to the documentation.
Otherwise you get a different LAMMPS executable in each build folder and when you do make install you will overwrite the one from the previous folder. Thus at the end you will have a LAMMPS executable with just the one package you configured in the last build folder.

So all the packages should be installed in the same build folder?


Please also note that “installing packages” is a term that is more suitable for the traditional build system (where C++ source files would be copied around or deleted); when using CMake it would be more specific to talk about “enabling packages” as nothing gets copied.