SebWouters / CheMPS2

CheMPS2: a spin-adapted implementation of DMRG for ab initio quantum chemistry
GNU General Public License v2.0
70 stars 34 forks source link

find_package(CheMPS2 CONFIG) #48

Closed loriab closed 8 years ago

loriab commented 8 years ago

Hi @SebWouters,

This PR isn't ready to go, but I thought I'd let you know what I was working on.

First of all, I think something like the changeset below is what you want for setting CMAKE_BUILD_TYPE. It's from http://public.kitware.com/pipermail/cmake/2012-May/050243.html . I think you want Release (default) and Debug so optimization and debug flags turn on and off as expected with the configuration modes.

The larger project is that Psi4 is revamping integration with add-ons so that find_package(CheMPS2 MODULE) doesn't use FindCheMPS which are comparatively hard to write b/c they have to consider everywhere the package can be found on the filesystem and all the install configurations. There, the FindCheMPS2 has to be distributed with every package looking to pull in CheMPS2 and the CMake target chemps2::chemps2 has to be defined by the importing program. Instead, we want to use find_package(CheMPS2 CONFIG). In this mode, The CMake build of CheMPS2 installs a few extra files, notably CheMPS2Config.cmake that say what the includes, libraries, and binary names, paths, etc. are and automatically export the aforementioned targets.

So this PR is a first round of that. https://github.com/loriab/gdma#detecting is a model for what this'll look like (repo will migrate to psi4 account eventually). Hope you're interested in incorporating once I get it polished.

Btw, I modified version a bit to be compatible with https://cmake.org/cmake/help/v3.4/command/find_package.html?highlight=patch without breaking anything your version string depends on.

loriab commented 8 years ago

Hi @SebWouters, there may still be some changes, but this PR is in near-final form, so ready to look over. I ended up changing the cmake more than I planned, but for CheMPS2/CMakeLists.txt, I think it turns out looking simpler in the end, especially wrt link libraries.

Along-the-way Changes

Targeted changes

Let me know if you have any questions.