[x] copy over xhost.cmake that has new compilers. import it instead of one-liner. adapt if C, not CXX.
[x] expand safeguards to new build types, RelWithDebInfo, and MinSizeRel
[x] update cmake min version to 3.16
[x] replace SameMajorVersion with now-available SameMinorVersion if appropriate
Actually went from AnyNewVersion to SameMajorVersion
[x] remove any ${PN} in main project CMake as they tend to get clobbered in/after find_package
[x] any new project-specific options, prepend in project-case, like ambit_ENABLE_PYTHON. does not apply to e.g., BUILD_TESTING, BUILD_SHARED_LIBS
[x] Python
[x] if still on old NumPy/pb11 Py detection, switch to approx. find_package(Python 3.7 COMPONENTS Interpreter Development NumPy REQUIRED)
[x] update any set(Python_ADDITIONAL_VERSIONS
[x] update cmake_minimum_required(VERSION 3.16) for Py detection
[x] update any PYTHON_EXECUTABLE to Python_EXECUTABLE
[x] remove any old FindPythonLibsNew.cmake
[x] if any pybind11, check that find_package(Python) before find_package(pybind11)
[x] if any pybind11 target, remove PREFIX/SUFFIX from properties
[x] psi4: update the call in external/
[x] editable config.cmake location
[x] add option(<project>_INSTALL_CMAKEDIR) to make Config.cmake location editable with variable, incl any subprojects like TargetLAPACK.
[x] recipe: specify in bld.bat as -D <project>_INSTALL_CMAKEDIR="Library\share\cmake\<project>" ^ if CMAKE_INSTALL_PREFIX="%PREFIX%"
[x] psi4: add the call in external/ (CMAKE_ARGS and <project>_DIR and any TargetLAPACK, etc.)
[x] modernize target install/export
[x] for install(TARGETS), use full runtime/arch/lib DESTINATIONs so Windows can work
[x] for install(TARGETS), consider a descriptive EXPORT so not repeating targets filename
[x] for install(EXPORT), use descriptive EXPORT and lang or type names to Targets files
[x] make properties target-centered, particularly for FetchContent usage. target and find_package(<package>) should provide same info.
[x] define export_properties variable and append it to all base targets (e.g., static and shared always-built libs)
[x] set the version on the target. use casing like in the config file, probaly project(CheMPS2) --> CheMPS2_VERSION
[x] set all other properties that were project-specific vars in the config (like Libint_MAX_AM_ERI) on the target
[x] check through find_package() that targets are fully loaded (--log-level verbose and extra stuff in Config.cmake can help)
[x] define aliases matching imported targets, add_library(ambit::ambit ALIAS ambit-shared). Favor shared if both can be built together.
[x] rename any CMAKE_SOURCE_DIR/CMAKE_BINARY_DIR to PROJECT_SOURCE_DIR/PROJECT_BINARY_DIR
[x] check fetch_content works
[x] modernize <project>Config.cmake.in
[x] kill off all PN with something like set(amb ambit) # NameSpace. PN gets overwritten a lot, so let's specialize it.
[x] remove find_header, find_file, find_library find_exe reminicent of Find<project>.cmake rather than <project>Config.cmake
[x] read find_project variables off target, rather than setting from file_header/lib/exe results
[x] if any Find files installed, add list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
[x] check components with check_required_components(<project>) (probably already present)
[x] NEVER load exported <project>Targets.cmake before all components confirmed found and all dependencies confirmed found
[x] run a find_project(<project>) to check that vars match target (same as 4th bullet prev. section)
[x] check that all dependencies are handled (sometimes outsourced to psi4, like BLAS for dkh)
[x] add TargetLAPACK if using BLAS/LAPACK
[x] copy over new FindTargetLAPACK, FindTargetHDF5 as needed. modify if only use BLAS
[x] install the Find files with the Config
[x] in config file, add any find_dependency that we were leaving for psi4 before
[x] handling lib and pylib as separate projects
there's room for opinion on this. see discussion at GH:jturney/ambit/pyambit/CMakeLists.txt .
[x] YES, do have an ENABLE_PYTHON (or better, _ENABLE_PYTHON) so library can be built alone
[x] PROBABLY YES, do have a project(pyproject) so python can be built alone after detecting project
[x] CHOOSING YES, do have a ambit_PYMOD variable attached to the target and Config?
[x] CHOOSING YES, same Config.cmake file for C++ and Py, where latter optional and detected with COMPONENTS Python? It's easy enough to have the targets exported to Targets-Python.cmake so same file can manage.
details on separate pylib
[x] for installation positioning, use PYMOD_INSTALL_LIBDIR if var already exists b/c in psi orbit. otherwise emulate libint (LIBINT2_INSTALL_PYMODDIR) or libxc (PYLIBXC_INSTALL_PYMODDIR)
[x] copy over basic and relevant options from main project
[x] copy over version from main project. notate where to sync verson
notes for packagers about config.cmake
[x] install whole py intf module, incl tests
[x] remove restriction that pb11 module can only link to shared library. remove PIC for pb11 module since it handles that
[x] for Linux-style install ONLY, write a Python component to Config.cmake
~if a Py-style install is wanted, toggle Linux-style and Py-style install with something like LIBINT2_PREFIX_PYTHON_INSTALL.~ Not yet wanted for ambit afaik
[x] leave a note for packagers about lib/pylib and config.cmake choices
[x] particular for this project: ambit
~updated Threads linking - not much tested, but it seems the done thing.~ Cancelled, as it just complicates detection when external target.
[x] made tests optionally installable, like the option promised
[x] removed the restriction to link only to the shared ambit c++ library pyambit
[x] installed tensor/indices.h so python could build independently
[x] removed src/python and lib/ and consolidated in pyambit/ so it could build independently
[x] added some ifdef includes for Windows (I copied blocks from other repos, so there might be lines that aren't strictly needed)
[x] ~correctly PRIVATE-ize hdf5 and/or lapack to avoid overlinking.~ Cancelled, as it doesn't hurt most ppl and makes the build more robust. See discussion in src/CM.
[x] update old files
${PN}
in main project CMake as they tend to get clobbered in/afterfind_package
[x] Python
set(Python_ADDITIONAL_VERSIONS
cmake_minimum_required(VERSION 3.16)
for Py detection[x] editable config.cmake location
option(<project>_INSTALL_CMAKEDIR)
to make Config.cmake location editable with variable, incl any subprojects like TargetLAPACK.-D <project>_INSTALL_CMAKEDIR="Library\share\cmake\<project>" ^
ifCMAKE_INSTALL_PREFIX="%PREFIX%"
<project>_DIR
and any TargetLAPACK, etc.)[x] modernize target install/export
[x] make properties target-centered, particularly for FetchContent usage. target and
find_package(<package>)
should provide same info.project(CheMPS2)
--> CheMPS2_VERSIONadd_library(ambit::ambit ALIAS ambit-shared)
. Favor shared if both can be built together.[x] modernize
<project>Config.cmake.in
set(amb ambit) # NameSpace
. PN gets overwritten a lot, so let's specialize it.Find<project>.cmake
rather than<project>Config.cmake
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
check_required_components(<project>)
(probably already present)<project>Targets.cmake
before all components confirmed found and all dependencies confirmed foundfind_project(<project>)
to check that vars match target (same as 4th bullet prev. section)[x] check that all dependencies are handled (sometimes outsourced to psi4, like BLAS for dkh)
find_dependency
that we were leaving for psi4 before[x] handling lib and pylib as separate projects
COMPONENTS Python
? It's easy enough to have the targets exported to Targets-Python.cmake so same file can manage.[x] particular for this project: ambit