All the files there now link into a libgromacs library.
add_subdirectory(gromacs)
add_subdirectory(gmxlib)
-add_subdirectory(mdlib)
add_subdirectory(kernel)
if(NOT GMX_FAHCORE)
add_subdirectory(legacyheaders)
+add_subdirectory(mdlib)
+
+set(LIBGROMACS_SOURCES ${MDLIB_SOURCES})
+
+add_library(libgromacs ${LIBGROMACS_SOURCES})
+target_link_libraries(libgromacs gmx
+ ${GMX_EXTRA_LIBRARIES} ${FFT_LIBRARIES} ${XML_LIBRARIES})
+set_target_properties(libgromacs PROPERTIES
+ OUTPUT_NAME "gromacs${GMX_LIBS_SUFFIX}"
+ SOVERSION ${SOVERSION}
+ INSTALL_NAME_DIR "${LIB_INSTALL_DIR}")
+
+install(TARGETS libgromacs DESTINATION ${LIB_INSTALL_DIR} COMPONENT libraries)
+
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libgromacs.pc.cmakein
+ ${CMAKE_CURRENT_BINARY_DIR}/libgromacs.pc @ONLY)
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libgromacs.pc
+ DESTINATION ${LIB_INSTALL_DIR}/pkgconfig
+ RENAME "libgromacs${GMX_LIBS_SUFFIX}.pc"
+ COMPONENT development)
--- /dev/null
+libdir=@LIB_INSTALL_DIR@
+includedir=@INCL_INSTALL_DIR@
+
+Name: libgromacs
+Description: Gromacs library
+URL: http://www.gromacs.org
+Version: @PROJECT_VERSION@
+Requires: libgmx@LIBSUFFIX@ @PKG_FFT@ @PKG_XML@
+Libs.private: -lm @CMAKE_THREAD_LIBS_INIT@
+Libs: -L${libdir} -lmd@LIBSUFFIX@ @PKG_FFT_LIBS@
+Cflags: -I${includedir} @PKG_CFLAGS@
+
--- /dev/null
+file(GLOB MDLIB_SOURCES *.c)
+
+# Files called xxx_test.c are test drivers with a main() function for
+# module xxx.c, so they should not be included in the library
+file(GLOB_RECURSE NOT_MDLIB_SOURCES *_test.c)
+list(REMOVE_ITEM MDLIB_SOURCES ${NOT_MDLIB_SOURCES})
+set(MDLIB_SOURCES ${MDLIB_SOURCES} PARENT_SCOPE)
md_openmm.c)
add_library(gmxpreprocess ${GMXPREPROCESS_SOURCES})
-target_link_libraries(gmxpreprocess md)
+target_link_libraries(gmxpreprocess libgromacs)
set_target_properties(gmxpreprocess PROPERTIES OUTPUT_NAME "gmxpreprocess${GMX_LIBS_SUFFIX}" SOVERSION ${SOVERSION} INSTALL_NAME_DIR "${LIB_INSTALL_DIR}")
add_library(fahcore ${MDRUN_SOURCES})
else(GMX_FAHCORE)
-list(APPEND GMX_EXTRA_LIBRARIES gmxpreprocess md)
+list(APPEND GMX_EXTRA_LIBRARIES gmxpreprocess libgromacs)
add_executable(grompp grompp.c)
target_link_libraries(grompp ${GMX_EXTRA_LIBRARIES})
gmx_pme_error.c )
-target_link_libraries(gmxana md gmx)
+target_link_libraries(gmxana gmx libgromacs)
set_target_properties(gmxana PROPERTIES OUTPUT_NAME "gmxana${GMX_LIBS_SUFFIX}" SOVERSION ${SOVERSION} INSTALL_NAME_DIR "${LIB_INSTALL_DIR}")
# List of programs with single corresponding .c source file,