Use native CMake mechanism for find_package(GROMACS)
authorTeemu Murtola <teemu.murtola@gmail.com>
Sun, 6 Jul 2014 03:51:04 +0000 (06:51 +0300)
committerGerrit Code Review <gerrit@gerrit.gromacs.org>
Wed, 13 Aug 2014 21:38:40 +0000 (23:38 +0200)
commitc6a675bfaa4de32277245c72ba0a5df4f4603e74
treef844a41fec6d9bdae13cf679597bf82c13c6cea0
parent643944e7f41c74ce4f0ca7b475fddcdfb241482b
Use native CMake mechanism for find_package(GROMACS)

Instead of various detection stuff that only worked well in the presence
of pkg-config, use native CMake mechanisms: package configuration files
and automatic export of library import definitions.  Include
directories and preprocessor macros influencing the installed headers
are still propagated separately.  The new mechanism also works for
arbitrary suffixes, and is relocatable (as long as external libraries
that GROMACS links against are not moved).  A simple FindGROMACS.cmake
is still there to hide some of the complexity to support multiple
suffixes, but it is not strictly necessary if the using code wants to do
those slightly more complex find_package() invocations directly.

Generalize the machinery that populated libgromacs.pc to use it also for
this purpose.

TODO for later (requires changes that are better done outside this
patch):
 - Improve the versioning logic

The machinery and its current limitations are documented in the Doxygen
page on using GROMACS as a library.  Some of these could possibly be
improved with additional effort, but the current approach is hopefully a
reasonable compromise between usability, robustness, and complexity.

Closes #1430, #1554

Change-Id: I49c50375a5abebfe8614704c175e6ed22c9daa56
17 files changed:
CMakeLists.txt
cmake/gmxManageMPI.cmake
cmake/gmxManageSharedLibraries.cmake
cmake/gmxManageSuffixes.cmake
doxygen/usinglibrary.md
install-guide/install-guide.md
scripts/GMXRC.bash.cmakein
scripts/GMXRC.csh.cmakein
share/template/CMakeLists.txt
share/template/CMakeLists.txt.template
share/template/cmake/FindGROMACS.cmake [new file with mode: 0644]
share/template/cmake/FindGROMACS.cmakein [deleted file]
src/gromacs/CMakeLists.txt
src/gromacs/InstallLibInfo.cmake [new file with mode: 0644]
src/gromacs/gromacs-config-version.cmake.cmakein [new file with mode: 0644]
src/gromacs/gromacs-config.cmake.cmakein [new file with mode: 0644]
src/gromacs/libgromacs.pc.cmakein