Optional external library

How can one have an optional external library in fpm.toml?
I link to LAMMPS but not necessarily on every machine on which I compile my code. Is it possible to avoid linking to an external library without modifying fpm.toml?
The subroutines which call LAMMPS functions can be easily dismissed at compile time using preprocessing via environment variables, however, I do not know what to do with neglecting libraries at link time.

Thank you very much for your comment!

Currently there is no way to write conditionals in the TOML file itself. You have to have multiple files, one of which you move to fpm.toml, or generate the fpm.toml file with a shell script or a Make file or cpp or other methods to handle that at this time. user-specified profiles are still under development. Response files can make it easier by allowing you to specify options outside of the manifest file , but there is currently not a simple clean method that I can think of that does not require invoking running something to conditionally generate the manifest file (ie. fpm.toml) to turn on or off an external library completely.

In an earlier version you could specify a makefile be invoked to do a build, but that is no longer available. Do you have ideas on how you would like it to work? Should you be able to choose a manifest file file to be used by name; should an fpm.toml file allow for some conditional preprocessing (cpp, conditional lines that call system commands that return true or false, a more extensive embeddable language format, …?

Thank you for the reply!
Actually, I had in mind to have multiple fpm.toml files and track those files with git instead of fpm.toml. I considered it not a good approach. I can write a bash script to generate fpm.toml based on the values given by the user.
By “a manifest file”, I think that you probably mean, a file containing the list of external libraries and perhaps also environment variables. If I understood it correctly, this file is not supposed to be tracked and it should be used by fpm. I searched the web, toml format does not include another file for such purposes. Again, if I understood correctly, the manifest file will be used by fpm on top of fpm.toml, if it is provided and it will consider additional external libraries that may not be used by default.

I do the preprocessing by sourcing a bash file (pasted below) before running “fpm build”. I thought that this information should not be in fpm.toml so that I can track it with git. With autotools I can configure Makefiles to dismiss or include any combination of the external libraries. Currently, with FPM, I can build only by including all external libraries used by the code.

cat envpar/fpm_intel.sh

export FPM_FC=mpiifort
export FPM_CC=mpiicc
export FPM_CXX=mpiicpc

#FFLAGS=“-O0 -C -g -traceback -DMPI -DSPGLIB -DHAVE_BPS -DHAVE_LAMMPS -I$BIGDFTROOT/install/include”
FFLAGS=“-O2 -qopenmp -DMPI -DSPGLIB -DHAVE_BPS -DHAVE_LAMMPS -I$BIGDFTROOT/install/include”
#FFLAGS=“-O2 -DMPI -DSPGLIB -DHAVE_BPS -DHAVE_LAMMPS -I$BIGDFTROOT/install/include”
CFLAGS=“-O2”
CPPFLAGS=“-O2 -DQSC_STANDALONE -DMPICH_SKIP_MPICXX -DOMPI_SKIP_MPICXX=1 -DLAMMPS_LIB_MPI -I$LAMMPSROOT/src”

SRC=“src”

LIBS=“-L$SPGLIBROOT/src/.libs -L$LAMMPSROOT/src -L$FUTILE/install/lib -L$MKLROOT/lib/intel64 -L$BIGDFTROOT/install/lib -cxxlib -shared-intel -qmkl=sequential”

export FPM_FFLAGS=“-DHAVE_MKL -I$FUTILE/install/include $FFLAGS”
export FPM_CFLAGS=“-I$SRC $CFLAGS”
export FPM_CXXFLAGS=“-I$SRC $CPPFLAGS”
export FPM_LDFLAGS=“$LIBS”