This option instructs CMake to prefer static external libs when both static
and shared version available. This makes possible linking statically against
external libraries (e.g. fftw, xml2).
The option only available on *NIX platforms, except APPLE and CYGWIN.
Note, that when the option is enabled UILD_SHARED_LIBS gets disabled.
Also note, that with this option on, the binaries built will still be
dynamically linked against system libraries.
option(GMX_DEFAULT_SUFFIX "Use default suffixes for GROMACS binaries and libs (_d for double, _mpi for MPI; rerun cmake after changing to see relevant options)" ON)
option(GMX_DEFAULT_SUFFIX "Use default suffixes for GROMACS binaries and libs (_d for double, _mpi for MPI; rerun cmake after changing to see relevant options)" ON)
+if(UNIX AND NOT APPLE AND NOT CYGWIN)
+ option(GMX_PREFER_STATIC_LIBS "When finding libraries prefer \".a\" static archives (NOTE: this is enabled only for UNIX (excluding APPLE and CYGWIN) platforms but it might not always work!" OFF)
+ mark_as_advanced(GMX_PREFER_STATIC_LIBS)
+endif()
+
########################################################################
# Set up binary and library suffixing
########################################################################
########################################################################
# Set up binary and library suffixing
########################################################################
########################################################################
# Find external packages #
########################################################################
########################################################################
# Find external packages #
########################################################################
+if(UNIX AND NOT APPLE AND NOT CYGWIN)
+ if(GMX_PREFER_STATIC_LIBS)
+ SET(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
+ if(BUILD_SHARED_LIBS)
+ message(WARNING "Static libraries requested, the GROMACS libraries will also be build static (BUILD_SHARED_LIBS=OFF)")
+ set(BUILD_SHARED_LIBS OFF CACHE BOOL "Enable shared libraries (can be problematic with MPI, Windows)" FORCE)
+ endif()
+ endif()
+endif()
find_package(LibXml2)
set(PKG_XML "")
find_package(LibXml2)
set(PKG_XML "")