Closed loriab closed 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.
Release
and fending off in-source build attempts.if (conditional expr) ... elseif(conditional expr) ... endif (conditional expr)
, CMake killed this off in its own source code 4 years ago so I'm removing it from CheMPS2 if I'm also altering that area.CLEAN_DIRECT_OUTPUT
isn't needed in >= 2.8 (which you require) according to FAQ (you'll have to search it)ENABLE_OPENMP
. I'm not adamant about that if you don't like it.${PROJECT}_VERSION
is something cmake can decompose into major.minor.patch variables. I didn't want to disrupt your versioning variables, so I just created a CheMPS2_MMP_VERSION
for that role.CheMPS2Config.cmake
that will have shared or static or both targets that will be detected by find_package(CheMPS2 CONFIG)
in the consuming project.chemps2
library, so I did.PUBLIC
, which is the default and uses the quantities both to build libchemps2/chemps2/testN and as instructions as to what's needed by a consuming project to use libchemps2, I tried to separate these roles- PRIVATE
for the former and INTERFACE
for the latter. So by setting the LIBC lib as PRIVATE for libchemps2 and HDF5 and MKL as INTERFACE for chemps2, then the chemps2 binary and the tests don't need to link against HDF5 or MKL, as simply the link against libchemps2 suffices.ExternalProject_Add()
files, grab them. They'll always be in the Psi4 history, but they're departing the repo proper.Let me know if you have any questions.
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 wantRelease
(default) andDebug
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 targetchemps2::chemps2
has to be defined by the importing program. Instead, we want to usefind_package(CheMPS2 CONFIG)
. In this mode, The CMake build of CheMPS2 installs a few extra files, notablyCheMPS2Config.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.